mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-09 21:53:40 +00:00
Solved producing orphan objects data on drawing deletion
This commit is contained in:
@@ -146,7 +146,20 @@ class Drawing(blenderbim.core.tool.Drawing):
|
||||
tool.Ifc.delete(element)
|
||||
obj = tool.Ifc.get_object(element)
|
||||
if obj:
|
||||
obj_data = obj.data
|
||||
bpy.data.objects.remove(obj)
|
||||
if obj_data.users == 0: # in case we have drawing element types
|
||||
cls.remove_object_data(obj_data)
|
||||
|
||||
@classmethod
|
||||
def remove_object_data(cls, data):
|
||||
"""also removes all related objects"""
|
||||
if isinstance(data, bpy.types.Camera):
|
||||
bpy.data.cameras.remove(data)
|
||||
elif isinstance(data, bpy.types.Mesh):
|
||||
bpy.data.meshes.remove(data)
|
||||
elif isinstance(data, bpy.types.Curve):
|
||||
bpy.data.curves.remove(C.object.data)
|
||||
|
||||
@classmethod
|
||||
def delete_object(cls, obj):
|
||||
|
||||
Reference in New Issue
Block a user