Fix #110161: Crash on dragging a Speaker NLA strip #110605

Merged
Sybren A. Stüvel merged 3 commits from guishe/blender:fix-drag-strip into main 2023-08-03 14:19:57 +02:00
2 changed files with 7 additions and 7 deletions

View File

@ -1364,7 +1364,7 @@ NlaStrip *BKE_nlastrip_next_in_track(NlaStrip *strip, bool skip_transitions)
{
NlaStrip *next = strip->next;
while (next != nullptr) {
if (skip_transitions && (next->type & NLASTRIP_TYPE_TRANSITION)) {
if (skip_transitions && (next->type == NLASTRIP_TYPE_TRANSITION)) {
next = next->next;
}
else {
@ -1378,7 +1378,7 @@ NlaStrip *BKE_nlastrip_prev_in_track(NlaStrip *strip, bool skip_transitions)
{
NlaStrip *prev = strip->prev;
while (prev != nullptr) {
if (skip_transitions && (prev->type & NLASTRIP_TYPE_TRANSITION)) {
if (skip_transitions && (prev->type == NLASTRIP_TYPE_TRANSITION)) {
prev = prev->prev;
}
else {
@ -1963,10 +1963,10 @@ static void BKE_nlastrip_validate_autoblends(NlaTrack *nlt, NlaStrip *nls)
* Strip will be removed / freed if it doesn't fit (invalid).
* Return value indicates if passed strip is valid/fixed or invalid/removed.
*/
static bool nlastrip_validate_transition_start_end(NlaStrip *strip)
static bool nlastrip_validate_transition_start_end(ListBase *strips, NlaStrip *strip)
{
if (!(strip->type & NLASTRIP_TYPE_TRANSITION)) {
if (!(strip->type == NLASTRIP_TYPE_TRANSITION)) {
return true;
}
if (strip->prev) {
@ -1976,7 +1976,7 @@ static bool nlastrip_validate_transition_start_end(NlaStrip *strip)
strip->end = strip->next->start;
}
if (strip->start >= strip->end || strip->prev == nullptr || strip->next == nullptr) {
BKE_nlastrip_free(strip, true);
BKE_nlastrip_remove_and_free(strips, strip, true);
return false;
}
return true;
@ -1996,7 +1996,7 @@ void BKE_nla_validate_state(AnimData *adt)
for (nlt = static_cast<NlaTrack *>(adt->nla_tracks.first); nlt; nlt = nlt->next) {
LISTBASE_FOREACH_MUTABLE (NlaStrip *, strip, &nlt->strips) {
if (!nlastrip_validate_transition_start_end(strip)) {
if (!nlastrip_validate_transition_start_end(&nlt->strips, strip)) {
printf(
"While moving NLA strips, a transition strip could no longer be applied to the new "
"positions and was removed.\n");

View File

@ -111,7 +111,7 @@ static float transdata_get_time_shuffle_offset_side(ListBase *trans_datas, const
}
/* Allow overlap with transitions. */
if (non_xformed_strip->type & NLASTRIP_TYPE_TRANSITION) {
if (non_xformed_strip->type == NLASTRIP_TYPE_TRANSITION) {
continue;
}