Fix error switching from different type of representations

E.g. from curve representation to mesh representation and vice versa. Mentioned in #5687.
This commit is contained in:
Andrej730
2024-11-13 17:26:51 +05:00
parent 5913fe881e
commit 2845071621
+8 -2
View File
@@ -747,7 +747,10 @@ class Geometry(bonsai.core.tool.Geometry):
meshes[mesh_name] = mesh
old_mesh = obj.data
cls.change_object_data(obj, mesh, is_global=False)
if type(old_mesh) == type(mesh):
cls.change_object_data(obj, mesh, is_global=False)
else:
obj = cls.recreate_object_with_data(obj, mesh, is_global=False)
cls.record_object_materials(obj)
if not cls.has_data_users(old_mesh):
cls.delete_data(old_mesh)
@@ -778,7 +781,10 @@ class Geometry(bonsai.core.tool.Geometry):
meshes[mesh_name] = mesh
old_mesh = obj.data
cls.change_object_data(obj, mesh, is_global=False)
if type(old_mesh) == type(mesh):
cls.change_object_data(obj, mesh, is_global=False)
else:
obj = cls.recreate_object_with_data(obj, mesh, is_global=False)
cls.record_object_materials(obj)
if not cls.has_data_users(old_mesh):
cls.delete_data(old_mesh)