24using ActionApplier = blender::FunctionRef<void(
27void pose_apply_restore_fcurves(
const Span<FCurve *> fcurves)
29 for (
FCurve *fcu : fcurves) {
30 fcu->flag &= ~FCURVE_DISABLED;
35Vector<FCurve *> pose_apply_disable_fcurves_for_unselected_bones(
40 Vector<FCurve *> modified_fcurves;
41 auto disable_unselected_fcurve = [&](
FCurve *fcu,
const char *bone_name) {
42 const bool is_bone_selected = selected_bone_names.
contains(bone_name);
43 if (!is_bone_selected) {
46 modified_fcurves.
append(fcu);
52 return modified_fcurves;
59 ActionApplier applier)
62 if (pose ==
nullptr) {
76 Vector<FCurve *> modified_fcurves = pose_apply_disable_fcurves_for_unselected_bones(
77 action, slot_handle, selected_bone_names);
82 applier(&pose_owner_ptr, action, slot_handle, anim_eval_context);
84 pose_apply_restore_fcurves(modified_fcurves);
102 const float blend_factor)
111 pose_apply(ob, action, slot_handle, anim_eval_context, evaluate_and_blend);
118 const float blend_factor)
126 for (
const Object *obj : objects) {
142 const float blend_factor)
145 for (
Object *
object : objects) {
153 for (
Object *
object : objects) {
156 object, &pose_action, slot.
handle, anim_eval_context, blend_factor);
164 "Actions without slots have no data. This should have been caught earlier.");
167 if (slot ==
nullptr) {
168 slot = pose_data.
slot(0);
Functions and classes to work with Actions.
Functions to work with animation poses.
Blender kernel action and pose functionality.
void animsys_blend_in_action(struct PointerRNA *ptr, struct bAction *act, int32_t action_slot_handle, const AnimationEvalContext *anim_eval_context, float blend_factor)
void animsys_evaluate_action(struct PointerRNA *ptr, struct bAction *act, int32_t action_slot_handle, const struct AnimationEvalContext *anim_eval_context, bool flush_to_original)
struct AnimationEvalContext AnimationEvalContext
#define BLI_assert_msg(a, msg)
#define LISTBASE_FOREACH(type, var, list)
struct bArmature bArmature
Object is a sort of wrapper for general info.
void append(const T &value)
bool contains(const Key &key) const
const Slot * slot(int64_t index) const
void pose_apply_action_all_bones(Object *ob, bAction *action, slot_handle_t slot_handle, const AnimationEvalContext *anim_eval_context)
void pose_apply_action(blender::Span< Object * > objects, Action &pose_action, const AnimationEvalContext *anim_eval_context, float blend_factor)
void pose_apply_action_blend_all_bones(Object *ob, bAction *action, slot_handle_t slot_handle, const AnimationEvalContext *anim_eval_context, float blend_factor)
decltype(::ActionSlot::handle) slot_handle_t
bool any_bone_selected(blender::Span< const Object * > objects)
Slot & get_best_pose_slot_for_id(const ID &id, Action &pose_data)
void pose_apply_action_blend(Object *ob, bAction *action, slot_handle_t slot_handle, const AnimationEvalContext *anim_eval_context, float blend_factor)
Slot * generic_slot_for_autoassign(const ID &animated_id, Action &action, StringRefNull last_slot_identifier)
void BKE_action_find_fcurves_with_bones(bAction *action, blender::animrig::slot_handle_t slot_handle, FoundFCurveCallback callback)
BoneNameSet BKE_armature_find_selected_bone_names(const bArmature *armature)
blender::Set< std::string > BoneNameSet
PointerRNA RNA_id_pointer_create(ID *id)