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.
This commit is contained in:
parent
1558b270e9
commit
8e940f31fd
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue