mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 14:48:02 +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_label = "Unlink Object"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
obj: bpy.props.StringProperty()
|
obj: bpy.props.StringProperty()
|
||||||
|
should_delete: bpy.props.BoolProperty(name="Should Delete", default=True)
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
return IfcStore.execute_ifc_operator(self, context)
|
return IfcStore.execute_ifc_operator(self, context)
|
||||||
@@ -167,7 +168,14 @@ class UnlinkObject(bpy.types.Operator):
|
|||||||
else:
|
else:
|
||||||
objects = context.selected_objects
|
objects = context.selected_objects
|
||||||
for obj in 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:
|
if obj in IfcStore.edited_objs:
|
||||||
IfcStore.edited_objs.remove(obj)
|
IfcStore.edited_objs.remove(obj)
|
||||||
IfcStore.unlink_element(obj=obj)
|
IfcStore.unlink_element(obj=obj)
|
||||||
@@ -182,6 +190,13 @@ class UnlinkObject(bpy.types.Operator):
|
|||||||
obj.name = "/".join(obj.name.split("/")[1:])
|
obj.name = "/".join(obj.name.split("/")[1:])
|
||||||
return {"FINISHED"}
|
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):
|
class CopyClass(bpy.types.Operator, Operator):
|
||||||
bl_idname = "bim.copy_class"
|
bl_idname = "bim.copy_class"
|
||||||
|
|||||||
Reference in New Issue
Block a user