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.
This commit is contained in:
parent
e90a2a3f01
commit
c8d6e2dfa0
Notes:
blender-bot
2023-06-21 19:23:24 +02:00
Referenced by issue #85027, Crash dragging a collection over Outliner with active filter without matches
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue