diff --git a/src/blenderbim/blenderbim/bim/module/model/workspace.py b/src/blenderbim/blenderbim/bim/module/model/workspace.py index 164af0ae99..693ed8c8fa 100644 --- a/src/blenderbim/blenderbim/bim/module/model/workspace.py +++ b/src/blenderbim/blenderbim/bim/module/model/workspace.py @@ -18,15 +18,16 @@ class BimTool(WorkSpaceTool): # ("bim.wall_tool_op", {"type": 'MOUSEMOVE', "value": 'ANY'}, {"properties": []}), # ("mesh.add_wall", {"type": 'LEFTMOUSE', "value": 'PRESS'}, {"properties": []}), ("bim.add_type_instance", {"type": "A", "value": "PRESS", "shift": True}, {"properties": []}), - ("bim.hotkey", {"type": "E", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "E")]}), + ("bim.hotkey", {"type": "E", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_E")]}), ("bim.join_wall", {"type": "T", "value": "PRESS", "shift": True}, {"properties": [("join_type", "L")]}), ("bim.join_wall", {"type": "Y", "value": "PRESS", "shift": True}, {"properties": [("join_type", "V")]}), ("bim.flip_wall", {"type": "F", "value": "PRESS", "shift": True}, {"properties": []}), ("bim.split_wall", {"type": "S", "value": "PRESS", "shift": True}, {"properties": []}), - ("bim.hotkey", {"type": "X", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "X")]}), - ("bim.hotkey", {"type": "C", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "C")]}), - ("bim.hotkey", {"type": "V", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "V")]}), - ("bim.hotkey", {"type": "O", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "O")]}), + ("bim.hotkey", {"type": "X", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_X")]}), + ("bim.hotkey", {"type": "C", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_C")]}), + ("bim.hotkey", {"type": "V", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_V")]}), + ("bim.hotkey", {"type": "O", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_O")]}), + ("bim.hotkey", {"type": "O", "value": "PRESS", "alt": True}, {"properties": [("hotkey", "A_O")]}), ) def draw_settings(context, layout, tool): @@ -56,6 +57,8 @@ class BimTool(WorkSpaceTool): row.label(text="", icon="EVENT_V") row.label(text="Align") + row.label(text="", icon="EVENT_ALT") + row.label(text="Opening", icon="EVENT_O") class Hotkey(bpy.types.Operator): bl_idname = "bim.hotkey" @@ -71,30 +74,33 @@ class Hotkey(bpy.types.Operator): getattr(self, f"hotkey_{self.hotkey}")() return {"FINISHED"} - def hotkey_C(self): + def hotkey_S_C(self): if self.props.ifc_class == "IfcWallType": bpy.ops.bim.align_wall(align_type="CENTERLINE") else: bpy.ops.bim.align_product(align_type="CENTERLINE") - def hotkey_E(self): + def hotkey_S_E(self): if self.props.ifc_class == "IfcWallType": bpy.ops.bim.join_wall(join_type="T") - def hotkey_V(self): + def hotkey_S_V(self): if self.props.ifc_class == "IfcWallType": bpy.ops.bim.align_wall(align_type="INTERIOR") else: bpy.ops.bim.align_product(align_type="POSITIVE") - def hotkey_X(self): + def hotkey_S_X(self): if self.props.ifc_class == "IfcWallType": bpy.ops.bim.align_wall(align_type="EXTERIOR") else: bpy.ops.bim.align_product(align_type="NEGATIVE") - def hotkey_O(self): + def hotkey_S_O(self): if self.props.ifc_class == "IfcWallType": bpy.ops.bim.add_wall_opening() elif self.props.ifc_class == "IfcSlabType": bpy.ops.bim.add_slab_opening() + + def hotkey_A_O(self): + bpy.ops.bim.toggle_opening_visibility() diff --git a/src/blenderbim/blenderbim/bim/module/void/__init__.py b/src/blenderbim/blenderbim/bim/module/void/__init__.py index 3727f40508..a65a04ee84 100644 --- a/src/blenderbim/blenderbim/bim/module/void/__init__.py +++ b/src/blenderbim/blenderbim/bim/module/void/__init__.py @@ -6,6 +6,7 @@ classes = ( operator.RemoveOpening, operator.AddFilling, operator.RemoveFilling, + operator.ToggleOpeningVisibility, prop.VoidProperties, ui.BIM_PT_voids, ) diff --git a/src/blenderbim/blenderbim/bim/module/void/operator.py b/src/blenderbim/blenderbim/bim/module/void/operator.py index 4e87b7aaeb..537b5faf19 100644 --- a/src/blenderbim/blenderbim/bim/module/void/operator.py +++ b/src/blenderbim/blenderbim/bim/module/void/operator.py @@ -130,3 +130,15 @@ class RemoveFilling(bpy.types.Operator): ) Data.load(IfcStore.get_file(), obj.BIMObjectProperties.ifc_definition_id) return {"FINISHED"} + + +class ToggleOpeningVisibility(bpy.types.Operator): + bl_idname = "bim.toggle_opening_visibility" + bl_label = "Toggle Opening Visibility" + bl_options = {"REGISTER", "UNDO"} + + def execute(self, context): + for project in [c for c in bpy.context.view_layer.layer_collection.children if "IfcProject" in c.name]: + for collection in [c for c in project.children if "IfcOpeningElements" in c.name]: + collection.hide_viewport = not collection.hide_viewport + return {"FINISHED"}