Blender  V3.3
Classes | Typedefs | Enumerations | Functions
BKE_animsys.h File Reference
#include "BLI_bitmap.h"
#include "BLI_sys_types.h"

Go to the source code of this file.

Classes

struct  AnimationEvalContext
 
struct  AnimationBasePathChange
 

Typedefs

typedef struct AnimationEvalContext AnimationEvalContext
 
typedef struct AnimationBasePathChange AnimationBasePathChange
 
typedef void(* ID_AnimData_Edit_Callback) (struct ID *id, struct AnimData *adt, void *user_data)
 
typedef void(* ID_FCurve_Edit_Callback) (struct ID *id, struct FCurve *fcu, void *user_data)
 
typedef struct NlaKeyframingContext NlaKeyframingContext
 
typedef enum eAnimData_Recalc eAnimData_Recalc
 

Enumerations

enum  eAnimData_Recalc { ADT_RECALC_DRIVERS = (1 << 0) , ADT_RECALC_ANIM = (1 << 1) , ADT_RECALC_ALL = (ADT_RECALC_DRIVERS | ADT_RECALC_ANIM) }
 

Functions

AnimationEvalContext BKE_animsys_eval_context_construct (struct Depsgraph *depsgraph, float eval_time)
 
AnimationEvalContext BKE_animsys_eval_context_construct_at (const AnimationEvalContext *anim_eval_context, float eval_time)
 
struct KeyingSetBKE_keyingset_add (struct ListBase *list, const char idname[], const char name[], short flag, short keyingflag)
 
struct KS_PathBKE_keyingset_add_path (struct KeyingSet *ks, struct ID *id, const char group_name[], const char rna_path[], int array_index, short flag, short groupmode)
 
struct KS_PathBKE_keyingset_find_path (struct KeyingSet *ks, struct ID *id, const char group_name[], const char rna_path[], int array_index, int group_mode)
 
void BKE_keyingsets_copy (struct ListBase *newlist, const struct ListBase *list)
 
void BKE_keyingsets_foreach_id (struct LibraryForeachIDData *data, const struct ListBase *keyingsets)
 
void BKE_keyingset_free_path (struct KeyingSet *ks, struct KS_Path *ksp)
 
void BKE_keyingset_free (struct KeyingSet *ks)
 
void BKE_keyingsets_free (struct ListBase *list)
 
void BKE_keyingsets_blend_write (struct BlendWriter *writer, struct ListBase *list)
 
void BKE_keyingsets_blend_read_data (struct BlendDataReader *reader, struct ListBase *list)
 
void BKE_keyingsets_blend_read_lib (struct BlendLibReader *reader, struct ID *id, struct ListBase *list)
 
void BKE_keyingsets_blend_read_expand (struct BlendExpander *expander, struct ListBase *list)
 
char * BKE_animsys_fix_rna_path_rename (struct ID *owner_id, char *old_path, const char *prefix, const char *oldName, const char *newName, int oldSubscript, int newSubscript, bool verify_paths)
 
void BKE_action_fix_paths_rename (struct ID *owner_id, struct bAction *act, const char *prefix, const char *oldName, const char *newName, int oldSubscript, int newSubscript, bool verify_paths)
 
void BKE_animdata_fix_paths_rename (struct ID *owner_id, struct AnimData *adt, struct ID *ref_id, const char *prefix, const char *oldName, const char *newName, int oldSubscript, int newSubscript, bool verify_paths)
 
void BKE_animdata_fix_paths_rename_all_ex (struct Main *bmain, struct ID *ref_id, const char *prefix, const char *oldName, const char *newName, int oldSubscript, int newSubscript, bool verify_paths)
 
void BKE_animdata_fix_paths_rename_all (struct ID *ref_id, const char *prefix, const char *oldName, const char *newName)
 
bool BKE_animdata_fix_paths_remove (struct ID *id, const char *path)
 
void BKE_animdata_transfer_by_basepath (struct Main *bmain, struct ID *srcID, struct ID *dstID, struct ListBase *basepaths)
 
