Blender V4.3
transform_convert_nla.cc File Reference
#include <cstdio>
#include "DNA_anim_types.h"
#include "DNA_space_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_math_matrix.h"
#include "BLI_math_vector.h"
#include "BKE_anim_data.hh"
#include "BKE_context.hh"
#include "BKE_nla.hh"
#include "ED_anim_api.hh"
#include "WM_api.hh"
#include "WM_types.hh"
#include "RNA_access.hh"
#include "RNA_prototypes.hh"
#include "transform.hh"
#include "transform_convert.hh"

Go to the source code of this file.

Classes

struct  TransDataNla
 
struct  IDGroupedTransData
 

Functions

static bool is_overlap (const float left_bound_a, const float right_bound_a, const float left_bound_b, const float right_bound_b)
 
static bool nlastrip_is_overlap (const NlaStrip *strip_a, const float offset_a, const NlaStrip *strip_b, const float offset_b)
 
static float transdata_get_time_shuffle_offset_side (ListBase *trans_datas, const bool shuffle_left)
 
static float transdata_get_time_shuffle_offset (ListBase *trans_datas)
 
static bool transdata_get_track_shuffle_offset_side (ListBase *trans_datas, const int shuffle_direction, int *r_total_offset)
 
static bool transdata_get_track_shuffle_offset (ListBase *trans_datas, int *r_track_offset)
 
Transform application to NLA strips
static void nlatrack_truncate_temporary_tracks (bAnimContext *ac)
 
static void applyTransformNLA_translation (PointerRNA *strip_rna_ptr, const TransDataNla *transdata)
 Applies a translation to the given NlaStrip.
 
static void applyTransformNLA_timeScale (PointerRNA *strip_rna_ptr, const float value)
 
static void nlastrip_overlap_reorder (TransDataNla *tdn, NlaStrip *strip)
 
static void nlastrip_flag_overlaps (NlaStrip *strip)
 
static void nlastrip_fix_overlapping (TransInfo *t, TransDataNla *tdn, NlaStrip *strip)
 
NLA Transform Creation
static void createTransNlaData (bContext *C, TransInfo *t)
 
static void recalcData_nla (TransInfo *t)
 
Special After Transform NLA
static void nlastrip_shuffle_transformed (TransDataContainer *tc, TransDataNla *first_trans_data)
 
static void special_aftertrans_update__nla (bContext *C, TransInfo *t)
 

Variables

TransConvertTypeInfo TransConvertType_NLA
 

Function Documentation

◆ applyTransformNLA_timeScale()

static void applyTransformNLA_timeScale ( PointerRNA * strip_rna_ptr,
const float value )
static

Definition at line 320 of file transform_convert_nla.cc.

References RNA_float_set().

Referenced by nlastrip_fix_overlapping().

◆ applyTransformNLA_translation()

static void applyTransformNLA_translation ( PointerRNA * strip_rna_ptr,
const TransDataNla * transdata )
static

Applies a translation to the given NlaStrip.

Parameters
strip_rna_ptrThe RNA pointer of the NLA strip to modify.
transdataThe transformation info structure.

Definition at line 308 of file transform_convert_nla.cc.

References TransDataNla::h1, TransDataNla::h2, and RNA_float_set().

Referenced by nlastrip_fix_overlapping().

◆ createTransNlaData()

◆ is_overlap()

static bool is_overlap ( const float left_bound_a,
const float right_bound_a,
const float left_bound_b,
const float right_bound_b )
static

Definition at line 67 of file transform_convert_nla.cc.

Referenced by BM_face_exists_overlap_subset(), and nlastrip_is_overlap().

◆ nlastrip_fix_overlapping()

static void nlastrip_fix_overlapping ( TransInfo * t,
TransDataNla * tdn,
NlaStrip * strip )
static

◆ nlastrip_flag_overlaps()

static void nlastrip_flag_overlaps ( NlaStrip * strip)
static

Flag overlaps with adjacent strips.

Since the strips are re-ordered as they're transformed, we only have to check adjacent strips for overlap instead of all of them.

Definition at line 342 of file transform_convert_nla.cc.

References NlaStrip::flag, NlaStrip::next, NLASTRIP_FLAG_INVALID_LOCATION, NLASTRIP_FLAG_SELECT, nlastrip_is_overlap(), and NlaStrip::prev.

Referenced by recalcData_nla().

◆ nlastrip_is_overlap()

