Merge branch 'master' into blender2.8
authorSybren A. Stüvel <sybren@stuvel.eu>
Fri, 21 Apr 2017 12:19:05 +0000 (14:19 +0200)
committerSybren A. Stüvel <sybren@stuvel.eu>
Fri, 21 Apr 2017 12:19:05 +0000 (14:19 +0200)
1  2 
CMakeLists.txt
build_files/cmake/macros.cmake
source/blender/alembic/intern/abc_mesh.cc
source/blender/alembic/intern/abc_object.cc
source/blender/alembic/intern/alembic_capi.cc
source/blender/blenkernel/intern/cachefile.c
source/blender/blenlib/intern/math_vector.c
source/blenderplayer/CMakeLists.txt
tests/python/bl_alembic_import_test.py

diff --cc CMakeLists.txt
Simple merge
Simple merge
Simple merge
index 5f7b4440e5f07e774acce79c730283791c8b235d,33ccc49f301fbfa639a8d2e0d66579d1f31cf762..7c0f02549733e2156a84253e4652fc8e26e2b8e8
@@@ -85,8 -83,45 +85,45 @@@ class SimpleImportTest(unittest.TestCas
  
          # All cubes should be selected, but the sphere shouldn't be.
          for ob in bpy.data.objects:
 -            self.assertEqual('Cube' in ob.name, ob.select)
 +            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