New button hide all spaces in spatial tool

This commit is contained in:
Massimo Fabbro
2024-02-18 17:11:18 +01:00
committed by Massimo Fabbro
parent 066616707a
commit a04542dfd1
6 changed files with 40 additions and 0 deletions
@@ -113,6 +113,7 @@ classes = (
covering.AddInstanceCeilingCoveringFromCursor,
covering.RegenSelectedCoveringObject,
space.ToggleSpaceVisibility,
space.ToggleHideSpaces,
mep.FitFlowSegments,
mep.RegenerateDistributionElement,
prop.BIMModelProperties,
@@ -112,3 +112,12 @@ class ToggleSpaceVisibility(bpy.types.Operator, tool.Ifc.Operator):
core.toggle_space_visibility(tool.Ifc, tool.Spatial)
return {"FINISHED"}
class ToggleHideSpaces(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.toggle_hide_spaces"
bl_label = "Toggle Hide Spaces"
bl_options = {"REGISTER"}
bl_description = "Hide or Unhide all spaces"
def execute(cls, context):
core.toggle_hide_spaces(tool.Ifc, tool.Spatial)
return {"FINISHED"}
@@ -50,6 +50,7 @@ class SpatialTool(WorkSpaceTool):
("bim.spatial_hotkey", {"type": "B", "value": "PRESS", "alt": True}, {"properties": [("hotkey", "A_B")]}),
("bim.spatial_hotkey", {"type": "T", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_T")]}),
("bim.spatial_hotkey", {"type": "G", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_G")]}),
("bim.spatial_hotkey", {"type": "H", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_H")]}),
)
def draw_settings(context, layout, ws_tool):
@@ -107,6 +108,10 @@ class SpatialToolUI:
row.label(text="", icon="EVENT_SHIFT")
row.label(text="", icon="EVENT_T")
row.operator("bim.toggle_space_visibility")
row = cls.layout.row(align=True)
row.label(text="", icon="EVENT_SHIFT")
row.label(text="", icon="EVENT_H")
row.operator("bim.toggle_hide_spaces")
@classmethod
def draw_selected_object_interface(cls, context):
@@ -180,5 +185,8 @@ class Hotkey(bpy.types.Operator, Operator):
def hotkey_S_T(self):
bpy.ops.bim.toggle_space_visibility()
def hotkey_S_H(self):
bpy.ops.bim.toggle_hide_spaces()
def hotkey_S_G(self):
bpy.ops.bim.generate_space()
@@ -205,3 +205,10 @@ def toggle_space_visibility(ifc, spatial):
if not spaces:
return
spatial.toggle_spaces_visibility_wired_and_textured(spaces)
def toggle_hide_spaces(ifc, spatial):
model = ifc.get()
spaces = model.by_type("IfcSpace")
if not spaces:
return
spatial.toggle_hide_spaces(spaces)
+1
View File
@@ -877,6 +877,7 @@ class Spatial:
def assign_relating_type_to_element(cls, ifc, Type, element, relating_type): pass
def regen_obj_representation(cls, ifc, geometry, obj, body): pass
def toggle_spaces_visibility_wired_and_textured(cls, spaces): pass
def toggle_hide_spaces(cls, spaces): pass
@interface
class Covering:
+14
View File
@@ -733,3 +733,17 @@ class Spatial(blenderbim.core.tool.Spatial):
bpy.data.objects[obj.name].show_wire = False
bpy.data.objects[obj.name].display_type = "TEXTURED"
return
@classmethod
def toggle_hide_spaces(cls, spaces):
first_obj = tool.Ifc.get_object(spaces[0])
if first_obj.hide_get() == False:
for space in spaces:
obj = tool.Ifc.get_object(space)
obj.hide_set(True)
return
elif first_obj.hide_get() == True:
for space in spaces:
obj = tool.Ifc.get_object(space)
obj.hide_set(False)