Disable edit mode on non mesh-like representations as well to prevent risk of invalid geometry.

This commit is contained in:
Dion Moult
2023-04-01 21:25:36 +11:00
parent 6b4955344d
commit 2f3c5a7c75
@@ -742,8 +742,11 @@ class OverrideModeSetEdit(bpy.types.Operator):
obj.select_set(False) obj.select_set(False)
continue continue
if obj.data.BIMMeshProperties.ifc_definition_id: representation = tool.Geometry.get_active_representation(obj)
representation = tool.Ifc.get().by_id(obj.data.BIMMeshProperties.ifc_definition_id) if not representation:
obj.select_set(False)
continue
if representation.RepresentationType in ("Tessellation", "Brep"): if representation.RepresentationType in ("Tessellation", "Brep"):
if element.HasOpenings: if element.HasOpenings:
# Mesh elements with openings must disable openings # Mesh elements with openings must disable openings
@@ -759,6 +762,10 @@ class OverrideModeSetEdit(bpy.types.Operator):
apply_openings=False, apply_openings=False,
) )
obj.data.BIMMeshProperties.mesh_checksum = tool.Geometry.get_mesh_checksum(obj.data) obj.data.BIMMeshProperties.mesh_checksum = tool.Geometry.get_mesh_checksum(obj.data)
else:
obj.select_set(False)
continue
if not context.selected_objects: if not context.selected_objects:
return {"FINISHED"} return {"FINISHED"}
bpy.ops.object.mode_set(mode="EDIT", toggle=True) bpy.ops.object.mode_set(mode="EDIT", toggle=True)