diff options
author | Julian Eisel <julian@blender.org> | 2022-02-28 15:12:28 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2022-02-28 15:14:46 +0300 |
commit | 8e940f31fdca44816a5d6151c74567b2d6d75454 (patch) | |
tree | c0076d181601e596547af66f7f02f92228c74ff4 /source/blender/windowmanager | |
parent | 1558b270e9fcbc2e23fa248b0e7e770dddae155c (diff) |
WM: Allow drop-box polls to use context from UI
The UI context was only set for the operator polls, but not for the
drop-box polls. Initially I thought this wouldn't be needed since the
drop-boxes should leave up context polls to the operator, but in
practice that may not be what API users expect. Plus the tooltip for the
drop-boxes will likely have to access context anyway, so they should be
able to check it beforehand.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_dragdrop.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c index 685d74f6d20..4ffb6b90e11 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.c +++ b/source/blender/windowmanager/intern/wm_dragdrop.c @@ -318,6 +318,10 @@ static wmDropBox *dropbox_active(bContext *C, wmEventHandler_Dropbox *handler = (wmEventHandler_Dropbox *)handler_base; if (handler->dropboxes) { LISTBASE_FOREACH (wmDropBox *, drop, handler->dropboxes) { + if (drag->drop_state.ui_context) { + CTX_store_set(C, drag->drop_state.ui_context); + } + if (!drop->poll(C, drag, event)) { /* If the drop's poll fails, don't set the disabled-info. This would be too aggressive. * Instead show it only if the drop box could be used in principle, but the operator @@ -326,10 +330,6 @@ static wmDropBox *dropbox_active(bContext *C, } const wmOperatorCallContext opcontext = wm_drop_operator_context_get(drop); - if (drag->drop_state.ui_context) { - CTX_store_set(C, drag->drop_state.ui_context); - } - if (WM_operator_poll_context(C, drop->ot, opcontext)) { return drop; } |