mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 00:28:02 +00:00
Prevent aggregate objects to be edited by TAB when not in aggregate mode.
This commit is contained in:
committed by
Bruno Perdigão
parent
cbdbd5bd83
commit
3c590f097a
@@ -1876,6 +1876,10 @@ class OverrideModeSetEdit(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
selected_objs = context.selected_objects # Purposely exclude active object
|
selected_objs = context.selected_objects # Purposely exclude active object
|
||||||
|
|
||||||
|
if self.has_aggregates(selected_objs):
|
||||||
|
self.report({"INFO"}, "One or more selected objects belong to an aggregate. Please enter Aggregate Mode to edit them.")
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
if len(selected_objs) == 1 and context.active_object == selected_objs[0]:
|
if len(selected_objs) == 1 and context.active_object == selected_objs[0]:
|
||||||
self.handle_single_object(context, context.active_object)
|
self.handle_single_object(context, context.active_object)
|
||||||
elif len(selected_objs) == 0:
|
elif len(selected_objs) == 0:
|
||||||
@@ -1978,6 +1982,18 @@ class OverrideModeSetEdit(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
context.scene.BIMGeometryProperties.mode = "EDIT"
|
context.scene.BIMGeometryProperties.mode = "EDIT"
|
||||||
context.scene.BIMGeometryProperties.is_changing_mode = False
|
context.scene.BIMGeometryProperties.is_changing_mode = False
|
||||||
|
|
||||||
|
def has_aggregates(self, objs):
|
||||||
|
for obj in objs:
|
||||||
|
element = tool.Ifc.get_entity(obj)
|
||||||
|
if not element:
|
||||||
|
continue
|
||||||
|
aggregate = ifcopenshell.util.element.get_aggregate(element)
|
||||||
|
parts = ifcopenshell.util.element.get_parts(element)
|
||||||
|
if (aggregate or parts) and not bpy.context.scene.BIMAggregateProperties.in_aggregate_mode:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
class OverrideModeSetObject(bpy.types.Operator, tool.Ifc.Operator):
|
class OverrideModeSetObject(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
bl_description = "Switch from Edit to Item or Object mode"
|
bl_description = "Switch from Edit to Item or Object mode"
|
||||||
@@ -2871,6 +2887,7 @@ class OverrideMoveAggregateMacro(bpy.types.Macro):
|
|||||||
bl_label = "IFC Move Aggregate"
|
bl_label = "IFC Move Aggregate"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
|
|
||||||
class OverrideMoveAggregate(bpy.types.Operator):
|
class OverrideMoveAggregate(bpy.types.Operator):
|
||||||
bl_idname = "bim.override_move_aggregate"
|
bl_idname = "bim.override_move_aggregate"
|
||||||
bl_label = "IFC Move Aggregate"
|
bl_label = "IFC Move Aggregate"
|
||||||
|
|||||||
Reference in New Issue
Block a user