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) {
75 Vector<FCurve *> modified_fcurves = pose_apply_disable_fcurves_for_unselected_bones(
76 action, slot_handle, selected_bone_names);
81 applier(&pose_owner_ptr, action, slot_handle, anim_eval_context);
83 pose_apply_restore_fcurves(modified_fcurves);
101 const float blend_factor)
110 pose_apply(ob, action, slot_handle, anim_eval_context, evaluate_and_blend);
117 const float blend_factor)
125 for (
const Object *obj : objects) {
141 const float blend_factor)
144 for (
Object *
object : objects) {
152 for (
Object *
object : objects) {
155 object, &pose_action, slot.
handle, anim_eval_context, blend_factor);
163 "Actions without slots have no data. This should have been caught earlier.");
166 if (slot ==
nullptr) {
167 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)
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)
blender::Set< std::string > BoneNameSet
BoneNameSet BKE_pose_channel_find_selected_names(const Object *object)
PointerRNA RNA_id_pointer_create(ID *id)