diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2021-03-05 18:35:08 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2021-03-05 18:35:08 +0300 |
commit | bf030decd42fd9eb35f59a5b724d87403917bc6a (patch) | |
tree | f89e0192b5109d042ee59de32d0c722c50320905 /source/blender/blenkernel/BKE_armature.h | |
parent | 8d0fbcd6dfe736f556b4e7f4aaf04536ee192dcb (diff) |
Animation: add function to apply a pose from an Action
Add `BKE_pose_apply_action(object, action, anim_eval_context)` function
and expose in RNA as `Pose.apply_action(action, evaluation_time)`.
This makes it possible to do the following:
- Have a rig in pose mode.
- Select a subset of the bones.
- Have some Action loaded that contains the pose you want to apply.
- Run `C.object.pose.apply_pose_from_action(D.actions['PoseName'])`
- The selected bones are now posed as determined by the Action.
Just like Blender's current pose library, having no bones selected acts
the same as having all bones selected.
Manifest Task: T86159
Reviewed By: Severin
Differential Revision: https://developer.blender.org/D10578
Diffstat (limited to 'source/blender/blenkernel/BKE_armature.h')
-rw-r--r-- | source/blender/blenkernel/BKE_armature.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index db44a771095..f5face2120e 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -27,6 +27,8 @@ extern "C" { #endif +struct AnimationEvalContext; +struct bAction; struct BMEditMesh; struct Bone; struct Depsgraph; @@ -193,6 +195,12 @@ void BKE_pose_where_is_bone(struct Depsgraph *depsgraph, bool do_extra); void BKE_pose_where_is_bone_tail(struct bPoseChannel *pchan); +/* Evaluate the action and apply it to the pose. If any pose bones are selected, only FCurves that + * relate to those bones are evaluated. */ +void BKE_pose_apply_action(struct Object *ob, + struct bAction *action, + struct AnimationEvalContext *anim_eval_context); + /* get_objectspace_bone_matrix has to be removed still */ void get_objectspace_bone_matrix(struct Bone *bone, float M_accumulatedMatrix[4][4], |