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:
authorSybren A. Stüvel <sybren@blender.org>2021-07-02 14:47:53 +0300
committerSybren A. Stüvel <sybren@blender.org>2021-07-15 17:12:36 +0300
commit28dc07a153dd2c16260fb0c824a4f65ab3a06493 (patch)
treebb567d48e6f47a8fe8f540ed233830ffda1e99cd /source/blender/blenkernel/intern/armature_pose.cc
parent9473c61b366cb3d55bac873e4a6cebd77595ee0d (diff)
Animation: add function to blend Action into pose
Add function `BKE_pose_apply_action_blend()`, which blends a given Action into current pose. The Action is evaluated at a specified frame, and the result is applied to the armature's pose. A blend factor can be given to blend between the current pose and the one in the Action. Quaternions are interpolated with SLERP; it is assumed that their FCurves are consecutively stored in the Action. This function will be used in the upcoming new Pose Library.
Diffstat (limited to 'source/blender/blenkernel/intern/armature_pose.cc')
-rw-r--r--source/blender/blenkernel/intern/armature_pose.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/armature_pose.cc b/source/blender/blenkernel/intern/armature_pose.cc
index 9f4b1a31114..09e1c7d6615 100644
--- a/source/blender/blenkernel/intern/armature_pose.cc
+++ b/source/blender/blenkernel/intern/armature_pose.cc
@@ -76,6 +76,20 @@ void BKE_pose_apply_action_all_bones(struct Object *ob,
animsys_evaluate_action(&pose_owner_ptr, action, anim_eval_context, false);
}
+void BKE_pose_apply_action_blend(struct Object *ob,
+ struct bAction *action,
+ struct AnimationEvalContext *anim_eval_context,
+ const float blend_factor)
+{
+ auto evaluate_and_blend = [blend_factor](PointerRNA *ptr,
+ bAction *act,
+ const AnimationEvalContext *anim_eval_context) {
+ animsys_blend_in_action(ptr, act, anim_eval_context, blend_factor);
+ };
+
+ pose_apply(ob, action, anim_eval_context, evaluate_and_blend);
+}
+
namespace {
void pose_apply(struct Object *ob,
struct bAction *action,