Add nest mode operators to workspace UI.

This commit is contained in:
Bruno Perdigão
2025-01-18 12:06:00 -03:00
parent c07c2d7692
commit 015d8f6722
3 changed files with 37 additions and 0 deletions
@@ -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")
@@ -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,
@@ -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"}