[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55954] trunk/blender/release/scripts: fix [#34805] Bake action ignores parent motion
Campbell Barton
ideasman42 at gmail.com
Thu Apr 11 10:42:26 CEST 2013
Revision: 55954
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55954
Author: campbellbarton
Date: 2013-04-11 08:42:25 +0000 (Thu, 11 Apr 2013)
Log Message:
-----------
fix [#34805] Bake action ignores parent motion
in fact this is more feature request.
add an option to bake a parented objects animation, then clear the parent and apply the action.
Modified Paths:
--------------
trunk/blender/release/scripts/modules/bpy_extras/anim_utils.py
trunk/blender/release/scripts/startup/bl_operators/anim.py
Modified: trunk/blender/release/scripts/modules/bpy_extras/anim_utils.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy_extras/anim_utils.py 2013-04-11 08:33:19 UTC (rev 55953)
+++ trunk/blender/release/scripts/modules/bpy_extras/anim_utils.py 2013-04-11 08:42:25 UTC (rev 55954)
@@ -32,6 +32,7 @@
do_pose=True,
do_object=True,
do_constraint_clear=False,
+ do_parents_clear=False,
do_clean=False,
action=None,
):
@@ -54,6 +55,8 @@
:type do_object: bool
:arg do_constraint_clear: Remove constraints (and do 'visual keying').
:type do_constraint_clear: bool
+ :arg do_parents_clear: Unparent after baking objects.
+ :type do_parents_clear: bool
:arg do_clean: Remove redundant keyframes after baking.
:type do_clean: bool
:arg action: An action to bake the data into, or None for a new action
@@ -77,8 +80,17 @@
matrix[name] = pbone.matrix_basis.copy()
return matrix
- def obj_frame_info(obj, do_visual_keying):
- return obj.matrix_local.copy() if do_visual_keying else obj.matrix_basis.copy()
+ 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_basis
+ if parent:
+ return parent.matrix_world * matrix
+ else:
+ return matrix.copy()
+ else:
+ def obj_frame_info(obj, do_visual_keying):
+ return obj.matrix_local.copy() if do_visual_keying else obj.matrix_basis.copy()
# -------------------------------------------------------------------------
# Setup the Context
@@ -192,6 +204,9 @@
obj.keyframe_insert("scale", -1, f, name, options)
+ if do_parents_clear:
+ obj.parent = None
+
# -------------------------------------------------------------------------
# Clean
Modified: trunk/blender/release/scripts/startup/bl_operators/anim.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/anim.py 2013-04-11 08:33:19 UTC (rev 55953)
+++ trunk/blender/release/scripts/startup/bl_operators/anim.py 2013-04-11 08:42:25 UTC (rev 55954)
@@ -195,6 +195,11 @@
description="Remove all constraints from keyed object/bones, and do 'visual' keying",
default=False,
)
+ clear_parents = BoolProperty(
+ name="Clear Parents",
+ description="Bake animation onto the object then clear parents (objects only)",
+ default=False,
+ )
bake_types = EnumProperty(
name="Bake Data",
description="Which data's transformations to bake",
@@ -216,6 +221,7 @@
do_pose='POSE' in self.bake_types,
do_object='OBJECT' in self.bake_types,
do_constraint_clear=self.clear_constraints,
+ do_parents_clear=self.clear_parents,
do_clean=True,
)
More information about the Bf-blender-cvs
mailing list