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): def _execute(self, context):
props = context.scene.BIMModelProperties props = context.scene.BIMModelProperties
props.relating_type_id = str(self.relating_type) props.relating_type_id = str(self.relating_type)
context.window.screen = context.window.screen # Closes the type manager popup
class AlignProduct(bpy.types.Operator): 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_idname = "bim.launch_type_manager"
bl_label = "Launch Type Manager" bl_label = "Launch Type Manager"
bl_options = {"REGISTER", "UNDO"} 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): def execute(self, context):
bpy.ops.bim.hotkey("INVOKE_DEFAULT", hotkey="S_A") bpy.ops.bim.hotkey("INVOKE_DEFAULT", hotkey="S_A")
@@ -102,7 +102,7 @@ class LaunchTypeManager(bpy.types.Operator):
if ifc_class is not None: if ifc_class is not None:
bpy.ops.bim.load_type_thumbnails(ifc_class=ifc_class, offset=0, limit=9) bpy.ops.bim.load_type_thumbnails(ifc_class=ifc_class, offset=0, limit=9)
return context.window_manager.invoke_props_dialog( 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): 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 = row.operator("bim.set_active_type", text=relating_type["name"], icon="BLANK1", emboss=False)
op.relating_type = relating_type["id"] 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"] op.relating_type_id = relating_type["id"]
row = box.row() 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"]
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: else:
row = box.row() row = box.row()
op = box.operator("bim.load_type_thumbnails", text="", icon="FILE_REFRESH", emboss=False) op = box.operator("bim.load_type_thumbnails", text="", icon="FILE_REFRESH", emboss=False)
+14 -16
View File
@@ -509,16 +509,12 @@ class CreateObjectUI:
if ifc_class: if ifc_class:
box = cls.layout.box() box = cls.layout.box()
row = box.row(align=True) 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": if AuthoringData.data["type_thumbnail"] and ui_context == "TOOL_HEADER":
row.template_icon(icon_value=AuthoringData.data["type_thumbnail"]) 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: else:
row.operator( row.operator("bim.launch_type_manager", icon="BLANK1", text="Type Manager", emboss=False)
"bim.launch_type_manager",
icon="BLANK1",
text=AuthoringData.data["relating_type_name"],
emboss=False,
)
row.operator( row.operator(
"bim.launch_type_manager", "bim.launch_type_manager",
@@ -966,16 +962,18 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
bpy.ops.wm.call_menu(name="BIM_MT_add_representation_item") bpy.ops.wm.call_menu(name="BIM_MT_add_representation_item")
else: else:
# Slab from walls # Slab from walls
walls = False # Make sure only Ifc Walls are selected
for obj in bpy.context.selected_objects: for obj in bpy.context.selected_objects:
walls = tool.Ifc.get_entity(obj).is_a("IfcWall") element = tool.Ifc.get_entity(obj)
if ( if not element or not element.is_a("IfcWall"):
walls break
and relating_type_id else:
and tool.Model.get_usage_type(tool.Ifc.get().by_id(int(relating_type_id))) == "LAYER3" if (
): relating_type_id
bpy.ops.bim.draw_slab_from_wall("INVOKE_DEFAULT") and tool.Model.get_usage_type(tool.Ifc.get().by_id(int(relating_type_id))) == "LAYER3"
return {"FINISHED"} ):
bpy.ops.bim.draw_slab_from_wall("INVOKE_DEFAULT")
return {"FINISHED"}
# Walls from slab # Walls from slab
slab = tool.Ifc.get_entity(bpy.context.active_object) slab = tool.Ifc.get_entity(bpy.context.active_object)
if ( if (