diff options
author | Julian Eisel <julian@blender.org> | 2021-10-26 19:04:45 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-10-26 19:14:17 +0300 |
commit | df2e05393533bff6b14751deb890ef0fc4064c8f (patch) | |
tree | 09eaaf20d2e5e8fed54b7cf6966db1d2cd88b69a /source/blender/windowmanager/intern/wm_event_system.c | |
parent | ec831ce5df86cbdbed8030d8a056f8a9b4eb0273 (diff) |
UI: Improved feedback when dropping is not possible on drag 'n drop
* Allow operators to show a "disabled hint" in red text explaining why dropping
at the current location and in current context doesn't work. Should greatly
help users to understand what's the problem.
* Show a "stop" cursor when dropping isn't possible, like it's common on OSes.
Differential Revision: https://developer.blender.org/D10358
Diffstat (limited to 'source/blender/windowmanager/intern/wm_event_system.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index df976d9a4cd..2aa9a4d8676 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -3055,12 +3055,7 @@ static int wm_handlers_do_intern(bContext *C, wmWindow *win, wmEvent *event, Lis ListBase *lb = (ListBase *)event->customdata; LISTBASE_FOREACH_MUTABLE (wmDrag *, drag, lb) { if (drop->poll(C, drag, event)) { - /* Optionally copy drag information to operator properties. Don't call it if the - * operator fails anyway, it might do more than just set properties (e.g. - * typically import an asset). */ - if (drop->copy && WM_operator_poll_context(C, drop->ot, drop->opcontext)) { - drop->copy(drag, drop); - } + wm_drop_prepare(C, drag, drop); /* Pass single matched wmDrag onto the operator. */ BLI_remlink(lb, drag); @@ -3094,6 +3089,8 @@ static int wm_handlers_do_intern(bContext *C, wmWindow *win, wmEvent *event, Lis break; } } + /* Always exit all drags on a drop event, even if poll didn't succeed. */ + wm_drags_exit(wm, win); } } } @@ -3390,6 +3387,7 @@ static void wm_event_drag_and_drop_test(wmWindowManager *wm, wmWindow *win, wmEv screen->do_draw_drag = true; } else if (event->type == EVT_ESCKEY) { + wm_drags_exit(wm, win); WM_drag_free_list(&wm->drags); screen->do_draw_drag = true; |