mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 02:07:36 +00:00
Fixed issue unlinking mesh objects
After d67eae5 delete_ifc_object is removing the meshes and it end up invalidating the unlinked object. Now mesh is copied before running delete_ifc_object
This commit is contained in:
@@ -174,6 +174,13 @@ class UnlinkObject(bpy.types.Operator):
|
|||||||
if element:
|
if element:
|
||||||
if self.should_delete:
|
if self.should_delete:
|
||||||
obj_copy = obj.copy()
|
obj_copy = obj.copy()
|
||||||
|
|
||||||
|
# copy object data, so it won't be removed by `delete_ifc_object`
|
||||||
|
if obj.data:
|
||||||
|
obj_copy.data = obj.data.copy()
|
||||||
|
if obj.type == "MESH":
|
||||||
|
obj_copy.data.BIMMeshProperties.ifc_definition_id = 0
|
||||||
|
|
||||||
for collection in obj.users_collection:
|
for collection in obj.users_collection:
|
||||||
collection.objects.link(obj_copy)
|
collection.objects.link(obj_copy)
|
||||||
tool.Geometry.delete_ifc_object(obj)
|
tool.Geometry.delete_ifc_object(obj)
|
||||||
@@ -181,8 +188,7 @@ class UnlinkObject(bpy.types.Operator):
|
|||||||
if obj in IfcStore.edited_objs:
|
if obj in IfcStore.edited_objs:
|
||||||
IfcStore.edited_objs.remove(obj)
|
IfcStore.edited_objs.remove(obj)
|
||||||
tool.Ifc.unlink(obj=obj)
|
tool.Ifc.unlink(obj=obj)
|
||||||
if obj.data:
|
|
||||||
obj.data = obj.data.copy()
|
|
||||||
for material_slot in obj.material_slots:
|
for material_slot in obj.material_slots:
|
||||||
if material_slot.material:
|
if material_slot.material:
|
||||||
material_slot.material = material_slot.material.copy()
|
material_slot.material = material_slot.material.copy()
|
||||||
|
|||||||
Reference in New Issue
Block a user