Alembic import: fixed dupligroup export when the dupli-empty has a parent

This commit is contained in:
Sybren A. Stüvel
2017-04-14 18:20:24 +02:00
parent 4d117f2fd2
commit 5fa4f397c2
6 changed files with 70 additions and 6 deletions

View File

@@ -221,5 +221,46 @@ class HierarchicalAndFlatExportTest(AbstractAlembicTest):
)
class DupliGroupExportTest(AbstractAlembicTest):
@with_tempdir
def test_hierarchical_export(self, tempdir: pathlib.Path):
abc = tempdir / 'dupligroup_hierarchical.abc'
script = "import bpy; bpy.ops.wm.alembic_export(filepath='%s', start=1, end=1, " \
"renderable_only=True, visible_layers_only=True, flatten=False)" % abc
self.run_blender('dupligroup-scene.blend', script)
# Now check the resulting Alembic file.
xform = self.abcprop(abc, '/Real_Cube/Linked_Suzanne/Cylinder/Suzanne/.xform')
self.assertEqual(1, xform['.inherits'])
self.assertAlmostEqualFloatArray(
xform['.vals'],
[1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 2.0, 0.0, 1.0]
)
@with_tempdir
def test_flat_export(self, tempdir: pathlib.Path):
abc = tempdir / 'dupligroup_hierarchical.abc'
script = "import bpy; bpy.ops.wm.alembic_export(filepath='%s', start=1, end=1, " \
"renderable_only=True, visible_layers_only=True, flatten=True)" % abc
self.run_blender('dupligroup-scene.blend', script)
# Now check the resulting Alembic file.
xform = self.abcprop(abc, '/Suzanne/.xform')
self.assertEqual(0, xform['.inherits'])
self.assertAlmostEqualFloatArray(
xform['.vals'],
[1.5, 0.0, 0.0, 0.0,
0.0, 1.5, 0.0, 0.0,
0.0, 0.0, 1.5, 0.0,
2.0, 3.0, 0.0, 1.0]
)
if __name__ == '__main__':
unittest.main(argv=sys.argv[0:1])