Blender  V2.93
Macros | Functions | Variables
anim_sys.c File Reference
#include <float.h>
#include <math.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "BLI_alloca.h"
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
#include "BLI_listbase.h"
#include "BLI_math_rotation.h"
#include "BLI_math_vector.h"
#include "BLI_string_utils.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "DNA_anim_types.h"
#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_texture_types.h"
#include "DNA_world_types.h"
#include "BKE_action.h"
#include "BKE_anim_data.h"
#include "BKE_animsys.h"
#include "BKE_context.h"
#include "BKE_fcurve.h"
#include "BKE_global.h"
#include "BKE_lib_id.h"
#include "BKE_lib_query.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_nla.h"
#include "BKE_node.h"
#include "BKE_report.h"
#include "BKE_texture.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "RNA_access.h"
#include "BLO_read_write.h"
#include "nla_private.h"
#include "atomic_ops.h"
#include "CLG_log.h"

Go to the source code of this file.

Macros

#define ANIMSYS_FLOAT_AS_BOOL(value)   ((value) > ((1.0f - FLT_EPSILON)))
 
#define EVAL_ANIM_IDS(first, aflag)
 
#define EVAL_ANIM_NODETREE_IDS(first, NtId_Type, aflag)
 

Functions

KS_PathBKE_keyingset_find_path (KeyingSet *ks, ID *id, const char group_name[], const char rna_path[], int array_index, int UNUSED(group_mode))
 
KeyingSetBKE_keyingset_add (ListBase *list, const char idname[], const char name[], short flag, short keyingflag)
 
KS_PathBKE_keyingset_add_path (KeyingSet *ks, ID *id, const char group_name[], const char rna_path[], int array_index, short flag, short groupmode)
 
void BKE_keyingset_free_path (KeyingSet *ks, KS_Path *ksp)
 
void BKE_keyingsets_copy (ListBase *newlist, const ListBase *list)
 
void BKE_keyingsets_foreach_id (LibraryForeachIDData *data, const ListBase *keyingsets)
 
void BKE_keyingset_free (KeyingSet *ks)
 
void BKE_keyingsets_free (ListBase *list)
 
void BKE_keyingsets_blend_write (BlendWriter *writer, ListBase *list)
 
void BKE_keyingsets_blend_read_data (BlendDataReader *reader, ListBase *list)
 
void BKE_keyingsets_blend_read_lib (BlendLibReader *reader, ID *id, ListBase *list)
 
void BKE_keyingsets_blend_read_expand (BlendExpander *expander, ListBase *list)
 
static bool is_fcurve_evaluatable (FCurve *fcu)
 
bool BKE_animsys_rna_path_resolve (PointerRNA *ptr, const char *rna_path, const int array_index, PathResolvedRNA *r_result)
 
bool BKE_animsys_read_from_rna_path (PathResolvedRNA *anim_rna, float *r_value)
 
bool BKE_animsys_write_to_rna_path (PathResolvedRNA *anim_rna, const float value)
 
static bool animsys_construct_orig_pointer_rna (const PointerRNA *ptr, PointerRNA *ptr_orig)
 
static void animsys_write_orig_anim_rna (PointerRNA *ptr, const char *rna_path, int array_index, float value)
 
static void animsys_evaluate_fcurves (PointerRNA *ptr, ListBase *list, const AnimationEvalContext *anim_eval_context, bool flush_to_original)
 
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)
 
static void animsys_evaluate_drivers (PointerRNA *ptr, AnimData *adt, const AnimationEvalContext *anim_eval_context)
 
static void action_idcode_patch_check (ID *id, bAction *act)
 
void animsys_evaluate_action_group (PointerRNA *ptr, bAction *act, bActionGroup *agrp, const AnimationEvalContext *anim_eval_context)
 
void animsys_evaluate_action (PointerRNA *ptr, bAction *act, const AnimationEvalContext *anim_eval_context, const bool flush_to_original)
 
static float nlastrip_get_influence (NlaStrip *strip, float cframe)
 
static void nlastrip_evaluate_controls (NlaStrip *strip, const AnimationEvalContext *anim_eval_context, const bool flush_to_original)
 
NlaEvalStripnlastrips_ctime_get_strip (ListBase *list, ListBase *strips, short index, const AnimationEvalContext *anim_eval_context, const bool flush_to_original)
 
static NlaEvalStripnlastrips_ctime_get_strip_single (ListBase *dst_list, NlaStrip *single_strip, const AnimationEvalContext *anim_eval_context, const bool flush_to_original)
 
static void nlavalidmask_init (NlaValidMask *mask, int bits)
 
static void nlavalidmask_free (NlaValidMask *mask)
 
static uint nlaevalchan_keyhash (const void *ptr)
 
static bool nlaevalchan_keycmp (const void *a, const void *b)
 
static NlaEvalChannelSnapshotnlaevalchan_snapshot_new (NlaEvalChannel *nec)
 
static void nlaevalchan_snapshot_free (NlaEvalChannelSnapshot *nec_snapshot)
 
static void nlaevalchan_snapshot_copy (NlaEvalChannelSnapshot *dst, const NlaEvalChannelSnapshot *src)
 
