mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-27 18:57:17 +00:00
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:
@@ -747,7 +747,10 @@ class Geometry(bonsai.core.tool.Geometry):
|
|||||||
meshes[mesh_name] = mesh
|
meshes[mesh_name] = mesh
|
||||||
|
|
||||||
old_mesh = obj.data
|
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)
|
cls.record_object_materials(obj)
|
||||||
if not cls.has_data_users(old_mesh):
|
if not cls.has_data_users(old_mesh):
|
||||||
cls.delete_data(old_mesh)
|
cls.delete_data(old_mesh)
|
||||||
@@ -778,7 +781,10 @@ class Geometry(bonsai.core.tool.Geometry):
|
|||||||
meshes[mesh_name] = mesh
|
meshes[mesh_name] = mesh
|
||||||
|
|
||||||
old_mesh = obj.data
|
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)
|
cls.record_object_materials(obj)
|
||||||
if not cls.has_data_users(old_mesh):
|
if not cls.has_data_users(old_mesh):
|
||||||
cls.delete_data(old_mesh)
|
cls.delete_data(old_mesh)
|
||||||
|
|||||||
Reference in New Issue
Block a user