diff options
author | Julian Eisel <julian@blender.org> | 2021-01-24 23:20:56 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-01-24 23:29:14 +0300 |
commit | c8d6e2dfa0e02ac214897f85a8e58f34bddddfd5 (patch) | |
tree | b934b49d9cebfd5a0c2f61f7f7f87f218e0ab6db /source/blender | |
parent | e90a2a3f01f97e1a32f869ff63c8d80e15197860 (diff) |
UI: Avoid showing drop hint on drag & drop if dropping won't succeed
If the poll check of the operator fails, the operator won't run. We can check
that in advance to hide the drop hint if dropping will fail anyway.
This improves feedback during dragging.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/windowmanager/intern/wm_dragdrop.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c index 289a18a771a..6fdcbab889c 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.c +++ b/source/blender/windowmanager/intern/wm_dragdrop.c @@ -225,7 +225,8 @@ static const char *dropbox_active(bContext *C, if (handler->dropboxes) { LISTBASE_FOREACH (wmDropBox *, drop, handler->dropboxes) { const char *tooltip = NULL; - if (drop->poll(C, drag, event, &tooltip)) { + if (drop->poll(C, drag, event, &tooltip) && + WM_operator_poll_context(C, drop->ot, drop->opcontext)) { /* XXX Doing translation here might not be ideal, but later we have no more * access to ot (and hence op context)... */ return (tooltip) ? tooltip : WM_operatortype_name(drop->ot, drop->ptr); |