diff --git a/src/bonsai/bonsai/bim/module/aggregate/__init__.py b/src/bonsai/bonsai/bim/module/aggregate/__init__.py index 99461553ec..daafdf201c 100644 --- a/src/bonsai/bonsai/bim/module/aggregate/__init__.py +++ b/src/bonsai/bonsai/bim/module/aggregate/__init__.py @@ -30,8 +30,10 @@ classes = ( operator.BIM_OT_aggregate_unassign_object, operator.BIM_OT_break_link_to_other_aggregates, operator.BIM_OT_select_linked_aggregates, + operator.BIM_OT_disable_aggregate_mode, + operator.BIM_OT_toggle_aggregate_mode_local_view, prop.BIMObjectAggregateProperties, - prop.NotEditingObjects, + prop.Objects, prop.BIMAggregateProperties, ui.BIM_PT_aggregate, ui.BIM_PT_linked_aggregate, diff --git a/src/bonsai/bonsai/bim/module/aggregate/operator.py b/src/bonsai/bonsai/bim/module/aggregate/operator.py index 54865e6b7c..e5cd4a93ea 100644 --- a/src/bonsai/bonsai/bim/module/aggregate/operator.py +++ b/src/bonsai/bonsai/bim/module/aggregate/operator.py @@ -370,3 +370,32 @@ class BIM_OT_select_linked_aggregates(bpy.types.Operator): obj.select_set(True) return {"FINISHED"} + +class BIM_OT_disable_aggregate_mode(bpy.types.Operator): + bl_idname = "bim.disable_aggregate_mode" + bl_label = "Disable Aggregate Mode" + bl_options = {"REGISTER", "UNDO"} + + def execute(self, context): + bpy.ops.object.select_all(action="DESELECT") + bonsai.core.aggregate.disable_aggregate_mode(tool.Aggregate) + return {"FINISHED"} + +class BIM_OT_toggle_aggregate_mode_local_view(bpy.types.Operator): + bl_idname = "bim.toggle_aggregate_mode_local_view" + bl_label = "Toggle Aggregate Mode Local View" + bl_options = {"REGISTER", "UNDO"} + + def execute(self, context): + props = context.scene.BIMAggregateProperties + objs = [o.obj for o in props.editing_objects] + if props.in_aggregate_mode: + if context.space_data.local_view: + bpy.ops.view3d.localview() + else: + for obj in objs: + obj.select_set(True) + bpy.ops.view3d.localview() + + return {"FINISHED"} + diff --git a/src/bonsai/bonsai/bim/module/model/workspace.py b/src/bonsai/bonsai/bim/module/model/workspace.py index 319afe4250..c4f59f400f 100644 --- a/src/bonsai/bonsai/bim/module/model/workspace.py +++ b/src/bonsai/bonsai/bim/module/model/workspace.py @@ -589,6 +589,12 @@ class EditObjectUI: AuthoringData.load(ifc_element_type) if context.region.type == "TOOL_HEADER": + if context.scene.BIMAggregateProperties.in_aggregate_mode: + layout.label(text=f"Aggregate Mode", icon="EMPTY_AXIS") + row = cls.layout.row(align=True) + op = row.operator("bim.disable_aggregate_mode", text="", icon="X") + op = row.operator("bim.toggle_aggregate_mode_local_view", text="", icon="ZOOM_SELECTED") + text = format_ifc_camel_case(AuthoringData.data["active_class"]) layout.label(text=f"{text} Edit Tools:", icon="RESTRICT_SELECT_OFF") cls.draw_parameter_adjustments(context)