static void nlaeval_snapshot_init (NlaEvalSnapshot *snapshot, NlaEvalData *nlaeval, NlaEvalSnapshot *base)
 
static NlaEvalChannelSnapshotnlaeval_snapshot_get (NlaEvalSnapshot *snapshot, int index)
 
static void nlaeval_snapshot_ensure_size (NlaEvalSnapshot *snapshot, int size)
 
static NlaEvalChannelSnapshot ** nlaeval_snapshot_ensure_slot (NlaEvalSnapshot *snapshot, NlaEvalChannel *nec)
 
static NlaEvalChannelSnapshotnlaeval_snapshot_find_channel (NlaEvalSnapshot *snapshot, NlaEvalChannel *nec)
 
static NlaEvalChannelSnapshotnlaeval_snapshot_ensure_channel (NlaEvalSnapshot *snapshot, NlaEvalChannel *nec)
 
static void nlaeval_snapshot_free_data (NlaEvalSnapshot *snapshot)
 
static void nlaevalchan_free_data (NlaEvalChannel *nec)
 
static void nlaeval_init (NlaEvalData *nlaeval)
 
static void nlaeval_free (NlaEvalData *nlaeval)
 
static int nlaevalchan_validate_index (const NlaEvalChannel *nec, int index)
 
static bool nlaevalchan_validate_index_ex (const NlaEvalChannel *nec, const int array_index)
 
static void nlaevalchan_get_default_values (NlaEvalChannel *nec, float *r_values)
 
static char nlaevalchan_detect_mix_mode (NlaEvalChannelKey *key, int length)
 
static NlaEvalChannelnlaevalchan_verify_key (NlaEvalData *nlaeval, const char *path, NlaEvalChannelKey *key)
 
static NlaEvalChannelnlaevalchan_verify (PointerRNA *ptr, NlaEvalData *nlaeval, const char *path)
 
static float nla_blend_value (const int blendmode, const float lower_value, const float strip_value, const float influence)
 
static float nla_combine_value (const int mix_mode, float base_value, const float lower_value, const float strip_value, const float influence)
 
static bool nla_blend_get_inverted_strip_value (const int blendmode, const float lower_value, const float blended_value, const float influence, float *r_strip_value)
 
static bool nla_combine_get_inverted_strip_value (const int mix_mode, float base_value, const float lower_value, const float blended_value, const float influence, float *r_strip_value)
 
static void nla_combine_quaternion (const float lower_values[4], const float strip_values[4], const float influence, float r_blended_value[4])
 
static bool nla_combine_quaternion_get_inverted_strip_values (const float lower_values[4], const float blended_values[4], const float influence, float r_strip_values[4])
 
static void nlaeval_fmodifiers_join_stacks (ListBase *result, ListBase *list1, ListBase *list2)
 
static void nlaeval_fmodifiers_split_stacks (ListBase *list1, ListBase *list2)
 
static void nlasnapshot_from_action (PointerRNA *ptr, NlaEvalData *channels, ListBase *modifiers, bAction *action, const float evaltime, NlaEvalSnapshot *r_snapshot)
 
static void nlastrip_evaluate_actionclip (PointerRNA *ptr, NlaEvalData *channels, ListBase *modifiers, NlaEvalStrip *nes, NlaEvalSnapshot *snapshot)
 
static void nlastrip_evaluate_transition (PointerRNA *ptr, NlaEvalData *channels, ListBase *modifiers, NlaEvalStrip *nes, NlaEvalSnapshot *snapshot, const AnimationEvalContext *anim_eval_context, const bool flush_to_original)
 
static void nlastrip_evaluate_meta (PointerRNA *ptr, NlaEvalData *channels, ListBase *modifiers, NlaEvalStrip *nes, NlaEvalSnapshot *snapshot, const AnimationEvalContext *anim_eval_context, const bool flush_to_original)
 
void nlastrip_evaluate (PointerRNA *ptr, NlaEvalData *channels, ListBase *modifiers, NlaEvalStrip *nes, NlaEvalSnapshot *snapshot, const AnimationEvalContext *anim_eval_context, const bool flush_to_original)
 
void nladata_flush_channels (PointerRNA *ptr, NlaEvalData *channels, NlaEvalSnapshot *snapshot, const bool flush_to_original)
 
static void nla_eval_domain_action (PointerRNA *ptr, NlaEvalData *channels, bAction *act, GSet *touched_actions)
 
static void nla_eval_domain_strips (PointerRNA *ptr, NlaEvalData *channels, ListBase *strips, GSet *touched_actions)
 
static void animsys_evaluate_nla_domain (PointerRNA *ptr, NlaEvalData *channels, AnimData *adt)
 
static void animsys_create_tweak_strip (const AnimData *adt, const bool keyframing_to_strip, NlaStrip *r_tweak_strip)
 
static void animsys_create_action_track_strip (const AnimData *adt, const bool keyframing_to_strip, NlaStrip *r_action_strip)
 
static bool is_nlatrack_evaluatable (const AnimData *adt, const NlaTrack *nlt)
 
