diff --git a/src/bonsai/bonsai/bim/module/model/workspace.py b/src/bonsai/bonsai/bim/module/model/workspace.py index 1be2e91176..9dfcd0f8a4 100644 --- a/src/bonsai/bonsai/bim/module/model/workspace.py +++ b/src/bonsai/bonsai/bim/module/model/workspace.py @@ -590,6 +590,11 @@ class EditObjectUI: 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") + if context.scene.BIMNestProperties.in_nest_mode: + layout.label(text=f"Nest Mode", icon="EMPTY_AXIS") + row = cls.layout.row(align=True) + op = row.operator("bim.disable_nest_mode", text="", icon="X") + op = row.operator("bim.toggle_nest_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") diff --git a/src/bonsai/bonsai/bim/module/nest/__init__.py b/src/bonsai/bonsai/bim/module/nest/__init__.py index fc111fb818..883fd00186 100644 --- a/src/bonsai/bonsai/bim/module/nest/__init__.py +++ b/src/bonsai/bonsai/bim/module/nest/__init__.py @@ -26,6 +26,8 @@ classes = ( operator.BIM_OT_select_components, operator.BIM_OT_select_nest, operator.BIM_OT_nest_unassign_object, + operator.BIM_OT_disable_nest_mode, + operator.BIM_OT_toggle_nest_mode_local_view, prop.BIMObjectNestProperties, prop.Objects, prop.BIMNestProperties, diff --git a/src/bonsai/bonsai/bim/module/nest/operator.py b/src/bonsai/bonsai/bim/module/nest/operator.py index 96f7930bcd..00b1f15f33 100644 --- a/src/bonsai/bonsai/bim/module/nest/operator.py +++ b/src/bonsai/bonsai/bim/module/nest/operator.py @@ -140,3 +140,33 @@ class BIM_OT_select_nest(bpy.types.Operator): nest_obj.select_set(True) bpy.context.view_layer.objects.active = nest_obj return {"FINISHED"} + + +class BIM_OT_disable_nest_mode(bpy.types.Operator): + bl_idname = "bim.disable_nest_mode" + bl_label = "Disable Nest Mode" + bl_options = {"REGISTER", "UNDO"} + + def execute(self, context): + bpy.ops.object.select_all(action="DESELECT") + core.disable_nest_mode(tool.Nest) + return {"FINISHED"} + + +class BIM_OT_toggle_nest_mode_local_view(bpy.types.Operator): + bl_idname = "bim.toggle_nest_mode_local_view" + bl_label = "Toggle Nest Mode Local View" + bl_options = {"REGISTER", "UNDO"} + + def execute(self, context): + props = context.scene.BIMNestProperties + objs = [o.obj for o in props.editing_objects] + if props.in_nest_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"}