Update Type Manager

Add back the type dropdown and looking glass icon in the toolbar
Clicking on a type in the manager no longer closes the popup anymore.
A visual indictor is displayed on the active type
Changed the parameters icon in the individual type interface

Fix bug in "Slab from Walls" Shift + A code
This commit is contained in:
Gorgious56
2025-01-09 17:45:40 +01:00
parent 2d5bc49ee0
commit a6e953a550
3 changed files with 27 additions and 22 deletions
@@ -489,7 +489,6 @@ class SetActiveType(bpy.types.Operator, tool.Ifc.Operator):
def _execute(self, context):
props = context.scene.BIMModelProperties
props.relating_type_id = str(self.relating_type)
context.window.screen = context.window.screen # Closes the type manager popup
class AlignProduct(bpy.types.Operator):
+12 -4
View File
@@ -84,7 +84,7 @@ class LaunchTypeManager(bpy.types.Operator):
bl_idname = "bim.launch_type_manager"
bl_label = "Launch Type Manager"
bl_options = {"REGISTER", "UNDO"}
bl_description = "Display all available Construction Types to add new instances"
bl_description = "Display all available Construction Types to add new occurrences"
def execute(self, context):
bpy.ops.bim.hotkey("INVOKE_DEFAULT", hotkey="S_A")
@@ -102,7 +102,7 @@ class LaunchTypeManager(bpy.types.Operator):
if ifc_class is not None:
bpy.ops.bim.load_type_thumbnails(ifc_class=ifc_class, offset=0, limit=9)
return context.window_manager.invoke_props_dialog(
self, width=550, title="Type Manager", confirm_text="Add Type"
self, width=550, title="Type Manager", confirm_text="Add Occurrence"
)
def draw(self, context):
@@ -146,7 +146,7 @@ class LaunchTypeManager(bpy.types.Operator):
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="", emboss=False)
op = row.operator("bim.launch_type_menu", icon="PREFERENCES", text="", emboss=False)
op.relating_type_id = relating_type["id"]
row = box.row()
@@ -163,7 +163,15 @@ class LaunchTypeManager(bpy.types.Operator):
row2.operator("bim.set_active_type", text="", emboss=False).relating_type = relating_type["id"]
row2.operator("bim.set_active_type", text="", emboss=False).relating_type = relating_type["id"]
row2.operator("bim.set_active_type", text="", emboss=False).relating_type = relating_type["id"]
row2.operator("bim.set_active_type", text="", emboss=False).relating_type = relating_type["id"]
is_current_relating_type = str(relating_type["id"]) == str(
AuthoringData.data["relating_type_id_current"]
)
if is_current_relating_type:
active_row = row2.row()
active_row.alignment = "CENTER"
active_row.label(text="Active", icon="CHECKMARK")
else:
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="", icon="FILE_REFRESH", emboss=False)
+15 -17
View File
@@ -509,16 +509,12 @@ class CreateObjectUI:
if ifc_class:
box = cls.layout.box()
row = box.row(align=True)
prop_with_search(row, cls.props, "relating_type_id", text="")
if AuthoringData.data["type_thumbnail"] and ui_context == "TOOL_HEADER":
row.template_icon(icon_value=AuthoringData.data["type_thumbnail"])
row.operator("bim.launch_type_manager", text=AuthoringData.data["relating_type_name"], emboss=False)
row.operator("bim.launch_type_manager", text="Type Manager", emboss=False)
else:
row.operator(
"bim.launch_type_manager",
icon="BLANK1",
text=AuthoringData.data["relating_type_name"],
emboss=False,
)
row.operator("bim.launch_type_manager", icon="BLANK1", text="Type Manager", emboss=False)
row.operator(
"bim.launch_type_manager",
@@ -595,7 +591,7 @@ class EditObjectUI:
op = row.operator("bim.disable_aggregate_mode", text="", icon="X")
op = row.operator("bim.toggle_aggregate_mode_local_view", text="", icon="ZOOM_SELECTED")
op = row.operator("bim.aggregate_assign_new_objects_in_aggregate_mode", text="", icon="CUBE")
text = format_ifc_camel_case(AuthoringData.data["active_class"])
layout.label(text=f"{text} Edit Tools:", icon="RESTRICT_SELECT_OFF")
cls.draw_parameter_adjustments(context)
@@ -966,16 +962,18 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
bpy.ops.wm.call_menu(name="BIM_MT_add_representation_item")
else:
# Slab from walls
walls = False
# Make sure only Ifc Walls are selected
for obj in bpy.context.selected_objects:
walls = tool.Ifc.get_entity(obj).is_a("IfcWall")
if (
walls
and relating_type_id
and tool.Model.get_usage_type(tool.Ifc.get().by_id(int(relating_type_id))) == "LAYER3"
):
bpy.ops.bim.draw_slab_from_wall("INVOKE_DEFAULT")
return {"FINISHED"}
element = tool.Ifc.get_entity(obj)
if not element or not element.is_a("IfcWall"):
break
else:
if (
relating_type_id
and tool.Model.get_usage_type(tool.Ifc.get().by_id(int(relating_type_id))) == "LAYER3"
):
bpy.ops.bim.draw_slab_from_wall("INVOKE_DEFAULT")
return {"FINISHED"}
# Walls from slab
slab = tool.Ifc.get_entity(bpy.context.active_object)
if (