See #5491. Clean up orphaned meshes when editing.

This commit is contained in:
Dion Moult
2024-09-27 21:59:42 +10:00
parent ceeba53c18
commit d93ffb1fe6
2 changed files with 6 additions and 0 deletions
@@ -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()
+3
View File
@@ -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")