From cae6873bc69ab8590ca6f4d2bbf2eb3d189ab13a Mon Sep 17 00:00:00 2001 From: Dan Eicher Date: Thu, 14 Jun 2012 04:57:42 +0000 Subject: [PATCH] Sequencer Drag & Drop -- disallow dropping on sequences for the current drop_poll functions --- .../editors/space_sequencer/space_sequencer.c | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index dbfc554007a..b8bf764fabc 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -325,27 +325,43 @@ static void sequencer_main_area_draw(const bContext *C, ARegion *ar) /* ************* dropboxes ************* */ -static int image_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) +static int image_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) { + ARegion *ar = CTX_wm_region(C); + Scene *scene = CTX_data_scene(C); + int hand; + if (drag->type == WM_DRAG_PATH) if (ELEM(drag->icon, ICON_FILE_IMAGE, ICON_FILE_BLANK)) /* rule might not work? */ - return 1; + if (find_nearest_seq(scene, &ar->v2d, &hand, event->mval) == NULL) + return 1; + return 0; } -static int movie_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) +static int movie_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) { + ARegion *ar = CTX_wm_region(C); + Scene *scene = CTX_data_scene(C); + int hand; + if (drag->type == WM_DRAG_PATH) if (ELEM3(drag->icon, 0, ICON_FILE_MOVIE, ICON_FILE_BLANK)) /* rule might not work? */ - return 1; + if (find_nearest_seq(scene, &ar->v2d, &hand, event->mval) == NULL) + return 1; return 0; } -static int sound_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) +static int sound_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) { + ARegion *ar = CTX_wm_region(C); + Scene *scene = CTX_data_scene(C); + int hand; + if (drag->type == WM_DRAG_PATH) if (ELEM(drag->icon, ICON_FILE_SOUND, ICON_FILE_BLANK)) /* rule might not work? */ - return 1; + if (find_nearest_seq(scene, &ar->v2d, &hand, event->mval) == NULL) + return 1; return 0; }