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:
authorJoshua Leung <aligorith@gmail.com>2017-11-19 15:32:03 +0300
committerJoshua Leung <aligorith@gmail.com>2017-11-19 15:57:21 +0300
commitfc77676f3326894482848b3f4e544c7569d5b440 (patch)
tree2d0d4d47234d59425084236a8c0299a5e53000d6 /release
parentc5f59f5854732f7d2c2020ca7ec67f1eaa043b78 (diff)
Bake Action operator: Added missing Bendy Bones support
Diffstat (limited to 'release')
-rw-r--r--release/scripts/modules/bpy_extras/anim_utils.py28
1 files changed, 25 insertions, 3 deletions
diff --git a/release/scripts/modules/bpy_extras/anim_utils.py b/release/scripts/modules/bpy_extras/anim_utils.py
index ea0bd77c0f0..75d2065a3d1 100644
--- a/release/scripts/modules/bpy_extras/anim_utils.py
+++ b/release/scripts/modules/bpy_extras/anim_utils.py
@@ -153,15 +153,29 @@ def bake_action_iter(
# -------------------------------------------------------------------------
# Helper Functions and vars
+ # Note: BBONE_PROPS is a list so we can preserve the ordering
+ BBONE_PROPS = [
+ 'bbone_curveinx', 'bbone_curveoutx',
+ 'bbone_curveiny', 'bbone_curveouty',
+ 'bbone_rollin', 'bbone_rollout',
+ 'bbone_scalein', 'bbone_scaleout',
+ 'bbone_easein', 'bbone_easeout'
+ ]
+
def pose_frame_info(obj):
matrix = {}
+ bbones = {}
for name, pbone in obj.pose.bones.items():
if do_visual_keying:
# Get the final transform of the bone in its own local space...
matrix[name] = obj.convert_space(pbone, pbone.matrix, 'POSE', 'LOCAL')
else:
matrix[name] = pbone.matrix_basis.copy()
- return matrix
+
+ # Bendy Bones
+ if pbone.bone.bbone_segments > 1:
+ bbones[name] = {bb_prop : getattr(pbone, bb_prop) for bb_prop in BBONE_PROPS}
+ return matrix, bbones
if do_parents_clear:
if do_visual_keying:
@@ -214,7 +228,7 @@ def bake_action_iter(
break
if do_pose:
- pose_info.append((frame, pose_frame_info(obj)))
+ pose_info.append((frame, *pose_frame_info(obj)))
if do_object:
obj_info.append((frame, obj_frame_info(obj)))
@@ -255,7 +269,7 @@ def bake_action_iter(
# create compatible eulers
euler_prev = None
- for (f, matrix) in pose_info:
+ for (f, matrix, bbones) in pose_info:
pbone.matrix_basis = matrix[name].copy()
pbone.keyframe_insert("location", -1, f, name, options)
@@ -278,6 +292,14 @@ def bake_action_iter(
pbone.keyframe_insert("scale", -1, f, name, options)
+ # Bendy Bones
+ if pbone.bone.bbone_segments > 1:
+ bbone_shape = bbones[name]
+ for bb_prop in BBONE_PROPS:
+ # update this property with value from bbone_shape, then key it
+ setattr(pbone, bb_prop, bbone_shape[bb_prop])
+ pbone.keyframe_insert(bb_prop, -1, f, name, options)
+
# object. TODO. multiple objects
if do_object:
if do_constraint_clear: