diff --git a/src/bonsai/bonsai/bim/data/icons/dm_quick_default.png b/src/bonsai/bonsai/bim/data/icons/dm_quick_default.png new file mode 100644 index 0000000000..763b103a4c Binary files /dev/null and b/src/bonsai/bonsai/bim/data/icons/dm_quick_default.png differ diff --git a/src/bonsai/bonsai/bim/data/icons/lm_quick_default.png b/src/bonsai/bonsai/bim/data/icons/lm_quick_default.png new file mode 100644 index 0000000000..e9cc93d151 Binary files /dev/null and b/src/bonsai/bonsai/bim/data/icons/lm_quick_default.png differ diff --git a/src/bonsai/bonsai/bim/module/model/ui.py b/src/bonsai/bonsai/bim/module/model/ui.py index 12e88a46fd..1a9ef5a4c9 100644 --- a/src/bonsai/bonsai/bim/module/model/ui.py +++ b/src/bonsai/bonsai/bim/module/model/ui.py @@ -107,20 +107,23 @@ class LaunchTypeManager(bpy.types.Operator): def draw(self, context): props = context.scene.BIMModelProperties - row = self.layout.row(align=True) - prop_with_search(row, props, "ifc_class", text="", should_click_ok_to_validate=True) - row.operator("bim.launch_add_element", icon="ADD", text="") + if AuthoringData.data['total_types'] > 1: + text = f"{AuthoringData.data['total_types']} {AuthoringData.data['ifc_element_type']}s" + else: + text = f"{AuthoringData.data['total_types']} {AuthoringData.data['ifc_element_type']}" + row.label(text=text, icon="FILE_VOLUME") + # prop_with_search(row, props, "ifc_class", text="", should_click_ok_to_validate=True) row.menu("BIM_MT_type_manager_menu", text="", icon="PREFERENCES") + row = self.layout.row(align=True) + row.operator("bim.launch_add_element", text=f"Create New {AuthoringData.data['ifc_element_type']}", icon="ADD") columns = self.layout.column_flow(columns=3) - row = columns.row() - row.alignment = "LEFT" - row.label(text=f"{AuthoringData.data['total_types']} Types", icon="FILE_VOLUME") - row = columns.row(align=True) row.alignment = "CENTER" - # In case you want something here in the future + ### In case you want something here in the future + + ### row = columns.row(align=True) row.alignment = "RIGHT" @@ -140,10 +143,10 @@ class LaunchTypeManager(bpy.types.Operator): box = outer_col.box() row = box.row(align=True) - op = row.operator("bim.set_active_type", text=relating_type["name"], icon="FILE_3D") + op = row.operator("bim.set_active_type", text=relating_type["name"], icon="BLANK1", emboss=False) op.relating_type = relating_type["id"] - op = row.operator("bim.launch_type_menu", icon="DOWNARROW_HLT", text="") + op = row.operator("bim.launch_type_menu", icon="DOWNARROW_HLT", text="", emboss=False) op.relating_type_id = relating_type["id"] row = box.row() @@ -163,8 +166,13 @@ class LaunchTypeManager(bpy.types.Operator): row2.operator("bim.set_active_type", text="", emboss=False).relating_type = relating_type["id"] else: row = box.row() - op = box.operator("bim.load_type_thumbnails", text="Load Thumbnails", icon="FILE_REFRESH") + op = box.operator("bim.load_type_thumbnails", text="", icon="FILE_REFRESH", emboss=False) op.ifc_class = props.ifc_class + + row = box.row() + row.alignment = "CENTER" + op = row.operator("bim.set_active_type", text=relating_type["predefined_type"], emboss=False) + op.relating_type = relating_type["id"] class BIM_PT_authoring(Panel): diff --git a/src/bonsai/bonsai/bim/module/model/workspace.py b/src/bonsai/bonsai/bim/module/model/workspace.py index 1997df2849..34a48b00c3 100644 --- a/src/bonsai/bonsai/bim/module/model/workspace.py +++ b/src/bonsai/bonsai/bim/module/model/workspace.py @@ -339,9 +339,9 @@ class CreateObjectUI: cls.layout.label(text=tool_name, icon="TOOL_SETTINGS") if AuthoringData.data["ifc_classes"] and AuthoringData.data["relating_type_id"]: - cls.draw_add_object(context) - cls.draw_thumbnail() if context.region.type != "TOOL_HEADER" else cls + cls.draw_thumbnail(context) cls.draw_add_object_parameters(context) + cls.draw_add_object(context) else: cls.draw_type_manager_launcher(context) @@ -355,42 +355,60 @@ class CreateObjectUI: @classmethod def draw_type_manager_launcher(cls, context): + ui_context = context.region.type row = cls.layout.row(align=True) - row.label(text="No Element Types Found", icon="ERROR") - row = cls.layout.row(align=True) - row.operator("bim.add_element", icon_value=bonsai.bim.icons["IFC"].icon_id, text="Add New Type") - if AuthoringData.data["ifc_element_type"]: - row = cls.layout.row(align=True) - op = row.operator( - "bim.add_default_type", - icon_value=custom_icon_previews["ADD_TYPE"].icon_id, - text=f"Quick Create Default {AuthoringData.data['ifc_element_type']}", + box = cls.layout.box() + row1 = box.row(align=True) + row1.operator( + "bim.launch_type_manager", + icon="ERROR", + text=f"No {AuthoringData.data['ifc_element_type']}s Found", + emboss=False, + ) + row1.operator( + "bim.launch_type_manager", + icon=tool.Blender.TYPE_MANAGER_ICON, #"DOWNARROW_HLT", + text="", + emboss=False, ) - op.ifc_element_type = AuthoringData.data["ifc_element_type"] + + if ui_context != "TOOL_HEADER": + + row = box.row(align=True) + row.alignment = "CENTER" + row.template_icon(icon_value=0, scale=3.3) + + row = box.row(align=True) + row.alignment = "CENTER" + row.operator( + "bim.launch_add_element", + text=f"Create New {AuthoringData.data['ifc_element_type']}", + ) + + row = box.row(align=True) + + if not AuthoringData.data["ifc_element_type"]: + row = box.row(align=True) + row.alignment = "CENTER" + row.template_icon(icon_value=0, scale=1) + + row = box.row(align=True) + row.alignment = "CENTER" + row.template_icon(icon_value=0, scale=3.5) + elif AuthoringData.data["ifc_element_type"]: + row = cls.layout.row(align=True) + op = row.operator( + "bim.add_default_type", + icon_value=custom_icon_previews["QUICK_DEFAULT"].icon_id, + text=f"Quick Create {AuthoringData.data['ifc_element_type']}", + ) + op.ifc_element_type = AuthoringData.data["ifc_element_type"] @classmethod def draw_add_object(cls, context): ui_context = str(context.region.type) - if not AuthoringData.data["ifc_element_type"]: - row = cls.layout.row(align=True) - prop_with_search(row, cls.props, "ifc_class", text="Type Class" if ui_context != "TOOL_HEADER" else "") + row = cls.layout.row(align=True) if AuthoringData.data["relating_type_id"]: - row = cls.layout.row(align=True) - box = row.box() - # This trick creates a fake dropdown - row2 = box.row(align=True) - row2.operator( - "bim.launch_type_manager", - icon="FILE_3D", - text=AuthoringData.data["relating_type_name"], - emboss=False, - ) - row2.operator( - "bim.launch_type_manager", - icon="DOWNARROW_HLT", - text="", - emboss=False, - ) row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row op = row.operator("bim.hotkey", text="Add", icon_value=custom_icon_previews["ADD"].icon_id) op.hotkey = "S_A" @@ -409,8 +427,6 @@ class CreateObjectUI: row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row row.prop(data=cls.props, property="extrusion_depth", text="Height" if ui_context != "TOOL_HEADER" else "H") row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row - row.prop(data=cls.props, property="length", text="Length" if ui_context != "TOOL_HEADER" else "L") - row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row row.prop(data=cls.props, property="x_angle", text="Slope") if ui_context != "TOOL_HEADER" else "A" elif cls.props.ifc_class in ("IfcSlabType", "IfcRampType", "IfcRoofType"): @@ -452,15 +468,64 @@ class CreateObjectUI: row.prop(data=cls.props, property="rl_mode", text="RL Mode" if ui_context != "TOOL_HEADER" else "RL") @classmethod - def draw_thumbnail(cls): + def draw_thumbnail(cls, context): + ui_context = context.region.type + row = cls.layout.row(align=True) + if not AuthoringData.data["ifc_element_type"]: + prop_with_search(row, cls.props, "ifc_class", text="Type Class" if ui_context != "TOOL_HEADER" else "") if AuthoringData.data["ifc_classes"]: if cls.props.ifc_class: box = cls.layout.box() - if AuthoringData.data["type_thumbnail"]: - box.template_icon(icon_value=AuthoringData.data["type_thumbnail"], scale=5) + # This trick creates a fake dropdown + row1 = box.row(align=True) + if AuthoringData.data["type_thumbnail"] and ui_context == "TOOL_HEADER": + row1.ui_units_y = 0.01 + row1.template_icon(icon_value=AuthoringData.data["type_thumbnail"], scale=1) + row2 = box.column(align=True) + row2.operator("bim.launch_type_manager", text="", emboss=False) + row1.operator("bim.launch_type_manager", text=AuthoringData.data["relating_type_name"], emboss=False) else: - op = box.operator("bim.load_type_thumbnails", text="Load Thumbnails", icon="FILE_REFRESH") - op.ifc_class = cls.props.ifc_class + row1.operator( + "bim.launch_type_manager", + icon="BLANK1", + text=AuthoringData.data["relating_type_name"], + emboss=False, + ) + + row1.operator( + "bim.launch_type_manager", + icon=tool.Blender.TYPE_MANAGER_ICON, #"DOWNARROW_HLT", + text="", + emboss=False, + ) + + if ui_context != "TOOL_HEADER": + row = box.row(align=True) + row.alignment = "CENTER" + row.operator("bim.launch_type_manager", text=AuthoringData.data["relating_type_description"], emboss=False,) + + if AuthoringData.data["type_thumbnail"]: + row1 = box.row() + row1.ui_units_y = 0.01 + row1.template_icon(icon_value=AuthoringData.data["type_thumbnail"], scale=4) + row2 = box.column(align=True) + row2.ui_units_y = 4 + row2.operator("bim.launch_type_manager", text="", emboss=False) + else: + op = box.operator( + "bim.load_type_thumbnails", + text="", icon="FILE_REFRESH", + emboss=False, + ) + op.ifc_class = cls.props.ifc_class + + row = box.row(align=True) + row.alignment = "CENTER" + row.operator( + "bim.launch_type_manager", + text=AuthoringData.data["predefined_type"], + emboss=False, + ) class EditObjectUI: diff --git a/src/bonsai/scripts/bonsai_icons.svg b/src/bonsai/scripts/bonsai_icons.svg index 89deb64240..035dfdea5d 100644 --- a/src/bonsai/scripts/bonsai_icons.svg +++ b/src/bonsai/scripts/bonsai_icons.svg @@ -28,15 +28,27 @@ inkscape:deskcolor="#d1d1d1" inkscape:document-units="px" showgrid="true" +<<<<<<< HEAD inkscape:zoom="22.627417" - inkscape:cx="14.097941" - inkscape:cy="9.7006212" + inkscape:cx="5.7894368" + inkscape:cy="9.7448153" inkscape:window-width="2326" inkscape:window-height="1555" - inkscape:window-x="592" + inkscape:window-x="1548" + inkscape:window-y="26" + inkscape:window-maximized="0" + inkscape:current-layer="g1418" +======= + inkscape:zoom="16" + inkscape:cx="18.4375" + inkscape:cy="13.21875" + inkscape:window-width="2328" + inkscape:window-height="1555" + inkscape:window-x="590" inkscape:window-y="25" inkscape:window-maximized="0" - inkscape:current-layer="g1622" + inkscape:current-layer="g776" +>>>>>>> origin/Type-Manager-UI showguides="true">>>>>>> origin/Type-Manager-UI +======= id="g1622" inkscape:label="reset_vertex" style="display:inline;stroke-width:0.529167;stroke-dasharray:none">>>>>>> origin/Type-Manager-UI inkscape:groupmode="layer" id="layer2" inkscape:label="refresh"