void BKE_animdata_main_cb (struct Main *bmain, ID_AnimData_Edit_Callback func, void *user_data)
 
void BKE_fcurves_main_cb (struct Main *bmain, ID_FCurve_Edit_Callback func, void *user_data)
 
void BKE_fcurves_id_cb (struct ID *id, ID_FCurve_Edit_Callback func, void *user_data)
 
struct NlaKeyframingContextBKE_animsys_get_nla_keyframing_context (struct ListBase *cache, struct PointerRNA *ptr, struct AnimData *adt, const struct AnimationEvalContext *anim_eval_context)
 
void BKE_animsys_nla_remap_keyframe_values (struct NlaKeyframingContext *context, struct PointerRNA *prop_ptr, struct PropertyRNA *prop, float *values, int count, int index, const struct AnimationEvalContext *anim_eval_context, bool *r_force_all, BLI_bitmap *r_successful_remaps)
 
void BKE_animsys_free_nla_keyframing_context_cache (struct ListBase *cache)
 
bool BKE_animsys_rna_path_resolve (struct PointerRNA *ptr, const char *rna_path, int array_index, struct PathResolvedRNA *r_result)
 
bool BKE_animsys_read_from_rna_path (struct PathResolvedRNA *anim_rna, float *r_value)
 
bool BKE_animsys_write_to_rna_path (struct PathResolvedRNA *anim_rna, float value)
 
void BKE_animsys_evaluate_animdata (struct ID *id, struct AnimData *adt, const struct AnimationEvalContext *anim_eval_context, eAnimData_Recalc recalc, bool flush_to_original)
 
void BKE_animsys_evaluate_all_animation (struct Main *main, struct Depsgraph *depsgraph, float ctime)
 
void animsys_evaluate_action (struct PointerRNA *ptr, struct bAction *act, const struct AnimationEvalContext *anim_eval_context, bool flush_to_original)
 
void animsys_blend_in_action (struct PointerRNA *ptr, struct bAction *act, const AnimationEvalContext *anim_eval_context, float blend_factor)
 
void animsys_evaluate_action_group (struct PointerRNA *ptr, struct bAction *act, struct bActionGroup *agrp, const struct AnimationEvalContext *anim_eval_context)
 
void BKE_animsys_eval_animdata (struct Depsgraph *depsgraph, struct ID *id)
 
void BKE_animsys_eval_driver (struct Depsgraph *depsgraph, struct ID *id, int driver_index, struct FCurve *fcu_orig)
 
void BKE_animsys_update_driver_array (struct ID *id)
 

Typedef Documentation

◆ AnimationBasePathChange

◆ AnimationEvalContext

◆ eAnimData_Recalc

◆ ID_AnimData_Edit_Callback

typedef void(* ID_AnimData_Edit_Callback) (struct ID *id, struct AnimData *adt, void *user_data)

Definition at line 218 of file BKE_animsys.h.

◆ ID_FCurve_Edit_Callback

typedef void(* ID_FCurve_Edit_Callback) (struct ID *id, struct FCurve *fcu, void *user_data)

Definition at line 221 of file BKE_animsys.h.

◆ NlaKeyframingContext

Definition at line 230 of file BKE_animsys.h.

Enumeration Type Documentation

◆ eAnimData_Recalc

Enumerator
ADT_RECALC_DRIVERS 
ADT_RECALC_ANIM 
ADT_RECALC_ALL 

Definition at line 288 of file BKE_animsys.h.

Function Documentation

◆ animsys_blend_in_action()

void animsys_blend_in_action ( struct PointerRNA ptr,
struct bAction act,
const AnimationEvalContext anim_eval_context,
float  blend_factor 
)

◆ animsys_evaluate_action()

void animsys_evaluate_action ( struct PointerRNA ptr,
struct bAction act,
const struct AnimationEvalContext anim_eval_context,
bool  flush_to_original 
)

◆ animsys_evaluate_action_group()

void animsys_evaluate_action_group ( struct PointerRNA ptr,
struct bAction act,
struct bActionGroup agrp,
const struct AnimationEvalContext anim_eval_context 
)

