[Bf-blender-cvs] [8e940f31fdc] master: WM: Allow drop-box polls to use context from UI
Julian Eisel
noreply at git.blender.org
Mon Feb 28 13:15:26 CET 2022
Commit: 8e940f31fdca44816a5d6151c74567b2d6d75454
Author: Julian Eisel
Date: Mon Feb 28 13:12:28 2022 +0100
Branches: master
https://developer.blender.org/rB8e940f31fdca44816a5d6151c74567b2d6d75454
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.
===================================================================
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 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;
}
More information about the Bf-blender-cvs
mailing list