Blender  V2.93
Macros | Functions | Variables
nla.c File Reference
#include <float.h>
#include <math.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "BLI_ghash.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
#include "BLI_string_utils.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "DNA_anim_types.h"
#include "DNA_scene_types.h"
#include "DNA_sound_types.h"
#include "DNA_speaker_types.h"
#include "BKE_action.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_nla.h"
#include "BKE_sound.h"
#include "BLO_read_write.h"
#include "RNA_access.h"
#include "nla_private.h"

Go to the source code of this file.

Macros

#define STASH_TRACK_NAME   DATA_("[Action Stash]")
 

Functions

void BKE_nlastrip_free (ListBase *strips, NlaStrip *strip, bool do_id_user)
 
void BKE_nlatrack_free (ListBase *tracks, NlaTrack *nlt, bool do_id_user)
 
void BKE_nla_tracks_free (ListBase *tracks, bool do_id_user)
 
NlaStripBKE_nlastrip_copy (Main *bmain, NlaStrip *strip, const bool use_same_action, const int flag)
 
NlaTrackBKE_nlatrack_copy (Main *bmain, NlaTrack *nlt, const bool use_same_actions, const int flag)
 
void BKE_nla_tracks_copy (Main *bmain, ListBase *dst, ListBase *src, const int flag)
 
NlaTrackBKE_nlatrack_add (AnimData *adt, NlaTrack *prev, const bool is_liboverride)
 
NlaStripBKE_nlastrip_new (bAction *act)
 
NlaStripBKE_nlastack_add_strip (AnimData *adt, bAction *act, const bool is_liboverride)
 
NlaStripBKE_nla_add_soundstrip (Main *bmain, Scene *scene, Speaker *speaker)
 
void BKE_nla_strip_foreach_id (NlaStrip *strip, LibraryForeachIDData *data)
 
static float nlastrip_get_frame_actionclip (NlaStrip *strip, float cframe, short mode)
 
static float nlastrip_get_frame_transition (NlaStrip *strip, float cframe, short mode)
 
float nlastrip_get_frame (NlaStrip *strip, float cframe, short mode)
 
float BKE_nla_tweakedit_remap (AnimData *adt, float cframe, short mode)
 
bool BKE_nlastrips_has_space (ListBase *strips, float start, float end)
 
void BKE_nlastrips_sort_strips (ListBase *strips)
 
bool BKE_nlastrips_add_strip (ListBase *strips, NlaStrip *strip)
 
void BKE_nlastrips_make_metas (ListBase *strips, bool is_temp)
 
void BKE_nlastrips_clear_metastrip (ListBase *strips, NlaStrip *strip)
 
void BKE_nlastrips_clear_metas (ListBase *strips, bool only_sel, bool only_temp)
 
bool BKE_nlameta_add_strip (NlaStrip *mstrip, NlaStrip *strip)
 
void BKE_nlameta_flush_transforms (NlaStrip *mstrip)
 
NlaTrackBKE_nlatrack_find_active (ListBase *tracks)
 
NlaTrackBKE_nlatrack_find_tweaked (AnimData *adt)
 
void BKE_nlatrack_solo_toggle (AnimData *adt, NlaTrack *nlt)
 
void BKE_nlatrack_set_active (ListBase *tracks, NlaTrack *nlt_a)
 
bool BKE_nlatrack_has_space (NlaTrack *nlt, float start, float end)
 
void BKE_nlatrack_sort_strips (NlaTrack *nlt)
 
bool BKE_nlatrack_add_strip (NlaTrack *nlt, NlaStrip *strip, const bool is_liboverride)
 
bool BKE_nlatrack_get_bounds (NlaTrack *nlt, float bounds[2])
 
bool BKE_nlatrack_is_nonlocal_in_liboverride (const ID *id, const NlaTrack *nlt)
 
NlaStripBKE_nlastrip_find_active (NlaTrack *nlt)
 
void BKE_nlastrip_set_active (AnimData *adt, NlaStrip *strip)
 
bool BKE_nlastrip_within_bounds (NlaStrip *strip, float min, float max)
 
static void nlastrip_fix_resize_overlaps (NlaStrip *strip)
 
void BKE_nlastrip_recalculate_bounds_sync_action (NlaStrip *strip)
 
void BKE_nlastrip_recalculate_bounds (NlaStrip *strip)
 
static bool nlastrip_is_first (AnimData *adt, NlaStrip *strip)
 
bool BKE_nlatrack_has_animated_strips (NlaTrack *nlt)
 
bool BKE_nlatracks_have_animated_strips (ListBase *tracks)
 
void BKE_nlastrip_validate_fcurves (NlaStrip *strip)
 
bool BKE_nlastrip_has_curves_for_property (const PointerRNA *ptr, const PropertyRNA *prop)
 
static bool nla_editbone_name_check (void *arg, const char *name)
 
void BKE_nlastrip_validate_name (AnimData *adt, NlaStrip *strip)
 
static void nlastrip_get_endpoint_overlaps (NlaStrip *strip, NlaTrack *track, float **start, float **end)
 
static void BKE_nlastrip_validate_autoblends (NlaTrack *nlt, NlaStrip *nls)
 
void BKE_nla_validate_state (AnimData *adt)
 
bool BKE_nla_action_is_stashed (AnimData *adt, bAction *act)
 
bool BKE_nla_action_stash (AnimData *adt, const bool is_liboverride)
 
void BKE_nla_action_pushdown (AnimData *adt, const bool is_liboverride)
 
bool BKE_nla_tweakmode_enter (AnimData *adt)
 
void BKE_nla_tweakmode_exit (AnimData *adt)
 
static void blend_write_nla_strips (BlendWriter *writer, ListBase *strips)
 
static void blend_data_read_nla_strips (BlendDataReader *reader, ListBase *strips)
 
static void blend_lib_read_nla_strips (BlendLibReader *reader, ID *id, ListBase *strips)
 
static void blend_read_expand_nla_strips (BlendExpander *expander, ListBase *strips)
 
void BKE_nla_blend_write (BlendWriter *writer, ListBase *tracks)
 
void BKE_nla_blend_read_data (BlendDataReader *reader, ListBase *tracks)
 
void BKE_nla_blend_read_lib (BlendLibReader *reader, ID *id, ListBase *tracks)
 
void BKE_nla_blend_read_expand (struct BlendExpander *expander, struct ListBase *tracks)
 

Variables

static CLG_LogRef LOG = {"bke.nla"}
 

Macro Definition Documentation

◆ STASH_TRACK_NAME

#define STASH_TRACK_NAME   DATA_("[Action Stash]")

Definition at line 1854 of file nla.c.

Function Documentation

◆ BKE_nla_action_is_stashed()

bool BKE_nla_action_is_stashed ( AnimData adt,
bAction act 
)

◆ BKE_nla_action_pushdown()

void BKE_nla_action_pushdown ( AnimData adt,
const bool  is_liboverride 
)

◆ BKE_nla_action_stash()

bool BKE_nla_action_stash ( AnimData adt,
const bool  is_liboverride 
)

◆ BKE_nla_add_soundstrip()

NlaStrip* BKE_nla_add_soundstrip ( Main bmain,
Scene scene,
Speaker speaker 
)

◆ BKE_nla_blend_read_data()

void BKE_nla_blend_read_data ( BlendDataReader reader,
ListBase tracks 
)

Definition at line 2284 of file nla.c.

References blend_data_read_nla_strips(), BLO_read_list(), LISTBASE_FOREACH, and tracks.

Referenced by BKE_animdata_blend_read_data().

◆ BKE_nla_blend_read_expand()

void BKE_nla_blend_read_expand ( struct BlendExpander expander,
struct ListBase tracks 
)

Definition at line 2308 of file nla.c.

References blend_read_expand_nla_strips(), LISTBASE_FOREACH, and tracks.

Referenced by BKE_animdata_blend_read_expand().

◆ BKE_nla_blend_read_lib()

void BKE_nla_blend_read_lib ( BlendLibReader reader,
ID id,
ListBase tracks 
)

◆ BKE_nla_blend_write()

void BKE_nla_blend_write ( BlendWriter writer,
ListBase tracks 
)

Definition at line 2272 of file nla.c.

References blend_write_nla_strips(), BLO_write_struct, LISTBASE_FOREACH, and tracks.

Referenced by BKE_animdata_blend_write().

◆ BKE_nla_strip_foreach_id()

void BKE_nla_strip_foreach_id ( NlaStrip strip,
LibraryForeachIDData data 
)

Callback used by lib_query to walk over all ID usages (mimics foreach_id callback of IDTypeInfo structure).

Definition at line 441 of file nla.c.

References NlaStrip::act, BKE_fcurve_foreach_id(), BKE_LIB_FOREACHID_PROCESS, BKE_nla_strip_foreach_id(), data, NlaStrip::fcurves, IDWALK_CB_USER, LISTBASE_FOREACH, and NlaStrip::strips.

Referenced by BKE_animdata_foreach_id(), and BKE_nla_strip_foreach_id().

◆ BKE_nla_tracks_copy()

void BKE_nla_tracks_copy ( Main bmain,
ListBase dst,
ListBase src,
const int  flag 
)

Copy all NLA data.

Parameters
flagControl ID pointers management, see LIB_ID_CREATE_.../LIB_ID_COPY_... flags in BKE_lib_id.h

Definition at line 257 of file nla.c.

References BKE_nlatrack_copy(), BLI_addtail(), BLI_listbase_clear(), ELEM, ListBase::first, NlaTrack::next, and NULL.

Referenced by BKE_animdata_copy(), and BKE_animdata_merge_copy().

◆ BKE_nla_tracks_free()

void BKE_nla_tracks_free ( ListBase tracks,
bool  do_id_user 
)

Definition at line 141 of file nla.c.

References BKE_nlatrack_free(), BLI_listbase_clear(), ELEM, ListBase::first, NlaTrack::next, NULL, and tracks.

Referenced by BKE_animdata_free().

◆ BKE_nla_tweakedit_remap()

float BKE_nla_tweakedit_remap ( AnimData adt,
float  cframe,
short  mode 
)

◆ BKE_nla_tweakmode_enter()

bool BKE_nla_tweakmode_enter ( AnimData adt)

◆ BKE_nla_tweakmode_exit()

void BKE_nla_tweakmode_exit ( AnimData adt)

◆ BKE_nla_validate_state()

void BKE_nla_validate_state ( AnimData adt)

◆ BKE_nlameta_add_strip()

bool BKE_nlameta_add_strip ( NlaStrip mstrip,
NlaStrip strip 
)

◆ BKE_nlameta_flush_transforms()

void BKE_nlameta_flush_transforms ( NlaStrip mstrip)

◆ BKE_nlastack_add_strip()

NlaStrip* BKE_nlastack_add_strip ( AnimData adt,
bAction act,
const bool  is_liboverride 
)

◆ BKE_nlastrip_copy()

NlaStrip* BKE_nlastrip_copy ( Main bmain,
NlaStrip strip,
const bool  use_same_action,
const int  flag 
)

Copy NLA strip

Parameters
use_same_actionWhen true, the existing action is used (instead of being duplicated)
flagControl ID pointers management, see LIB_ID_CREATE_.../LIB_ID_COPY_... flags in BKE_lib_id.h

Definition at line 169 of file nla.c.

References NlaStrip::act, BKE_fcurves_copy(), BKE_id_copy_ex(), BKE_nlastrip_copy(), BLI_addtail(), BLI_listbase_clear(), copy_fmodifiers(), NlaStrip::fcurves, ListBase::first, bAction::id, id_us_plus(), LIB_ID_CREATE_NO_USER_REFCOUNT, MEM_dupallocN, NlaStrip::modifiers, NlaStrip::next, NULL, NlaStrip::prev, and NlaStrip::strips.

Referenced by BKE_nlastrip_copy(), BKE_nlatrack_copy(), nlaedit_duplicate_exec(), and nlaedit_split_strip_actclip().

◆ BKE_nlastrip_find_active()

NlaStrip* BKE_nlastrip_find_active ( NlaTrack nlt)

◆ BKE_nlastrip_free()

void BKE_nlastrip_free ( ListBase strips,
NlaStrip strip,
bool  do_id_user 
)

◆ BKE_nlastrip_has_curves_for_property()

bool BKE_nlastrip_has_curves_for_property ( const PointerRNA ptr,
const PropertyRNA prop 
)

Definition at line 1582 of file nla.c.

References ELEM, NULL, ptr, RNA_NlaStrip, RNA_struct_type_find_property(), and PointerRNA::type.

◆ BKE_nlastrip_new()