◆ BKE_action_fix_paths_rename()

void BKE_action_fix_paths_rename ( struct ID owner_id,
struct bAction act,
const char *  prefix,
const char *  oldName,
const char *  newName,
int  oldSubscript,
int  newSubscript,
bool  verify_paths 
)

Fix all the paths for the given ID + Action.

This is just an external wrapper for the F-Curve fixing function, with input validity checks on top of the basic method.

Note
it is assumed that the structure we're replacing is <prefix><["><name><"]> i.e. pose.bones["Bone"].

Definition at line 915 of file anim_data.c.

References BLI_array_alloca, BLI_sprintfN(), BLI_str_escape(), bAction::curves, ELEM, fcurves_path_rename_fix(), MEM_freeN, and NULL.

Referenced by constraint_bone_name_fix(), and joined_armature_fix_links_constraints().

◆ BKE_animdata_fix_paths_remove()

bool BKE_animdata_fix_paths_remove ( struct ID id,
const char *  path 
)

Fix the path after removing elements that are not ID (e.g., node). Return true if any animation data was affected.

Definition at line 1067 of file anim_data.c.

References AnimData::action, IdAdtTemplate::adt, bAction::curves, AnimData::drivers, fcurves_path_remove_fix(), id_can_have_animdata(), LISTBASE_FOREACH, AnimData::nla_tracks, nlastrips_path_remove_fix(), NULL, and AnimData::tmpact.

Referenced by clip_delete_plane_track(), clip_delete_track(), and nodeRemoveNode().

◆ BKE_animdata_fix_paths_rename()

void BKE_animdata_fix_paths_rename ( struct ID owner_id,
struct AnimData adt,
struct ID ref_id,
const char *  prefix,
const char *  oldName,
const char *  newName,
int  oldSubscript,
int  newSubscript,
bool  verify_paths 
)

Fix all the paths for the given ID+AnimData

Note
it is assumed that the structure we're replacing is <prefix><["><name><"]> i.e. pose.bones["Bone"].

Definition at line 958 of file anim_data.c.

References AnimData::action, BLI_array_alloca, BLI_sprintfN(), BLI_str_escape(), bAction::curves, DEG_id_tag_update(), AnimData::drivers, drivers_path_rename_fix(), ELEM, fcurves_path_rename_fix(), ListBase::first, bAction::id, ID_RECALC_COPY_ON_WRITE, MEM_freeN, NlaTrack::next, AnimData::nla_tracks, nlastrips_path_rename_fix(), NULL, NlaTrack::strips, and AnimData::tmpact.

Referenced by SEQ_ensure_unique_name(), and texture_slot_move_exec().

◆ BKE_animdata_fix_paths_rename_all()

void BKE_animdata_fix_paths_rename_all ( struct ID ref_id,
const char *  prefix,
const char *  oldName,
const char *  newName 
)

◆ BKE_animdata_fix_paths_rename_all_ex()

void BKE_animdata_fix_paths_rename_all_ex ( struct Main bmain,
struct ID ref_id,
const char *  prefix,
const char *  oldName,
const char *  newName,
int  oldSubscript,
int  newSubscript,
bool  verify_paths 
)

◆ BKE_animdata_main_cb()

void BKE_animdata_main_cb ( struct Main bmain,
ID_AnimData_Edit_Callback  func,
void user_data 
)

◆ BKE_animdata_transfer_by_basepath()

void BKE_animdata_transfer_by_basepath ( struct Main bmain,
struct ID srcID,
struct ID dstID,
struct ListBase basepaths 
)

Move animation data from source to destination if its paths are based on basepaths.

Transfer the animation data from srcID to dstID where the srcID animation data is based off basepath, creating new AnimData and associated data as necessary.

Parameters
basepathsA list of AnimationBasePathChange.

Definition at line 601 of file anim_data.c.

References AnimData::action, action_move_fcurves_by_basepath(), animdata_move_drivers_by_basepath(), BKE_action_add(), BKE_animdata_action_ensure_idroot(), BKE_animdata_ensure_id(), BKE_animdata_from_id(), CLOG_ERROR, CLOG_WARN, DEG_id_tag_update(), AnimData::drivers, ELEM, ListBase::first, G, G_DEBUG, bAction::id, ID_RECALC_COPY_ON_WRITE, id_us_min(), LISTBASE_FOREACH, LOG, ID::name, and NULL.

Referenced by blender::ed::space_node::node_group_make_insert_selected(), blender::ed::space_node::node_group_separate_selected(), and blender::ed::space_node::node_group_ungroup().

◆ BKE_animsys_eval_animdata()

void BKE_animsys_eval_animdata ( struct Depsgraph depsgraph,
struct ID id 
)

◆ BKE_animsys_eval_context_construct()

AnimationEvalContext BKE_animsys_eval_context_construct ( struct Depsgraph depsgraph,
float  eval_time 
)

◆ BKE_animsys_eval_context_construct_at()

AnimationEvalContext BKE_animsys_eval_context_construct_at ( const AnimationEvalContext anim_eval_context,
float  eval_time 
)

◆ BKE_animsys_eval_driver()

void BKE_animsys_eval_driver ( struct Depsgraph depsgraph,
struct ID id,
int  driver_index,
struct FCurve fcu_orig 
)

◆ BKE_animsys_evaluate_all_animation()

void BKE_animsys_evaluate_all_animation ( struct Main main,
struct Depsgraph depsgraph,
float  ctime 
)

Evaluation of all ID-blocks with Animation Data blocks - Animation Data Only

This will evaluate only the animation info available in the animation data-blocks encountered. In order to enforce the system by which some settings controlled by a 'local' (i.e. belonging in the nearest ID-block that setting is related to, not a standard 'root') block are overridden by a larger 'user'

Definition at line 3985 of file anim_sys.c.

References ADT_RECALC_ANIM, BKE_animsys_eval_context_construct(), BLI_listbase_is_empty(), DEG_is_active(), depsgraph, EVAL_ANIM_IDS, EVAL_ANIM_NODETREE_IDS, G, G_DEBUG, id, and main().

Referenced by do_render_strip_seqbase().

◆ BKE_animsys_evaluate_animdata()

void BKE_animsys_evaluate_animdata ( struct ID id,
struct AnimData adt,
const struct AnimationEvalContext anim_eval_context,
eAnimData_Recalc  recalc,
bool  flush_to_original 
)

Evaluation loop for evaluation animation data

This assumes that the animation-data provided belongs to the ID block in question, and that the flags for which parts of the animation-data settings need to be recalculated have been set already by the depsgraph. Now, we use the recalculate.

Referenced by BKE_object_modifier_update_subframe(), BKE_object_where_is_calc_time(), ocean_bake_exec(), particle_system_update(), pose_clear_user_transforms_exec(), RE_RenderAnim(), seq_prefetch_frames(), seq_render_mask(), and what_does_obaction().

◆ BKE_animsys_fix_rna_path_rename()

char* BKE_animsys_fix_rna_path_rename ( struct ID owner_id,
char *  old_path,
const char *  prefix,
const char *  oldName,
const char *  newName,
int  oldSubscript,
int  newSubscript,
bool  verify_paths 
)

Get a "fixed" version of the given path old_path.

This is just an external wrapper for the RNA-Path fixing function, with input validity checks on top of the basic method.

Note
it is assumed that the structure we're replacing is <prefix><["><name><"]> i.e. pose.bones["Bone"].

Definition at line 860 of file anim_data.c.

References BLI_array_alloca, BLI_sprintfN(), BLI_str_escape(), CLOG_WARN, ELEM, G, G_DEBUG, LOG, MEM_freeN, NULL, result, and rna_path_rename_fix().

Referenced by gpencil_joined_fix_animdata_cb(), and joined_armature_fix_animdata_cb().

◆ BKE_animsys_free_nla_keyframing_context_cache()

void BKE_animsys_free_nla_keyframing_context_cache ( struct ListBase cache)

◆ BKE_animsys_get_nla_keyframing_context()

