31#include "RNA_prototypes.hh"
71 const float right_bound_a,
72 const float left_bound_b,
73 const float right_bound_b)
75 return (left_bound_a < right_bound_b) && (right_bound_a > left_bound_b);
84 strip_a->
end + offset_a,
85 strip_b->
start + offset_b,
86 strip_b->
end + offset_b);
98 float total_offset = 0;
123 offset = shuffle_left ?
124 fmin(offset, non_xformed_strip->start - (xformed_strip->
end + total_offset)) :
125 fmax(offset, non_xformed_strip->end - (xformed_strip->
start + total_offset));
129 total_offset += offset;
130 }
while (!
IS_EQT(offset, 0.0f, 1
e-4));
151 return -offset_left < offset_right ? offset_left : offset_right;
167 const int shuffle_direction,
191 if (dst_track ==
nullptr) {
202 offset = shuffle_direction;
206 *r_total_offset += offset;
207 }
while (offset != 0);
229 if (down_valid && up_valid) {
230 if (offset_down <
abs(offset_up)) {
231 *r_track_offset = offset_down;
234 *r_track_offset = offset_up;
237 else if (down_valid) {
238 *r_track_offset = offset_down;
241 *r_track_offset = offset_up;
244 return down_valid || up_valid;
254 ListBase anim_data = {
nullptr,
nullptr};
262 ListBase *nla_tracks = &ale->adt->nla_tracks;
269 if (track->strips.first !=
nullptr) {
285 if (track->strips.first !=
nullptr) {
354 adj_strip = strip->
next;
376 for (
short iter = 0; iter <= iter_max; iter++) {
377 const bool p_exceeded = (prev !=
nullptr) && (tdn->
h1[0] < prev->end);
378 const bool n_exceeded = (
next !=
nullptr) && (tdn->
h2[0] >
next->start);
380 if ((p_exceeded && n_exceeded) || (iter == iter_max)) {
387 tdn->
h1[0] = prev->end;
392 tdn->
h2[0] = strip->
end;
395 else if (n_exceeded) {
397 float offset = tdn->
h2[0] -
next->start;
399 tdn->
h1[0] -= offset;
400 tdn->
h2[0] -= offset;
402 else if (p_exceeded) {
404 float offset = prev->end - tdn->
h1[0];
406 tdn->
h1[0] += offset;
407 tdn->
h2[0] += offset;
423 const float originalStripScale = tdn->
h1[2];
424 const float newStripScale = originalStripScale * t->
values_final[0];
433 printf(
"recalcData_nla: unsupported NLA transformation mode %d\n", t->
mode);
452 ListBase anim_data = {
nullptr,
nullptr};
526 "TransDataNla (NLA Editor)");
556 float center[3], yval;
567 tdn->
h1[0] = strip->start;
569 tdn->
h2[0] = strip->end;
571 tdn->
h1[2] = tdn->
h2[2] = strip->scale;
653 int delta_y1, delta_y2;
681 strip->
end = tdn->
h2[0];
711 strip->
end = tdn->
h2[0];
727 if (nlatrack_isliboverride) {
739 int delta = (delta_y2) ? delta_y2 : delta_y1;
752 int delta_new_tracks = delta;
757 CLAMP(delta_new_tracks, -1, 1);
758 dst_track = old_track;
760 while (delta_new_tracks < 0) {
761 dst_track = dst_track->
prev;
767 while (delta_new_tracks > 0) {
768 dst_track = dst_track->
next;
772 for (
int j = 0; j < -delta_new_tracks; j++) {
776 nla_tracks, (
NlaTrack *)nla_tracks->
first, new_track, is_liboverride);
777 dst_track = new_track;
780 for (
int j = 0; j < delta_new_tracks; j++) {
785 nla_tracks, (
NlaTrack *)nla_tracks->
last, new_track, is_liboverride);
786 dst_track = new_track;
790 if (dst_track ==
nullptr) {
791 dst_track = old_track;
795 if (dst_track != old_track) {
799 tdn->
nlt = dst_track;
833 ListBase grouped_trans_datas = {
nullptr,
nullptr};
858 if (group->id == tdn->
id) {
863 if (dst_group ==
nullptr) {
865 dst_group->
id = tdn->
id;
875 ListBase *trans_datas = &group->trans_datas;
878 int minimum_track_offset = 0;
880 if (minimum_track_offset != 0) {
894 trans_data->
nlt = dst_track;
898 printf(
"Cannot moved. Target track '%s' is locked. \n", trans_data->
nlt->
name);
905 trans_data->
nlt = old_track;
916 strip->
start += minimum_time_offset;
917 strip->
end += minimum_time_offset;
953 if (tdn->
strip ==
nullptr) {
960 ListBase anim_data = {
nullptr,
nullptr};
AnimData * BKE_animdata_from_id(const ID *id)
Main * CTX_data_main(const bContext *C)
void BKE_nlameta_flush_transforms(NlaStrip *mstrip)
bool BKE_nlatrack_add_strip(NlaTrack *nlt, NlaStrip *strip, bool is_liboverride)
void BKE_nlastrips_clear_metas(ListBase *strips, bool only_sel, bool only_temp)
struct NlaTrack * BKE_nlatrack_new()
NlaStrip * BKE_nlastrip_prev_in_track(NlaStrip *strip, bool skip_transitions)
void BKE_nlatrack_insert_after(ListBase *nla_tracks, NlaTrack *prev, NlaTrack *new_track, bool is_liboverride)
void BKE_nlatrack_set_active(ListBase *tracks, NlaTrack *nlt)
NlaStrip * BKE_nlastrip_next_in_track(NlaStrip *strip, bool skip_transitions)
void BKE_nlatrack_remove_strip(NlaTrack *track, NlaStrip *strip)
void BKE_nlastrips_add_strip_unsafe(ListBase *strips, NlaStrip *strip)
void BKE_nlatrack_sort_strips(NlaTrack *nlt)
void BKE_nlatrack_insert_before(ListBase *nla_tracks, NlaTrack *next, NlaTrack *new_track, bool is_liboverride)
bool BKE_nlatrack_is_nonlocal_in_liboverride(const ID *id, const NlaTrack *nlt)
void BKE_nlatrack_remove_and_free(ListBase *tracks, NlaTrack *nlt, bool do_id_user)
void BKE_nlastrips_make_metas(ListBase *strips, bool is_temp)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
LinkData * BLI_genericNodeN(void *data)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
void void BLI_freelistN(ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define LISTBASE_FOREACH_BACKWARD_MUTABLE(type, var, list)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_listbase_swaplinks(ListBase *listbase, void *vlinka, void *vlinkb) ATTR_NONNULL(1
void unit_m3(float m[3][3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
#define ID_IS_OVERRIDE_LIBRARY(_id)
@ NLASTRIP_FLAG_INVALID_LOCATION
@ NLASTRIP_TYPE_TRANSITION
@ NLATRACK_TEMPORARILY_ADDED
@ NLATRACK_OVERRIDELIBRARY_LOCAL
void ED_nla_postop_refresh(bAnimContext *ac)
#define NLATRACK_STEP(snla)
@ ANIMFILTER_DATA_VISIBLE
@ ANIMFILTER_LIST_VISIBLE
Read Guarded memory(de)allocation.
void ANIM_animdata_freelist(ListBase *anim_data)
void ANIM_id_update(Main *bmain, ID *id)
bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, const eAnimFilter_Flags filter_mode, void *data, const eAnimCont_Types datatype)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_callocN(size_t len, const char *str)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)