Fix T82973: Strips overlap after transforming
When transforming multiple strips to limits of sequencer timeline they get squashed into one channel. Store selection minimum and maximum channel in TransSeq and limit transformation so no strip can be transformed beyond timeline boundary. Reviewed By: Sergey, mano-wii Differential Revision: https://developer.blender.org/D10013
This commit is contained in:
parent
fa96aa5811
commit
f21b4e69b0
Notes:
blender-bot
2023-02-14 09:38:57 +01:00
Referenced by issue #82973, Strips overlap at channel 1 and 32
|
@ -49,7 +49,7 @@ void mesh_customdatacorrect_init(TransInfo *t);
|
|||
|
||||
/* transform_convert_sequencer.c */
|
||||
int transform_convert_sequencer_get_snap_bound(TransInfo *t);
|
||||
|
||||
void transform_convert_sequencer_channel_clamp(TransInfo *t);
|
||||
/********************* intern **********************/
|
||||
|
||||
typedef enum eTransConvertType {
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
|
@ -64,6 +65,8 @@ typedef struct TransSeq {
|
|||
int min;
|
||||
int max;
|
||||
bool snap_left;
|
||||
int selection_channel_range_min;
|
||||
int selection_channel_range_max;
|
||||
} TransSeq;
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
@ -623,6 +626,14 @@ void createTransSeqData(TransInfo *t)
|
|||
}
|
||||
}
|
||||
|
||||
ts->selection_channel_range_min = MAXSEQ + 1;
|
||||
LISTBASE_FOREACH (Sequence *, seq, SEQ_active_seqbase_get(ed)) {
|
||||
if ((seq->flag & SELECT) != 0) {
|
||||
ts->selection_channel_range_min = min_ii(ts->selection_channel_range_min, seq->machine);
|
||||
ts->selection_channel_range_max = max_ii(ts->selection_channel_range_max, seq->machine);
|
||||
}
|
||||
}
|
||||
|
||||
#undef XXX_DURIAN_ANIM_TX_HACK
|
||||
}
|
||||
|
||||
|
@ -850,6 +861,21 @@ void special_aftertrans_update__sequencer(bContext *UNUSED(C), TransInfo *t)
|
|||
}
|
||||
}
|
||||
|
||||
void transform_convert_sequencer_channel_clamp(TransInfo *t)
|
||||
{
|
||||
const TransSeq *ts = (TransSeq *)TRANS_DATA_CONTAINER_FIRST_SINGLE(t)->custom.type.data;
|
||||
const int channel_offset = round_fl_to_int(t->values[1]);
|
||||
const int min_channel_after_transform = ts->selection_channel_range_min + channel_offset;
|
||||
const int max_channel_after_transform = ts->selection_channel_range_max + channel_offset;
|
||||
|
||||
if (max_channel_after_transform > MAXSEQ) {
|
||||
t->values[1] -= max_channel_after_transform - MAXSEQ;
|
||||
}
|
||||
if (min_channel_after_transform < 1) {
|
||||
t->values[1] -= min_channel_after_transform - 1;
|
||||
}
|
||||
}
|
||||
|
||||
int transform_convert_sequencer_get_snap_bound(TransInfo *t)
|
||||
{
|
||||
TransSeq *ts = TRANS_DATA_CONTAINER_FIRST_SINGLE(t)->custom.type.data;
|
||||
|
|
|
@ -35,10 +35,12 @@
|
|||
#include "WM_types.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_view2d.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "transform.h"
|
||||
#include "transform_convert.h"
|
||||
#include "transform_mode.h"
|
||||
#include "transform_snap.h"
|
||||
|
||||
|
@ -106,6 +108,7 @@ static void applySeqSlide(TransInfo *t, const int mval[2])
|
|||
float values_final[3] = {0.0f};
|
||||
|
||||
snapSequenceBounds(t, mval);
|
||||
transform_convert_sequencer_channel_clamp(t);
|
||||
if (applyNumInput(&t->num, values_final)) {
|
||||
if (t->con.mode & CON_APPLY) {
|
||||
if (t->con.mode & CON_AXIS0) {
|
||||
|
|
Loading…
Reference in New Issue