diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2017-07-11 17:16:56 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2017-07-11 17:17:27 +0300 |
commit | 32edfd53d978b34c9eb528e705f29e3feb673d37 (patch) | |
tree | a3d7d5046a221ca120c0121ea7c894284102cc91 /tests | |
parent | 085ed00e42a5af31c03a3599c4fef38786fb6ba5 (diff) |
Fix T52022 Alembic Inherits transform not taken into account
Alembic's "inherits transform" flag wasn't taken into account when
constructing the parent object relations.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/python/bl_alembic_import_test.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/python/bl_alembic_import_test.py b/tests/python/bl_alembic_import_test.py index d8cd64a1d56..f45748f86e7 100644 --- a/tests/python/bl_alembic_import_test.py +++ b/tests/python/bl_alembic_import_test.py @@ -75,6 +75,39 @@ class SimpleImportTest(AbstractAlembicTest): self.assertEqual(objects['Cube_003'], objects['Cube_005'].parent) self.assertEqual(objects['Cube_003'], objects['Cube_006'].parent) + def test_inherit_or_not(self): + res = bpy.ops.wm.alembic_import( + filepath=str(self.testdir / "T52022-inheritance.abc"), + as_background_job=False) + self.assertEqual({'FINISHED'}, res) + + # The objects should be linked to scene_collection in Blender 2.8, + # and to scene in Blender 2.7x. + objects = bpy.context.scene.objects + + # ABC parent is top-level object, which translates to nothing in Blender + self.assertIsNone(objects['locator1'].parent) + + # ABC parent is locator1, but locator2 has "inherits Xforms" = false, which + # translates to "no parent" in Blender. + self.assertIsNone(objects['locator2'].parent) + + # Shouldn't have inherited the ABC parent's transform. + x, y, z = objects['locator2'].matrix_world.to_translation() + self.assertAlmostEqual(0, x) + self.assertAlmostEqual(0, y) + self.assertAlmostEqual(2, z) + + # ABC parent is inherited and translates to normal parent in Blender. + self.assertEqual(objects['locator2'], objects['locatorShape2'].parent) + + # Should have inherited its ABC parent's transform. + x, y, z = objects['locatorShape2'].matrix_world.to_translation() + self.assertAlmostEqual(0, x) + self.assertAlmostEqual(0, y) + self.assertAlmostEqual(2, z) + + def test_select_after_import(self): # Add a sphere, so that there is something in the scene, selected, and active, # before we do the Alembic import. |