NlaStrip* BKE_nlastrip_new ( bAction act)

◆ BKE_nlastrip_recalculate_bounds()

void BKE_nlastrip_recalculate_bounds ( NlaStrip strip)

◆ BKE_nlastrip_recalculate_bounds_sync_action()

void BKE_nlastrip_recalculate_bounds_sync_action ( NlaStrip strip)

Recalculate the start and end frames for the strip to match the bounds of its action such that the overall NLA animation result is unchanged.

Definition at line 1389 of file nla.c.

References NlaStrip::act, NlaStrip::actend, NlaStrip::actstart, BKE_nlastrip_recalculate_bounds(), calc_action_range(), NLASTRIP_TYPE_CLIP, NULL, NlaStrip::scale, NlaStrip::start, and NlaStrip::type.

Referenced by animsys_create_tweak_strip(), BKE_nla_tweakmode_exit(), and nlaedit_sync_actlen_exec().

◆ BKE_nlastrip_set_active()

void BKE_nlastrip_set_active ( AnimData adt,
NlaStrip strip 
)

◆ BKE_nlastrip_validate_autoblends()

static void BKE_nlastrip_validate_autoblends ( NlaTrack nlt,
NlaStrip nls 
)
static

◆ BKE_nlastrip_validate_fcurves()

void BKE_nlastrip_validate_fcurves ( NlaStrip strip)

◆ BKE_nlastrip_validate_name()

void BKE_nlastrip_validate_name ( AnimData adt,
NlaStrip strip 
)

◆ BKE_nlastrip_within_bounds()

bool BKE_nlastrip_within_bounds ( NlaStrip strip,
float  min,
float  max 
)

◆ BKE_nlastrips_add_strip()

bool BKE_nlastrips_add_strip ( ListBase strips,
NlaStrip strip 
)

◆ BKE_nlastrips_clear_metas()

void BKE_nlastrips_clear_metas ( ListBase strips,
bool  only_sel,
bool  only_temp 
)

◆ BKE_nlastrips_clear_metastrip()

void BKE_nlastrips_clear_metastrip ( ListBase strips,
NlaStrip strip 
)

◆ BKE_nlastrips_has_space()

bool BKE_nlastrips_has_space ( ListBase strips,
float  start,
float  end 
)

◆ BKE_nlastrips_make_metas()

void BKE_nlastrips_make_metas ( ListBase strips,
bool  is_temp 
)

◆ BKE_nlastrips_sort_strips()

void BKE_nlastrips_sort_strips ( ListBase strips)

◆ BKE_nlatrack_add()

NlaTrack* BKE_nlatrack_add ( AnimData adt,
NlaTrack prev,
const bool  is_liboverride 
)

◆ BKE_nlatrack_add_strip()

bool BKE_nlatrack_add_strip ( NlaTrack nlt,
NlaStrip strip,
const bool  is_liboverride 
)

◆ BKE_nlatrack_copy()

NlaTrack* BKE_nlatrack_copy ( Main bmain,
NlaTrack nlt,
const bool  use_same_actions,
const int  flag 
)

Copy a single NLA Track.

Parameters
flagControl ID pointers management, see LIB_ID_CREATE_.../LIB_ID_COPY_... flags in BKE_lib_id.h

Definition at line 223 of file nla.c.

References BKE_nlastrip_copy(), BLI_addtail(), BLI_listbase_clear(), ListBase::first, MEM_dupallocN, NlaStrip::next, NlaTrack::next, NULL, NlaTrack::prev, and NlaTrack::strips.

Referenced by BKE_nla_tracks_copy().

◆ BKE_nlatrack_find_active()

NlaTrack* BKE_nlatrack_find_active ( ListBase tracks)

Definition at line 995 of file nla.c.

References ELEM, ListBase::first, NlaTrack::flag, NlaTrack::next, NLATRACK_ACTIVE, NULL, and tracks.

Referenced by BKE_nla_tweakedit_remap().

◆ BKE_nlatrack_find_tweaked()

NlaTrack* BKE_nlatrack_find_tweaked ( AnimData adt)

◆ BKE_nlatrack_free()

void BKE_nlatrack_free ( ListBase tracks,
NlaTrack nlt,
bool  do_id_user 
)

◆ BKE_nlatrack_get_bounds()

