From b480b4343510e01c3a981944e7816dc3951564aa Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Mon, 12 Jul 2021 17:34:35 +1000 Subject: [PATCH] BIM workspace tool is now no longer wall specific, and adapts to different element types --- .../blenderbim/bim/module/model/__init__.py | 2 +- .../blenderbim/bim/module/model/wall.py | 15 ------- .../blenderbim/bim/module/model/workspace.py | 43 +++++++++++++------ 3 files changed, 32 insertions(+), 28 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/model/__init__.py b/src/blenderbim/blenderbim/bim/module/model/__init__.py index 6bf79bfd1d..98cb2da069 100644 --- a/src/blenderbim/blenderbim/bim/module/model/__init__.py +++ b/src/blenderbim/blenderbim/bim/module/model/__init__.py @@ -3,7 +3,7 @@ from . import handler, prop, ui, grid, product, wall, slab, stair, door, window, classes = ( product.AddTypeInstance, - wall.AddWall, + workspace.HotkeyE, wall.JoinWall, wall.AlignWall, wall.FlipWall, diff --git a/src/blenderbim/blenderbim/bim/module/model/wall.py b/src/blenderbim/blenderbim/bim/module/model/wall.py index 98d9f6b691..c6c81f9fd3 100644 --- a/src/blenderbim/blenderbim/bim/module/model/wall.py +++ b/src/blenderbim/blenderbim/bim/module/model/wall.py @@ -36,21 +36,6 @@ def mode_callback(obj, data): IfcStore.edited_objs.add(obj) -class AddWall(bpy.types.Operator): - bl_idname = "bim.add_wall" - bl_label = "Add Wall" - bl_options = {"REGISTER", "UNDO"} - join_type: bpy.props.StringProperty() - - def execute(self, context): - return IfcStore.execute_ifc_operator(self, context) - - def _execute(self, context): - props = context.scene.BIMModelProperties - bpy.ops.bim.add_type_instance(ifc_class="IfcWallType", relating_type=int(props.relating_type)) - return {"FINISHED"} - - class JoinWall(bpy.types.Operator): bl_idname = "bim.join_wall" bl_label = "Join Wall" diff --git a/src/blenderbim/blenderbim/bim/module/model/workspace.py b/src/blenderbim/blenderbim/bim/module/model/workspace.py index 741276a526..cc58461146 100644 --- a/src/blenderbim/blenderbim/bim/module/model/workspace.py +++ b/src/blenderbim/blenderbim/bim/module/model/workspace.py @@ -1,6 +1,7 @@ import os import bpy from bpy.types import WorkSpaceTool +from blenderbim.bim.ifc import IfcStore class BimTool(WorkSpaceTool): @@ -16,8 +17,8 @@ class BimTool(WorkSpaceTool): bl_keymap = ( # ("bim.wall_tool_op", {"type": 'MOUSEMOVE', "value": 'ANY'}, {"properties": []}), # ("mesh.add_wall", {"type": 'LEFTMOUSE', "value": 'PRESS'}, {"properties": []}), - ("bim.add_wall", {"type": "A", "value": "PRESS", "shift": True}, {"properties": []}), - ("bim.join_wall", {"type": "E", "value": "PRESS", "shift": True}, {"properties": [("join_type", "T")]}), + ("bim.add_type_instance", {"type": "A", "value": "PRESS", "shift": True}, {"properties": []}), + ("bim.hotkey_e", {"type": "E", "value": "PRESS", "shift": True}, {"properties": []}), ("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": []}), @@ -40,20 +41,38 @@ class BimTool(WorkSpaceTool): ) def draw_settings(context, layout, tool): - props = context.scene.BIMModelProperties row = layout.row(align=True) + props = context.scene.BIMTypeProperties + row.prop(props, "ifc_class", text="") row.prop(props, "relating_type", text="") row.label(text="", icon="BLANK1") row.label(text="", icon="EVENT_SHIFT") row.label(text="Add", icon="EVENT_A") - row.label(text="Extend", icon="EVENT_E") - row.label(text="Butt", icon="EVENT_T") - row.label(text="Mitre", icon="EVENT_Y") - row.label(text="Flip", icon="EVENT_F") - row.label(text="Split", icon="EVENT_S") - row.label(text="", icon="EVENT_X") - row.label(text="", icon="EVENT_C") - row.label(text="", icon="EVENT_V") - row.label(text="Align") + + if props.ifc_class == "IfcWallType": + row.label(text="Extend", icon="EVENT_E") + row.label(text="Butt", icon="EVENT_T") + row.label(text="Mitre", icon="EVENT_Y") + row.label(text="Flip", icon="EVENT_F") + row.label(text="Split", icon="EVENT_S") + row.label(text="", icon="EVENT_X") + row.label(text="", icon="EVENT_C") + row.label(text="", icon="EVENT_V") + row.label(text="Align") + + +class HotkeyE(bpy.types.Operator): + bl_idname = "bim.hotkey_e" + bl_label = "Hotkey E" + bl_options = {"REGISTER", "UNDO"} + + def execute(self, context): + return IfcStore.execute_ifc_operator(self, context) + + def _execute(self, context): + props = context.scene.BIMTypeProperties + if props.ifc_class == "IfcWallType": + bpy.ops.bim.join_wall(join_type="T") + return {"FINISHED"}