Fix #109081: Ensure swap strips do not overlap each other. #109980

Merged
Nathan Vegdahl merged 2 commits from guishe/blender:fix-swap-strips into main 2023-08-14 17:06:34 +02:00
1 changed files with 8 additions and 2 deletions

View File

@ -1669,7 +1669,7 @@ static int nlaedit_swap_exec(bContext *C, wmOperator *op)
/* check if the track has room for the strips to be swapped */
if (BKE_nlastrips_has_space(&nlt->strips, nsa[0], nsa[1]) &&
BKE_nlastrips_has_space(&nlt->strips, nsb[0], nsb[1]))
BKE_nlastrips_has_space(&nlt->strips, nsb[0], nsb[1]) && (nsb[1] <= nsa[0]))
{
/* set new extents for strips then */
area->start = nsa[0];
@ -1682,7 +1682,13 @@ static int nlaedit_swap_exec(bContext *C, wmOperator *op)
}
else {
/* not enough room to swap, so show message */
if ((area->flag & NLASTRIP_FLAG_TEMP_META) || (sb->flag & NLASTRIP_FLAG_TEMP_META)) {
if (nsb[1] > nsa[0]) {
BKE_report(op->reports,
RPT_WARNING,
"Cannot swap selected strips because they will overlap each other in their "
"new places");
}
else if ((area->flag & NLASTRIP_FLAG_TEMP_META) || (sb->flag & NLASTRIP_FLAG_TEMP_META)) {
BKE_report(
op->reports,
RPT_WARNING,