bool BKE_nlatrack_get_bounds ( NlaTrack nlt,
float  bounds[2] 
)

◆ BKE_nlatrack_has_animated_strips()

bool BKE_nlatrack_has_animated_strips ( NlaTrack nlt)

◆ BKE_nlatrack_has_space()

bool BKE_nlatrack_has_space ( NlaTrack nlt,
float  start,
float  end 
)

◆ BKE_nlatrack_is_nonlocal_in_liboverride()

bool BKE_nlatrack_is_nonlocal_in_liboverride ( const ID id,
const NlaTrack nlt 
)

Check whether given NLA track is not local (i.e. from linked data) when the object is a library override.

Parameters
nltMay be NULL, in which case we consider it as a non-local track case.

Definition at line 1204 of file nla.c.

References NlaTrack::flag, ID_IS_OVERRIDE_LIBRARY, NLATRACK_OVERRIDELIBRARY_LOCAL, and NULL.

◆ BKE_nlatrack_set_active()

void BKE_nlatrack_set_active ( ListBase tracks,
NlaTrack nlt_a 
)

Definition at line 1091 of file nla.c.

References ELEM, ListBase::first, NlaTrack::flag, NlaTrack::next, NLATRACK_ACTIVE, NULL, and tracks.

Referenced by BKE_nlatrack_add().

◆ BKE_nlatrack_solo_toggle()

void BKE_nlatrack_solo_toggle ( AnimData adt,
NlaTrack nlt 
)

◆ BKE_nlatrack_sort_strips()

void BKE_nlatrack_sort_strips ( NlaTrack nlt)

Definition at line 1135 of file nla.c.

References BKE_nlastrips_sort_strips(), ELEM, ListBase::first, NULL, and NlaTrack::strips.

Referenced by special_aftertrans_update__nla().

◆ BKE_nlatracks_have_animated_strips()

bool BKE_nlatracks_have_animated_strips ( ListBase tracks)

Definition at line 1495 of file nla.c.

References BKE_nlatrack_has_animated_strips(), ELEM, ListBase::first, NlaTrack::next, NULL, and tracks.

◆ blend_data_read_nla_strips()

static void blend_data_read_nla_strips ( BlendDataReader reader,
ListBase strips 
)
static

◆ blend_lib_read_nla_strips()

static void blend_lib_read_nla_strips ( BlendLibReader reader,
ID id,
ListBase strips 
)
static

Definition at line 2241 of file nla.c.

References BKE_fcurve_blend_read_lib(), BLO_read_id_address, id, ID::lib, and LISTBASE_FOREACH.

Referenced by BKE_nla_blend_read_lib().

◆ blend_read_expand_nla_strips()

static void blend_read_expand_nla_strips ( BlendExpander expander,
ListBase strips 
)
static

◆ blend_write_nla_strips()

static void blend_write_nla_strips ( BlendWriter writer,
ListBase strips 
)
static

◆ nla_editbone_name_check()

static bool nla_editbone_name_check ( void *  arg,
const char *  name 
)
static

Definition at line 1616 of file nla.c.

References BLI_ghash_haskey().

Referenced by BKE_nlastrip_validate_name().

◆ nlastrip_fix_resize_overlaps()

static void nlastrip_fix_resize_overlaps ( NlaStrip strip)
static

◆ nlastrip_get_endpoint_overlaps()

static void nlastrip_get_endpoint_overlaps ( NlaStrip strip,
NlaTrack track,
float **  start,
float **  end 
)
static

◆ nlastrip_get_frame()

float nlastrip_get_frame ( NlaStrip strip,
float  cframe,
short  mode 
)

◆ nlastrip_get_frame_actionclip()

static float nlastrip_get_frame_actionclip ( NlaStrip strip,
float  cframe,
short  mode 
)
static

◆ nlastrip_get_frame_transition()

static float nlastrip_get_frame_transition ( NlaStrip strip,
float  cframe,
short  mode 
)
static

◆ nlastrip_is_first()

static bool nlastrip_is_first ( AnimData adt,
NlaStrip strip 
)
static

Variable Documentation

◆ LOG

CLG_LogRef LOG = {"bke.nla"}
static

Definition at line 62 of file nla.c.

Referenced by BKE_nla_action_pushdown(), and BKE_nla_action_stash().