[Bf-blender-cvs] [c8d6e2dfa0e] master: UI: Avoid showing drop hint on drag & drop if dropping won't succeed

Julian Eisel noreply at git.blender.org
Sun Jan 24 21:29:40 CET 2021


Commit: c8d6e2dfa0e02ac214897f85a8e58f34bddddfd5
Author: Julian Eisel
Date:   Sun Jan 24 21:20:56 2021 +0100
Branches: master
https://developer.blender.org/rBc8d6e2dfa0e02ac214897f85a8e58f34bddddfd5

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.

===================================================================

M	source/blender/windowmanager/intern/wm_dragdrop.c

===================================================================

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);



More information about the Bf-blender-cvs mailing list