WIP UI tools and icons

partial support for draw wall tool added
This commit is contained in:
tim
2024-09-17 09:56:17 -04:00
parent c35cdc5d4c
commit 40d95c2943
4 changed files with 63 additions and 29 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 821 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 829 B

+31 -24
View File
@@ -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"),
}
+32 -5
View File
@@ -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"><inkscape:grid
type="axonomgrid"
id="grid5114"
@@ -1335,7 +1335,7 @@
inkscape:groupmode="layer"
id="g37355"
inkscape:label="draw"
style="display:inline"><path
style="display:none"><path
id="path37347"
style="display:inline;fill:#00d27b;fill-opacity:1;stroke:#00d27b;stroke-width:0;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
inkscape:label="pencil"
@@ -1473,6 +1473,33 @@
transform="matrix(0.9343902,0,0,0.94423804,0.27774818,0.236059)"
inkscape:label="edges" /></g><g
inkscape:groupmode="layer"
id="g38229"
inkscape:label="apply_void"
style="display:inline"><path
style="display:inline;fill:#4c9fff;fill-opacity:1;stroke:#00d27b;stroke-width:0;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
d="M 0.76091855,2.4310578 4.0934898,4.3552832 V 8.2020824 L 0.76091855,6.2767558"
id="path38219"
inkscape:label="side-left"
sodipodi:nodetypes="cccc" /><path
id="path38221"
style="display:inline;fill:#99c8ff;fill-opacity:1;stroke:#00d27b;stroke-width:0;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
inkscape:label="side-right"
d="M 7.7080566 2.4298258 L 4.3754435 4.3547729 L 4.3754435 8.2010497 L 5.2678955 7.6858357 L 4.8358805 7.2538207 A 0.67680418 0.67680418 0 0 1 4.8358805 6.2967732 A 0.67680418 0.67680418 0 0 1 5.792928 6.2967732 L 6.2053059 6.7091512 L 7.1933593 5.720581 A 0.67680418 0.67680418 0 0 1 7.7080566 5.5236938 L 7.7080566 2.4298258 z " /><path
style="display:inline;fill:#cce3ff;fill-opacity:1;stroke:#75ffaf;stroke-width:0;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
d="M 7.5642528,2.187708 4.2344344,4.1113829 0.90461606,2.187708 4.2333333,0.26458379"
id="path38223"
inkscape:label="top"
sodipodi:nodetypes="cccc" /><path
id="path38227"
style="color:#000000;display:none;fill:#00d27b;stroke-linejoin:round;stroke-miterlimit:0;-inkscape-stroke:none;paint-order:stroke fill markers"
d="m 4.2233784,-0.052978 a 0.14085458,0.14085458 0 0 0 -0.013826,0.0016419 0.14085458,0.14085458 0 0 0 -0.04535,0.01641845 L 0.53343037,2.0370913 a 0.14085458,0.14085458 0 0 0 -0.009402,0.00821 0.14084052,0.14084052 0 0 0 -0.011614,0.0093 0.14085458,0.14085458 0 0 0 -0.0270994,0.031742 0.14084052,0.14084052 0 0 0 -0.002765,0.00328 0.14084052,0.14084052 0 0 0 -0.001106,0.00383 0.14085458,0.14085458 0 0 0 -0.0149323,0.042688 0.14084052,0.14084052 0 0 0 -0.001106,0.0093 0.14085458,0.14085458 0 0 0 -0.002765,0.014777 V 6.3064255 A 0.14085458,0.14085458 0 0 0 0.53343107,6.429564 L 4.1642021,8.5021316 a 0.14085458,0.14085458 0 0 0 0.00387,0.00164 0.14084052,0.14084052 0 0 0 0.032077,0.010946 0.14085458,0.14085458 0 0 0 0.016039,0.00328 0.14084052,0.14084052 0 0 0 0.016038,0.00328 0.14084052,0.14084052 0 0 0 0.017145,-0.00328 0.14085458,0.14085458 0 0 0 0.018251,-0.00328 0.14084052,0.14084052 0 0 0 0.029312,-0.010398 0.14085458,0.14085458 0 0 0 0.00553,-0.00219 L 5.9372798,7.5690161 V 7.2444779 L 4.3749141,8.1370946 V 4.3137837 L 7.7225246,2.4004864 V 5.7427366 H 8.0040269 V 2.1602297 A 0.14085458,0.14085458 0 0 0 7.9315774,2.0370913 L 4.3024645,-0.0349177 A 0.14085458,0.14085458 0 0 0 4.2233784,-0.052978 Z M 4.2322272,0.24802701 7.5781786,2.1596824 4.2333333,4.0718852 0.88848805,2.1596824 Z M 0.74414205,2.401581 4.0917526,4.314331 V 8.1381892 L 0.74414205,6.2243446 Z"
transform="matrix(0.9343902,0,0,0.94423804,0.27774818,0.236059)"
inkscape:label="edges" /><path
id="path12568-9"
style="display:inline;fill:none;stroke:#ffffff;stroke-width:0.55985833;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
d="M 7.6720194,6.2002014 6.2060546,7.6661662 5.3153418,6.7754533"
sodipodi:nodetypes="ccc" /></g><g
inkscape:groupmode="layer"
id="layer3"
inkscape:label="add_type"
style="display:none;stroke:#00d27b;stroke-opacity:1"><path

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 123 KiB