mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 22:50:56 +00:00
Fix #2927. Continuing to make mesh editing stricter.
This commit is contained in:
@@ -748,7 +748,7 @@ class OverrideModeSetEdit(bpy.types.Operator):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if tool.Geometry.is_meshlike(representation):
|
if tool.Geometry.is_meshlike(representation):
|
||||||
if element.HasOpenings:
|
if getattr(element, "HasOpenings", None):
|
||||||
# Mesh elements with openings must disable openings
|
# Mesh elements with openings must disable openings
|
||||||
# so that you can edit the original topology.
|
# so that you can edit the original topology.
|
||||||
core.switch_representation(
|
core.switch_representation(
|
||||||
|
|||||||
@@ -129,21 +129,32 @@ class Geometry(blenderbim.core.tool.Geometry):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_mesh_checksum(cls, mesh):
|
def get_mesh_checksum(cls, mesh):
|
||||||
# Get mesh data
|
|
||||||
vertices = mesh.vertices[:]
|
|
||||||
edges = mesh.edges[:]
|
|
||||||
faces = mesh.polygons[:]
|
|
||||||
|
|
||||||
# Convert mesh data to bytes
|
|
||||||
data_bytes = b""
|
data_bytes = b""
|
||||||
for v in vertices:
|
if isinstance(mesh, bpy.types.Mesh):
|
||||||
data_bytes += struct.pack("3f", *v.co)
|
vertices = mesh.vertices[:]
|
||||||
for e in edges:
|
edges = mesh.edges[:]
|
||||||
data_bytes += struct.pack("2i", *e.vertices)
|
faces = mesh.polygons[:]
|
||||||
for f in faces:
|
|
||||||
data_bytes += struct.pack("%di" % len(f.vertices), *f.vertices)
|
# Convert mesh data to bytes
|
||||||
|
for v in vertices:
|
||||||
|
data_bytes += struct.pack("3f", *v.co)
|
||||||
|
for e in edges:
|
||||||
|
data_bytes += struct.pack("2i", *e.vertices)
|
||||||
|
for f in faces:
|
||||||
|
data_bytes += struct.pack("%di" % len(f.vertices), *f.vertices)
|
||||||
|
elif isinstance(mesh, bpy.types.Curve):
|
||||||
|
splines = mesh.splines[:]
|
||||||
|
|
||||||
|
for spline in splines:
|
||||||
|
if spline.type == "BEZIER":
|
||||||
|
for bezier_point in spline.bezier_points:
|
||||||
|
data_bytes += struct.pack("3f", *bezier_point.co)
|
||||||
|
data_bytes += struct.pack("3f", *bezier_point.handle_left)
|
||||||
|
data_bytes += struct.pack("3f", *bezier_point.handle_right)
|
||||||
|
else:
|
||||||
|
for point in spline.points:
|
||||||
|
data_bytes += struct.pack("4f", *point.co)
|
||||||
|
|
||||||
# Generate hash of mesh data
|
|
||||||
hasher = hashlib.sha1()
|
hasher = hashlib.sha1()
|
||||||
hasher.update(data_bytes)
|
hasher.update(data_bytes)
|
||||||
return hasher.hexdigest()
|
return hasher.hexdigest()
|
||||||
|
|||||||
Reference in New Issue
Block a user