Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2021-10-21 17:36:35 +0300
committerJulian Eisel <julian@blender.org>2021-10-21 17:36:35 +0300
commit594c857f652b7f9283b299e1e82cd7dc324f8ffe (patch)
tree57a28604b196282ba6abbdcb16cad0944dd8c5dc /source/blender
parent16c79d3b8276493a5ce70e74d50cf066f64894c2 (diff)
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.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/interface/interface_region_tooltip.c5
1 files changed, 3 insertions, 2 deletions
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 */