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.
This commit is contained in:
parent
16c79d3b82
commit
594c857f65
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue