Blender V4.3
blender::animrig Namespace Reference

Namespaces

namespace  internal
 
namespace  legacy
 
namespace  nla
 
namespace  tests
 

Classes

class  Action
 
class  AnimatedProperty
 
class  BoneColor
 
class  ChannelBag
 
class  ChannelGroup
 
class  CombinedKeyingResult
 
class  EvaluationResult
 
struct  FCurveDescriptor
 
struct  KeyframeSettings
 
struct  KeyInsertData
 
class  Layer
 
class  PropIdentifier
 
class  Slot
 
class  SlotRuntime
 
class  Strip
 
class  StripKeyframeData
 
struct  TempFrameValCache
 

Typedefs

using slot_handle_t = decltype(::ActionSlot::handle)
 

Enumerations

enum class  ActionSlotAssignmentResult : int8_t { OK = 0 , SlotNotFromAction = 1 , SlotNotSuitable = 2 , MissingAction = 3 }
 
enum class  BakeCurveRemove { NONE = 0 , IN_RANGE = 1 , OUT_RANGE = 2 , ALL = 3 }
 
enum class  SingleKeyingResult {
  SUCCESS = 0 , UNKNOWN_FAILURE , CANNOT_CREATE_FCURVE , FCURVE_NOT_KEYFRAMEABLE ,
  NO_KEY_NEEDED , UNABLE_TO_INSERT_TO_NLA_STACK , ID_NOT_EDITABLE , ID_NOT_ANIMATABLE ,
  NO_VALID_LAYER , NO_VALID_STRIP , NO_VALID_SLOT , CANNOT_RESOLVE_PATH ,
  _KEYING_RESULT_MAX
}
 
enum class  ModifyKeyMode { INSERT = 0 , DELETE }
 
enum class  ModifyKeyReturn { SUCCESS = 0 , INVALID_CONTEXT = -1 , MISSING_TYPEINFO = -2 }
 
enum  { VISUALKEY_NONE = 0 , VISUALKEY_LOC , VISUALKEY_ROT , VISUALKEY_SCA }
 

Functions

 ENUM_OPERATORS (Layer::Flags, Layer::Flags::Enabled)
 
 ENUM_OPERATORS (Slot::Flags, Slot::Flags::Active)
 
Actionaction_add (Main &bmain, StringRefNull name)
 
bool assign_action (bAction *action, ID &animated_id)
 
bool assign_action (bAction *action, OwnedAnimData owned_adt)
 
bool assign_tmpaction (bAction *action, OwnedAnimData owned_adt)
 
bool unassign_action (ID &animated_id)
 
bool unassign_action (OwnedAnimData owned_adt)
 
Slotassign_action_ensure_slot_for_keying (Action &action, ID &animated_id)
 
bool generic_assign_action (ID &animated_id, bAction *action_to_assign, bAction *&action_ptr_ref, slot_handle_t &slot_handle_ref, char *slot_name)
 
ActionSlotAssignmentResult generic_assign_action_slot (Slot *slot_to_assign, ID &animated_id, bAction *&action_ptr_ref, slot_handle_t &slot_handle_ref, char *slot_name) ATTR_WARN_UNUSED_RESULT
 
ActionSlotAssignmentResult generic_assign_action_slot_handle (slot_handle_t slot_handle_to_assign, ID &animated_id, bAction *&action_ptr_ref, slot_handle_t &slot_handle_ref, char *slot_name) ATTR_WARN_UNUSED_RESULT
 
bool is_action_assignable_to (const bAction *dna_action, ID_Type id_code) ATTR_WARN_UNUSED_RESULT
 
ActionSlotAssignmentResult assign_action_slot (Slot *slot_to_assign, ID &animated_id)
 
ActionSlotAssignmentResult assign_action_and_slot (Action *action, Slot *slot_to_assign, ID &animated_id)
 
Actionget_action (ID &animated_id)
 
std::optional< std::pair< Action *, Slot * > > get_action_slot_pair (ID &animated_id)
 
const animrig::ChannelBagchannelbag_for_action_slot (const Action &action, slot_handle_t slot_handle)
 
animrig::ChannelBagchannelbag_for_action_slot (Action &action, slot_handle_t slot_handle)
 
Span< FCurve * > fcurves_for_action_slot (Action &action, slot_handle_t slot_handle)
 
Span< const FCurve * > fcurves_for_action_slot (const Action &action, slot_handle_t slot_handle)
 
FCurveaction_fcurve_ensure (Main *bmain, bAction *act, const char group[], PointerRNA *ptr, FCurveDescriptor fcurve_descriptor)
 
FCurvefcurve_find_in_action (bAction *act, FCurveDescriptor fcurve_descriptor)
 
FCurvefcurve_find_in_action_slot (bAction *act, slot_handle_t slot_handle, FCurveDescriptor fcurve_descriptor)
 
FCurvefcurve_find_in_assigned_slot (AnimData &adt, FCurveDescriptor fcurve_descriptor)
 
bool fcurve_matches_collection_path (const FCurve &fcurve, StringRefNull collection_rna_path, StringRefNull data_name)
 
Vector< FCurve * > fcurves_in_action_slot_filtered (bAction *act, slot_handle_t slot_handle, FunctionRef< bool(const FCurve &fcurve)> predicate)
 
bool action_fcurve_remove (Action &action, FCurve &fcu)
 
bool action_fcurve_detach (Action &action, FCurve &fcurve_to_detach)
 
void action_fcurve_attach (Action &action, slot_handle_t action_slot, FCurve &fcurve_to_attach, std::optional< StringRefNull > group_name)
 
void action_fcurve_move (Action &action_dst, slot_handle_t action_slot_dst, Action &action_src, FCurve &fcurve)
 
IDaction_slot_get_id_for_keying (Main &bmain, Action &action, slot_handle_t slot_handle, ID *primary_id)
 
IDaction_slot_get_id_best_guess (Main &bmain, Slot &slot, ID *primary_id)
 
slot_handle_t first_slot_handle (const ::bAction &dna_action)
 
void assert_baklava_phase_1_invariants (const Action &action)
 
void assert_baklava_phase_1_invariants (const Layer &layer)
 
void assert_baklava_phase_1_invariants (const Strip &strip)
 
Actionconvert_to_layered_action (Main &bmain, const Action &legacy_action)
 
void move_slot (Main &bmain, Slot &slot, Action &from_action, Action &to_action)
 
void deselect_keys_actions (blender::Span< bAction * > actions)
 
void action_deselect_keys (Action &action)
 
void foreach_fcurve_in_action (Action &action, FunctionRef< void(FCurve &fcurve)> callback)
 
void foreach_fcurve_in_action_slot (Action &action, slot_handle_t handle, FunctionRef< void(FCurve &fcurve)> callback)
 
bool foreach_action_slot_use (const ID &animated_id, FunctionRef< bool(const Action &action, slot_handle_t slot_handle)> callback)
 
bool foreach_action_slot_use_with_references (ID &animated_id, FunctionRef< bool(bAction *&action_ptr_ref, slot_handle_t &slot_handle_ref, char *slot_name)> callback)
 
void reevaluate_fcurve_errors (bAnimContext *ac)
 
const FCurvefcurve_find_by_rna_path (const AnimData &adt, StringRefNull rna_path, int array_index)
 
template<typename CB >
static void ANIM_armature_foreach_bone (ListBase *bones, CB callback)
 
template<typename CB >
static void ANIM_armature_foreach_bone (const ListBase *bones, CB callback)
 
int armature_bonecoll_find_index (const bArmature *armature, const ::BoneCollection *bcoll)
 
int armature_bonecoll_find_parent_index (const bArmature *armature, int bcoll_index)
 
int armature_bonecoll_child_number_find (const bArmature *armature, const ::BoneCollection *bcoll)
 
int armature_bonecoll_child_number_set (bArmature *armature, ::BoneCollection *bcoll, int new_child_number)
 
bool armature_bonecoll_is_root (const bArmature *armature, int bcoll_index)
 
bool armature_bonecoll_is_child_of (const bArmature *armature, int potential_parent_index, int potential_child_index)
 
bool armature_bonecoll_is_descendant_of (const bArmature *armature, int potential_parent_index, int potential_descendant_index)
 
bool bonecoll_has_children (const BoneCollection *bcoll)
 
void bonecolls_copy_expanded_flag (Span< BoneCollection * > bcolls_dest, Span< const BoneCollection * > bcolls_source)
 
int armature_bonecoll_move_to_parent (bArmature *armature, int from_bcoll_index, int to_child_num, int from_parent_index, int to_parent_index)
 
blender::Map< BoneCollection *, BoneCollection * > ANIM_bonecoll_array_copy_no_membership (BoneCollection ***bcoll_array_dst, int *bcoll_array_dst_num, BoneCollection **bcoll_array_src, int bcoll_array_src_num, bool do_id_user)
 
void ANIM_bonecoll_array_free (BoneCollection ***bcoll_array, int *bcoll_array_num, bool do_id_user)
 
const BoneColorANIM_bonecolor_posebone_get (const bPoseChannel *pose_bone)
 
float evaluate_driver_from_rna_pointer (const AnimationEvalContext *anim_eval_context, PointerRNA *ptr, PropertyRNA *prop, const FCurve *fcu)
 
EvaluationResult evaluate_action (PointerRNA &animated_id_ptr, Action &action, slot_handle_t slot_handle, const AnimationEvalContext &anim_eval_context)
 
void evaluate_and_apply_action (PointerRNA &animated_id_ptr, Action &action, slot_handle_t slot_handle, const AnimationEvalContext &anim_eval_context, bool flush_to_original)
 
KeyframeSettings get_keyframe_settings (bool from_userprefs)
 
const FCurvefcurve_find (Span< const FCurve * > fcurves, FCurveDescriptor fcurve_descriptor)
 
FCurvefcurve_find (Span< FCurve * > fcurves, FCurveDescriptor fcurve_descriptor)
 
FCurvecreate_fcurve_for_channel (FCurveDescriptor fcurve_descriptor)
 
void initialize_bezt (BezTriple *beztr, float2 position, const KeyframeSettings &settings, eFCurve_Flags fcu_flags)
 
bool fcurve_delete_keyframe_at_time (FCurve *fcurve, float time)
 
bool delete_keyframe_fcurve_legacy (AnimData *adt, FCurve *fcu, float cfra)
 
int insert_bezt_fcurve (FCurve *fcu, const BezTriple *bezt, eInsertKeyFlags flag)
 Lesser Key-framing API call.
 
SingleKeyingResult insert_vert_fcurve (FCurve *fcu, const float2 position, const KeyframeSettings &settings, eInsertKeyFlags flag)
 Main Key-framing API call.
 
void sample_fcurve_segment (const FCurve *fcu, float start_frame, float sample_rate, float *samples, int sample_count)
 
void bake_fcurve (FCurve *fcu, blender::int2 range, float step, BakeCurveRemove remove_existing)
 
void bake_fcurve_segments (FCurve *fcu)
 
const std::optional< StringRefNulldefault_channel_group_for_path (const PointerRNA *animated_struct, const StringRef prop_rna_path)
 
bool key_insertion_may_create_fcurve (eInsertKeyFlags insert_key_flags)
 
void pose_apply_action_selected_bones (Object *ob, bAction *action, slot_handle_t slot_handle, const AnimationEvalContext *anim_eval_context)
 
void pose_apply_action_all_bones (Object *ob, bAction *action, slot_handle_t slot_handle, const AnimationEvalContext *anim_eval_context)
 
void pose_apply_action_blend (Object *ob, bAction *action, slot_handle_t slot_handle, const AnimationEvalContext *anim_eval_context, float blend_factor)
 
Vector< floatget_rna_values (PointerRNA *ptr, PropertyRNA *prop)
 
StringRef get_rotation_mode_path (eRotationModes rotation_mode)
 
bool visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
 
Vector< floatvisualkey_get_values (PointerRNA *ptr, PropertyRNA *prop)
 
static animrig::LayerActionLayer_alloc ()
 
template<typename T >
static void grow_array (T **array, int *num, const int add_num)
 
template<typename T >
static void grow_array_and_append (T **array, int *num, T item)
 
template<typename T >
static void grow_array_and_insert (T **array, int *num, const int index, T item)
 
template<typename T >
static void shrink_array (T **array, int *num, const int shrink_num)
 
template<typename T >
static void shrink_array_and_remove (T **array, int *num, const int index)
 
template<typename T >
static void shrink_array_and_swap_remove (T **array, int *num, const int index)
 
template<typename T >
static void array_shift_range (T *array, const int num, const int range_start, const int range_end, const int to)
 
static void layer_ptr_destructor (ActionLayer **dna_layer_ptr)
 
static void slot_name_ensure_unique (Action &action, Slot &slot)
 
static void slot_ptr_destructor (ActionSlot **dna_slot_ptr)
 
static float2 get_frame_range_of_fcurves (Span< const FCurve * > fcurves, bool include_modifiers)
 
static void strip_ptr_destructor (ActionStrip **dna_strip_ptr)
 
static bool is_id_using_action_slot (const ID &animated_id, const Action &action, const slot_handle_t slot_handle)
 
static void channelbag_ptr_destructor (ActionChannelBag **dna_channelbag_ptr)
 
static void fcurve_ptr_destructor (FCurve **fcurve_ptr)
 
static void fcurve_ptr_noop_destructor (FCurve **)
 
static void clone_slot (Slot &from, Slot &to)
 
int armature_bonecoll_find_index (const bArmature *armature, const BoneCollection *bcoll)
 
EvaluationResult blend_layer_results (const EvaluationResult &last_result, const EvaluationResult &current_result, const Layer &current_layer)
 
void apply_evaluation_result (const EvaluationResult &evaluation_result, PointerRNA &animated_id_ptr, bool flush_to_original)
 
static bool is_fcurve_evaluatable (const FCurve *fcu)
 
static void animsys_construct_orig_pointer_rna (const PointerRNA *ptr, PointerRNA *ptr_orig)
 
static void animsys_write_orig_anim_rna (PointerRNA *ptr, const char *rna_path, const int array_index, const float value)
 
static EvaluationResult evaluate_keyframe_data (PointerRNA &animated_id_ptr, StripKeyframeData &strip_data, const slot_handle_t slot_handle, const AnimationEvalContext &offset_eval_context)
 
static EvaluationResult evaluate_strip (PointerRNA &animated_id_ptr, Action &owning_action, Strip &strip, const slot_handle_t slot_handle, const AnimationEvalContext &anim_eval_context)
 
static void replace_bezt_keyframe_ypos (BezTriple *dst, const BezTriple *bezt)
 
static void subdivide_nonauto_handles (const FCurve *fcu, BezTriple *bezt, BezTriple *prev, BezTriple *next)
 
static bool new_key_needed (const FCurve &fcu, const float frame, const float value)
 
static float2 remap_cyclic_keyframe_location (const FCurve &fcu, const eFCU_Cycle_Type type, float2 position)
 
static void remove_fcurve_key_range (FCurve *fcu, const int2 range, const BakeCurveRemove removal_mode)
 
static void make_new_fcurve_cyclic (FCurve *fcu, const blender::float2 &action_range)
 
static void get_keyframe_values_create_reports (ReportList *reports, PointerRNA ptr, PropertyRNA *prop, const int index, const int count, const bool force_all, const BitSpan successful_remaps)
 
static Vector< floatget_keyframe_values (PointerRNA *ptr, PropertyRNA *prop, const bool visual_key)
 
static BitVector nla_map_keyframe_values_and_generate_reports (const MutableSpan< float > values, const int index, PointerRNA &ptr, PropertyRNA &prop, NlaKeyframingContext *nla_context, const AnimationEvalContext *anim_eval_context, ReportList *reports, bool *force_all)
 
static float nla_time_remap (float time, const AnimationEvalContext *anim_eval_context, PointerRNA *id_ptr, AnimData *adt, bAction *act, ListBase *nla_cache, NlaKeyframingContext **r_nla_context)
 
static SingleKeyingResult insert_keyframe_value (FCurve *fcu, float cfra, float curval, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag)
 
static SingleKeyingResult insert_keyframe_fcurve_value (Main *bmain, PointerRNA *ptr, PropertyRNA *prop, bAction *act, const char group[], const char rna_path[], int array_index, const float fcurve_frame, float curval, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag)
 
static void deg_tag_after_keyframe_delete (Main *bmain, ID *id, AnimData *adt)
 
static CombinedKeyingResult insert_key_legacy_action (Main *bmain, bAction *action, PointerRNA *ptr, PropertyRNA *prop, const std::optional< StringRefNull > channel_group, const std::string &rna_path, const float frame, const Span< float > values, eInsertKeyFlags insert_key_flag, eBezTriple_KeyframeType key_type, const BitSpan keying_mask)
 
static SingleKeyingResult insert_key_layer (Main *bmain, Action &action, Layer &layer, const Slot &slot, const std::string &rna_path, const std::optional< PropertySubType > prop_subtype, const std::optional< blender::StringRefNull > channel_group, const KeyInsertData &key_data, const KeyframeSettings &key_settings, const eInsertKeyFlags insert_key_flags)
 
static CombinedKeyingResult insert_key_layered_action (Main *bmain, Action &action, PointerRNA *rna_pointer, const std::optional< StringRefNull > channel_group, const blender::Span< RNAPath > rna_paths, const float scene_frame, const KeyframeSettings &key_settings, const eInsertKeyFlags insert_key_flags)
 
static eInsertKeyFlags get_autokey_flags (Scene *scene)
 
void pose_apply_action_selected_bones (Object *ob, bAction *action, const int32_t slot_handle, const AnimationEvalContext *anim_eval_context)
 
void pose_apply_action_all_bones (Object *ob, bAction *action, const int32_t slot_handle, const AnimationEvalContext *anim_eval_context)
 
void pose_apply_action_blend (Object *ob, bAction *action, const int32_t slot_handle, const AnimationEvalContext *anim_eval_context, const float blend_factor)
 
Public F-Curves API
bActionid_action_ensure (Main *bmain, ID *id)
 
void animdata_fcurve_delete (bAnimContext *ac, AnimData *adt, FCurve *fcu)
 
bool animdata_remove_empty_action (AnimData *adt)
 
Vector< ID * > find_related_ids (Main &bmain, ID &id)
 
static void add_object_data_users (const Main &bmain, const ID &id, Vector< ID * > &related_ids)
 
static bActionfind_related_action (Main &bmain, ID &id)
 
Key-Framing Management
void update_autoflags_fcurve_direct (FCurve *fcu, PropertyRNA *prop)
 
CombinedKeyingResult insert_keyframes (Main *bmain, PointerRNA *struct_pointer, std::optional< StringRefNull > channel_group, const blender::Span< RNAPath > rna_paths, std::optional< float > scene_frame, const AnimationEvalContext &anim_eval_context, eBezTriple_KeyframeType key_type, eInsertKeyFlags insert_key_flags)
 Main key-frame insertion API.
 
bool insert_keyframe_direct (ReportList *reports, PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, const AnimationEvalContext *anim_eval_context, eBezTriple_KeyframeType keytype, NlaKeyframingContext *nla_context, eInsertKeyFlags flag)
 Secondary Insert Key-framing API call.
 
int delete_keyframe (Main *bmain, ReportList *reports, ID *id, const RNAPath &rna_path, float cfra)
 Main Delete Key-Framing API call.
 
int clear_keyframe (Main *bmain, ReportList *reports, ID *id, const RNAPath &rna_path)
 
bool is_keying_flag (const Scene *scene, eKeying_Flag flag)
 
eInsertKeyFlags get_keyframing_flags (Scene *scene)
 
Auto keyframing

Notes:

  • All the defines for this (User-Pref settings and Per-Scene settings) are defined in DNA_userdef_types.h
  • Scene settings take precedence over those for user-preferences, with old files inheriting user-preferences settings for the scene settings
  • "On/Off + Mode" are stored per Scene, but "settings" are currently stored as user-preferences.
bool is_autokey_on (const Scene *scene)
 
bool is_autokey_mode (const Scene *scene, eAutokey_Mode mode)
 
bool autokeyframe_cfra_can_key (const Scene *scene, ID *id)
 
void autokeyframe_object (bContext *C, Scene *scene, Object *ob, Span< RNAPath > rna_paths)
 
bool autokeyframe_object (bContext *C, Scene *scene, Object *ob, KeyingSet *ks)
 
bool autokeyframe_pchan (bContext *C, Scene *scene, Object *ob, bPoseChannel *pchan, KeyingSet *ks)
 
void autokeyframe_pose_channel (bContext *C, Scene *scene, Object *ob, bPoseChannel *pose_channel, Span< RNAPath > rna_paths, short targetless_ik)
 
bool autokeyframe_property (bContext *C, Scene *scene, PointerRNA *ptr, PropertyRNA *prop, int rnaindex, float cfra, bool only_if_property_keyed)
 

Typedef Documentation

◆ slot_handle_t

Definition at line 44 of file ANIM_action.hh.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
VISUALKEY_NONE 
VISUALKEY_LOC 
VISUALKEY_ROT 
VISUALKEY_SCA 

Definition at line 30 of file visualkey.cc.

◆ ActionSlotAssignmentResult

Enumerator
OK 
SlotNotFromAction 
SlotNotSuitable 
MissingAction 

Definition at line 1231 of file ANIM_action.hh.

◆ BakeCurveRemove

Enumerator
NONE 
IN_RANGE 
OUT_RANGE 
ALL 

Definition at line 140 of file ANIM_fcurve.hh.

◆ ModifyKeyMode

Mode for modify_keyframes.

Enumerator
INSERT 
DELETE 

Definition at line 14 of file ANIM_keyingsets.hh.

◆ ModifyKeyReturn

Return codes for errors (with Relative KeyingSets).

Enumerator
SUCCESS 
INVALID_CONTEXT 

Context info was invalid for using the Keying Set.

MISSING_TYPEINFO 

There isn't any type-info for generating paths from context.

Definition at line 20 of file ANIM_keyingsets.hh.

◆ SingleKeyingResult

Represents a single success/failure in the keyframing process.

What is considered "single" depends on the level at which the failure happens. For example, it can be at the level of a single key on a single fcurve, all the way up to the level of an entire ID not being animatable. Both are considered "single" events.

Enumerator
SUCCESS 
UNKNOWN_FAILURE 
CANNOT_CREATE_FCURVE 
FCURVE_NOT_KEYFRAMEABLE 
NO_KEY_NEEDED 
UNABLE_TO_INSERT_TO_NLA_STACK 
ID_NOT_EDITABLE 
ID_NOT_ANIMATABLE 
NO_VALID_LAYER 
NO_VALID_STRIP 
NO_VALID_SLOT 
CANNOT_RESOLVE_PATH 
_KEYING_RESULT_MAX 

Definition at line 44 of file ANIM_keyframing.hh.

Function Documentation

◆ action_add()

Action & blender::animrig::action_add ( Main & bmain,
StringRefNull name )

Create a new Action with zero users.

This is basically the same as BKE_action_add, except that the Action has zero users and it's already wrapped with its C++ wrapper.

See also
BKE_action_add

Definition at line 1151 of file animrig/intern/action.cc.

References BKE_action_add(), bAction::id, and id_us_clear_real().

Referenced by BKE_animdata_transfer_by_basepath(), blender::bke::greasepencil::convert::AnimDataConvertor::fcurves_convert_finalize(), and blender::animrig::tests::TEST_F().

◆ action_deselect_keys()

void blender::animrig::action_deselect_keys ( Action & action)

Deselect all keys within the action.

Definition at line 24 of file action_selection.cc.

References BKE_fcurve_deselect_all_keys(), and blender::animrig::legacy::fcurves_all().

Referenced by deselect_keys_actions(), and poselib_keytag_pose().

◆ action_fcurve_attach()

void blender::animrig::action_fcurve_attach ( Action & action,
slot_handle_t action_slot,
FCurve & fcurve_to_attach,
std::optional< StringRefNull > group_name )

◆ action_fcurve_detach()

bool blender::animrig::action_fcurve_detach ( Action & action,
FCurve & fcurve_to_detach )

Detach the F-Curve from the Action, searching for it in all channelbags.

Compatible with both legacy and layered Actions. The slot handles are ignored for legacy Actions.

The F-Curve is not freed, and ownership is transferred to the caller.

See also
action_fcurve_remove
action_fcurve_attach
action_fcurve_move
Returns
true when the F-Curve was found and detached, false if not found.

Definition at line 2476 of file animrig/intern/action.cc.

References action_fcurve_detach(), BLI_remlink_safe(), blender::animrig::StripKeyframeData::channelbags(), bAction::curves, blender::animrig::Action::is_action_legacy(), and blender::animrig::Action::layers().

Referenced by action_fcurve_detach(), and action_fcurve_move().

◆ action_fcurve_ensure()

FCurve * blender::animrig::action_fcurve_ensure ( Main * bmain,
bAction * act,
const char group[],
PointerRNA * ptr,
FCurveDescriptor fcurve_descriptor )

Find or create an F-Curve on the given action that matches the given fcurve descriptor.

This function is primarily intended for use with legacy actions, but for reasons of expedience it now also works with layered actions under the following limited circumstances: ptr must be non-null and must have an owner_id that already uses act. See the comments in the implementation for more details.

Note
This function also ensures that dependency graph relationships are rebuilt. This is necessary when adding a new F-Curve, as a previously-unanimated depsgraph component may become animated now.
Parameters
ptrRNA pointer for the struct the fcurve is being looked up/created for. For legacy actions this is optional and may be null, but if provided is used to do things like set the fcurve color properly. For layered actions this parameter is required, and is used to create and assign an appropriate slot if needed when creating the fcurve.
fcurve_descriptordescription of the fcurve to lookup/create. Note that this is not relative to ptr (e.g. if ptr is not an ID). It should contain the exact data path of the fcurve to be looked up/created.

Definition at line 2341 of file animrig/intern/action.cc.

References action_fcurve_ensure(), action_group_colors_set_from_posebone(), action_groups_add_channel(), action_groups_add_new(), blender::animrig::legacy::action_treat_as_legacy(), blender::animrig::FCurveDescriptor::array_index, assert_baklava_phase_1_invariants(), assign_action_ensure_slot_for_keying(), BKE_action_group_find_name(), BLI_addtail(), BLI_assert, BLI_assert_msg, BLI_listbase_is_empty(), blender::StringRefNull::c_str(), blender::animrig::StripKeyframeData::channelbag_for_slot_ensure(), create_fcurve_for_channel(), bAction::curves, PointerRNA::data, DEG_relations_tag_update(), FCURVE_ACTIVE, blender::animrig::ChannelBag::fcurve_ensure(), fcurve_find_in_action(), FCurve::flag, get_action(), blender::animrig::Action::layer(), blender::animrig::Action::layer_keystrip_ensure(), PointerRNA::owner_id, blender::animrig::FCurveDescriptor::prop_subtype, ptr, RNA_id_pointer_create(), blender::animrig::FCurveDescriptor::rna_path, RNA_path_resolve_property(), RNA_property_subtype(), and PointerRNA::type.

Referenced by action_fcurve_ensure(), blender::ed::object::followpath_path_animate_exec(), insert_keyframe_fcurve_value(), blender::ed::object::parent_set(), blender::interface::tests::CopyDriversToSelected::SetUp(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), and blender::animrig::tests::TEST_F().

◆ action_fcurve_move()

void blender::animrig::action_fcurve_move ( Action & action_dst,
slot_handle_t action_slot_dst,
Action & action_src,
FCurve & fcurve )

Move an F-Curve from one Action to the other.

If the F-Curve was part of a channel group, the group membership also carries over to the destination Action. If no group with the same name exists, it is created. This only happens for layered Actions, though.

Compatible with both legacy and layered Actions. The slot handle and group membership are ignored for legacy Actions.

The F-Curve must exist on the source Action. All channelbags for all slots are searched for the F-Curve.

Parameters
action_slot_dstmay not be Slot::unassigned on layered Actions.
See also
blender::animrig::action_fcurve_detach

Definition at line 2531 of file animrig/intern/action.cc.

References action_fcurve_attach(), action_fcurve_detach(), action_fcurve_move(), BLI_assert, FCurve::grp, bActionGroup::name, and UNUSED_VARS_NDEBUG.

Referenced by action_fcurve_move(), action_move_fcurves_by_basepath(), blender::bke::greasepencil::convert::AnimDataConvertor::fcurves_convert_finalize(), and blender::animrig::tests::TEST_F().

◆ action_fcurve_remove()

bool blender::animrig::action_fcurve_remove ( Action & action,
FCurve & fcu )

Remove the given FCurve from the action by searching for it in all channelbags. This assumes that an FCurve can only exist in an action once.

Returns
true if the given FCurve was removed.
See also
action_fcurve_detach

Definition at line 2455 of file animrig/intern/action.cc.

References action_fcurve_remove(), BLI_assert, blender::animrig::StripKeyframeData::channelbags(), blender::animrig::Action::is_action_layered(), and blender::animrig::Action::layers().

Referenced by action_fcurve_remove(), animdata_fcurve_delete(), clear_keyframe(), and ED_curve_updateAnimPaths().

◆ action_slot_get_id_best_guess()

ID * blender::animrig::action_slot_get_id_best_guess ( Main & bmain,
Slot & slot,
ID * primary_id )

Make a best-effort guess as to which ID* is animated by the given slot.

This is only used in rare cases; usually the ID* for which operations are performed is known.

Note
This function was specifically written because the 'display name' of an F-Curve can only be determined by resolving its RNA path, and for that an ID* is necessary. It would be better to cache that name on the F-Curve itself, so that this constant resolving (for drawing, filtering by name, etc.) isn't necessary any more.

Definition at line 2651 of file animrig/intern/action.cc.

References action_slot_get_id_best_guess(), blender::animrig::Slot::users(), and users.

Referenced by action_slot_get_id_best_guess(), and animfilter_action_slots().

◆ action_slot_get_id_for_keying()

ID * blender::animrig::action_slot_get_id_for_keying ( Main & bmain,
Action & action,
slot_handle_t slot_handle,
ID * primary_id )

Find an appropriate user of the given Action + Slot for keyframing purposes.

(NOTE: although this function exists for handling situations caused by the expanded capabilities of layered actions, for convenience it also works with legacy actions. For legacy actions this simply returns primary_id as long as it's a user of action.)

Usually this function shouldn't be necessary, because you'll already have an obvious ID that you're keying. But in some cases (such as the action editor where multiple slots are accessible) the active ID that would normally get keyed might have nothing to do with the slot that's actually getting keyed.

This function handles such cases by attempting to find an actual user of the slot that's appropriate for keying. More specifically:

  • If primary_id is a user of the slot, primary_id is always returned.
  • If the slot has precisely one user, that user is returned.
  • Otherwise, nullptr is returned.

In other words, the cases where a user of the slot is not returned are:

  • The slot has no users at all.
  • The slot has multiple users, none of which are primary_id, and therefore there is no single, clear user that can be appropriately used for keying.
Parameters
primary_idwhenever this is among the users of the action + slot, it is given priority and is returned. May be null.

Definition at line 2617 of file animrig/intern/action.cc.

References action_slot_get_id_for_keying(), blender::animrig::legacy::action_treat_as_legacy(), get_action(), blender::animrig::Action::slot_for_handle(), blender::animrig::Slot::users(), and users.

Referenced by action_slot_get_id_for_keying(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), and blender::animrig::tests::TEST_F().

◆ ActionLayer_alloc()

static animrig::Layer & blender::animrig::ActionLayer_alloc ( )
static

Definition at line 77 of file animrig/intern/action.cc.

References DNA_struct_default_alloc.

Referenced by blender::animrig::Action::layer_add().

◆ add_object_data_users()

static void blender::animrig::add_object_data_users ( const Main & bmain,
const ID & id,
Vector< ID * > & related_ids )
static

◆ ANIM_armature_foreach_bone() [1/2]

template<typename CB >
static void blender::animrig::ANIM_armature_foreach_bone ( const ListBase * bones,
CB callback )
static

Call callback(bone) for each bone in the list of bones.

Bones are visited in depth-first order.

TODO: extend the callback with a bool return value to indicate whether the loop should continue or stop.

Definition at line 47 of file ANIM_armature_iter.hh.

References ANIM_armature_foreach_bone(), and callback.

◆ ANIM_armature_foreach_bone() [2/2]

template<typename CB >
static void blender::animrig::ANIM_armature_foreach_bone ( ListBase * bones,
CB callback )
static

Call callback(bone) for each bone in the list of bones.

Bones are visited in depth-first order.

TODO: extend the callback with a bool return value to indicate whether the loop should continue or stop.

Definition at line 30 of file ANIM_armature_iter.hh.

References ANIM_armature_foreach_bone(), and callback.

Referenced by ANIM_armature_bonecoll_reconstruct(), ANIM_armature_foreach_bone(), ANIM_armature_foreach_bone(), ANIM_armature_runtime_free(), and version_bonelayers_to_bonecollections().

◆ ANIM_bonecoll_array_copy_no_membership()

blender::Map< BoneCollection *, BoneCollection * > blender::animrig::ANIM_bonecoll_array_copy_no_membership ( BoneCollection *** bcoll_array_dst,
int * bcoll_array_dst_num,
BoneCollection ** bcoll_array_src,
int bcoll_array_src_num,
bool do_id_user )

Duplicates a list of BoneCollections for edit-mode undo purposes, and returns original-to-duplicate remapping data.

IMPORTANT: this discards membership data in the duplicate collections. This is because this function is only intended to be used with edit-mode Armatures, where the membership information in collections is not definitive, instead being stored in the EditBones. The assumption is that the membership information in the collections will be rebuilt from the EditBones when leaving edit mode.

The source and destination each have two parts: a heap-allocated array of BoneCollection *, and an integer that keeps track of that array's length. The destination parameters are pointers to those components, so they can be modified. The destination array should be empty and unallocated.

Parameters
bcoll_array_dst,bcoll_array_dst_numthe destination BoneCollection array and array size.
bcoll_array_src,bcoll_array_src_numthe source BoneCollection array and array size.
do_id_userwhen true, increments the user count of IDs that the BoneCollections' custom properties point to, if any.
Returns
a map from pointers-to-the-original-collections to pointers-to-the-duplicate-collections. This can be used to remap collection pointers in other data, such as EditBones.

Definition at line 1393 of file animrig/intern/bone_collections.cc.

References BLI_assert, BLI_listbase_clear(), BoneCollection::bones, IDP_CopyProperty_ex(), LIB_ID_CREATE_NO_USER_REFCOUNT, MEM_dupallocN, MEM_malloc_arrayN, and BoneCollection::prop.

Referenced by undoarm_from_editarm(), and undoarm_to_editarm().

◆ ANIM_bonecoll_array_free()

void blender::animrig::ANIM_bonecoll_array_free ( BoneCollection *** bcoll_array,
int * bcoll_array_num,
bool do_id_user )

Frees a list of BoneCollections.

IMPORTANT: although there is nothing about this function that fundamentally prevents it from being used generally, other data structures like Armature runtime data and EditBones often store direct pointers to BoneCollections, which this function does NOT handle. Prefer using higher-level functions to remove BoneCollections from Armatures.

Parameters
bcoll_arraypointer to the heap-allocated array of BoneCollection * to be freed.
bcoll_array_numpointer to the integer that tracks the length of bcoll_array.
do_id_userwhen true, decrements the user count of IDs that the BoneCollections' custom properties point to, if any.

Definition at line 1428 of file animrig/intern/bone_collections.cc.

References BLI_freelistN(), BoneCollection::bones, IDP_FreeProperty_ex(), MEM_freeN(), MEM_SAFE_FREE, and BoneCollection::prop.

Referenced by undoarm_free_data(), and undoarm_to_editarm().

◆ ANIM_bonecolor_posebone_get()

const BoneColor & blender::animrig::ANIM_bonecolor_posebone_get ( const bPoseChannel * pose_bone)

Return the effective BoneColor of this pose bone.

This returns the pose bone's own color, unless it's set to "default", then it defaults to the armature bone color.

Definition at line 88 of file bonecolor.cc.

References bPoseChannel::bone, Bone::color, bPoseChannel::color, and BoneColor::palette_index.

Referenced by action_group_colors_set_from_posebone(), and pose_select_same_color().

◆ animdata_fcurve_delete()

◆ animdata_remove_empty_action()

bool blender::animrig::animdata_remove_empty_action ( AnimData * adt)

Unlink the action from animdata if it's empty.

If the action has no F-Curves, unlink it from AnimData if it did not come from a NLA Strip being tweaked.

Definition at line 317 of file animdata.cc.

References AnimData::action, ADT_NLA_EDIT_ON, BLI_listbase_is_empty(), bAction::curves, DEG_id_tag_update(), AnimData::flag, bAction::id, ID_RECALC_ANIMATION_NO_FLUSH, and id_us_min().

Referenced by animdata_fcurve_delete(), and clear_anim_v3d_exec().

◆ animsys_construct_orig_pointer_rna()

static void blender::animrig::animsys_construct_orig_pointer_rna ( const PointerRNA * ptr,
PointerRNA * ptr_orig )
static

◆ animsys_write_orig_anim_rna()

static void blender::animrig::animsys_write_orig_anim_rna ( PointerRNA * ptr,
const char * rna_path,
const int array_index,
const float value )
static

◆ apply_evaluation_result()

void blender::animrig::apply_evaluation_result ( const EvaluationResult & evaluation_result,
PointerRNA & animated_id_ptr,
bool flush_to_original )

Apply the result of the animation evaluation to the given data-block.

Parameters
flush_to_originalwhen true, look up the original data-block (assuming the given one is an evaluated copy) and update that too.

Definition at line 170 of file evaluation.cc.

References animsys_write_orig_anim_rna(), blender::animrig::PropIdentifier::array_index, BKE_animsys_write_to_rna_path(), blender::StringRefNull::c_str(), blender::animrig::EvaluationResult::items(), blender::animrig::AnimatedProperty::prop_rna, blender::animrig::PropIdentifier::rna_path, and blender::animrig::AnimatedProperty::value.

Referenced by evaluate_and_apply_action().

◆ armature_bonecoll_child_number_find()

int blender::animrig::armature_bonecoll_child_number_find ( const bArmature * armature,
const ::BoneCollection * bcoll )

Find the child number of this bone collection.

This is the offset of this collection relative to the parent's first child. In other words, the first child has number 0, second child has number 1, etc.

This requires a scan of the array, hence the function is called 'find' and not 'get'.

Definition at line 1153 of file animrig/intern/bone_collections.cc.

References armature_bonecoll_find_index(), armature_bonecoll_find_parent_index(), and bonecoll_child_number().

◆ armature_bonecoll_child_number_set()

int blender::animrig::armature_bonecoll_child_number_set ( bArmature * armature,
::BoneCollection * bcoll,
int new_child_number )

◆ armature_bonecoll_find_index() [1/2]

◆ armature_bonecoll_find_index() [2/2]

int blender::animrig::armature_bonecoll_find_index ( const bArmature * armature,
const BoneCollection * bcoll )

Definition at line 1119 of file animrig/intern/bone_collections.cc.

◆ armature_bonecoll_find_parent_index()

◆ armature_bonecoll_is_child_of()

◆ armature_bonecoll_is_descendant_of()

bool blender::animrig::armature_bonecoll_is_descendant_of ( const bArmature * armature,
int potential_parent_index,
int potential_descendant_index )

◆ armature_bonecoll_is_root()

bool blender::animrig::armature_bonecoll_is_root ( const bArmature * armature,
int bcoll_index )

◆ armature_bonecoll_move_to_parent()

int blender::animrig::armature_bonecoll_move_to_parent ( bArmature * armature,
int from_bcoll_index,
int to_child_num,
int from_parent_index,
int to_parent_index )

Move a bone collection from one parent to another.

Parameters
from_bcoll_indexIndex of the bone collection to move.
to_child_numGap index of where to insert the collection; 0 to make it the first child, and parent->child_count to make it the last child. -1 also works as an indicator for the last child, as that makes it possible to call this function without requiring the caller to find the BoneCollection* of the parent.
from_parent_indexIndex of its current parent (-1 if it is a root collection).
to_parent_indexIndex of the new parent (-1 if it is to become a root collection).
Returns
the collection's new index in the collections_array.

Definition at line 1296 of file animrig/intern/bone_collections.cc.

References ancestors_visible_update(), BLI_assert, BLI_assert_msg, blender::animrig::internal::bonecolls_move_to_index(), BoneCollection::child_count, BoneCollection::child_index, bArmature::collection_array, bArmature::collection_array_num, bArmature::collection_root_count, and BoneCollection::flags.

Referenced by ANIM_armature_bonecoll_move_before_after_index(), ANIM_armature_bonecoll_remove_from_index(), blender::ui::bonecollections::BoneCollectionDropTarget::on_drop(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), and blender::animrig::tests::TEST_F().

◆ array_shift_range()

template<typename T >
static void blender::animrig::array_shift_range ( T * array,
const int num,
const int range_start,
const int range_end,
const int to )
static

Moves the given (end exclusive) range to index to, shifting other items before/after to make room.

The range is moved such that the start ends up at to.

to must be far away enough from the end of the array for the entire range to be moved there without spilling over the end of the array.

Definition at line 180 of file animrig/intern/action.cc.

References BLI_assert, ELEM, and UNUSED_VARS_NDEBUG.

Referenced by blender::animrig::ChannelBag::channel_group_move(), blender::animrig::ChannelBag::channel_group_remove(), blender::animrig::ChannelBag::fcurve_assign_to_channel_group(), blender::animrig::ChannelBag::fcurve_move(), and blender::animrig::ChannelBag::fcurve_ungroup().

◆ assert_baklava_phase_1_invariants() [1/3]

void blender::animrig::assert_baklava_phase_1_invariants ( const Action & action)

Assert the invariants of Project Baklava phase 1.

For an action the invariants are that it:

  • Is a legacy action.
  • OR has zero layers.
  • OR has a single layer that adheres to the phase 1 invariants for layers.

For a layer the invariants are that it:

  • Has zero strips.
  • OR has a single strip that adheres to the phase 1 invariants for strips.

For a strip the invariants are that it:

  • Is a keyframe strip.
  • AND is infinite.
  • AND has no time offset (i.e. aligns with scene time).

This simultaneously serves as a todo marker for later phases of Project Baklava and ensures that the phase-1 invariants hold at runtime.

TODO: these functions should be changed to assert fewer and fewer assumptions as we progress through the phases of Project Baklava and more and more of the new animation system is implemented. Finally, they should be removed entirely when the full system is completely implemented.

Definition at line 2672 of file animrig/intern/action.cc.

References assert_baklava_phase_1_invariants(), BLI_assert, blender::animrig::Action::is_action_legacy(), blender::animrig::Action::layer(), and blender::animrig::Action::layers().

Referenced by blender::bke::action_blend_write(), action_fcurve_ensure(), assert_baklava_phase_1_invariants(), assert_baklava_phase_1_invariants(), assert_baklava_phase_1_invariants(), blender::animrig::legacy::channelbag_ensure(), channelbag_for_action_slot(), fcurve_find_in_action(), fcurves_for_action_slot(), fcurves_for_action_slot(), blender::animrig::Action::get_layer_for_keyframing(), insert_key_layer(), blender::animrig::Action::layer_keystrip_ensure(), and move_slot().

◆ assert_baklava_phase_1_invariants() [2/3]

void blender::animrig::assert_baklava_phase_1_invariants ( const Layer & layer)

Assert the invariants of Project Baklava phase 1.

For an action the invariants are that it:

  • Is a legacy action.
  • OR has zero layers.
  • OR has a single layer that adheres to the phase 1 invariants for layers.

For a layer the invariants are that it:

  • Has zero strips.
  • OR has a single strip that adheres to the phase 1 invariants for strips.

For a strip the invariants are that it:

  • Is a keyframe strip.
  • AND is infinite.
  • AND has no time offset (i.e. aligns with scene time).

This simultaneously serves as a todo marker for later phases of Project Baklava and ensures that the phase-1 invariants hold at runtime.

TODO: these functions should be changed to assert fewer and fewer assumptions as we progress through the phases of Project Baklava and more and more of the new animation system is implemented. Finally, they should be removed entirely when the full system is completely implemented.

Definition at line 2685 of file animrig/intern/action.cc.

References assert_baklava_phase_1_invariants(), and BLI_assert.

◆ assert_baklava_phase_1_invariants() [3/3]

void blender::animrig::assert_baklava_phase_1_invariants ( const Strip & strip)

Assert the invariants of Project Baklava phase 1.

For an action the invariants are that it:

  • Is a legacy action.
  • OR has zero layers.
  • OR has a single layer that adheres to the phase 1 invariants for layers.

For a layer the invariants are that it:

  • Has zero strips.
  • OR has a single strip that adheres to the phase 1 invariants for strips.

For a strip the invariants are that it:

  • Is a keyframe strip.
  • AND is infinite.
  • AND has no time offset (i.e. aligns with scene time).

This simultaneously serves as a todo marker for later phases of Project Baklava and ensures that the phase-1 invariants hold at runtime.

TODO: these functions should be changed to assert fewer and fewer assumptions as we progress through the phases of Project Baklava and more and more of the new animation system is implemented. Finally, they should be removed entirely when the full system is completely implemented.

Definition at line 2695 of file animrig/intern/action.cc.

References assert_baklava_phase_1_invariants(), BLI_assert, ActionStrip::frame_offset, blender::animrig::Strip::is_infinite(), blender::animrig::Strip::type(), and UNUSED_VARS_NDEBUG.

◆ assign_action() [1/2]

bool blender::animrig::assign_action ( bAction * action,
ID & animated_id )
nodiscard

Assign the Action to the ID.

This will make a best-effort guess as to which slot to use, in this order;

  • By slot handle.
  • By fallback string.
  • By the ID's name (matching against the slot name).
  • If the above do not find a suitable slot, the animated ID will not receive any animation and the caller is responsible for creating a slot and assigning it.
Returns
false if the assignment was not possible (for example the ID is of a type that cannot be animated). If the above fall-through case of "no slot found" is reached, this function will still return true as the Action was successfully assigned.

Definition at line 1158 of file animrig/intern/action.cc.

References assign_action(), and BKE_animdata_ensure_id().

Referenced by action_to_animdata(), assign_action(), assign_action_and_slot(), assign_action_ensure_slot_for_keying(), BKE_animdata_set_action(), BKE_animdata_transfer_by_basepath(), blender::bke::greasepencil::convert::AnimDataConvertor::fcurves_convert_finalize(), id_action_ensure(), ipo_to_animdata(), blender::ed::space_node::node_group_ungroup(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), unassign_action(), and unassign_action().

◆ assign_action() [2/2]

bool blender::animrig::assign_action ( bAction * action,
OwnedAnimData owned_adt )
nodiscard

Same as assign_action(action, id) above.

Use this function when you already have the AnimData struct of this ID.

Returns
true when successful, false otherwise. This can fail when the NLA is in tweak mode (no action changes allowed) or when a legacy Action is assigned and it doesn't match the animated ID's type.

Definition at line 1167 of file animrig/intern/action.cc.

References AnimData::action, OwnedAnimData::adt, BKE_animdata_action_editable(), BKE_report(), generic_assign_action(), OwnedAnimData::owner_id, RPT_ERROR, AnimData::slot_handle, and AnimData::slot_name.

◆ assign_action_and_slot()

◆ assign_action_ensure_slot_for_keying()

Slot * blender::animrig::assign_action_ensure_slot_for_keying ( Action & action,
ID & animated_id )
nodiscard

Assign the Action, ensuring that a Slot is also assigned.

If this Action happens to already be assigned, and a Slot is assigned too, that Slot is returned. Otherwise a new Slot is created + assigned.

Returns
the assigned slot if the assignment was successful, or nullptr otherwise. Reasons the assignment can fail is when the given ID is of an animatable type, when the ID is in NLA Tweak mode (in which case no Action assignments can happen), or when the legacy Action ID type doesn't match the animated ID.
Note
Contrary to assign_action() this skips the search by slot name when the Action is already assigned. It should be possible for an animator to un-assign a slot, then create a new slot by inserting a new key. This shouldn't auto-assign the old slot (by name) and then insert the key.
See also
assign_action()

Definition at line 1201 of file animrig/intern/action.cc.

References AnimData::action, assign_action(), assign_action_slot(), BKE_animdata_from_id(), BLI_assert_unreachable, blender::animrig::Slot::is_suitable_for(), ID::name, OK, blender::animrig::Action::slot_add_for_id(), blender::animrig::Action::slot_find_by_name(), blender::animrig::Action::slot_for_handle(), AnimData::slot_handle, and AnimData::slot_name.

Referenced by action_fcurve_ensure(), insert_key_layered_action(), blender::animrig::tests::TEST_F(), and blender::animrig::tests::TEST_F().

◆ assign_action_slot()

◆ assign_tmpaction()

◆ autokeyframe_cfra_can_key()

◆ autokeyframe_object() [1/2]

bool blender::animrig::autokeyframe_object ( bContext * C,
Scene * scene,
Object * ob,
KeyingSet * ks )

Auto-keyframing feature - for objects

Note
Context may not always be available, so must check before using it as it's a luxury for a few cases.

Definition at line 163 of file keyframing_auto.cc.

References ANIM_apply_keyingset(), ANIM_relative_keyingset_add_source(), autokeyframe_cfra_can_key(), BKE_scene_frame_get(), Object::id, and INSERT.

◆ autokeyframe_object() [2/2]

◆ autokeyframe_pchan()

bool blender::animrig::autokeyframe_pchan ( bContext * C,
Scene * scene,
Object * ob,
bPoseChannel * pchan,
KeyingSet * ks )

◆ autokeyframe_pose_channel()

void blender::animrig::autokeyframe_pose_channel ( bContext * C,
Scene * scene,
Object * ob,
bPoseChannel * pose_channel,
Span< RNAPath > rna_paths,
short targetless_ik )

◆ autokeyframe_property()

bool blender::animrig::autokeyframe_property ( bContext * C,
Scene * scene,
PointerRNA * ptr,
PropertyRNA * prop,
int rnaindex,
float cfra,
bool only_if_property_keyed )

◆ bake_fcurve()

void blender::animrig::bake_fcurve ( FCurve * fcu,
blender::int2 range,
float step,
BakeCurveRemove remove_existing )

Creates keyframes in the given range at the given step interval.

Parameters
rangestart and end frame to bake. Is inclusive on both ends.
remove_existingchoice which keys to remove in relation to the given range.

Definition at line 551 of file animrig/intern/fcurve.cc.

References FCurve::bezt, BKE_bezier_array_merge(), BKE_fcurve_handles_recalc(), BLI_assert, FCurve::flag, get_keyframe_settings(), initialize_bezt(), MEM_callocN, MEM_freeN(), NONE, remove_fcurve_key_range(), sample_fcurve_segment(), and FCurve::totvert.

◆ bake_fcurve_segments()

void blender::animrig::bake_fcurve_segments ( FCurve * fcu)

Fill the space between selected keyframes with keyframes on full frames. E.g. With a key selected on frame 1 and 3 it will insert a key on frame 2.

Definition at line 598 of file animrig/intern/fcurve.cc.

References FCurve::bezt, BEZT_ISSEL_ANY, BEZT_KEYTYPE_BREAKDOWN, BKE_fcurve_handles_recalc(), ceil(), evaluate_fcurve(), float, floor(), blender::animrig::TempFrameValCache::frame, get_keyframe_settings(), insert_vert_fcurve(), INSERTKEY_NOFLAGS, int, MEM_callocN, MEM_freeN(), next, range, and FCurve::totvert.

Referenced by bake_action_keys(), and bake_graph_keys().

◆ blend_layer_results()

◆ bonecoll_has_children()

bool blender::animrig::bonecoll_has_children ( const BoneCollection * bcoll)

◆ bonecolls_copy_expanded_flag()

void blender::animrig::bonecolls_copy_expanded_flag ( Span< BoneCollection * > bcolls_dest,
Span< const BoneCollection * > bcolls_source )

For each bone collection in the destination armature, copy its BONE_COLLECTION_EXPANDED flag from the corresponding bone collection in the source armature.

This is used in the handling of undo steps, to ensure that undo'ing does not modify this flag.

Definition at line 1257 of file animrig/intern/bone_collections.cc.

References ANIM_armature_bonecoll_is_expanded_set(), bonecolls_get_by_name(), BoneCollection::name, blender::Span< T >::size(), and STREQ.

Referenced by armature_undo_preserve(), and undoarm_to_editarm().

◆ channelbag_for_action_slot() [1/2]

animrig::ChannelBag * blender::animrig::channelbag_for_action_slot ( Action & action,
slot_handle_t slot_handle )

Definition at line 2210 of file animrig/intern/action.cc.

References channelbag_for_action_slot().

◆ channelbag_for_action_slot() [2/2]

◆ channelbag_ptr_destructor()

static void blender::animrig::channelbag_ptr_destructor ( ActionChannelBag ** dna_channelbag_ptr)
static

◆ clear_keyframe()

int blender::animrig::clear_keyframe ( Main * bmain,
ReportList * reports,
ID * id,
const RNAPath & rna_path )

Main Keyframing API call: Use this when validation of necessary animation data isn't necessary as it already exists. It will clear the current buttons fcurve(s).

Returns
The number of f-curves removed.

Definition at line 686 of file animrig/intern/keyframing.cc.

References AnimData::action, action_fcurve_remove(), blender::Vector< T, InlineBufferCapacity, Allocator >::append(), BKE_animdata_from_id(), BKE_report(), BKE_reportf(), ELEM, foreach_fcurve_in_action_slot(), blender::animrig::Action::is_action_layered(), RNAPath::path, ptr, RNA_id_pointer_create(), FCurve::rna_path, RNA_path_resolve_property(), RPT_ERROR, and AnimData::slot_handle.

Referenced by clear_key_button_exec().

◆ clone_slot()

static void blender::animrig::clone_slot ( Slot & from,
Slot & to )
static

Clone information from the given slot into this slot while retaining important info like the slot handle and runtime data. This copies the name which might clash with other names on the action. Call slot_name_ensure_unique after.

Definition at line 2760 of file animrig/intern/action.cc.

References clone_slot(), and ActionSlot::runtime.

Referenced by clone_slot(), and move_slot().

◆ convert_to_layered_action()

◆ create_fcurve_for_channel()

FCurve * blender::animrig::create_fcurve_for_channel ( FCurveDescriptor fcurve_descriptor)

◆ default_channel_group_for_path()

const std::optional< StringRefNull > blender::animrig::default_channel_group_for_path ( const PointerRNA * animated_struct,
const StringRef prop_rna_path )

Return the default channel group name for the given RNA pointer and property path, or none if it has no default.

For example, for object location/rotation/scale this returns the standard "Object Transforms" channel group name.

Definition at line 189 of file animrig/intern/keyframing.cc.

References BLI_assert, PointerRNA::data, blender::StringRefBase::find(), bPoseChannel::name, blender::StringRefBase::not_found, and PointerRNA::type.

Referenced by insert_key_layered_action(), and insert_key_legacy_action().

◆ deg_tag_after_keyframe_delete()

static void blender::animrig::deg_tag_after_keyframe_delete ( Main * bmain,
ID * id,
AnimData * adt )
static

◆ delete_keyframe()

◆ delete_keyframe_fcurve_legacy()

bool blender::animrig::delete_keyframe_fcurve_legacy ( AnimData * adt,
FCurve * fcu,
float cfra )

Deletes the keyframe at cfra on fcu if a key exists there, and deletes the fcurve if it was the only keyframe.

Note
For fcurves on legacy actions only. More specifically, this assumes that the fcurve lives on adt->action and that adt->action is a legacy action.
The caller needs to run BKE_nla_tweakedit_remap to get NLA relative frame. The caller should also check BKE_fcurve_is_protected before keying.

Definition at line 108 of file animrig/intern/fcurve.cc.

References animdata_fcurve_delete(), BKE_fcurve_is_empty(), and fcurve_delete_keyframe_at_time().

◆ deselect_keys_actions()

void blender::animrig::deselect_keys_actions ( blender::Span< bAction * > actions)

Deselect the keys of all actions in the Span. Duplicate entries are only visited once.

Definition at line 31 of file action_selection.cc.

References action_deselect_keys(), and blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add().

◆ ENUM_OPERATORS() [1/2]

blender::animrig::ENUM_OPERATORS ( Layer::Flags ,
Layer::Flags::Enabled  )

◆ ENUM_OPERATORS() [2/2]

blender::animrig::ENUM_OPERATORS ( Slot::Flags ,
Slot::Flags::Active  )

◆ evaluate_action()

EvaluationResult blender::animrig::evaluate_action ( PointerRNA & animated_id_ptr,
Action & action,
slot_handle_t slot_handle,
const AnimationEvalContext & anim_eval_context )

Evaluate the given action for the given slot and animated ID.

This does not apply the resulting values to the ID. Instead, it returns the resulting values in an EvaluationResult.

Definition at line 38 of file evaluation.cc.

References blend_layer_results(), blender::animrig::internal::evaluate_layer(), and blender::animrig::Action::layers().

Referenced by evaluate_and_apply_action().

◆ evaluate_and_apply_action()

void blender::animrig::evaluate_and_apply_action ( PointerRNA & animated_id_ptr,
Action & action,
slot_handle_t slot_handle,
const AnimationEvalContext & anim_eval_context,
bool flush_to_original )

Top level animation evaluation function.

Animate the given ID, using the layered Action and the given slot.

Parameters
flush_to_originalwhen true, look up the original data-block (assuming the given one is an evaluated copy) and update that too.

Definition at line 73 of file evaluation.cc.

References apply_evaluation_result(), and evaluate_action().

Referenced by BKE_animsys_evaluate_animdata().

◆ evaluate_driver_from_rna_pointer()

float blender::animrig::evaluate_driver_from_rna_pointer ( const AnimationEvalContext * anim_eval_context,
PointerRNA * ptr,
PropertyRNA * prop,
const FCurve * fcu )

Evaluates the driver on the frame given in anim_eval_context and returns the value. Returns 0 if the RNA path can't be resolved.

Definition at line 16 of file driver.cc.

References FCurve::array_index, FCurve::driver, evaluate_driver(), ptr, and RNA_path_resolved_create().

◆ evaluate_keyframe_data()

◆ evaluate_strip()

static EvaluationResult blender::animrig::evaluate_strip ( PointerRNA & animated_id_ptr,
Action & owning_action,
Strip & strip,
const slot_handle_t slot_handle,
const AnimationEvalContext & anim_eval_context )
static

◆ fcurve_delete_keyframe_at_time()

bool blender::animrig::fcurve_delete_keyframe_at_time ( FCurve * fcurve,
float time )

Delete the keyframe at time on fcurve if a key exists there.

This does NOT delete the FCurve if it ends up empty. That is for the caller to do.

Note
time is in fcurve time, not scene time. Any time remapping must be done prior to calling this function.
Returns
True if a keyframe was found at time and deleted, false otherwise.

Definition at line 89 of file animrig/intern/fcurve.cc.

References FCurve::bezt, BKE_fcurve_bezt_binarysearch_index(), BKE_fcurve_delete_key(), BKE_fcurve_handles_recalc(), BKE_fcurve_is_protected(), and FCurve::totvert.

Referenced by delete_key_v3d_without_keying_set(), delete_keyframe(), and delete_keyframe_fcurve_legacy().

◆ fcurve_find() [1/2]

const FCurve * blender::animrig::fcurve_find ( Span< const FCurve * > fcurves,
FCurveDescriptor fcurve_descriptor )

Return the first fcurve in fcurves that matches fcurve_descriptor.

If no matching fcurve is found, returns nullptr.

Definition at line 38 of file animrig/intern/fcurve.cc.

References blender::animrig::FCurveDescriptor::array_index, and blender::animrig::FCurveDescriptor::rna_path.

Referenced by blender::animrig::ChannelBag::ChannelBag(), delete_keyframe(), blender::animrig::ChannelBag::fcurve_find(), blender::animrig::ChannelBag::fcurve_find(), and fcurve_find().

◆ fcurve_find() [2/2]

FCurve * blender::animrig::fcurve_find ( Span< FCurve * > fcurves,
FCurveDescriptor fcurve_descriptor )

Definition at line 50 of file animrig/intern/fcurve.cc.

References blender::Span< T >::cast(), and fcurve_find().

◆ fcurve_find_by_rna_path()

const FCurve * blender::animrig::fcurve_find_by_rna_path ( const AnimData & adt,
StringRefNull rna_path,
int array_index )

Compatibility helper function for BKE_animadata_fcurve_find_by_rna_path().

Searches each layer (top to bottom) to find an FCurve that matches the given RNA path & index.

See also
BKE_animadata_fcurve_find_by_rna_path
Note
The returned FCurve should NOT be used for keyframe manipulation. Its existence is an indicator for "this property is animated".
This function assumes that adt->action actually points to a layered Action. It is a bug to call this with a legacy Action, or without one.

This function should probably be limited to the active layer (for the given property, once pinning to layers is there), so that the "this is keyed" color is more accurate.

Again, this is just to hook up the layered Action to the old Blender UI code.

Definition at line 365 of file animdata.cc.

References AnimData::action, BLI_assert, blender::animrig::StripKeyframeData::channelbag_for_slot(), blender::animrig::Action::is_action_layered(), blender::animrig::Action::layer(), bAction::layer_array_num, blender::animrig::Action::slot_for_handle(), and AnimData::slot_handle.

◆ fcurve_find_in_action()

◆ fcurve_find_in_action_slot()

◆ fcurve_find_in_assigned_slot()

FCurve * blender::animrig::fcurve_find_in_assigned_slot ( AnimData & adt,
FCurveDescriptor fcurve_descriptor )

◆ fcurve_matches_collection_path()

bool blender::animrig::fcurve_matches_collection_path ( const FCurve & fcurve,
StringRefNull collection_rna_path,
StringRefNull data_name )

Return whether fcurve targets the given collection path + data name.

For example, to match F-Curves for the pose bone named "botje", you'd pass collection_rna_path = "pose.bones[" and data_name="botje".

Returns
True if fcurve matches, false if it doesn't.

Definition at line 2299 of file animrig/intern/action.cc.

References BLI_assert, BLI_str_quoted_substr(), blender::StringRefNull::c_str(), blender::StringRefBase::is_empty(), FCurve::rna_path, and blender::StringRefBase::size().

Referenced by updateDuplicateActionConstraintSettings().

◆ fcurve_ptr_destructor()

static void blender::animrig::fcurve_ptr_destructor ( FCurve ** fcurve_ptr)
static

Definition at line 1747 of file animrig/intern/action.cc.

References BKE_fcurve_free().

Referenced by blender::animrig::ChannelBag::fcurves_clear().

◆ fcurve_ptr_noop_destructor()

static void blender::animrig::fcurve_ptr_noop_destructor ( FCurve ** )
static

◆ fcurves_for_action_slot() [1/2]

Span< FCurve * > blender::animrig::fcurves_for_action_slot ( Action & action,
slot_handle_t slot_handle )

Return the F-Curves for this specific slot handle.

This is just a utility function, that's intended to become obsolete when multi-layer Actions are introduced. However, since Blender currently only supports a single layer with a single strip, of a single type, this function can be used.

The use of this function is also an indicator for code that will have to be altered when multi-layered Actions are getting implemented.

Note
This function requires a layered Action. To transparently handle legacy Actions, see the animrig::legacy namespace.
See also
blender::animrig::legacy::fcurves_for_action_slot

Definition at line 2217 of file animrig/intern/action.cc.

References assert_baklava_phase_1_invariants(), BLI_assert, channelbag_for_action_slot(), blender::animrig::ChannelBag::fcurves(), and blender::animrig::Action::is_action_layered().

Referenced by animsys_evaluate_action(), delete_keyframe(), blender::animrig::legacy::fcurves_for_action_slot_templated(), blender::animrig::Action::get_frame_range_of_slot(), blender::animrig::Action::has_keyframes(), and blender::animrig::Action::is_slot_animated().

◆ fcurves_for_action_slot() [2/2]

Span< const FCurve * > blender::animrig::fcurves_for_action_slot ( const Action & action,
slot_handle_t slot_handle )

◆ fcurves_in_action_slot_filtered()

Vector< FCurve * > blender::animrig::fcurves_in_action_slot_filtered ( bAction * act,
slot_handle_t slot_handle,
FunctionRef< bool(const FCurve &fcurve)> predicate )

Return the F-Curves in the given action+slot for which predicate returns true.

This works for both layered and legacy actions. For legacy actions the slot handle is ignored.

Definition at line 2324 of file animrig/intern/action.cc.

References BLI_assert, and foreach_fcurve_in_action_slot().

Referenced by updateDuplicateActionConstraintSettings().

◆ find_related_action()

static bAction * blender::animrig::find_related_action ( Main & bmain,
ID & id )
static

◆ find_related_ids()

Vector< ID * > blender::animrig::find_related_ids ( Main & bmain,
ID & id )

Build a Vector of IDs that are related to the given ID. Related things are e.g. Object<->Data, Mesh<->Material and so on. The exact relationships are defined per ID type. Only relationships of 1:1 are traced. The case of multiple users for 1 ID is treated as not related. The returned Vector always contains the passed ID as the first index as such will never be empty.

Definition at line 66 of file animdata.cc.

References add_object_data_users(), BKE_id_owner_get(), BKE_key_from_id(), BLI_assert, Object::data, ID::flag, FOREACH_MAIN_LISTBASE_ID_BEGIN, FOREACH_MAIN_LISTBASE_ID_END, Key::from, GS, bNodeTree::id, Key::id, Object::id, ID_FLAG_EMBEDDED_DATA, ID_KE, ID_MA, ID_OB, ID_PA, ID_REAL_USERS, LISTBASE_FOREACH, ID::name, node_tree, blender::bke::node_tree_from_id(), Material::nodetree, Main::objects, and Object::particlesystem.

Referenced by find_related_action().

◆ first_slot_handle()

slot_handle_t blender::animrig::first_slot_handle ( const ::bAction & dna_action)

Return the handle of the first slot of this Action.

This is for code that needs to treat Actions as somewhat-legacy Actions, i.e. as holders of F-Curves for which the specific slot is not interesting.

TODO: Maybe at some point this function should get extended with an ID type parameter, to return the first slot that is suitable for that ID type.

Returns
The handle of the first slot, or Slot::unassigned if there is no slot (which includes legacy Actions).

Definition at line 2663 of file animrig/intern/action.cc.

References first_slot_handle(), ActionSlot::handle, bAction::slot_array, and bAction::slot_array_num.

Referenced by action_preview_render_prepare(), first_slot_handle(), and poselib_blend_apply().

◆ foreach_action_slot_use()

bool blender::animrig::foreach_action_slot_use ( const ID & animated_id,
FunctionRef< bool(const Action &action, slot_handle_t slot_handle)> callback )

Call the given callback for each Action + Slot that this ID uses.

The following cases are visited:

  • Direct Action+Slot assignment.
  • NLA strips.
  • Action Constraints, both on Object and Pose Bone level.
Parameters
callbackThe function to call for each Action+Slot used. Even when there is no slot assigned, this function will be called (but then with slot_handle = Slot::unassigned). The callback should return true to continue the foreach loop, or return false to stop it.
Returns
Whether the foreach loop came to a natural end. So returns false when the callback returned false, and true otherwise.

Definition at line 73 of file action_iterators.cc.

References callback, and foreach_action_slot_use_with_references().

Referenced by is_id_using_action_slot(), and blender::animrig::internal::rebuild_slot_user_cache().

◆ foreach_action_slot_use_with_references()

bool blender::animrig::foreach_action_slot_use_with_references ( ID & animated_id,
FunctionRef< bool(bAction *&action_ptr_ref, slot_handle_t &slot_handle_ref, char *slot_name)> callback )

Same as foreach_action_slot_use(), except that it reports some pointers so the callback can modify which Action/slot is assigned.

See also
blender::animrig::generic_assign_action
blender::animrig::generic_assign_action_slot
blender::animrig::generic_assign_action_slot_handle

Visit a constraint, and call the callback if it's an Action constraint.

Returns
whether to continue looping over possible uses of Actions, i.e. the return value of the callback.

Visit a constraint, and call the callback if it's an Action constraint.

Returns
whether to continue looping over possible uses of Actions, i.e. the return value of the callback.

Definition at line 91 of file action_iterators.cc.

References NlaStrip::act, AnimData::action, BKE_animdata_from_id(), callback, blender::bke::nla::foreach_strip_adt(), AnimData::slot_handle, and AnimData::slot_name.

Referenced by foreach_action_slot_use(), move_slot(), and blender::animrig::tests::TEST_F().

◆ foreach_fcurve_in_action()

void blender::animrig::foreach_fcurve_in_action ( Action & action,
FunctionRef< void(FCurve &fcurve)> callback )

Iterates over all FCurves of the Action and executes the callback on it. Works on layered and legacy actions.

Definition at line 21 of file action_iterators.cc.

References callback, bAction::curves, blender::animrig::Action::is_action_legacy(), blender::animrig::Action::layers(), and LISTBASE_FOREACH.

◆ foreach_fcurve_in_action_slot()

void blender::animrig::foreach_fcurve_in_action_slot ( Action & action,
slot_handle_t handle,
FunctionRef< void(FCurve &fcurve)> callback )

Iterates over all FCurves of the given slot handle in the Action and executes the callback on it. Works on layered and legacy actions. When the action is legacy, the slot handle will be ignored.

Note
Use lambdas to have access to specific data in the callback.

Definition at line 44 of file action_iterators.cc.

References BLI_assert, callback, bAction::curves, blender::animrig::Action::is_action_layered(), blender::animrig::Action::is_action_legacy(), blender::animrig::Action::layers(), and LISTBASE_FOREACH.

Referenced by action_move_fcurves_by_basepath(), clear_keyframe(), fcurves_in_action_slot_filtered(), get_item_transform_flags_and_fcurves(), and blender::animrig::tests::TEST_F().

◆ generic_assign_action()

bool blender::animrig::generic_assign_action ( ID & animated_id,
bAction * action_to_assign,
bAction *& action_ptr_ref,
slot_handle_t & slot_handle_ref,
char * slot_name )
nodiscard

◆ generic_assign_action_slot()

◆ generic_assign_action_slot_handle()

ActionSlotAssignmentResult blender::animrig::generic_assign_action_slot_handle ( slot_handle_t slot_handle_to_assign,
ID & animated_id,
bAction *& action_ptr_ref,
slot_handle_t & slot_handle_ref,
char * slot_name )

Generic function to build Slot Handle-assignment logic.

This is a low-level function, intended as a building block for higher-level slot handle assignment functions.

Definition at line 1376 of file animrig/intern/action.cc.

References generic_assign_action_slot(), MissingAction, OK, and blender::animrig::Slot::unassigned.

◆ get_action()

Action * blender::animrig::get_action ( ID & animated_id)

◆ get_action_slot_pair()

std::optional< std::pair< Action *, Slot * > > blender::animrig::get_action_slot_pair ( ID & animated_id)

Get the Action and the Slot that animate this ID.

Returns
One of two options:
  • pair<Action, Slot> when an Action and a Slot are assigned. In other words, when this ID is actually animated by this Action+Slot pair.
  • nullopt: when this ID is not animated. This can have several causes: not an animatable type, no Action assigned, or no Slot assigned.

Definition at line 1459 of file animrig/intern/action.cc.

References AnimData::action, BKE_animdata_from_id(), blender::animrig::Action::slot_for_handle(), and AnimData::slot_handle.

Referenced by blender::animrig::tests::TEST_F().

◆ get_autokey_flags()

◆ get_frame_range_of_fcurves()

◆ get_keyframe_settings()

◆ get_keyframe_values()

static Vector< float > blender::animrig::get_keyframe_values ( PointerRNA * ptr,
PropertyRNA * prop,
const bool visual_key )
static

◆ get_keyframe_values_create_reports()

static void blender::animrig::get_keyframe_values_create_reports ( ReportList * reports,
PointerRNA ptr,
PropertyRNA * prop,
const int index,
const int count,
const bool force_all,
const BitSpan successful_remaps )
static

◆ get_keyframing_flags()

◆ get_rna_values()

◆ get_rotation_mode_path()

StringRef blender::animrig::get_rotation_mode_path ( eRotationModes rotation_mode)

Get the rna path for the given rotation mode.

Definition at line 73 of file anim_rna.cc.

References ROT_MODE_AXISANGLE, and ROT_MODE_QUAT.

Referenced by autokeyframe_object(), and autokeyframe_pose().

◆ grow_array()

template<typename T >
static void blender::animrig::grow_array ( T ** array,
int * num,
const int add_num )
static

◆ grow_array_and_append()

◆ grow_array_and_insert()

template<typename T >
static void blender::animrig::grow_array_and_insert ( T ** array,
int * num,
const int index,
T item )
static

◆ id_action_ensure()

◆ initialize_bezt()

void blender::animrig::initialize_bezt ( BezTriple * beztr,
float2 position,
const KeyframeSettings & settings,
eFCurve_Flags fcu_flags )

◆ insert_bezt_fcurve()

int blender::animrig::insert_bezt_fcurve ( FCurve * fcu,
const BezTriple * bezt,
eInsertKeyFlags flag )

Lesser Key-framing API call.

Use this when validation of necessary animation data isn't necessary as it already exists, and there is a BezTriple that can be directly copied into the array.

This function adds a given BezTriple to an F-Curve. It will allocate memory for the array if needed, and will insert the BezTriple into a suitable place in chronological order.

Returns
The index of the keyframe array into which the bezt has been added.
Note
Any recalculate of the F-Curve that needs to be done will need to be done by the caller.

Definition at line 145 of file animrig/intern/fcurve.cc.

References FCurve::bezt, BKE_fcurve_bezt_binarysearch_index(), BKE_fcurve_get_cycle_type(), ELEM, FCU_CYCLE_PERFECT, flag, FCurve::fpt, INSERTKEY_CYCLE_AWARE, INSERTKEY_OVERWRITE_FULL, INSERTKEY_REPLACE, MEM_callocN, MEM_freeN(), replace_bezt_keyframe_ypos(), FCurve::totvert, and BezTriple::vec.

Referenced by clean_fcurve(), decimate_fcurve(), insert_vert_fcurve(), and paste_animedit_keys_fcurve().

◆ insert_key_layer()

static SingleKeyingResult blender::animrig::insert_key_layer ( Main * bmain,
Action & action,
Layer & layer,
const Slot & slot,
const std::string & rna_path,
const std::optional< PropertySubType > prop_subtype,
const std::optional< blender::StringRefNull > channel_group,
const KeyInsertData & key_data,
const KeyframeSettings & key_settings,
const eInsertKeyFlags insert_key_flags )
static

◆ insert_key_layered_action()

◆ insert_key_legacy_action()

static CombinedKeyingResult blender::animrig::insert_key_legacy_action ( Main * bmain,
bAction * action,
PointerRNA * ptr,
PropertyRNA * prop,
const std::optional< StringRefNull > channel_group,
const std::string & rna_path,
const float frame,
const Span< float > values,
eInsertKeyFlags insert_key_flag,
eBezTriple_KeyframeType key_type,
const BitSpan keying_mask )
static

◆ insert_keyframe_direct()

bool blender::animrig::insert_keyframe_direct ( ReportList * reports,
PointerRNA ptr,
PropertyRNA * prop,
FCurve * fcu,
const AnimationEvalContext * anim_eval_context,
eBezTriple_KeyframeType keytype,
NlaKeyframingContext * nla_context,
eInsertKeyFlags flag )

Secondary Insert Key-framing API call.

Use this when validation of necessary animation data is not necessary, since an RNA-pointer to the necessary data being keyframed, and a pointer to the F-Curve to use have both been provided.

This function can't keyframe quaternion channels on some NLA strip types.

Parameters
keytypeThe "keyframe type" (eBezTriple_KeyframeType), as shown in the Dope Sheet.
flagUsed for special settings that alter the behavior of the keyframe insertion. These include the 'visual' key-framing modes, quick refresh, and extra keyframe filtering.
Returns
Success.

Definition at line 424 of file animrig/intern/keyframing.cc.

References FCurve::array_index, BKE_report(), BKE_reportf(), PointerRNA::data, AnimationEvalContext::eval_time, flag, get_keyframe_values(), insert_keyframe_value(), INSERTKEY_MATRIX, ID::name, nla_map_keyframe_values_and_generate_reports(), PointerRNA::owner_id, ptr, FCurve::rna_path, RNA_path_resolve_property(), RPT_, RPT_ERROR, SUCCESS, and update_autoflags_fcurve_direct().

Referenced by achannel_setting_slider_cb(), achannel_setting_slider_nla_curve_cb(), and autokeyframe_property().

◆ insert_keyframe_fcurve_value()

static SingleKeyingResult blender::animrig::insert_keyframe_fcurve_value ( Main * bmain,
PointerRNA * ptr,
PropertyRNA * prop,
bAction * act,
const char group[],
const char rna_path[],
int array_index,
const float fcurve_frame,
float curval,
eBezTriple_KeyframeType keytype,
eInsertKeyFlags flag )
static

◆ insert_keyframe_value()

◆ insert_keyframes()

CombinedKeyingResult blender::animrig::insert_keyframes ( Main * bmain,
PointerRNA * struct_pointer,
std::optional< StringRefNull > channel_group,
const blender::Span< RNAPath > rna_paths,
std::optional< float > scene_frame,
const AnimationEvalContext & anim_eval_context,
eBezTriple_KeyframeType key_type,
eInsertKeyFlags insert_key_flags )

Main key-frame insertion API.

Insert keys for struct_pointer, for all paths in rna_paths. Any necessary animation data (AnimData, Action, ...) is created if it doesn't already exist.

Note that this function was created as part of an ongoing refactor by merging two other functions that were almost identical to each other. There are still things left over from that which can and should be improved (such as the partially redundant scene_frame and anim_eval_contextparameters). Additionally, it's a bit of a mega-function now, and can probably be stripped down to a clearer core functionality.

Parameters
struct_pointerRNA pointer to the struct to be keyed. This is often an ID, but not necessarily. For example, pose bones are also common. Note that if you have an ID and want to pass it here for keying, you can create the PointerRNA for it with RNA_id_pointer_create().
channel_groupthe channel group to put any newly created fcurves under. If not given, the standard groups are used.
rna_pathsthe RNA paths to key. These paths are relative to struct_pointer. Note that for paths to array properties, if the array index is specified then only that element is keyed, but if the index is not specified then all array elements are keyed.
scene_framethe frame to insert the keys at. This is in scene time, not NLA mapped (NLA mapping is already handled internally by this function). If not given, the evaluation time from anim_eval_context is used instead.
Returns
A summary of the successful and failed keyframe insertions, with reasons for the failures.

Definition at line 952 of file animrig/intern/keyframing.cc.

References AnimData::action, blender::animrig::legacy::action_treat_as_legacy(), blender::animrig::CombinedKeyingResult::add(), blender::Vector< T, InlineBufferCapacity, Allocator >::as_mutable_span(), blender::Vector< T, InlineBufferCapacity, Allocator >::as_span(), FCurve::bezt, BKE_animdata_ensure_id(), BKE_animsys_free_nla_keyframing_context_cache(), BKE_animsys_nla_remap_keyframe_values(), BKE_fcurve_bezt_binarysearch_index(), BLI_assert, DEG_id_tag_update(), ELEM, AnimationEvalContext::eval_time, fcurve_find_in_action(), blender::animrig::CombinedKeyingResult::get_count(), get_keyframe_settings(), get_keyframe_values(), bAction::id, id_action_ensure(), ID_RECALC_ANIMATION_NO_FLUSH, insert_key_layered_action(), insert_key_legacy_action(), insert_keyframes(), INSERTKEY_AVAILABLE, INSERTKEY_MATRIX, INSERTKEY_NO_USERPREF, INSERTKEY_REPLACE, blender::animrig::KeyframeSettings::keyframe_type, blender::animrig::CombinedKeyingResult::merge(), nla_time_remap(), PointerRNA::owner_id, ptr, RNA_id_pointer_create(), RNA_path_from_ID_to_property(), RNA_path_resolve_property(), blender::Span< T >::size(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), and FCurve::totvert.

Referenced by achannel_setting_slider_shapekey_cb(), autokeyframe_object(), autokeyframe_pose_channel(), autokeyframe_property(), insert_keyframes(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), and blender::animrig::tests::TEST_F().

◆ insert_vert_fcurve()

SingleKeyingResult blender::animrig::insert_vert_fcurve ( FCurve * fcu,
const float2 position,
const KeyframeSettings & settings,
eInsertKeyFlags flag )

Main Key-framing API call.

Use this when validation of necessary animation data isn't necessary as it already exists. It will insert a keyframe using the current value being keyframed.

This function is a wrapper for insert_bezt_fcurve(), and should be used when adding a new keyframe to a curve, when the keyframe doesn't exist anywhere else yet.

Returns
Either success or an indicator of why keying failed.
Parameters
keyframe_typeThe type of keyframe (eBezTriple_KeyframeType).
flagOptional flags (eInsertKeyFlags) for controlling how keys get added and/or whether updates get done.

Definition at line 410 of file animrig/intern/fcurve.cc.

References FCurve::bezt, BKE_fcurve_active_keyframe_set(), BKE_fcurve_get_cycle_type(), BKE_fcurve_handles_recalc(), BLI_assert, FCU_CYCLE_PERFECT, FCurve::flag, flag, initialize_bezt(), insert_bezt_fcurve(), INSERTKEY_CYCLE_AWARE, INSERTKEY_FAST, INSERTKEY_NEEDED, INSERTKEY_OVERWRITE_FULL, INSERTKEY_REPLACE, BezTriple::ipo, new_key_needed(), NO_KEY_NEEDED, remap_cyclic_keyframe_location(), subdivide_nonauto_handles(), SUCCESS, FCurve::totvert, and UNKNOWN_FAILURE.

Referenced by bake_fcurve_segments(), insert_keyframe_value(), blender::animrig::StripKeyframeData::keyframe_insert(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), and blender::animrig::tests::TEST_F().

◆ is_action_assignable_to()

bool blender::animrig::is_action_assignable_to ( const bAction * dna_action,
ID_Type id_code )

Return whether the given Action can be assigned to the ID.

This always returns true for layered Actions. For legacy Actions it returns true if the Action's idroot matches the ID.

Definition at line 1400 of file animrig/intern/action.cc.

References blender::animrig::legacy::action_treat_as_legacy(), and bAction::idroot.

Referenced by blender::animrig::tests::TEST_F().

◆ is_autokey_mode()

bool blender::animrig::is_autokey_mode ( const Scene * scene,
eAutokey_Mode mode )

Check the mode for auto-keyframing (per scene takes precedence).

Definition at line 73 of file keyframing_auto.cc.

Referenced by autokeyframe_cfra_can_key(), and get_autokey_flags().

◆ is_autokey_on()

◆ is_fcurve_evaluatable()

static bool blender::animrig::is_fcurve_evaluatable ( const FCurve * fcu)
static

Definition at line 89 of file evaluation.cc.

References BKE_fcurve_is_empty(), FCURVE_DISABLED, FCURVE_MUTED, and FCurve::flag.

Referenced by evaluate_keyframe_data().

◆ is_id_using_action_slot()

static bool blender::animrig::is_id_using_action_slot ( const ID & animated_id,
const Action & action,
const slot_handle_t slot_handle )
static

Definition at line 1248 of file animrig/intern/action.cc.

References foreach_action_slot_use().

Referenced by generic_assign_action_slot().

◆ is_keying_flag()

bool blender::animrig::is_keying_flag ( const Scene * scene,
eKeying_Flag flag )

◆ key_insertion_may_create_fcurve()

bool blender::animrig::key_insertion_may_create_fcurve ( eInsertKeyFlags insert_key_flags)

Return whether key insertion functions are allowed to create new fcurves, according to the given flags.

Specifically, both INSERTKEY_REPLACE and INSERTKEY_AVAILABLE prohibit the creation of new F-Curves.

Definition at line 264 of file animrig/intern/keyframing.cc.

References INSERTKEY_AVAILABLE, and INSERTKEY_REPLACE.

Referenced by insert_keyframe_fcurve_value(), and blender::animrig::StripKeyframeData::keyframe_insert().

◆ layer_ptr_destructor()

static void blender::animrig::layer_ptr_destructor ( ActionLayer ** dna_layer_ptr)
static

Definition at line 273 of file animrig/intern/action.cc.

Referenced by blender::animrig::Action::layer_remove().

◆ make_new_fcurve_cyclic()

static void blender::animrig::make_new_fcurve_cyclic ( FCurve * fcu,
const blender::float2 & action_range )
static

Used to make curves newly added to a cyclic Action cycle with the correct period.

Definition at line 270 of file animrig/intern/keyframing.cc.

References add_fmodifier(), FCurve::bezt, ListBase::first, floorf, FMODIFIER_TYPE_CYCLES, MEM_reallocN, FCurve::modifiers, FCurve::totvert, and BezTriple::vec.

Referenced by insert_keyframe_fcurve_value().

◆ move_slot()

void blender::animrig::move_slot ( Main & bmain,
Slot & slot,
Action & from_action,
Action & to_action )

Move the given slot from from_action to to_action. The slot name might not be exactly the same if the name already exists in the slots of to_action. Also the slot handle is likely going to be different on to_action. All users of the slot will be reassigned to the moved slot on to_action.

Note
The from_action will not be deleted by this function. But it might leave it without users which means it will not be saved (unless it has a fake user).

Definition at line 2769 of file animrig/intern/action.cc.

References assert_baklava_phase_1_invariants(), BLI_assert, BLI_assert_msg, ActionStripKeyframeData::channelbag_array, ActionStripKeyframeData::channelbag_array_num, blender::animrig::StripKeyframeData::channelbag_for_slot(), clone_slot(), blender::animrig::StripKeyframeData::find_channelbag_index(), foreach_action_slot_use_with_references(), generic_assign_action(), generic_assign_action_slot(), ActionSlot::handle, blender::animrig::Action::layer(), move_slot(), blender::animrig::Action::slot_add(), ActionChannelBag::slot_handle, slot_name_ensure_unique(), blender::animrig::Action::slot_remove(), blender::animrig::Action::slots(), UNUSED_VARS_NDEBUG, and blender::animrig::Slot::users().

Referenced by merge_actions_selection_exec(), move_slot(), and blender::animrig::tests::TEST_F().

◆ new_key_needed()

static bool blender::animrig::new_key_needed ( const FCurve & fcu,
const float frame,
const float value )
static

Return whether the given fcurve already evaluates to the same value as the proposed keyframe at the keyframe's time.

This is a helper function for determining whether to insert a keyframe or not when "only insert needed" is enabled.

NOTE: this does not determine whether inserting the keyframe would change the fcurve at points other than the keyframe itself. For example, even if inserting the key wouldn't change the fcurve's value at the time of the keyframe, the resulting changes to bezier interpolation could change the fcurve on either side of it. This function intentionally does not account for that, since that's not how the "only insert needed" feature is supposed to work.

Definition at line 343 of file animrig/intern/fcurve.cc.

References FCurve::bezt, BKE_fcurve_bezt_binarysearch_index(), compare_ff_relative(), evaluate_fcurve(), FCurve::totvert, and BezTriple::vec.

Referenced by insert_vert_fcurve().

◆ nla_map_keyframe_values_and_generate_reports()

static BitVector blender::animrig::nla_map_keyframe_values_and_generate_reports ( const MutableSpan< float > values,
const int index,
PointerRNA & ptr,
PropertyRNA & prop,
NlaKeyframingContext * nla_context,
const AnimationEvalContext * anim_eval_context,
ReportList * reports,
bool * force_all )
static

◆ nla_time_remap()

static float blender::animrig::nla_time_remap ( float time,
const AnimationEvalContext * anim_eval_context,
PointerRNA * id_ptr,
AnimData * adt,
bAction * act,
ListBase * nla_cache,
NlaKeyframingContext ** r_nla_context )
static

◆ pose_apply_action_all_bones() [1/2]

void blender::animrig::pose_apply_action_all_bones ( Object * ob,
bAction * action,
const int32_t slot_handle,
const AnimationEvalContext * anim_eval_context )

Definition at line 96 of file pose.cc.

References animsys_evaluate_action(), Object::id, and RNA_id_pointer_create().

◆ pose_apply_action_all_bones() [2/2]

void blender::animrig::pose_apply_action_all_bones ( Object * ob,
bAction * action,
slot_handle_t slot_handle,
const AnimationEvalContext * anim_eval_context )

Evaluate the action and apply it to the pose. Ignore selection state of the bones.

Referenced by action_preview_render_prepare().

◆ pose_apply_action_blend() [1/2]

void blender::animrig::pose_apply_action_blend ( Object * ob,
bAction * action,
const int32_t slot_handle,
const AnimationEvalContext * anim_eval_context,
const float blend_factor )

Definition at line 105 of file pose.cc.

References animsys_blend_in_action(), and ptr.

◆ pose_apply_action_blend() [2/2]

void blender::animrig::pose_apply_action_blend ( Object * ob,
bAction * action,
slot_handle_t slot_handle,
const AnimationEvalContext * anim_eval_context,
float blend_factor )

Referenced by poselib_blend_apply().

◆ pose_apply_action_selected_bones() [1/2]

void blender::animrig::pose_apply_action_selected_bones ( Object * ob,
bAction * action,
const int32_t slot_handle,
const AnimationEvalContext * anim_eval_context )

Definition at line 81 of file pose.cc.

References animsys_evaluate_action(), and ptr.

◆ pose_apply_action_selected_bones() [2/2]

void blender::animrig::pose_apply_action_selected_bones ( Object * ob,
bAction * action,
slot_handle_t slot_handle,
const AnimationEvalContext * anim_eval_context )

Evaluate the action and apply it to the pose. If any pose bones are selected, only FCurves that relate to those bones are evaluated.

◆ reevaluate_fcurve_errors()

void blender::animrig::reevaluate_fcurve_errors ( bAnimContext * ac)

◆ remap_cyclic_keyframe_location()

static float2 blender::animrig::remap_cyclic_keyframe_location ( const FCurve & fcu,
const eFCU_Cycle_Type type,
float2 position )
static

Move the point where a key is about to be inserted to be inside the main cycle range. Returns the type of the cycle if it is enabled and valid.

Definition at line 372 of file animrig/intern/fcurve.cc.

References FMod_Cycles::after_mode, FCurve::bezt, FCM_EXTRAPOLATE_CYCLIC_OFFSET, FCU_CYCLE_NONE, FCU_CYCLE_OFFSET, ListBase::first, floorf, FCurve::modifiers, FCurve::totvert, and BezTriple::vec.

Referenced by insert_vert_fcurve().

◆ remove_fcurve_key_range()

static void blender::animrig::remove_fcurve_key_range ( FCurve * fcu,
const int2 range,
const BakeCurveRemove removal_mode )
static

◆ replace_bezt_keyframe_ypos()

static void blender::animrig::replace_bezt_keyframe_ypos ( BezTriple * dst,
const BezTriple * bezt )
static

Definition at line 128 of file animrig/intern/fcurve.cc.

References BezTriple::f1, BezTriple::f2, BezTriple::f3, and BezTriple::vec.

Referenced by insert_bezt_fcurve().

◆ sample_fcurve_segment()

void blender::animrig::sample_fcurve_segment ( const FCurve * fcu,
float start_frame,
float sample_rate,
float * samples,
int sample_count )
Parameters
sample_rateindicates how many samples per frame should be generated.
r_samplesIs expected to be an array large enough to hold sample_count.

Definition at line 485 of file animrig/intern/fcurve.cc.

References evaluate_fcurve(), and float.

Referenced by bake_fcurve(), btw_smooth_allocate_operator_data(), btw_smooth_graph_keys(), gaussian_smooth_allocate_operator_data(), and gaussian_smooth_graph_keys().

◆ shrink_array()

template<typename T >
static void blender::animrig::shrink_array ( T ** array,
int * num,
const int shrink_num )
static

◆ shrink_array_and_remove()

template<typename T >
static void blender::animrig::shrink_array_and_remove ( T ** array,
int * num,
const int index )
static

◆ shrink_array_and_swap_remove()

template<typename T >
static void blender::animrig::shrink_array_and_swap_remove ( T ** array,
int * num,
const int index )
static

Same as shrink_array_and_remove() above, except instead of shifting all the elements after the removed item over to fill the gap, it just swaps in the last element to where the removed element was.

Definition at line 153 of file animrig/intern/action.cc.

References BLI_assert, MEM_freeN(), and blender::uninitialized_move_n().

Referenced by blender::animrig::Action::strip_keyframe_data_remove_if_unused().

◆ slot_name_ensure_unique()

static void blender::animrig::slot_name_ensure_unique ( Action & action,
Slot & slot )
static

◆ slot_ptr_destructor()

static void blender::animrig::slot_ptr_destructor ( ActionSlot ** dna_slot_ptr)
static

Definition at line 514 of file animrig/intern/action.cc.

Referenced by blender::animrig::Action::slot_remove().

◆ strip_ptr_destructor()

static void blender::animrig::strip_ptr_destructor ( ActionStrip ** dna_strip_ptr)
static

Definition at line 930 of file animrig/intern/action.cc.

Referenced by blender::animrig::Layer::strip_remove().

◆ subdivide_nonauto_handles()

static void blender::animrig::subdivide_nonauto_handles ( const FCurve * fcu,
BezTriple * bezt,
BezTriple * prev,
BezTriple * next )
static

Update the FCurve to allow insertion of bezt without modifying the curve shape.

Checks whether it is necessary to apply Bezier subdivision due to involvement of non-auto handles. If necessary, changes bezt handles from Auto to Aligned.

Parameters
beztkey being inserted
prevkeyframe before that key
nextkeyframe after that key

Definition at line 239 of file animrig/intern/fcurve.cc.

References FCurve::auto_smoothing, BEZT_IPO_BEZ, BEZT_IS_AUTOH, BKE_fcurve_bezt_subdivide_handles(), fabsf, FCURVE_SMOOTH_CONT_ACCEL, BezTriple::h1, BezTriple::h2, HD_ALIGN, HD_VECT, BezTriple::ipo, next, and BezTriple::vec.

Referenced by insert_vert_fcurve().

◆ unassign_action() [1/2]

bool blender::animrig::unassign_action ( ID & animated_id)
nodiscard

Un-assign the Action assigned to this ID.

Same as calling assign_action(nullptr, animated_id).

See also
#blender::animrig::assign_action(ID &animated_id)

Definition at line 1191 of file animrig/intern/action.cc.

References assign_action().

Referenced by animrecord_check_state(), BKE_animdata_free(), BKE_animdata_transfer_by_basepath(), BKE_nla_action_pushdown(), blender::ed::space_node::node_group_ungroup(), blender::animrig::tests::TEST_F(), and blender::animrig::tests::TEST_F().

◆ unassign_action() [2/2]

bool blender::animrig::unassign_action ( OwnedAnimData owned_adt)
nodiscard

Un-assign the Action assigned to this ID.

Same as calling assign_action(nullptr, owned_adt).

See also
#blender::animrig::assign_action(OwnedAnimData owned_adt)

Definition at line 1196 of file animrig/intern/action.cc.

References assign_action().

◆ update_autoflags_fcurve_direct()

void blender::animrig::update_autoflags_fcurve_direct ( FCurve * fcu,
PropertyRNA * prop )

◆ visualkey_can_use()

◆ visualkey_get_values()

Vector< float > blender::animrig::visualkey_get_values ( PointerRNA * ptr,
PropertyRNA * prop )

This helper function extracts the value to use for visual-keyframing In the event that it is not possible to perform visual keying, try to fall-back to using the default method. Assumes that all data it has been passed is valid.

Definition at line 197 of file visualkey.cc.

References BKE_armature_mat_pose_to_bone(), bPoseChannel::bone, BONE_CONNECTED, copy_m4_m4(), PointerRNA::data, Bone::flag, get_rna_values(), mat4_to_axis_angle(), mat4_to_eulO(), mat4_to_quat(), mat4_to_size(), Bone::parent, bPoseChannel::pose_mat, ptr, RNA_property_identifier(), bPoseChannel::rotmode, Object::rotmode, and PointerRNA::type.

Referenced by get_keyframe_values().