Fix: Strips are added to wrong position when dragging movies
Caused by a745d6cc69, which removed store/restore mechanism for
`move_strips` operator property, but failed to modify condition for
setting strip position to mouse cursor. Because of this, the strip was
always placed to mouse cursor, even when drag and drop was used.
Pull Request: https://projects.blender.org/blender/blender/pulls/145810
This commit is contained in:
committed by
Richard Antalik
parent
32e61d3d09
commit
2f22f7e051
@@ -343,7 +343,7 @@ static void sequencer_file_drop_channel_frame_set(bContext *C,
|
||||
RNA_int_set(op->ptr, "frame_start", int(frame_start));
|
||||
}
|
||||
|
||||
static bool op_invoked_by_drop_event(wmOperator *op)
|
||||
static bool op_invoked_by_drop_event(const wmOperator *op)
|
||||
{
|
||||
SequencerAddData *sad = reinterpret_cast<SequencerAddData *>(op->customdata);
|
||||
if (sad == nullptr) {
|
||||
@@ -352,6 +352,14 @@ static bool op_invoked_by_drop_event(wmOperator *op)
|
||||
return sad->is_drop_event;
|
||||
}
|
||||
|
||||
static bool can_move_strips(const wmOperator *op)
|
||||
{
|
||||
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "move_strips");
|
||||
|
||||
return prop != nullptr && RNA_property_boolean_get(op->ptr, prop) &&
|
||||
(op->flag & OP_IS_REPEAT) == 0 && !op_invoked_by_drop_event(op);
|
||||
}
|
||||
|
||||
static void sequencer_generic_invoke_xy__internal(
|
||||
bContext *C, wmOperator *op, int flag, int type, const wmEvent *event)
|
||||
{
|
||||
@@ -386,9 +394,7 @@ static void sequencer_generic_invoke_xy__internal(
|
||||
|
||||
static void move_strips(bContext *C, wmOperator *op)
|
||||
{
|
||||
if (!RNA_boolean_get(op->ptr, "move_strips") || op_invoked_by_drop_event(op) ||
|
||||
(op->flag & OP_IS_REPEAT) != 0)
|
||||
{
|
||||
if (!can_move_strips(op)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -508,9 +514,7 @@ static bool load_data_init_from_operator(seq::LoadData *load_data, bContext *C,
|
||||
}
|
||||
|
||||
/* Override strip position by current mouse position. */
|
||||
if ((prop = RNA_struct_find_property(op->ptr, "move_strips")) &&
|
||||
RNA_property_boolean_get(op->ptr, prop) && (op->flag & OP_IS_REPEAT) == 0)
|
||||
{
|
||||
if (can_move_strips(op) && region != nullptr) {
|
||||
const wmWindow *win = CTX_wm_window(C);
|
||||
int2 mouse_region(win->eventstate->xy[0] - region->winrct.xmin,
|
||||
win->eventstate->xy[1] - region->winrct.ymin);
|
||||
@@ -554,8 +558,7 @@ static void seq_load_apply_generic_options(bContext *C, wmOperator *op, Strip *s
|
||||
}
|
||||
|
||||
if (RNA_boolean_get(op->ptr, "overlap") == true ||
|
||||
!seq::transform_test_overlap(scene, ed->current_strips(), strip) ||
|
||||
RNA_boolean_get(op->ptr, "move_strips"))
|
||||
!seq::transform_test_overlap(scene, ed->current_strips(), strip))
|
||||
{
|
||||
/* No overlap should be handled or the strip is not overlapping, exit early. */
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user