static bool is_action_track_evaluated_without_nla (const AnimData *adt, const bool any_strip_evaluated)
 
static NlaTracknlatrack_find_tweaked (const AnimData *adt)
 
static bool animsys_evaluate_nla_for_flush (NlaEvalData *echannels, PointerRNA *ptr, const AnimData *adt, const AnimationEvalContext *anim_eval_context, const bool flush_to_original)
 
static void animsys_evaluate_nla_for_keyframing (PointerRNA *ptr, const AnimData *adt, const AnimationEvalContext *anim_eval_context, NlaKeyframingContext *r_context)
 
static void animsys_calculate_nla (PointerRNA *ptr, AnimData *adt, const AnimationEvalContext *anim_eval_context, const bool flush_to_original)
 
void nlasnapshot_enable_all_blend_domain (NlaEvalSnapshot *snapshot)
 
void nlasnapshot_ensure_channels (NlaEvalData *eval_data, NlaEvalSnapshot *snapshot)
 
void nlasnapshot_blend (NlaEvalData *eval_data, NlaEvalSnapshot *lower_snapshot, NlaEvalSnapshot *upper_snapshot, const short upper_blendmode, const float upper_influence, NlaEvalSnapshot *r_blended_snapshot)
 
NlaKeyframingContextBKE_animsys_get_nla_keyframing_context (struct ListBase *cache, struct PointerRNA *ptr, struct AnimData *adt, const AnimationEvalContext *anim_eval_context)
 
bool BKE_animsys_nla_remap_keyframe_values (struct NlaKeyframingContext *context, struct PointerRNA *prop_ptr, struct PropertyRNA *prop, float *values, int count, int index, bool *r_force_all)
 
void BKE_animsys_free_nla_keyframing_context_cache (struct ListBase *cache)
 
static void animsys_evaluate_overrides (PointerRNA *ptr, AnimData *adt)
 
void BKE_animsys_evaluate_animdata (ID *id, AnimData *adt, const AnimationEvalContext *anim_eval_context, eAnimData_Recalc recalc, const bool flush_to_original)
 
void BKE_animsys_evaluate_all_animation (Main *main, Depsgraph *depsgraph, float ctime)
 
void BKE_animsys_eval_animdata (Depsgraph *depsgraph, ID *id)
 
void BKE_animsys_update_driver_array (ID *id)
 
void BKE_animsys_eval_driver (Depsgraph *depsgraph, ID *id, int driver_index, FCurve *fcu_orig)
 

Variables

static CLG_LogRef LOG = {"bke.anim_sys"}
 

Macro Definition Documentation

◆ ANIMSYS_FLOAT_AS_BOOL

#define ANIMSYS_FLOAT_AS_BOOL (   value)    ((value) > ((1.0f - FLT_EPSILON)))

Definition at line 436 of file anim_sys.c.

◆ EVAL_ANIM_IDS

#define EVAL_ANIM_IDS (   first,
  aflag 
)
Value:
for (id = first; id; id = id->next) { \
if (ID_REAL_USERS(id) > 0) { \
AnimData *adt = BKE_animdata_from_id(id); \
BKE_animsys_evaluate_animdata(id, adt, &anim_eval_context, aflag, flush_to_original); \
} \
} \
(void)0
struct AnimData * BKE_animdata_from_id(struct ID *id)
Definition: anim_data.c:96
#define ID_REAL_USERS(id)
Definition: DNA_ID.h:413
void * next
Definition: DNA_ID.h:274

◆ EVAL_ANIM_NODETREE_IDS

#define EVAL_ANIM_NODETREE_IDS (   first,
  NtId_Type,
  aflag 
)
Value:
for (id = first; id; id = id->next) { \
if (ID_REAL_USERS(id) > 0) { \
AnimData *adt = BKE_animdata_from_id(id); \
NtId_Type *ntp = (NtId_Type *)id; \
if (ntp->nodetree) { \
AnimData *adt2 = BKE_animdata_from_id((ID *)ntp->nodetree); \
BKE_animsys_evaluate_animdata( \
&ntp->nodetree->id, adt2, &anim_eval_context, ADT_RECALC_ANIM, flush_to_original); \
} \
BKE_animsys_evaluate_animdata(id, adt, &anim_eval_context, aflag, flush_to_original); \
} \
} \
(void)0
@ ADT_RECALC_ANIM
Definition: BKE_animsys.h:238
Definition: DNA_ID.h:273

Function Documentation

◆ action_idcode_patch_check()

static void action_idcode_patch_check ( ID id,
bAction act 
)
static

◆ animsys_calculate_nla()

static void animsys_calculate_nla ( PointerRNA ptr,
AnimData adt,
const AnimationEvalContext anim_eval_context,
const bool  flush_to_original 
)
static

◆ animsys_construct_orig_pointer_rna()

static bool animsys_construct_orig_pointer_rna ( const PointerRNA ptr,
PointerRNA ptr_orig 
)
static

◆ animsys_create_action_track_strip()

static void animsys_create_action_track_strip ( const AnimData adt,
const bool  keyframing_to_strip,
NlaStrip r_action_strip 
)
static

