From 40d95c294392234c1a1f6af5ea20c4a0e9070fd5 Mon Sep 17 00:00:00 2001 From: tim Date: Tue, 17 Sep 2024 09:56:17 -0400 Subject: [PATCH] WIP UI tools and icons partial support for draw wall tool added --- .../bim/data/icons/dm_show_openings.png | Bin 821 -> 0 bytes .../bim/data/icons/lm_show_openings.png | Bin 829 -> 0 bytes .../bonsai/bim/module/model/workspace.py | 55 ++++++++++-------- src/bonsai/scripts/bonsai_icons.svg | 37 ++++++++++-- 4 files changed, 63 insertions(+), 29 deletions(-) delete mode 100644 src/bonsai/bonsai/bim/data/icons/dm_show_openings.png delete mode 100644 src/bonsai/bonsai/bim/data/icons/lm_show_openings.png diff --git a/src/bonsai/bonsai/bim/data/icons/dm_show_openings.png b/src/bonsai/bonsai/bim/data/icons/dm_show_openings.png deleted file mode 100644 index 145bcfa38e20f3e8559595b18279f73d69e68d21..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 821 zcmV-51Iqk~P)pF8FWQhbW?9;ba!ELWdL_~cP?peYja~^aAhuUa%Y?FJQ@H10>Vi| zK~z|U?UzkRR8bVif9IKoS#4TGX%K~FXl9xk6x2p6%XV$-YsgeENyBAdB|`}f2nRe8LB9y)d*gY%BmmYC zHmNA81uo$G%PF9JR--a=Gh-0}uv&>`Bc(tMus$GKm{d^v%gwdJTlpO_fXzw1nxzid z9-y(e#*}b%Up)7N004-? z|IlMIugiqC7B)@Tzp}-7GhhaPe+;j=4 zRy(o!EQ1=P`ULo=H9%G85bw-Ae4W(TDez#9FDN}R43aE%y1&@zS5ObE^A7S|XGH?g zQu~}fLs4Fx!(DAINt$0<#gM>dn}bn9xFtfazwkv{v4U((cvaI)Vf{<;lyDAVVu8>f zK*hj!4q2S!%?cj`|K*nQ(QODANp5P&|#Gd9MZ;#o3gZ(s0dx zv0xu~e4fuhUVbzA0(C0Pk*p-k_ekb<4|JI5aL%v`r~rNjVLXY#95c-hf94QCC$to! z0}V$W(iWprt%O2+A2bSRcWYFZW(GEv2i%G~Pcsgb9B-jXpdQ6RFYA7#QC^a@L>Ci} zMIguSaY}^P6G;F}744^$;HRe003xYnZ$y6qoell`6+U3}00000NkvXXu0mjfee+Lf diff --git a/src/bonsai/bonsai/bim/data/icons/lm_show_openings.png b/src/bonsai/bonsai/bim/data/icons/lm_show_openings.png deleted file mode 100644 index 68016af132fd3031958ad61262ab18d0979e415b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 829 zcmV-D1H$}?P)pF8FWQhbW?9;ba!ELWdL_~cP?peYja~^aAhuUa%Y?FJQ@H10?J85 zK~z|U?UzkRRACf`pL5MI%Oa>v;HoeUtugQD2nMYr5?r=X{KIt0tg&1ssI3a5{7FJX zw1O7muAoJkyTWGfB#C7%l9I|c5s|4m&S@p6IpfSY*2c5^?)lF9aKG=q=Uh=${%05) z*=%oNr@e)p{~SO-9BrJAw=ouPV>UBROP+`c+qYzly* zmHlGSq;Q7dZ%z>gj0NgnUS=vL0FG|rnWF}{3hWMx7G?xml6G@#sGPZ|0n82xMY#za z3{!Yjb*3ahgU8LihyWb7NYh1bh;S+@;lE=@l{(AK>vaLl4$4Kj18j?t_)_>)sIo55 zw|sHMWs-`K6yGb)AW9MNA%^0g70wsi8SEM+B`5#{ju0@$tr2hf^zl^x@RE0=@Tk^SkyrYKhYfkjF6;A2PtK zc2ZlO$@k?C*7O1Gal8Wxq{3H-YV;!+OsUY|$_YM_g}ejWoArEU2TvG1q25kk7uafqt zf!md{Nk1klHVHzhuNZ^GZdVq-uc}-g5c$*;9Y8GOzZ=mXj+On8EP!ap00000NkvXX Hu0mjfH&k%O diff --git a/src/bonsai/bonsai/bim/module/model/workspace.py b/src/bonsai/bonsai/bim/module/model/workspace.py index 337e92c822..ddd906c08f 100644 --- a/src/bonsai/bonsai/bim/module/model/workspace.py +++ b/src/bonsai/bonsai/bim/module/model/workspace.py @@ -73,7 +73,7 @@ class BimTool(WorkSpaceTool): bl_space_type = "VIEW_3D" bl_context_mode = "OBJECT" bl_idname = "bim.bim_tool" - bl_label = "BIM Tool" + bl_label = "Multi Tool" bl_description = "Create and edit elements by construction class" bl_icon = os.path.join(os.path.dirname(__file__), "ops.authoring.bim") bl_widget = None @@ -95,6 +95,7 @@ class BimTool(WorkSpaceTool): ("bim.hotkey", {"type": "Q", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_Q")]}), ("bim.hotkey", {"type": "R", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_R")]}), ("bim.hotkey", {"type": "T", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_T")]}), + ("bim.hotkey", {"type": "U", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_U")]}), ("bim.hotkey", {"type": "V", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_V")]}), ("bim.hotkey", {"type": "X", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_X")]}), ("bim.hotkey", {"type": "Y", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_Y")]}), @@ -281,21 +282,21 @@ class CableTool(BimTool): def add_layout_hotkey_operator(layout, text, hotkey, description, ui_context=""): - parts = hotkey.split("_") - modifier, key = parts + parts = hotkey.split("_") if hotkey else [] + modifier, key = (parts + ["", ""])[:2] op_text = "" if ui_context == "TOOL_HEADER" else text custom_icon = custom_icon_previews.get(text.upper().replace(" ", "_"), custom_icon_previews["IFC"]).icon_id modifier_icon, modifier_str = MODIFIERS.get(modifier, ("NONE", "")) - + row = layout.row(align=True) op = row.operator("bim.hotkey", text=op_text, icon_value=custom_icon) - if ui_context != "TOOL_HEADER" and len(parts) == 2: + if ui_context != "TOOL_HEADER": row.label(text="", icon=modifier_icon) - row.label(text="", icon=f"EVENT_{key}") + row.label(text="", icon=f"EVENT_{key}" if key else "BLANK1") - hotkey_description = f"Hotkey: {modifier_str} {key}" + hotkey_description = f"Hotkey: {modifier_str} {key}".strip() description = "\n\n".join(filter(None, [description, hotkey_description])) op.hotkey = hotkey @@ -305,9 +306,7 @@ def add_layout_hotkey_operator(layout, text, hotkey, description, ui_context="") ## TO DOs: ## - Check all Regens - might be missing from profiles -## - Change Show openings to Toggle Openings until better UX is figured out ## - Complete remaining icons -## - Remove labels from tool header ## - Check if RL should be applicable to more types ## - Apply void button is showing when any two objects are selected - should only appear when a voidable object and a void are selected ## - Type Class and Relating Type fields seem to be crossed between selected and new @@ -333,6 +332,10 @@ class AddElementUI: elif AuthoringData.data["ifc_element_type"] != ifc_element_type: AuthoringData.load(ifc_element_type) + if ifc_element_type and context.region.type == "TOOL_HEADER": + tool_name = "Multi Tool" if ifc_element_type == "all" else ''.join(' ' + char if char.isupper() else char for char in ifc_element_type.removeprefix('Ifc').removesuffix('Type')).strip() + ' Tool' + cls.layout.label(text=tool_name, icon="TOOL_SETTINGS") + cls.draw_type_manager_launcher(context) cls.draw_thumbnail() if context.region.type != "TOOL_HEADER" else cls cls.draw_add_object(context) @@ -463,7 +466,7 @@ class ModifySelectedUI: elif AuthoringData.data["ifc_element_type"] != ifc_element_type: AuthoringData.load(ifc_element_type) - + layout.label(text="Modify Selected Tools:", icon="TOOL_SETTINGS") cls.draw_parameter_adjustments(context) cls.draw_operations(context) cls.draw_void(context) @@ -508,7 +511,7 @@ class ModifySelectedUI: def draw_parameter_adjustments(cls, context): ui_context = str(context.region.type) row = cls.layout.row(align=True) - row.label(text="Parameter Adjustments") + row.label(text="Parameter Adjustments") if ui_context != "TOOL_HEADER" else row row = cls.layout.row(align=True) if AuthoringData.data["active_material_usage"] == "LAYER2": @@ -553,7 +556,7 @@ class ModifySelectedUI: def draw_operations(cls, context): ui_context = str(context.region.type) row = cls.layout.row(align=True) - row.label(text="Operations") + row.label(text="Operations") if ui_context != "TOOL_HEADER" else row if AuthoringData.data["active_material_usage"] == "LAYER2": row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row add_layout_hotkey_operator(row, "Extend", "S_E", "Extends/reduces element to 3D cursor", ui_context) @@ -562,9 +565,7 @@ class ModifySelectedUI: row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row add_layout_hotkey_operator(row, "Mitre", "S_Y", "Intersects two non-parallel elements to a mitred corner junction", ui_context) row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row - row.operator("bim.unjoin_walls", text="Unjoin Walls" if ui_context != "TOOL_HEADER" else "", icon_value=custom_icon_previews["UNJOIN_WALLS"].icon_id) - row.label(text="", icon="BLANK1") if ui_context != "TOOL_HEADER" else row - row.label(text="", icon="BLANK1") if ui_context != "TOOL_HEADER" else row + add_layout_hotkey_operator(row, "Unjoin Walls", "S_U", "", ui_context) elif AuthoringData.data["active_material_usage"] == "LAYER3": if "LAYER2" in AuthoringData.data["selected_material_usages"]: @@ -609,18 +610,18 @@ class ModifySelectedUI: row.operator("bim.mep_connect_elements", text="Connect MEP Elements" if ui_context != "TOOL_HEADER" else "", icon_value=custom_icon_previews["CONNECT_MEP_ELEMENTS"].icon_id) row.label(text="", icon="BLANK1") if ui_context != "TOOL_HEADER" else row row.label(text="", icon="BLANK1") if ui_context != "TOOL_HEADER" else row - - cls.draw_void(context) - row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row add_layout_hotkey_operator(row, "Regen", "S_G", bpy.ops.bim.regenerate_distribution_element.__doc__, ui_context) @classmethod def draw_void(cls, context): ui_context = str(context.region.type) - row = cls.layout.row(align=True) + row = cls.layout.row(align=True if ui_context != "TOOL_HEADER" else False) if len(context.selected_objects) > 1: - row.operator("bim.add_opening", text="Apply Void", icon_value=custom_icon_previews["VOID"].icon_id) + + row.operator("bim.add_opening", text="Apply Void", icon_value=custom_icon_previews["APPLY_VOID"].icon_id) + row.label(text="", icon="BLANK1") if ui_context != "TOOL_HEADER" else row + row.label(text="", icon="BLANK1") if ui_context != "TOOL_HEADER" else row else: row.operator("bim.add_potential_opening", text="Add Void" if ui_context != "TOOL_HEADER" else "", icon_value=custom_icon_previews["ADD_VOID"].icon_id) if ui_context != "TOOL_HEADER": @@ -662,7 +663,7 @@ class ModifySelectedUI: def draw_align(cls, context): ui_context = str(context.region.type) row = cls.layout.row(align=True) - row.label(text="Align") + row.label(text="Align") if ui_context != "TOOL_HEADER" else row row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row add_layout_hotkey_operator(row, "Exterior", "S_X", "", ui_context) row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row @@ -676,7 +677,7 @@ class ModifySelectedUI: def draw_aggregation(cls, context): ui_context = str(context.region.type) row = cls.layout.row(align=True) - row.label(text="Aggregation") + row.label(text="Aggregation") if ui_context != "TOOL_HEADER" else row add_layout_hotkey_operator(cls.layout, "Assign", "C_P", bpy.ops.bim.aggregate_assign_object.__doc__, ui_context) add_layout_hotkey_operator(cls.layout, "Unassign", "A_P", bpy.ops.bim.aggregate_unassign_object.__doc__, ui_context) @@ -684,7 +685,7 @@ class ModifySelectedUI: def draw_qto(cls, context): ui_context = str(context.region.type) row = cls.layout.row(align=True) - row.label(text="Quantity Take-off") + row.label(text="Quantity Take-off") if ui_context != "TOOL_HEADER" else row add_layout_hotkey_operator(cls.layout, "Perform Quantity Take-off", "S_Q", bpy.ops.bim.perform_quantity_take_off.__doc__, ui_context) @@ -937,7 +938,7 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator): def hotkey_S_V(self): if not bpy.context.selected_objects: return - if self.active_material_usage == "LAYER2": + elif self.active_material_usage == "LAYER2": bpy.ops.bim.align_wall(align_type="INTERIOR") else: bpy.ops.bim.align_product(align_type="POSITIVE") @@ -986,6 +987,11 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator): if AuthoringData.data["active_class"] in ("IfcOpeningElement",): if len(bpy.context.selected_objects) == 2: bpy.ops.bim.clone_opening() + + def hotkey_S_U(self): + if not bpy.context.selected_objects: + return + bpy.ops.bim.unjoin_walls() def hotkey_A_D(self): if not bpy.context.selected_objects: @@ -1016,4 +1022,5 @@ MODIFIERS = { "A": ("EVENT_ALT", "OPTION" if sys.platform == "Darwin" else "ALT"), "C": ("EVENT_CTRL", "CTRL"), "S": ("EVENT_SHIFT", "⇧"), + "E": ("EVENT_PADENTER", "ENTER" if sys.platform == "Darwin" else "RETURN"), } diff --git a/src/bonsai/scripts/bonsai_icons.svg b/src/bonsai/scripts/bonsai_icons.svg index 03ff801921..6c9278e70a 100644 --- a/src/bonsai/scripts/bonsai_icons.svg +++ b/src/bonsai/scripts/bonsai_icons.svg @@ -27,15 +27,15 @@ inkscape:deskcolor="#d1d1d1" inkscape:document-units="px" showgrid="true" - inkscape:zoom="13.670731" - inkscape:cx="5.4861732" - inkscape:cy="7.2051741" + inkscape:zoom="19.333334" + inkscape:cx="12.775862" + inkscape:cy="21.284482" inkscape:window-width="1839" inkscape:window-height="1421" inkscape:window-x="1064" inkscape:window-y="106" inkscape:window-maximized="0" - inkscape:current-layer="g37355" + inkscape:current-layer="g38229" showguides="true">