Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2020-05-26 17:38:47 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-05-26 17:42:01 +0300
commita1c9d425844c5c2299daf9a89438d164f605407c (patch)
treedacd7ddc8fcf4616f8354f45420d739eb2fea51e /tests
parentf3cf29ac96937bec76e6cfeb6b143625a814bc03 (diff)
Fix T77021: Alembic export of animated mesh with multiple UV maps fails
This was caused by a side-effect of our exporting code's memory management (Alembic considers data "written" and "final" when its C++ objects go out of scope) in combination with my change in rB65574463fa2d. I removed an "only export UVs on the first frame" clause because it was unclear why this restriction was there. As it turns out, it breaks the export of the 2nd and subsequent UV maps on an animated mesh. Effectively, on every frame the Alembic library thought we want to create a new UV map, instead of continuing to write a new frame of data to the existing one. This is resolved by keeping a reference to the C++ objects for the UV maps in memory while the exporter is running.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/python/alembic_tests.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/python/alembic_tests.py b/tests/python/alembic_tests.py
index 9de1bc06d84..875e17e97f0 100755
--- a/tests/python/alembic_tests.py
+++ b/tests/python/alembic_tests.py
@@ -84,6 +84,7 @@ class AbstractAlembicTest(AbstractBlenderRunnerTest):
'uint8_t': int,
'int16_t': int,
'int32_t': int,
+ 'uint32_t': int,
'uint64_t': int,
'float64_t': float,
'float32_t': float,
@@ -325,6 +326,60 @@ class HairParticlesExportTest(AbstractAlembicTest):
self.assertIn('.faceIndices', abcprop)
+class UVMapExportTest(AbstractAlembicTest):
+ @with_tempdir
+ def test_uvmap_export(self, tempdir: pathlib.Path):
+ """Minimal test for exporting multiple UV maps on an animated mesh.
+
+ This covers the issue reported in T77021.
+ """
+ basename = 'T77021-multiple-uvmaps-animated-mesh'
+ abc = tempdir / f'{basename}.abc'
+ script = f"import bpy; bpy.ops.wm.alembic_export(filepath='{abc.as_posix()}', start=1, end=1, " \
+ f"renderable_only=True, visible_objects_only=True, flatten=False)"
+ self.run_blender(f'{basename}.blend', script)
+
+ self.maxDiff = 1000
+
+ # The main UV map should be written to .geom
+ abcprop = self.abcprop(abc, '/Cube/CubeShape/.geom/uv')
+ self.assertEqual(abcprop['.vals'], [
+ [0.625, 0.75],
+ [0.875, 0.75],
+ [0.875, 0.5],
+ [0.625, 0.5],
+ [0.375, 1.0],
+ [0.625, 1.0],
+ [0.375, 0.75],
+ [0.375, 0.25],
+ [0.625, 0.25],
+ [0.625, 0.0],
+ [0.375, 0.0],
+ [0.125, 0.75],
+ [0.375, 0.5],
+ [0.125, 0.5],
+ ])
+
+ # The second UV map should be written to .arbGeomParams
+ abcprop = self.abcprop(abc, '/Cube/CubeShape/.geom/.arbGeomParams/Secondary')
+ self.assertEqual(abcprop['.vals'], [
+ [0.75, 0.375],
+ [0.75, 0.125],
+ [0.5, 0.125],
+ [0.5, 0.375],
+ [1.0, 0.625],
+ [1.0, 0.375],
+ [0.75, 0.625],
+ [0.25, 0.625],
+ [0.25, 0.375],
+ [0.0, 0.375],
+ [0.0, 0.625],
+ [0.75, 0.875],
+ [0.5, 0.625],
+ [0.5, 0.875],
+ ])
+
+
class LongNamesExportTest(AbstractAlembicTest):
@with_tempdir
def test_export_long_names(self, tempdir: pathlib.Path):