diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-11-20 12:45:03 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-11-20 12:45:03 +0300 |
commit | a8777f905846f80385fc90135e000c3169bbefc6 (patch) | |
tree | 928a7db22a8553abd35f99a0afe2990be87d69ac /release | |
parent | c0c696b014e3c21b923a2c21fb33a18839a3faa3 (diff) | |
parent | 65af15ad887b30e678db9acab75efc7897c9197e (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/modules/bpy_extras/anim_utils.py | 28 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d_toolbar.py | 6 |
2 files changed, 28 insertions, 6 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: diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 18d2bface41..a46358b2e38 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -852,12 +852,12 @@ class VIEW3D_PT_tools_posemode(View3DPanel, Panel): draw_keyframing_tools(context, layout) - pchan = context.active_pose_bone - mpath = pchan.motion_path if pchan else None + ob = context.object + avs = ob.pose.animation_visualization col = layout.column(align=True) col.label(text="Motion Paths:") - if mpath: + if avs.motion_path.has_motion_paths: row = col.row(align=True) row.operator("pose.paths_update", text="Update") row.operator("pose.paths_clear", text="", icon='X') |