This commit is contained in:
Andrej730
2025-11-17 11:08:47 +05:00
parent a038fa62ba
commit 4a5f1b01a1
3 changed files with 53 additions and 48 deletions
@@ -2544,7 +2544,6 @@ class OverrideModeSetObject(bpy.types.Operator, tool.Ifc.Operator):
props.is_changing_mode = False props.is_changing_mode = False
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"
@@ -2580,8 +2579,11 @@ class DirectProfileEdit(bpy.types.Operator, tool.Ifc.Operator):
active_obj = context.active_object active_obj = context.active_object
if active_obj and context.mode == "OBJECT": if active_obj and context.mode == "OBJECT":
if len(context.selected_objects) > 1: if len(context.selected_objects) > 1:
self.report({"WARNING"}, "Currently Direct Profile Edit only works on one object at a time. Operating on active object only.") self.report(
bpy.ops.object.select_all(action='DESELECT') {"WARNING"},
"Currently Direct Profile Edit only works on one object at a time. Operating on active object only.",
)
bpy.ops.object.select_all(action="DESELECT")
active_obj.select_set(True) active_obj.select_set(True)
context.view_layer.objects.active = active_obj context.view_layer.objects.active = active_obj
@@ -2619,13 +2621,16 @@ class DirectProfileEdit(bpy.types.Operator, tool.Ifc.Operator):
# Use the standard save workflow for items # Use the standard save workflow for items
from bonsai.bim.module.model.decorator import ProfileDecorator from bonsai.bim.module.model.decorator import ProfileDecorator
ProfileDecorator.uninstall() ProfileDecorator.uninstall()
tool.Blender.toggle_edit_mode(context) tool.Blender.toggle_edit_mode(context)
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)
@@ -2681,7 +2686,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"}
@@ -2761,7 +2766,7 @@ class DirectProfileEdit(bpy.types.Operator, tool.Ifc.Operator):
return {"CANCELLED"} return {"CANCELLED"}
# Select and activate the swept solid object # Select and activate the swept solid object
bpy.ops.object.select_all(action='DESELECT') bpy.ops.object.select_all(action="DESELECT")
swept_solid_obj.select_set(True) swept_solid_obj.select_set(True)
context.view_layer.objects.active = swept_solid_obj context.view_layer.objects.active = swept_solid_obj
@@ -2779,6 +2784,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:
@@ -2796,7 +2802,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"