mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 02:23:34 +00:00
Progress on Selected Type Preview (#5535)
* Remove length from wall tool No longer relevant with the new draw method * Selected Type Preview and Launch Type Manager Redesign of thumbnail preview * Update to Type Manager Moved Create new type to end of paginated loop Added Predefined type label under thumbnail * No Types Found Modified to match Types Manager tiles Quick Default icon added * No Types Found Modified to match Types Manager tiles Quick Default icon added * Description in thumbnail linked to value --------- Co-authored-by: tim <tjrhyder@gmail.com>
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
@@ -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):
|
||||
|
||||
@@ -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:
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 158 KiB After Width: | Height: | Size: 174 KiB |
Reference in New Issue
Block a user