◆ animsys_create_tweak_strip()

static void animsys_create_tweak_strip ( const AnimData adt,
const bool  keyframing_to_strip,
NlaStrip r_tweak_strip 
)
static

Tweaked strip is evaluated differently from other strips. Adjacent strips are ignored and includes a workaround for when user is not editing in place.

Controls whether able to keyframe outside range of tweaked strip.

Definition at line 2112 of file anim_sys.c.

References AnimData::actstrip, ADT_NLA_EDIT_NOMAP, BKE_nlastrip_recalculate_bounds_sync_action(), NlaStrip::extendmode, NlaStrip::flag, AnimData::flag, NlaStrip::next, NLASTRIP_EXTEND_HOLD, NLASTRIP_EXTEND_NOTHING, NLASTRIP_FLAG_NO_TIME_MAP, NLASTRIP_FLAG_SYNC_LENGTH, NLASTRIP_FLAG_USR_TIME, NULL, and NlaStrip::prev.

Referenced by animsys_evaluate_nla_for_flush(), and animsys_evaluate_nla_for_keyframing().

◆ animsys_evaluate_action()

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

◆ animsys_evaluate_action_group()

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

◆ animsys_evaluate_drivers()

static void animsys_evaluate_drivers ( PointerRNA ptr,
AnimData adt,
const AnimationEvalContext anim_eval_context 
)
static

◆ animsys_evaluate_fcurves()

static void animsys_evaluate_fcurves ( PointerRNA ptr,
ListBase list,
const AnimationEvalContext anim_eval_context,
bool  flush_to_original 
)
static

Evaluate all the F-Curves in the given list This performs a set of standard checks. If extra checks are required, separate code should be used.

Definition at line 611 of file anim_sys.c.

References animsys_write_orig_anim_rna(), BKE_animsys_rna_path_resolve(), BKE_animsys_write_to_rna_path(), calculate_fcurve(), is_fcurve_evaluatable(), LISTBASE_FOREACH, and ptr.

Referenced by animsys_evaluate_action(), and nlastrip_evaluate_controls().

◆ animsys_evaluate_nla_domain()

static void animsys_evaluate_nla_domain ( PointerRNA ptr,
NlaEvalData channels,
AnimData adt 
)
static

Ensure that all channels touched by any of the actions in enabled tracks exist. This is necessary to ensure that evaluation result depends only on current frame.

Definition at line 2075 of file anim_sys.c.

References AnimData::action, ADT_NLA_SOLO_TRACK, BLI_gset_free(), BLI_gset_ptr_new(), AnimData::flag, LISTBASE_FOREACH, nla_eval_domain_action(), nla_eval_domain_strips(), AnimData::nla_tracks, NLATRACK_MUTED, NLATRACK_SOLO, NULL, and ptr.

Referenced by animsys_calculate_nla().

◆ animsys_evaluate_nla_for_flush()

static bool animsys_evaluate_nla_for_flush ( NlaEvalData echannels,
PointerRNA ptr,
const AnimData adt,
const AnimationEvalContext anim_eval_context,
const bool  flush_to_original 
)
static

NLA Evaluation function - values are calculated and stored in temporary "NlaEvalChannels"

Parameters
[out]echannelsEvaluation channels with calculated values

Append strip to evaluate for this track.

Tweaked strip is evaluated differently.

Definition at line 2280 of file anim_sys.c.

References animsys_create_action_track_strip(), animsys_create_tweak_strip(), BLI_freelistN(), NlaEvalData::eval_snapshot, ListBase::first, is_action_track_evaluated_without_nla(), is_nlatrack_evaluatable(), NlaEvalStrip::next, NlaTrack::next, AnimData::nla_tracks, nlastrip_evaluate(), nlastrips_ctime_get_strip(), nlastrips_ctime_get_strip_single(), nlatrack_find_tweaked(), NULL, ptr, NlaTrack::strips, and NlaEvalStrip::track.

Referenced by animsys_calculate_nla().

◆ animsys_evaluate_nla_for_keyframing()

static void animsys_evaluate_nla_for_keyframing ( PointerRNA ptr,
const AnimData adt,
const AnimationEvalContext anim_eval_context,
NlaKeyframingContext r_context 
)
static

◆ animsys_evaluate_overrides()

static void animsys_evaluate_overrides ( PointerRNA ptr,
AnimData adt 
)
static

◆ animsys_write_orig_anim_rna()

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

◆ BKE_animsys_eval_animdata()

