diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2015-10-21 18:30:35 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2015-10-21 18:30:35 +0300 |
commit | 0775680e4d05eda3c495a56dc0b6eafbe96dc586 (patch) | |
tree | 4f3286eef96dec6ababe43467ed2a4f50388b988 /source/blender/blenkernel/intern/nla.c | |
parent | 4ade467fc6adfc13ce9e21d7e50b366fce70ea5f (diff) | |
parent | 6bc007610263c879f6bb30b844ba9d9a0fb9433c (diff) |
Merge branch 'master' into UI-graphical-redesignUI-graphical-redesign
Conflicts:
source/blender/blenkernel/BKE_blender.h
source/blender/blenloader/intern/versioning_270.c
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_intern.h
source/blender/editors/interface/resources.c
Diffstat (limited to 'source/blender/blenkernel/intern/nla.c')
-rw-r--r-- | source/blender/blenkernel/intern/nla.c | 82 |
1 files changed, 77 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 037b44e0d8c..65245477c7f 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -45,7 +45,7 @@ #include "BLI_string.h" #include "BLI_ghash.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "DNA_anim_types.h" #include "DNA_scene_types.h" @@ -1178,7 +1178,34 @@ static void nlastrip_fix_resize_overlaps(NlaStrip *strip) NlaStrip *nls = strip->next; float offset = 0.0f; - if (strip->end > nls->start) { + if (nls->type == NLASTRIP_TYPE_TRANSITION) { + /* transition strips should grow/shrink to accomodate the resized strip, + * but if the strip's bounds now exceed the transition, we're forced to + * offset everything to maintain the balance + */ + if (strip->end <= nls->start) { + /* grow the transition to fill the void */ + nls->start = strip->end; + } + else if (strip->end < nls->end) { + /* shrink the transition to give the strip room */ + nls->start = strip->end; + } + else { + /* shrink transition down to 1 frame long (so that it can still be found), + * then offset everything else by the remaining defict to give the strip room + */ + nls->start = nls->end - 1.0f; + offset = ceilf(strip->end - nls->start); /* XXX: review whether preventing fractionals is good here... */ + + /* apply necessary offset to ensure that the strip has enough space */ + for (; nls; nls = nls->next) { + nls->start += offset; + nls->end += offset; + } + } + } + else if (strip->end > nls->start) { /* NOTE: need to ensure we don't have a fractional frame offset, even if that leaves a gap, * otherwise it will be very hard to get rid of later */ @@ -1198,7 +1225,34 @@ static void nlastrip_fix_resize_overlaps(NlaStrip *strip) NlaStrip *nls = strip->prev; float offset = 0.0f; - if (strip->start < nls->end) { + if (nls->type == NLASTRIP_TYPE_TRANSITION) { + /* transition strips should grow/shrink to accomodate the resized strip, + * but if the strip's bounds now exceed the transition, we're forced to + * offset everything to maintain the balance + */ + if (strip->start >= nls->end) { + /* grow the transition to fill the void */ + nls->end = strip->start; + } + else if (strip->start > nls->start) { + /* shrink the transition to give the strip room */ + nls->end = strip->start; + } + else { + /* shrink transition down to 1 frame long (so that it can still be found), + * then offset everything else by the remaining defict to give the strip room + */ + nls->end = nls->start + 1.0f; + offset = ceilf(nls->end - strip->start); /* XXX: review whether preventing fractionals is good here... */ + + /* apply necessary offset to ensure that the strip has enough space */ + for (; nls; nls = nls->next) { + nls->start -= offset; + nls->end -= offset; + } + } + } + else if (strip->start < nls->end) { /* NOTE: need to ensure we don't have a fractional frame offset, even if that leaves a gap, * otherwise it will be very hard to get rid of later */ @@ -1778,7 +1832,7 @@ bool BKE_nla_tweakmode_enter(AnimData *adt) } return false; } - + /* go over all the tracks up to the active one, tagging each strip that uses the same * action as the active strip, but leaving everything else alone */ @@ -1791,6 +1845,13 @@ bool BKE_nla_tweakmode_enter(AnimData *adt) } } + /* tag all other strips in active track that uses the same action as the active strip */ + for (strip = activeTrack->strips.first; strip; strip = strip->next) { + if ((strip->act == activeStrip->act) && (strip != activeStrip)) + strip->flag |= NLASTRIP_FLAG_TWEAKUSER; + else + strip->flag &= ~NLASTRIP_FLAG_TWEAKUSER; + } /* go over all the tracks after AND INCLUDING the active one, tagging them as being disabled * - the active track needs to also be tagged, otherwise, it'll overlap with the tweaks going on @@ -1852,8 +1913,19 @@ void BKE_nla_tweakmode_exit(AnimData *adt) for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) { nlt->flag &= ~NLATRACK_DISABLED; - for (strip = nlt->strips.first; strip; strip = strip->next) + for (strip = nlt->strips.first; strip; strip = strip->next) { + /* sync strip extents if this strip uses the same action */ + if ((adt->actstrip) && (adt->actstrip->act == strip->act) && (strip->flag & NLASTRIP_FLAG_SYNC_LENGTH)) { + /* recalculate the length of the action */ + calc_action_range(strip->act, &strip->actstart, &strip->actend, 0); + + /* adjust the strip extents in response to this */ + BKE_nlastrip_recalculate_bounds(strip); + } + + /* clear tweakuser flag */ strip->flag &= ~NLASTRIP_FLAG_TWEAKUSER; + } } /* handle AnimData level changes: |