mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 10:57:49 +00:00
Fix #3050. Unlinking now gives you an option to delete as well.
This commit is contained in:
@@ -156,6 +156,7 @@ class UnlinkObject(bpy.types.Operator):
|
||||
bl_label = "Unlink Object"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
obj: bpy.props.StringProperty()
|
||||
should_delete: bpy.props.BoolProperty(name="Should Delete", default=True)
|
||||
|
||||
def execute(self, context):
|
||||
return IfcStore.execute_ifc_operator(self, context)
|
||||
@@ -167,7 +168,14 @@ class UnlinkObject(bpy.types.Operator):
|
||||
else:
|
||||
objects = context.selected_objects
|
||||
for obj in objects:
|
||||
if obj.BIMObjectProperties.ifc_definition_id:
|
||||
element = tool.Ifc.get_entity(obj)
|
||||
if element:
|
||||
if self.should_delete:
|
||||
obj_copy = obj.copy()
|
||||
for collection in obj.users_collection:
|
||||
collection.objects.link(obj_copy)
|
||||
tool.Geometry.delete_ifc_object(obj)
|
||||
obj = obj_copy
|
||||
if obj in IfcStore.edited_objs:
|
||||
IfcStore.edited_objs.remove(obj)
|
||||
IfcStore.unlink_element(obj=obj)
|
||||
@@ -182,6 +190,13 @@ class UnlinkObject(bpy.types.Operator):
|
||||
obj.name = "/".join(obj.name.split("/")[1:])
|
||||
return {"FINISHED"}
|
||||
|
||||
def draw(self, context):
|
||||
row = self.layout.row()
|
||||
row.prop(self, "should_delete")
|
||||
|
||||
def invoke(self, context, event):
|
||||
return context.window_manager.invoke_props_dialog(self)
|
||||
|
||||
|
||||
class CopyClass(bpy.types.Operator, Operator):
|
||||
bl_idname = "bim.copy_class"
|
||||
|
||||
Reference in New Issue
Block a user