static bool nlastrip_is_overlap ( const NlaStrip * strip_a,
const float offset_a,
const NlaStrip * strip_b,
const float offset_b )
static

◆ nlastrip_overlap_reorder()

static void nlastrip_overlap_reorder ( TransDataNla * tdn,
NlaStrip * strip )
static

Reorder strips for proper nla stack evaluation while dragging.

Definition at line 326 of file transform_convert_nla.cc.

References BLI_listbase_swaplinks(), TransDataNla::h1, NlaStrip::next, TransDataNla::nlt, NlaStrip::prev, NlaStrip::start, and NlaTrack::strips.

Referenced by recalcData_nla().

◆ nlastrip_shuffle_transformed()

◆ nlatrack_truncate_temporary_tracks()

static void nlatrack_truncate_temporary_tracks ( bAnimContext * ac)
static

◆ recalcData_nla()

◆ special_aftertrans_update__nla()

◆ transdata_get_time_shuffle_offset()

static float transdata_get_time_shuffle_offset ( ListBase * trans_datas)
static

Assumes strips to horizontally translate (shuffle) are tagged with NLASTRIP_FLAG_INVALID_LOCATION.

Returns
The minimal total signed offset that results in no overlaps between tagged strips and non-tagged strips.

Definition at line 141 of file transform_convert_nla.cc.

References BLI_assert, and transdata_get_time_shuffle_offset_side().

Referenced by nlastrip_shuffle_transformed().

◆ transdata_get_time_shuffle_offset_side()

static float transdata_get_time_shuffle_offset_side ( ListBase * trans_datas,
const bool shuffle_left )
static

Assumes strips to horizontally translate (shuffle) are tagged with NLASTRIP_FLAG_INVALID_LOCATION.

Returns
The total sided offset that results in no overlaps between tagged strips and non-tagged strips.

Definition at line 93 of file transform_convert_nla.cc.

References e, NlaStrip::end, IS_EQT, LISTBASE_FOREACH, NLASTRIP_FLAG_INVALID_LOCATION, nlastrip_is_overlap(), NLASTRIP_TYPE_TRANSITION, TransDataNla::nlt, NlaStrip::start, TransDataNla::strip, and NlaTrack::strips.

Referenced by transdata_get_time_shuffle_offset().

◆ transdata_get_track_shuffle_offset()

static bool transdata_get_track_shuffle_offset ( ListBase * trans_datas,
int * r_track_offset )
static

Assumes all of given trans_datas are part of the same ID.

Parameters
r_track_offsetThe minimal total signed offset that results in valid strip track-moves for all strips from trans_datas.
Returns
true if r_track_offset results in a valid offset, false if no solution exists in either direction.

Definition at line 218 of file transform_convert_nla.cc.

References abs(), and transdata_get_track_shuffle_offset_side().

Referenced by nlastrip_shuffle_transformed().

◆ transdata_get_track_shuffle_offset_side()

static bool transdata_get_track_shuffle_offset_side ( ListBase * trans_datas,
const int shuffle_direction,
int * r_total_offset )
static

Assumes all of given trans_datas are part of the same ID.

Parameters
shuffle_directionthe direction the strip is traveling. 1 is towards the bottom of the stack, -1 is away from it.
r_total_offsetThe minimal total signed offset that results in valid strip track-moves for all strips from trans_datas.
Returns
true if r_total_offset results in a valid offset, false if no solution exists in the desired direction.

Definition at line 163 of file transform_convert_nla.cc.

References BKE_animdata_from_id(), BKE_nlatrack_is_nonlocal_in_liboverride(), BLI_findlink(), BLI_listbase_is_empty(), LinkData::data, ListBase::first, NlaTrack::flag, TransDataNla::id, LISTBASE_FOREACH, AnimData::nla_tracks, NLATRACK_PROTECTED, and TransDataNla::trackIndex.

Referenced by transdata_get_track_shuffle_offset().

Variable Documentation

◆ TransConvertType_NLA

TransConvertTypeInfo TransConvertType_NLA
Initial value:
= {
}
@ T_2D_EDIT
Definition transform.hh:104
@ T_POINTS
Definition transform.hh:93
static void recalcData_nla(TransInfo *t)
static void createTransNlaData(bContext *C, TransInfo *t)
static void special_aftertrans_update__nla(bContext *C, TransInfo *t)

Definition at line 994 of file transform_convert_nla.cc.

Referenced by convert_type_get().