From 2d4980e68ebbff4cd78f71abb42e767b0d9a1247 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 3 Feb 2015 15:41:34 +0100 Subject: [PATCH] Fix T42510: bake animation wrong result. Caused by own rBfb7ff31315a1c9 - not surprising code using Object.matrix_local in other contexts than mere Object parenting fails, since it was using a broken implementation before... Note that whole NLA_OT_Bake op would need some love, it is quite brittle in many aspects. --- release/scripts/modules/bpy_extras/anim_utils.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/release/scripts/modules/bpy_extras/anim_utils.py b/release/scripts/modules/bpy_extras/anim_utils.py index d87c207e2d0..8905f327f18 100644 --- a/release/scripts/modules/bpy_extras/anim_utils.py +++ b/release/scripts/modules/bpy_extras/anim_utils.py @@ -25,6 +25,7 @@ __all__ = ( import bpy +# XXX visual keying is actually always considered as True in this code... def bake_action(frame_start, frame_end, frame_step=1, @@ -85,15 +86,15 @@ def bake_action(frame_start, if do_parents_clear: def obj_frame_info(obj, do_visual_keying): - parent = obj.parent - matrix = obj.matrix_local if do_visual_keying else obj.matrix_local - if parent: - return parent.matrix_world * matrix - else: - return matrix.copy() + return obj.matrix_world.copy() if do_visual_keying else obj.matrix_world.copy() else: def obj_frame_info(obj, do_visual_keying): - return obj.matrix_local.copy() if do_visual_keying else obj.matrix_local.copy() + parent = obj.parent + matrix = obj.matrix_world if do_visual_keying else obj.matrix_world + if parent: + return parent.matrix_world.inverted_safe() * matrix + else: + return matrix.copy() # ------------------------------------------------------------------------- # Setup the Context