mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-07 00:11:36 +00:00
See #4239. Ensure that all copy pasted objects are unlinked. Use duplicate if you want to copy.
This commit is contained in:
@@ -1272,7 +1272,12 @@ class OverridePasteBuffer(bpy.types.Operator):
|
||||
bpy.ops.view3d.pastebuffer()
|
||||
if IfcStore.get_file():
|
||||
for obj in context.selected_objects:
|
||||
blenderbim.core.root.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=obj)
|
||||
# Pasted objects may come from another Blender session, or even
|
||||
# from the same session where the original object has since
|
||||
# been deleted. As the source element may not exist, paste will
|
||||
# always unlink the element. If you want to duplicate an
|
||||
# element, use the duplicate commands.
|
||||
tool.Root.unlink_object(obj)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
|
||||
@@ -293,3 +293,15 @@ class Root(blenderbim.core.tool.Root):
|
||||
name = getattr(element, "Name", getattr(element, "AxisTag", None))
|
||||
obj.name = "{}/{}".format(element.is_a(), name or "Unnamed")
|
||||
obj.BIMObjectProperties.is_renaming = False
|
||||
|
||||
@classmethod
|
||||
def unlink_object(cls, obj):
|
||||
tool.Ifc.unlink(obj=obj)
|
||||
if hasattr(obj.data, "BIMMeshProperties"):
|
||||
obj.data.BIMMeshProperties.ifc_definition_id = 0
|
||||
for material_slot in obj.material_slots:
|
||||
if material_slot.material:
|
||||
blenderbim.core.style.unlink_style(tool.Ifc, tool.Style, obj=material_slot.material)
|
||||
blenderbim.core.material.unlink_material(tool.Ifc, obj=material_slot.material)
|
||||
if "Ifc" in obj.name and "/" in obj.name:
|
||||
obj.name = obj.name.split("/", 1)[1]
|
||||
|
||||
Reference in New Issue
Block a user