Fix #140225: Always ensure mesh topology is up to date during USD import
It is possible for a mesh to change topology across frames but still be detected as not needing a topology update. Until we can make a finer-grained check against the before and after topology, unconditionally ensure it's updated for now. Adds a new test that checks a few frames of changing topology that is similar, but not the same. Pull Request: https://projects.blender.org/blender/blender/pulls/140253
This commit is contained in:
committed by
Jesse Yurkovich
parent
a25e1c9267
commit
37f8616bd5
@@ -160,6 +160,32 @@ class USDImportTest(AbstractUSDTest):
|
||||
self.assertEqual(len(mesh.vertices), 5)
|
||||
self.assertEqual(len(mesh.polygons[0].vertices), 5)
|
||||
|
||||
def test_import_mesh_topology_change(self):
|
||||
"""Test importing meshes with changing topology over time."""
|
||||
|
||||
infile = str(self.testdir / "usd_mesh_topology_change.usda")
|
||||
res = bpy.ops.wm.usd_import(filepath=infile)
|
||||
self.assertEqual({'FINISHED'}, res, f"Unable to import USD file {infile}")
|
||||
|
||||
# Check topology for all frames against expected vertex and face counts
|
||||
expected_face_verts = [
|
||||
(4, 4, 4),
|
||||
(3, 4, 5),
|
||||
(3, 3, 6),
|
||||
(4, 4, 4),
|
||||
]
|
||||
for frame in range(1, 5):
|
||||
bpy.context.scene.frame_set(frame)
|
||||
depsgraph = bpy.context.evaluated_depsgraph_get()
|
||||
|
||||
mesh = depsgraph.objects["TopoTest"].data
|
||||
|
||||
expected = expected_face_verts[frame - 1]
|
||||
self.assertEqual(len(mesh.polygons), len(expected), f"Unexpected data for {frame=}")
|
||||
for face in range(0, 3):
|
||||
verts = mesh.polygons[face].vertices
|
||||
self.assertEqual(len(verts), expected[face], f"Unexpected data for {frame=} {face=}")
|
||||
|
||||
def test_import_mesh_uv_maps(self):
|
||||
"""Test importing meshes with udim UVs and multiple UV sets."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user