diff options
-rw-r--r-- | source/blender/io/alembic/intern/abc_writer_object.cc | 12 | ||||
-rw-r--r-- | tests/python/alembic_tests.py | 18 |
2 files changed, 20 insertions, 10 deletions
diff --git a/source/blender/io/alembic/intern/abc_writer_object.cc b/source/blender/io/alembic/intern/abc_writer_object.cc index f4a3587f54d..3d280d9f0a4 100644 --- a/source/blender/io/alembic/intern/abc_writer_object.cc +++ b/source/blender/io/alembic/intern/abc_writer_object.cc @@ -30,7 +30,17 @@ AbcObjectWriter::AbcObjectWriter(Object *ob, AbcObjectWriter *parent) : m_object(ob), m_settings(settings), m_time_sampling(time_sampling), m_first_frame(true) { - m_name = get_id_name(m_object) + "Shape"; + /* This class is used as superclass for objects themselves (i.e. transforms) and for object + * data (meshes, curves, cameras, etc.). However, when writing transforms, the m_name field is + * ignored. This is a temporary tweak to get the exporter to write object data with the data + * name instead of the object name in a safe way. */ + if (m_object->data == nullptr) { + m_name = get_id_name(m_object); + } + else { + ID *ob_data = static_cast<ID *>(m_object->data); + m_name = get_id_name(ob_data); + } if (parent) { parent->addChild(this); diff --git a/tests/python/alembic_tests.py b/tests/python/alembic_tests.py index 2d477c5a6f0..fbb9496c9df 100644 --- a/tests/python/alembic_tests.py +++ b/tests/python/alembic_tests.py @@ -253,10 +253,10 @@ class CurveExportTest(AbstractAlembicTest): self.run_blender('single-curve.blend', script) # Now check the resulting Alembic file. - abcprop = self.abcprop(abc, '/NurbsCurve/NurbsCurveShape/.geom') + abcprop = self.abcprop(abc, '/NurbsCurve/CurveData/.geom') self.assertEqual(abcprop['.orders'], [4]) - abcprop = self.abcprop(abc, '/NurbsCurve/NurbsCurveShape/.geom/.userProperties') + abcprop = self.abcprop(abc, '/NurbsCurve/CurveData/.geom/.userProperties') self.assertEqual(abcprop['blender:resolution'], 10) @@ -286,7 +286,7 @@ class HairParticlesExportTest(AbstractAlembicTest): abcprop = self.abcprop(abc, '/Suzanne/Non-hair particle system/.geom') self.assertIn('.velocities', abcprop) - abcprop = self.abcprop(abc, '/Suzanne/SuzanneShape/.geom') + abcprop = self.abcprop(abc, '/Suzanne/MonkeyMesh/.geom') self.assertIn('.faceIndices', abcprop) @with_tempdir @@ -299,7 +299,7 @@ class HairParticlesExportTest(AbstractAlembicTest): self.assertRaises(AbcPropError, self.abcprop, abc, '/Suzanne/Non-hair particle system/.geom') - abcprop = self.abcprop(abc, '/Suzanne/SuzanneShape/.geom') + abcprop = self.abcprop(abc, '/Suzanne/MonkeyMesh/.geom') self.assertIn('.faceIndices', abcprop) @with_tempdir @@ -311,7 +311,7 @@ class HairParticlesExportTest(AbstractAlembicTest): abcprop = self.abcprop(abc, '/Suzanne/Non-hair particle system/.geom') self.assertIn('.velocities', abcprop) - abcprop = self.abcprop(abc, '/Suzanne/SuzanneShape/.geom') + abcprop = self.abcprop(abc, '/Suzanne/MonkeyMesh/.geom') self.assertIn('.faceIndices', abcprop) @with_tempdir @@ -322,7 +322,7 @@ class HairParticlesExportTest(AbstractAlembicTest): self.assertRaises(AbcPropError, self.abcprop, abc, '/Suzanne/Non-hair particle system/.geom') - abcprop = self.abcprop(abc, '/Suzanne/SuzanneShape/.geom') + abcprop = self.abcprop(abc, '/Suzanne/MonkeyMesh/.geom') self.assertIn('.faceIndices', abcprop) @@ -342,7 +342,7 @@ class UVMapExportTest(AbstractAlembicTest): self.maxDiff = 1000 # The main UV map should be written to .geom - abcprop = self.abcprop(abc, '/Cube/CubeShape/.geom/uv') + abcprop = self.abcprop(abc, '/Cube/Cube/.geom/uv') self.assertEqual(abcprop['.vals'], [ [0.625, 0.75], [0.875, 0.75], @@ -361,7 +361,7 @@ class UVMapExportTest(AbstractAlembicTest): ]) # The second UV map should be written to .arbGeomParams - abcprop = self.abcprop(abc, '/Cube/CubeShape/.geom/.arbGeomParams/Secondary') + abcprop = self.abcprop(abc, '/Cube/Cube/.geom/.arbGeomParams/Secondary') self.assertEqual(abcprop['.vals'], [ [0.75, 0.375], [0.75, 0.125], @@ -465,7 +465,7 @@ class LongNamesExportTest(AbstractAlembicTest): 0.0, 3.0, 0.0, 1.0, ]) - abcprop = self.abcprop(abc, '%s/CubeShape/.geom' % name) + abcprop = self.abcprop(abc, '%s/Cube/.geom' % name) self.assertIn('.faceCounts', abcprop) |