VSE: Add drag and drop handler for preview area

For some users, dropping assets into preview area may be more practical
due to space constraints or it may be just more intuitive.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D13311
This commit is contained in:
Peter Fog 2021-11-23 05:16:49 +01:00 committed by Richard Antalik
parent b42494cf6b
commit 34370d9fdf
1 changed files with 13 additions and 3 deletions

View File

@ -486,10 +486,9 @@ static void sequencer_drop_copy(wmDrag *drag, wmDropBox *drop)
}
/* This region dropbox definition. */
static void sequencer_dropboxes(void)
{
ListBase *lb = WM_dropboxmap_find("Sequencer", SPACE_SEQ, RGN_TYPE_WINDOW);
static void sequencer_dropboxes_add_to_lb(ListBase *lb)
{
WM_dropbox_add(
lb, "SEQUENCER_OT_image_strip_add", image_drop_poll, sequencer_drop_copy, NULL, NULL);
WM_dropbox_add(
@ -498,6 +497,14 @@ static void sequencer_dropboxes(void)
lb, "SEQUENCER_OT_sound_strip_add", sound_drop_poll, sequencer_drop_copy, NULL, NULL);
}
static void sequencer_dropboxes(void)
{
ListBase *lb = WM_dropboxmap_find("Sequencer", SPACE_SEQ, RGN_TYPE_WINDOW);
sequencer_dropboxes_add_to_lb(lb);
lb = WM_dropboxmap_find("Sequencer", SPACE_SEQ, RGN_TYPE_PREVIEW);
sequencer_dropboxes_add_to_lb(lb);
}
/* ************* end drop *********** */
/* DO NOT make this static, this hides the symbol and breaks API generation script. */
@ -786,6 +793,9 @@ static void sequencer_preview_region_init(wmWindowManager *wm, ARegion *region)
/* Own keymap. */
keymap = WM_keymap_ensure(wm->defaultconf, "SequencerPreview", SPACE_SEQ, 0);
WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
ListBase *lb = WM_dropboxmap_find("Sequencer", SPACE_SEQ, RGN_TYPE_PREVIEW);
WM_event_add_dropbox_handler(&region->handlers, lb);
}
static void sequencer_preview_region_layout(const bContext *C, ARegion *region)