Type Manager fixes

- Corrected the alignment of the Type Manager preview in tool header
- Improved click-ability of the thumbnail icon in the Type Manger preview in the side bar
This commit is contained in:
tim
2024-10-13 20:33:25 -04:00
committed by Dion Moult
parent a1fb4d6b81
commit 9ccbd332cf
@@ -404,7 +404,7 @@ class CreateObjectUI:
op = row.operator( op = row.operator(
"bim.add_default_type", "bim.add_default_type",
icon_value=custom_icon_previews["QUICK_DEFAULT"].icon_id, icon_value=custom_icon_previews["QUICK_DEFAULT"].icon_id,
text=f"Quick Create {AuthoringData.data['ifc_element_type']}", text=f"Quick Create {AuthoringData.data['ifc_element_type']}"
) )
op.ifc_element_type = AuthoringData.data["ifc_element_type"] op.ifc_element_type = AuthoringData.data["ifc_element_type"]
@@ -480,27 +480,23 @@ class CreateObjectUI:
if AuthoringData.data["ifc_classes"]: if AuthoringData.data["ifc_classes"]:
if cls.props.ifc_class: if cls.props.ifc_class:
box = cls.layout.box() box = cls.layout.box()
# This trick creates a fake dropdown row = box.row(align=True)
row1 = box.row(align=True)
if AuthoringData.data["type_thumbnail"] and ui_context == "TOOL_HEADER": if AuthoringData.data["type_thumbnail"] and ui_context == "TOOL_HEADER":
row1.ui_units_y = 0.01 row.template_icon(icon_value=AuthoringData.data["type_thumbnail"])
row1.template_icon(icon_value=AuthoringData.data["type_thumbnail"], scale=1) row.operator(
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 "bim.launch_type_manager", text=AuthoringData.data["relating_type_name"], emboss=False
) )
else: else:
row1.operator( row.operator(
"bim.launch_type_manager", "bim.launch_type_manager",
icon="BLANK1", icon="BLANK1",
text=AuthoringData.data["relating_type_name"], text=AuthoringData.data["relating_type_name"],
emboss=False, emboss=False,
) )
row1.operator( row.operator(
"bim.launch_type_manager", "bim.launch_type_manager",
icon=tool.Blender.TYPE_MANAGER_ICON, # "DOWNARROW_HLT", icon=tool.Blender.TYPE_MANAGER_ICON,
text="", text="",
emboss=False, emboss=False,
) )
@@ -520,7 +516,8 @@ class CreateObjectUI:
row1.template_icon(icon_value=AuthoringData.data["type_thumbnail"], scale=4) row1.template_icon(icon_value=AuthoringData.data["type_thumbnail"], scale=4)
row2 = box.column(align=True) row2 = box.column(align=True)
row2.ui_units_y = 4 row2.ui_units_y = 4
row2.operator("bim.launch_type_manager", text="", emboss=False) for _ in range(4):
row2.operator("bim.launch_type_manager", text="", emboss=False)
else: else:
op = box.operator( op = box.operator(
"bim.load_type_thumbnails", "bim.load_type_thumbnails",