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
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@stuvel.eu>2017-04-21 15:19:05 +0300
committerSybren A. Stüvel <sybren@stuvel.eu>2017-04-21 15:19:05 +0300
commit81011679ddb1fc57e37fe1ba2eb494a1dedaa0fd (patch)
tree54dc7feaf7fbcfbb45891a61bef5113af508696a /tests/python/bl_alembic_import_test.py
parentbfa888cef28955501195dfbee002bc793685e527 (diff)
parent9c02990ac13a25968d8ec15da15129617d3f25d0 (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'tests/python/bl_alembic_import_test.py')
-rw-r--r--tests/python/bl_alembic_import_test.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/python/bl_alembic_import_test.py b/tests/python/bl_alembic_import_test.py
index 5f7b4440e5f..7c0f0254973 100644
--- a/tests/python/bl_alembic_import_test.py
+++ b/tests/python/bl_alembic_import_test.py
@@ -87,6 +87,43 @@ class SimpleImportTest(unittest.TestCase):
for ob in bpy.data.objects:
self.assertEqual('Cube' in ob.name, ob.select_get())
+ def test_change_path(self):
+ import math
+
+ fname = 'cube-rotating1.abc'
+ abc = self.testdir / fname
+ relpath = bpy.path.relpath(str(abc))
+
+ res = bpy.ops.wm.alembic_import(filepath=str(abc), as_background_job=False)
+ self.assertEqual({'FINISHED'}, res)
+ cube = bpy.context.active_object
+
+ # Check that the file loaded ok.
+ bpy.context.scene.frame_set(10)
+ x, y, z = cube.matrix_world.to_euler('XYZ')
+ self.assertAlmostEqual(x, 0)
+ self.assertAlmostEqual(y, 0)
+ self.assertAlmostEqual(z, math.pi / 2, places=5)
+
+ # Change path from absolute to relative. This should not break the animation.
+ bpy.context.scene.frame_set(1)
+ bpy.data.cache_files[fname].filepath = relpath
+ bpy.context.scene.frame_set(10)
+
+ x, y, z = cube.matrix_world.to_euler('XYZ')
+ self.assertAlmostEqual(x, 0)
+ self.assertAlmostEqual(y, 0)
+ self.assertAlmostEqual(z, math.pi / 2, places=5)
+
+ # Replace the Alembic file; this should apply new animation.
+ bpy.data.cache_files[fname].filepath = relpath.replace('1.abc', '2.abc')
+ bpy.context.scene.update()
+
+ x, y, z = cube.matrix_world.to_euler('XYZ')
+ self.assertAlmostEqual(x, math.pi / 2, places=5)
+ self.assertAlmostEqual(y, 0)
+ self.assertAlmostEqual(z, 0)
+
def main():
global args