[Bf-blender-cvs] [594c857f652] master: Fix tooltip disabled hint not using correct context from the button
Julian Eisel
noreply at git.blender.org
Thu Oct 21 16:39:42 CEST 2021
Commit: 594c857f652b7f9283b299e1e82cd7dc324f8ffe
Author: Julian Eisel
Date: Thu Oct 21 16:36:35 2021 +0200
Branches: master
https://developer.blender.org/rB594c857f652b7f9283b299e1e82cd7dc324f8ffe
Fix tooltip disabled hint not using correct context from the button
To display the "disabled hint" (text explaining why a button is disabled) in a
tooltip, it would run the operator poll callback, which could then set a poll
message. But the context for the poll check wasn't the one from the button, so
the poll may give a different result (and disabled hint) than the check of the
button itself did.
Make sure it uses the exact context from the button.
===================================================================
M source/blender/editors/interface/interface_region_tooltip.c
===================================================================
diff --git a/source/blender/editors/interface/interface_region_tooltip.c b/source/blender/editors/interface/interface_region_tooltip.c
index 4a7203bb421..eb25d896d26 100644
--- a/source/blender/editors/interface/interface_region_tooltip.c
+++ b/source/blender/editors/interface/interface_region_tooltip.c
@@ -960,9 +960,10 @@ static uiTooltipData *ui_tooltip_data_from_button_or_extra_icon(bContext *C,
/* if operator poll check failed, it can give pretty precise info why */
if (optype) {
+ const int opcontext = extra_icon ? extra_icon->optype_params->opcontext : but->opcontext;
CTX_wm_operator_poll_msg_clear(C);
- WM_operator_poll_context(
- C, optype, extra_icon ? extra_icon->optype_params->opcontext : but->opcontext);
+ ui_but_context_poll_operator_ex(
+ C, but, &(wmOperatorCallParams){.optype = optype, .opcontext = opcontext});
disabled_msg = CTX_wm_operator_poll_msg_get(C, &disabled_msg_free);
}
/* alternatively, buttons can store some reasoning too */
More information about the Bf-blender-cvs
mailing list