void BKE_animsys_eval_animdata ( Depsgraph depsgraph,
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 ( Depsgraph depsgraph,
ID id,
int  driver_index,
FCurve fcu_orig 
)

◆ BKE_animsys_evaluate_all_animation()

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

◆ BKE_animsys_evaluate_animdata()

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

◆ BKE_animsys_free_nla_keyframing_context_cache()

void BKE_animsys_free_nla_keyframing_context_cache ( struct ListBase cache)

◆ BKE_animsys_get_nla_keyframing_context()

NlaKeyframingContext* BKE_animsys_get_nla_keyframing_context ( struct ListBase cache,
struct PointerRNA ptr,
struct AnimData adt,
const 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.

Definition at line 2600 of file anim_sys.c.

References NlaStrip::act, AnimData::act_blendmode, AnimData::act_influence, AnimData::action, NlaKeyframingContext::adt, ADT_NLA_EDIT_ON, ADT_NLA_EVAL_OFF, animsys_evaluate_nla_for_keyframing(), BLI_addtail(), BLI_assert, BLI_findptr(), ELEM, ListBase::first, AnimData::flag, NlaKeyframingContext::lower_eval_data, MEM_callocN, AnimData::nla_tracks, nlaeval_init(), NLASTRIP_MODE_REPLACE, NULL, ptr, and NlaKeyframingContext::strip.

◆ BKE_animsys_nla_remap_keyframe_values()

bool BKE_animsys_nla_remap_keyframe_values ( struct NlaKeyframingContext context,
struct PointerRNA prop_ptr,
struct PropertyRNA prop,
float values,
int  count,
int  index,
bool *  r_force_all 
)

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.
Returns
False if correction fails due to a division by zero, or null r_force_all when all channels are required.

Remove lower NLA stack effects.

Using the tweak strip's blended result and the lower snapshot value, we can solve for the tweak strip value it must evaluate to.

Definition at line 2648 of file anim_sys.c.

References NlaEvalChannel::base_snapshot, BLI_assert, context, count, ELEM, NlaEvalData::eval_snapshot, NlaEvalChannelSnapshot::length, NlaEvalChannel::mix_mode, NEC_MIX_QUATERNION, nla_blend_get_inverted_strip_value(), nla_combine_get_inverted_strip_value(), nla_combine_quaternion_get_inverted_strip_values(), nlaeval_snapshot_find_channel(), nlaevalchan_verify_key(), NLASTRIP_MODE_COMBINE, NLASTRIP_MODE_REPLACE, NULL, NlaEvalChannelKey::ptr, and NlaEvalChannelSnapshot::values.

Referenced by get_keyframe_values().

◆ BKE_animsys_read_from_rna_path()

bool BKE_animsys_read_from_rna_path ( PathResolvedRNA anim_rna,
float r_value 
)

◆ BKE_animsys_rna_path_resolve()

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

◆ BKE_animsys_update_driver_array()

void BKE_animsys_update_driver_array ( ID id)

◆ BKE_animsys_write_to_rna_path()

bool BKE_animsys_write_to_rna_path ( PathResolvedRNA anim_rna,
const float  value 
)

◆ BKE_keyingset_add()

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

◆ BKE_keyingset_add_path()

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

◆ BKE_keyingset_find_path()

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

◆ BKE_keyingset_free()

void BKE_keyingset_free ( KeyingSet ks)

◆ BKE_keyingset_free_path()

void BKE_keyingset_free_path ( KeyingSet ks,
KS_Path ksp 
)

◆ BKE_keyingsets_blend_read_data()

void BKE_keyingsets_blend_read_data ( BlendDataReader reader,
ListBase list 
)

Definition at line 341 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 ( BlendExpander expander,
ListBase list 
)

Definition at line 363 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 ( BlendLibReader reader,
ID id,
ListBase list 
)

Definition at line 354 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 ( BlendWriter writer,
ListBase list 
)

Definition at line 323 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 ( ListBase newlist,
const ListBase list 
)

◆ BKE_keyingsets_foreach_id()

void BKE_keyingsets_foreach_id ( LibraryForeachIDData data,
const ListBase keyingsets 
)

◆ BKE_keyingsets_free()

void BKE_keyingsets_free ( ListBase list)

◆ is_action_track_evaluated_without_nla()

static bool is_action_track_evaluated_without_nla ( const AnimData adt,
const bool  any_strip_evaluated 
)
static

Check for special case of non-pushed action being evaluated with no NLA influence (off and no strips evaluated) nor NLA interference (ensure NLA not soloing).

NLA settings interference.

Allow action track to evaluate as if there isn't any NLA data.

Definition at line 2230 of file anim_sys.c.

References AnimData::action, ADT_NLA_EDIT_ON, ADT_NLA_SOLO_TRACK, AnimData::flag, and NULL.

Referenced by animsys_evaluate_nla_for_flush(), and animsys_evaluate_nla_for_keyframing().

◆ is_fcurve_evaluatable()

static bool is_fcurve_evaluatable ( FCurve fcu)
static

◆ is_nlatrack_evaluatable()

static bool is_nlatrack_evaluatable ( const AnimData adt,
const NlaTrack nlt 
)
static

◆ nla_blend_get_inverted_strip_value()

static bool nla_blend_get_inverted_strip_value ( const int  blendmode,
const float  lower_value,
const float  blended_value,
const float  influence,
float r_strip_value 
)
static
Returns
true if solution exists and output is written to.

No solution if strip had 0 influence.

Math:

blended_value = inf * (lower_value * strip_value) + (1 - inf) * lower_value blended_value - (1 - inf) * lower_value = inf * (lower_value * strip_value) (blended_value - (1 - inf) * lower_value) / (inf * lower_value) = strip_value (blended_value - lower_value + inf * lower_value) / (inf * lower_value) = strip_value ((blended_value - lower_value) / (inf * lower_value)) + 1 = strip_value

strip_value = ((blended_value - lower_value) / (inf * lower_value)) + 1

Math:

blended_value = lower_value * (1.0f - inf) + (strip_value * inf) blended_value - lower_value * (1.0f - inf) = (strip_value * inf) (blended_value - lower_value * (1.0f - inf)) / inf = strip_value

strip_value = (blended_value - lower_value * (1.0f - inf)) / inf

Definition at line 1512 of file anim_sys.c.

References ATTR_FALLTHROUGH, BLI_assert, IS_EQF, NLASTRIP_MODE_ADD, NLASTRIP_MODE_COMBINE, NLASTRIP_MODE_MULTIPLY, and NLASTRIP_MODE_SUBTRACT.

Referenced by BKE_animsys_nla_remap_keyframe_values().

◆ nla_blend_value()

static float nla_blend_value ( const int  blendmode,
const float  lower_value,
const float  strip_value,
const float  influence 
)
static

◆ nla_combine_get_inverted_strip_value()

static bool nla_combine_get_inverted_strip_value ( const int  mix_mode,
float  base_value,
const float  lower_value,
const float  blended_value,
const float  influence,
float r_strip_value 
)
static
Returns
true if solution exists and output is written to.

Definition at line 1576 of file anim_sys.c.

References BLI_assert, IS_EQF, NEC_MIX_ADD, NEC_MIX_AXIS_ANGLE, NEC_MIX_MULTIPLY, and powf.

Referenced by BKE_animsys_nla_remap_keyframe_values().

◆ nla_combine_quaternion()

static void nla_combine_quaternion ( const float  lower_values[4],
const float  strip_values[4],
const float  influence,
float  r_blended_value[4] 
)
static

Accumulate quaternion channels for Combine mode according to influence.

Returns
blended_value = lower_values @ strip_values^infl

Definition at line 1622 of file anim_sys.c.

References mul_qt_qtqt(), normalize_qt_qt(), and pow_qt_fl_normalized().

Referenced by nlasnapshot_blend().

◆ nla_combine_quaternion_get_inverted_strip_values()

static bool nla_combine_quaternion_get_inverted_strip_values ( const float  lower_values[4],
const float  blended_values[4],
const float  influence,
float  r_strip_values[4] 
)
static
Returns
true if solution exists and output written to.

Definition at line 1637 of file anim_sys.c.

References invert_qt_normalized(), IS_EQF, mul_qt_qtqt(), normalize_qt_qt(), and pow_qt_fl_normalized().

Referenced by BKE_animsys_nla_remap_keyframe_values().

◆ nla_combine_value()

static float nla_combine_value ( const int  mix_mode,
float  base_value,
const float  lower_value,
const float  strip_value,
const float  influence 
)
static

Definition at line 1482 of file anim_sys.c.

References BLI_assert, IS_EQF, NEC_MIX_ADD, NEC_MIX_AXIS_ANGLE, NEC_MIX_MULTIPLY, and powf.

Referenced by nlasnapshot_blend().

◆ nla_eval_domain_action()

static void nla_eval_domain_action ( PointerRNA ptr,
NlaEvalData channels,
bAction act,
GSet touched_actions 
)
static

◆ nla_eval_domain_strips()

static void nla_eval_domain_strips ( PointerRNA ptr,
NlaEvalData channels,
ListBase strips,
GSet touched_actions 
)
static

Definition at line 2055 of file anim_sys.c.

References LISTBASE_FOREACH, nla_eval_domain_action(), and ptr.

Referenced by animsys_evaluate_nla_domain().

◆ nladata_flush_channels()

void nladata_flush_channels ( PointerRNA ptr,
NlaEvalData channels,
NlaEvalSnapshot snapshot,
const bool  flush_to_original 
)

The bitmask is set for all channels touched by NLA due to the domain() function. Channels touched by current set of evaluated strips will have a snapshot channel directly from the evaluation snapshot.

This function falls back to the default value if the snapshot channel doesn't exist. Thus channels, touched by NLA but not by the current set of evaluated strips, will be reset to default. If channel not touched by NLA then it's value is unchanged.

Definition at line 1980 of file anim_sys.c.

References animsys_write_orig_anim_rna(), BKE_animsys_write_to_rna_path(), BLI_BITMAP_TEST, NlaEvalData::channels, NlaEvalChannelSnapshot::length, LISTBASE_FOREACH, nlaeval_snapshot_find_channel(), NULL, PathResolvedRNA::prop_index, PathResolvedRNA::ptr, ptr, and NlaEvalChannelSnapshot::values.

Referenced by animsys_calculate_nla().

◆ nlaeval_fmodifiers_join_stacks()

static void nlaeval_fmodifiers_join_stacks ( ListBase result,
ListBase list1,
ListBase list2 
)
static

◆ nlaeval_fmodifiers_split_stacks()

static void nlaeval_fmodifiers_split_stacks ( ListBase list1,
ListBase list2 
)
static

◆ nlaeval_free()

static void nlaeval_free ( NlaEvalData nlaeval)
static

◆ nlaeval_init()

static void nlaeval_init ( NlaEvalData nlaeval)
static

◆ nlaeval_snapshot_ensure_channel()

static NlaEvalChannelSnapshot* nlaeval_snapshot_ensure_channel ( NlaEvalSnapshot snapshot,
NlaEvalChannel nec 
)
static

◆ nlaeval_snapshot_ensure_size()

static void nlaeval_snapshot_ensure_size ( NlaEvalSnapshot snapshot,
int  size 
)
static

◆ nlaeval_snapshot_ensure_slot()

static NlaEvalChannelSnapshot** nlaeval_snapshot_ensure_slot ( NlaEvalSnapshot snapshot,
NlaEvalChannel nec 
)
static

◆ nlaeval_snapshot_find_channel()

static NlaEvalChannelSnapshot* nlaeval_snapshot_find_channel ( NlaEvalSnapshot snapshot,
NlaEvalChannel nec 
)
static

◆ nlaeval_snapshot_free_data()

static void nlaeval_snapshot_free_data ( NlaEvalSnapshot snapshot)
static

◆ nlaeval_snapshot_get()

static NlaEvalChannelSnapshot* nlaeval_snapshot_get ( NlaEvalSnapshot snapshot,
int  index 
)
static

◆ nlaeval_snapshot_init()

static void nlaeval_snapshot_init ( NlaEvalSnapshot snapshot,
NlaEvalData nlaeval,
NlaEvalSnapshot base 
)
static

◆ nlaevalchan_detect_mix_mode()

static char nlaevalchan_detect_mix_mode ( NlaEvalChannelKey key,
int  length 
)
static

◆ nlaevalchan_free_data()

static void nlaevalchan_free_data ( NlaEvalChannel nec)
static

Definition at line 1174 of file anim_sys.c.

References NlaEvalChannel::domain, and nlavalidmask_free().

Referenced by nlaeval_free().

◆ nlaevalchan_get_default_values()

static void nlaevalchan_get_default_values ( NlaEvalChannel nec,
float r_values 
)
static

◆ nlaevalchan_keycmp()

static bool nlaevalchan_keycmp ( const void *  a,
const void *  b 
)
static

Definition at line 1032 of file anim_sys.c.

References A, Freestyle::a, and B.

Referenced by nlaeval_init().

◆ nlaevalchan_keyhash()

static uint nlaevalchan_keyhash ( const void *  ptr)
static

◆ nlaevalchan_snapshot_copy()

static void nlaevalchan_snapshot_copy ( NlaEvalChannelSnapshot dst,
const NlaEvalChannelSnapshot src 
)
static

◆ nlaevalchan_snapshot_free()

static void nlaevalchan_snapshot_free ( NlaEvalChannelSnapshot nec_snapshot)
static

◆ nlaevalchan_snapshot_new()

static NlaEvalChannelSnapshot* nlaevalchan_snapshot_new ( NlaEvalChannel nec)
static

◆ nlaevalchan_validate_index()

static int nlaevalchan_validate_index ( const NlaEvalChannel nec,
int  index 
)
static

Definition at line 1209 of file anim_sys.c.

References NlaEvalChannel::is_array.

Referenced by nla_eval_domain_action(), and nlaevalchan_validate_index_ex().

◆ nlaevalchan_validate_index_ex()

static bool nlaevalchan_validate_index_ex ( const NlaEvalChannel nec,
const int  array_index 
)
static

Although array_index comes from fcurve, that doesn't necessarily mean the property has that many elements.

Definition at line 1221 of file anim_sys.c.

References NlaEvalChannel::base_snapshot, CLOG_WARN, G, G_DEBUG, id, NlaEvalChannel::key, NlaEvalChannelSnapshot::length, LOG, ID::name, nlaevalchan_validate_index(), PointerRNA::owner_id, NlaEvalChannelKey::ptr, and NlaEvalChannel::rna_path.

Referenced by nlasnapshot_from_action().

◆ nlaevalchan_verify()

static NlaEvalChannel* nlaevalchan_verify ( PointerRNA ptr,
NlaEvalData nlaeval,
const char *  path 
)
static

◆ nlaevalchan_verify_key()

static NlaEvalChannel* nlaevalchan_verify_key ( NlaEvalData nlaeval,
const char *  path,
NlaEvalChannelKey key 
)
static

◆ nlasnapshot_blend()

void nlasnapshot_blend ( NlaEvalData eval_data,
NlaEvalSnapshot lower_snapshot,
NlaEvalSnapshot upper_snapshot,
const short  upper_blendmode,
const float  upper_influence,
NlaEvalSnapshot r_blended_snapshot 
)

Blends the lower_snapshot with the upper_snapshot into r_blended_snapshot according to the given upper_blendmode and upper_influence.

For upper_snapshot, blending limited to values in the blend_domain. For Replace blendmode, this allows the upper snapshot to have a location XYZ channel where only a subset of values are blended.

Blend with lower_snapshot's base or default.

Always copy lower_snapshot to result, irrelevant of whether upper_snapshot has a corresponding channel. This only matters when lower_snapshot not the same as r_blended_snapshot.

Definition at line 2517 of file anim_sys.c.

References NlaEvalSnapshot::base, NlaEvalChannelSnapshot::blend_domain, BLI_BITMAP_TEST_BOOL, NlaEvalData::channels, IS_EQF, length(), LISTBASE_FOREACH, NEC_MIX_QUATERNION, nla_blend_value(), nla_combine_quaternion(), nla_combine_value(), nlaeval_snapshot_ensure_channel(), nlaeval_snapshot_ensure_size(), nlaeval_snapshot_find_channel(), nlaeval_snapshot_get(), NLASTRIP_MODE_COMBINE, NULL, NlaEvalData::num_channels, NlaValidMask::ptr, and NlaEvalChannelSnapshot::values.

Referenced by nlastrip_evaluate_actionclip(), and nlastrip_evaluate_transition().

◆ nlasnapshot_enable_all_blend_domain()

void nlasnapshot_enable_all_blend_domain ( NlaEvalSnapshot snapshot)

◆ nlasnapshot_ensure_channels()

void nlasnapshot_ensure_channels ( NlaEvalData eval_data,
NlaEvalSnapshot snapshot 
)

◆ nlasnapshot_from_action()

static void nlasnapshot_from_action ( PointerRNA ptr,
NlaEvalData channels,
ListBase modifiers,
bAction action,
const float  evaltime,
NlaEvalSnapshot r_snapshot 
)
static

◆ nlastrip_evaluate()

void nlastrip_evaluate ( PointerRNA ptr,
NlaEvalData channels,
ListBase modifiers,
NlaEvalStrip nes,
NlaEvalSnapshot snapshot,
const AnimationEvalContext anim_eval_context,
const bool  flush_to_original 
)

◆ nlastrip_evaluate_actionclip()

static void nlastrip_evaluate_actionclip ( PointerRNA ptr,
NlaEvalData channels,
ListBase modifiers,
NlaEvalStrip nes,
NlaEvalSnapshot snapshot 
)
static

◆ nlastrip_evaluate_controls()

static void nlastrip_evaluate_controls ( NlaStrip strip,
const AnimationEvalContext anim_eval_context,
const bool  flush_to_original 
)
static

◆ nlastrip_evaluate_meta()

static void nlastrip_evaluate_meta ( PointerRNA ptr,
NlaEvalData channels,
ListBase modifiers,
NlaEvalStrip nes,
NlaEvalSnapshot snapshot,
const AnimationEvalContext anim_eval_context,
const bool  flush_to_original 
)
static

◆ nlastrip_evaluate_transition()

static void nlastrip_evaluate_transition ( PointerRNA ptr,
NlaEvalData channels,
ListBase modifiers,
NlaEvalStrip nes,
NlaEvalSnapshot snapshot,
const AnimationEvalContext anim_eval_context,
const bool  flush_to_original 
)
static

◆ nlastrip_get_influence()

static float nlastrip_get_influence ( NlaStrip strip,
float  cframe 
)
static

◆ nlastrips_ctime_get_strip()

NlaEvalStrip* nlastrips_ctime_get_strip ( ListBase list,
ListBase strips,
short  index,
const AnimationEvalContext anim_eval_context,
const bool  flush_to_original 
)

◆ nlastrips_ctime_get_strip_single()

static NlaEvalStrip* nlastrips_ctime_get_strip_single ( ListBase dst_list,
NlaStrip single_strip,
const AnimationEvalContext anim_eval_context,
const bool  flush_to_original 
)
static

◆ nlatrack_find_tweaked()

static NlaTrack* nlatrack_find_tweaked ( const AnimData adt)
static

XXX(Wayde Moss): BKE_nlatrack_find_tweaked() exists within nla.c, but it doesn't appear to work as expected. From animsys_evaluate_nla_for_flush(), it returns NULL in tweak mode. I'm not sure why. Preferably, it would be as simple as checking for (adt->act_Track == nlt) but that doesn't work either, neither does comparing indices.

This function is a temporary work around. The first disabled track is always the tweaked track.

Definition at line 2258 of file anim_sys.c.

References ListBase::first, NlaTrack::flag, NlaTrack::next, AnimData::nla_tracks, NLATRACK_DISABLED, and NULL.

Referenced by animsys_evaluate_nla_for_flush(), and animsys_evaluate_nla_for_keyframing().

◆ nlavalidmask_free()

static void nlavalidmask_free ( NlaValidMask mask)
static

Definition at line 1015 of file anim_sys.c.

References mask(), and MEM_freeN.

Referenced by nlaevalchan_free_data(), and nlaevalchan_snapshot_free().

◆ nlavalidmask_init()

static void nlavalidmask_init ( NlaValidMask mask,
int  bits 
)
static

Definition at line 1004 of file anim_sys.c.

References BLI_BITMAP_NEW, BLI_BITMAP_SIZE, and mask().

Referenced by nlaevalchan_snapshot_new(), and nlaevalchan_verify_key().

Variable Documentation

◆ LOG

CLG_LogRef LOG = {"bke.anim_sys"}
static