mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +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):
|
def update_representation_obj(self, context):
|
||||||
for item_obj in self.item_objs:
|
for item_obj in self.item_objs:
|
||||||
if item_obj.obj:
|
if item_obj.obj:
|
||||||
|
data = item_obj.obj.data
|
||||||
bpy.data.objects.remove(item_obj.obj)
|
bpy.data.objects.remove(item_obj.obj)
|
||||||
|
if data and not data.users:
|
||||||
|
bpy.data.meshes.remove(data)
|
||||||
self.item_objs.clear()
|
self.item_objs.clear()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -281,7 +281,10 @@ class Model(bonsai.core.tool.Model):
|
|||||||
if obj is None:
|
if obj is None:
|
||||||
obj = bpy.data.objects.new("Profile", mesh)
|
obj = bpy.data.objects.new("Profile", mesh)
|
||||||
else:
|
else:
|
||||||
|
old_data = obj.data
|
||||||
obj.data = mesh
|
obj.data = mesh
|
||||||
|
if old_data and not old_data.users:
|
||||||
|
bpy.data.meshes.remove(old_data)
|
||||||
|
|
||||||
for arc in cls.arcs:
|
for arc in cls.arcs:
|
||||||
group = obj.vertex_groups.new(name="IFCARCINDEX")
|
group = obj.vertex_groups.new(name="IFCARCINDEX")
|
||||||
|
|||||||
Reference in New Issue
Block a user