This commit is contained in:
Andrej730
2025-12-04 16:49:16 +05:00
parent 30e750d770
commit 549b2e6ff8
2 changed files with 67 additions and 69 deletions
@@ -2585,6 +2585,7 @@ class OverrideModeSetObject(bpy.types.Operator, tool.Ifc.Operator):
return element.ObjectType in annotation_types_with_order return element.ObjectType in annotation_types_with_order
class DirectProfileEdit(bpy.types.Operator, tool.Ifc.Operator): class DirectProfileEdit(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.direct_profile_edit" bl_idname = "bim.direct_profile_edit"
bl_label = "IFC Direct Profile Edit" bl_label = "IFC Direct Profile Edit"
@@ -2680,8 +2681,10 @@ class DirectProfileEdit(bpy.types.Operator, tool.Ifc.Operator):
profile = tool.Model.export_profile(obj) profile = tool.Model.export_profile(obj)
if not profile: if not profile:
def msg(self, context): def msg(self, context):
self.layout.label(text="INVALID PROFILE") self.layout.label(text="INVALID PROFILE")
context.window_manager.popup_menu(msg, title="Error", icon="ERROR") context.window_manager.popup_menu(msg, title="Error", icon="ERROR")
tool.Blender.toggle_edit_mode(context) tool.Blender.toggle_edit_mode(context)
ProfileDecorator.install(context) ProfileDecorator.install(context)
@@ -2712,8 +2715,10 @@ class DirectProfileEdit(bpy.types.Operator, tool.Ifc.Operator):
new = tool.Model.export_curves(obj) new = tool.Model.export_curves(obj)
if not new: if not new:
def msg(self, context): def msg(self, context):
self.layout.label(text="INVALID PROFILE") self.layout.label(text="INVALID PROFILE")
context.window_manager.popup_menu(msg, title="Error", icon="ERROR") context.window_manager.popup_menu(msg, title="Error", icon="ERROR")
tool.Blender.toggle_edit_mode(context) tool.Blender.toggle_edit_mode(context)
ProfileDecorator.install(context) ProfileDecorator.install(context)
@@ -2808,7 +2813,7 @@ class DirectProfileEdit(bpy.types.Operator, tool.Ifc.Operator):
return {"CANCELLED"} return {"CANCELLED"}
# Check if object has mesh or curve data # Check if object has mesh or curve data
if not hasattr(obj, 'data') or not obj.data: if not hasattr(obj, "data") or not obj.data:
self.report({"INFO"}, "Object has no editable data") self.report({"INFO"}, "Object has no editable data")
return {"CANCELLED"} return {"CANCELLED"}
@@ -2899,7 +2904,7 @@ class DirectProfileEdit(bpy.types.Operator, tool.Ifc.Operator):
return {"CANCELLED"} return {"CANCELLED"}
# Select and activate the editable object # Select and activate the editable object
bpy.ops.object.select_all(action='DESELECT') bpy.ops.object.select_all(action="DESELECT")
editable_item_obj.select_set(True) editable_item_obj.select_set(True)
context.view_layer.objects.active = editable_item_obj context.view_layer.objects.active = editable_item_obj
@@ -2919,6 +2924,7 @@ class DirectProfileEdit(bpy.types.Operator, tool.Ifc.Operator):
tool.Blender.toggle_edit_mode(context) tool.Blender.toggle_edit_mode(context)
from bonsai.bim.module.model.decorator import ProfileDecorator from bonsai.bim.module.model.decorator import ProfileDecorator
ProfileDecorator.install(context) ProfileDecorator.install(context)
if not bpy.app.background: if not bpy.app.background:
@@ -2933,6 +2939,7 @@ class DirectProfileEdit(bpy.types.Operator, tool.Ifc.Operator):
tool.Blender.toggle_edit_mode(context) tool.Blender.toggle_edit_mode(context)
from bonsai.bim.module.model.decorator import ProfileDecorator from bonsai.bim.module.model.decorator import ProfileDecorator
ProfileDecorator.install(context) ProfileDecorator.install(context)
if not bpy.app.background: if not bpy.app.background:
@@ -2964,13 +2971,6 @@ class DirectProfileEdit(bpy.types.Operator, tool.Ifc.Operator):
return {"CANCELLED"} return {"CANCELLED"}
class FlipObject(bpy.types.Operator): class FlipObject(bpy.types.Operator):
bl_idname = "bim.flip_object" bl_idname = "bim.flip_object"
bl_label = "Flip Object" bl_label = "Flip Object"
@@ -663,5 +663,3 @@ class BIM_PT_purge(Panel):
row.prop(props, "ifc_class_purge", text="") row.prop(props, "ifc_class_purge", text="")
row.operator("bim.purge_unused_elements_by_class", text="Purge Orphaned", icon="TRASH") row.operator("bim.purge_unused_elements_by_class", text="Purge Orphaned", icon="TRASH")
row.operator("bim.print_unused_elements_stats", text="", icon="INFO") row.operator("bim.print_unused_elements_stats", text="", icon="INFO")