mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-30 16:43:00 +00:00
Fix bug where existing meshes were not deleted when switching representations.
This commit is contained in:
@@ -179,9 +179,9 @@ class TestAddRepresentation:
|
||||
|
||||
|
||||
class TestSwitchRepresentation:
|
||||
def test_switching_to_a_freshly_reloaded_representation(self, geometry):
|
||||
def test_switching_to_a_freshly_loaded_representation(self, geometry):
|
||||
geometry.resolve_mapped_representation("mapped_rep").should_be_called().will_return("representation")
|
||||
geometry.get_representation_data("representation").should_be_called().will_return("data")
|
||||
geometry.get_representation_data("representation").should_be_called().will_return(None)
|
||||
geometry.import_representation(
|
||||
"obj", "representation", enable_dynamic_voids=True
|
||||
).should_be_called().will_return("new_data")
|
||||
@@ -201,6 +201,29 @@ class TestSwitchRepresentation:
|
||||
is_global=True,
|
||||
)
|
||||
|
||||
def test_switching_to_a_reloaded_representation_and_deleting_the_existing_data(self, geometry):
|
||||
geometry.resolve_mapped_representation("mapped_rep").should_be_called().will_return("representation")
|
||||
geometry.get_representation_data("representation").should_be_called().will_return("existing_data")
|
||||
geometry.import_representation(
|
||||
"obj", "representation", enable_dynamic_voids=True
|
||||
).should_be_called().will_return("new_data")
|
||||
geometry.get_representation_name("representation").should_be_called().will_return("name")
|
||||
geometry.rename_object("new_data", "name").should_be_called()
|
||||
geometry.link("representation", "new_data").should_be_called()
|
||||
geometry.change_object_data("obj", "new_data", is_global=True).should_be_called()
|
||||
geometry.delete_data("existing_data").should_be_called()
|
||||
geometry.clear_modifiers("obj").should_be_called()
|
||||
geometry.is_body_representation("representation").should_be_called().will_return(True)
|
||||
geometry.create_dynamic_voids("obj").should_be_called()
|
||||
subject.switch_representation(
|
||||
geometry,
|
||||
obj="obj",
|
||||
representation="mapped_rep",
|
||||
should_reload=True,
|
||||
enable_dynamic_voids=True,
|
||||
is_global=True,
|
||||
)
|
||||
|
||||
def test_switching_to_an_existing_representation(self, geometry):
|
||||
geometry.resolve_mapped_representation("mapped_rep").should_be_called().will_return("representation")
|
||||
geometry.get_representation_data("representation").should_be_called().will_return("data")
|
||||
|
||||
@@ -82,6 +82,13 @@ class TestCreateDynamicVoids(NewFile):
|
||||
assert modifier.use_self is True
|
||||
|
||||
|
||||
class TestDeleteData(NewFile):
|
||||
def test_run(self):
|
||||
data = bpy.data.meshes.new("Mesh")
|
||||
subject.delete_data(data)
|
||||
assert not bpy.data.meshes.get("Mesh")
|
||||
|
||||
|
||||
class TestDoesObjectHaveMeshWithFaces(NewFile):
|
||||
def test_empties_return_false(self):
|
||||
obj = bpy.data.objects.new("Object", None)
|
||||
|
||||
Reference in New Issue
Block a user