struct NlaKeyframingContext* BKE_animsys_get_nla_keyframing_context ( struct ListBase cache,
struct PointerRNA ptr,
struct AnimData adt,
const struct AnimationEvalContext anim_eval_context 
)

Prepare data necessary to compute correct keyframe values for NLA strips with non-Replace mode or influence different from 1.

Parameters
cacheList used to cache contexts for reuse when keying multiple channels in one operation.
ptrRNA pointer to the Object with the animation.
Returns
Keyframing context, or NULL if not necessary.

Referenced by achannel_setting_slider_cb(), achannel_setting_slider_shapekey_cb(), and nla_time_remap().

◆ BKE_animsys_nla_remap_keyframe_values()

void BKE_animsys_nla_remap_keyframe_values ( struct NlaKeyframingContext context,
struct PointerRNA prop_ptr,
struct PropertyRNA prop,
float values,
int  count,
int  index,
const struct AnimationEvalContext anim_eval_context,
bool r_force_all,
BLI_bitmap r_successful_remaps 
)

Apply correction from the NLA context to the values about to be keyframed.

Parameters
contextContext to use (may be NULL).
prop_ptrProperty about to be keyframed.
[in,out]valuesArray of property values to adjust.
countNumber of values in the array.
indexIndex of the element about to be updated, or -1.
[out]r_force_allSet to true if all channels must be inserted. May be NULL.
[out]r_successful_remapsBits will be enabled for indices that are both intended to be remapped and succeeded remapping. With both, it allows caller to check successfully remapped indices without having to explicitly check whether the index was intended to be remapped.

Create blended_snapshot and fill with input values.

Remove lower NLA stack effects.

Definition at line 3740 of file anim_sys.c.

References NlaEvalChannel::base_snapshot, BLI_assert, BLI_assert_msg, BLI_bitmap_copy_all(), BLI_BITMAP_ENABLE, BLI_BITMAP_NEW, BLI_bitmap_set_all(), BLI_BITMAP_TEST_BOOL, BLI_listbase_is_empty(), NlaEvalChannelSnapshot::channel, blender::compositor::context, count, ELEM, NlaEvalChannelSnapshot::length, LISTBASE_FOREACH_BACKWARD, MEM_freeN, NlaEvalChannel::mix_mode, NEC_MIX_QUATERNION, nlaeval_snapshot_ensure_channel(), nlaeval_snapshot_free_data(), nlaeval_snapshot_init(), nlaevalchan_verify_key(), nlasnapshot_blend_get_inverted_upper_snapshot(), nlasnapshot_blend_strip_get_inverted_lower_snapshot(), NLASTRIP_MODE_COMBINE, NLASTRIP_MODE_REPLACE, NULL, PointerRNA::owner_id, NlaEvalChannelKey::ptr, NlaValidMask::ptr, NlaEvalChannelSnapshot::remap_domain, RNA_id_pointer_create(), and NlaEvalChannelSnapshot::values.

Referenced by get_keyframe_values().

◆ BKE_animsys_read_from_rna_path()

bool BKE_animsys_read_from_rna_path ( struct PathResolvedRNA anim_rna,
float r_value 
)

◆ BKE_animsys_rna_path_resolve()

bool BKE_animsys_rna_path_resolve ( struct PointerRNA ptr,
const char *  rna_path,
int  array_index,
struct PathResolvedRNA r_result 
)

◆ BKE_animsys_update_driver_array()

void BKE_animsys_update_driver_array ( struct ID id)

◆ BKE_animsys_write_to_rna_path()

bool BKE_animsys_write_to_rna_path ( struct PathResolvedRNA anim_rna,
float  value 
)

◆ BKE_fcurves_id_cb()

void BKE_fcurves_id_cb ( struct ID id,
ID_FCurve_Edit_Callback  func,
void user_data 
)

◆ BKE_fcurves_main_cb()

void BKE_fcurves_main_cb ( struct Main bmain,
ID_FCurve_Edit_Callback  func,
void user_data 
)

Apply the given callback function on all F-Curves attached to data in main database.

Definition at line 1166 of file anim_data.c.

References adt_apply_all_fcurves_cb(), BKE_animdata_main_cb(), and user_data.

Referenced by do_versions_after_linking_270(), ED_armature_join_objects_exec(), and ED_gpencil_join_objects_exec().

◆ BKE_keyingset_add()

struct KeyingSet* BKE_keyingset_add ( struct ListBase list,
const char  idname[],
const char  name[],
short  flag,
short  keyingflag 
)

◆ BKE_keyingset_add_path()

struct KS_Path* BKE_keyingset_add_path ( struct KeyingSet ks,
struct ID id,
const char  group_name[],
const char  rna_path[],
int  array_index,
short  flag,
short  groupmode 
)

Add a path to a KeyingSet. Nothing is returned for now. Checks are performed to ensure that destination is appropriate for the KeyingSet in question

Definition at line 160 of file anim_sys.c.

References KS_Path::array_index, BKE_keyingset_find_path(), BLI_addtail(), BLI_strdup(), BLI_strncpy(), CLOG_ERROR, ELEM, KS_Path::flag, G, G_DEBUG, KS_Path::group, KS_Path::groupmode, GS, id, KS_Path::id, KS_Path::idtype, LOG, MEM_callocN, ID::name, NULL, KeyingSet::paths, and KS_Path::rna_path.

Referenced by add_keyingset_button_exec(), and do_outliner_keyingset_editop().

◆ BKE_keyingset_find_path()

struct KS_Path* BKE_keyingset_find_path ( struct KeyingSet ks,
struct ID id,
const char  group_name[],
const char  rna_path[],
int  array_index,
int  group_mode 
)

Find the destination matching the criteria given. TODO: do we want some method to perform partial matches too?

Referenced by do_outliner_keyingset_editop(), and remove_keyingset_button_exec().

◆ BKE_keyingset_free()

void BKE_keyingset_free ( struct KeyingSet ks)

◆ BKE_keyingset_free_path()

void BKE_keyingset_free_path ( struct KeyingSet ks,
struct KS_Path ksp 
)

◆ BKE_keyingsets_blend_read_data()

void BKE_keyingsets_blend_read_data ( struct BlendDataReader reader,
struct ListBase list 
)

Definition at line 319 of file anim_sys.c.

References BLO_read_data_address, BLO_read_list(), LISTBASE_FOREACH, and KeyingSet::paths.

Referenced by scene_blend_read_data().

◆ BKE_keyingsets_blend_read_expand()

void BKE_keyingsets_blend_read_expand ( struct BlendExpander expander,
struct ListBase list 
)

Definition at line 341 of file anim_sys.c.

References BLO_expand, LISTBASE_FOREACH, and KeyingSet::paths.

Referenced by scene_blend_read_expand().

◆ BKE_keyingsets_blend_read_lib()

void BKE_keyingsets_blend_read_lib ( struct BlendLibReader reader,
struct ID id,
struct ListBase list 
)

Definition at line 332 of file anim_sys.c.

References BLO_read_id_address, id, Library::id, ID::lib, LISTBASE_FOREACH, and KeyingSet::paths.

Referenced by scene_blend_read_lib().

◆ BKE_keyingsets_blend_write()

void BKE_keyingsets_blend_write ( struct BlendWriter writer,
struct ListBase list 
)

Definition at line 301 of file anim_sys.c.

References BLO_write_string(), BLO_write_struct, LISTBASE_FOREACH, and KeyingSet::paths.

Referenced by scene_blend_write().

◆ BKE_keyingsets_copy()

void BKE_keyingsets_copy ( struct ListBase newlist,
const struct ListBase list 
)

Referenced by scene_copy_data().

◆ BKE_keyingsets_foreach_id()

void BKE_keyingsets_foreach_id ( struct LibraryForeachIDData data,
const struct ListBase keyingsets 
)

Process the ID pointers inside a scene's keyingsets, in see BKE_lib_query.h for details.

Referenced by scene_foreach_id().

◆ BKE_keyingsets_free()

void BKE_keyingsets_free ( struct ListBase list)