mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
See #5491. Clean up orphaned meshes when editing.
This commit is contained in:
@@ -63,7 +63,10 @@ def update_mode(self, context):
|
||||
def update_representation_obj(self, context):
|
||||
for item_obj in self.item_objs:
|
||||
if item_obj.obj:
|
||||
data = item_obj.obj.data
|
||||
bpy.data.objects.remove(item_obj.obj)
|
||||
if data and not data.users:
|
||||
bpy.data.meshes.remove(data)
|
||||
self.item_objs.clear()
|
||||
|
||||
|
||||
|
||||
@@ -281,7 +281,10 @@ class Model(bonsai.core.tool.Model):
|
||||
if obj is None:
|
||||
obj = bpy.data.objects.new("Profile", mesh)
|
||||
else:
|
||||
old_data = obj.data
|
||||
obj.data = mesh
|
||||
if old_data and not old_data.users:
|
||||
bpy.data.meshes.remove(old_data)
|
||||
|
||||
for arc in cls.arcs:
|
||||
group = obj.vertex_groups.new(name="IFCARCINDEX")
|
||||
|
||||
Reference in New Issue
Block a user