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-01-13 17:08:09 +0300
committerJulian Eisel <julian@blender.org>2021-01-13 17:31:02 +0300
commit2771dfd5632ad6d982ee4bf3e87decdb197ebed7 (patch)
tree515ef4f88aaf9ad2a3873ba9dec5133317703d18 /source/blender/editors/interface/interface_region_tooltip.c
parentad4202a14fbce95b7c40df0e815c1ac261515b05 (diff)
UI: Revert design changes to data-block selector for the 2.92 release
Partially reverts 2250b5cefee7. Removing the user count and fake user count icons was controversial (which was expected) and there are a few further changes needed, that won't make it in time for the release, see D9946. While there is a design to bring back the user count and fake user indicators, a new design idea was proposed that the UI team wants to follow. This came too late for the 2.92 release, the new design is targeted at the 2.93 release now. Meanwhile, UI team decision was to simply revert the design changes. The new design is being worked on in https://developer.blender.org/T84669. Note that this commit does not revert some internal changes done in 2250b5cefee7. Namely the introduction of `ed_util_ops.c` and data-block operators in there. These will still be needed in the new design.
Diffstat (limited to 'source/blender/editors/interface/interface_region_tooltip.c')
-rw-r--r--source/blender/editors/interface/interface_region_tooltip.c68
1 files changed, 25 insertions, 43 deletions
diff --git a/source/blender/editors/interface/interface_region_tooltip.c b/source/blender/editors/interface/interface_region_tooltip.c
index d88e4283553..2bf63955855 100644
--- a/source/blender/editors/interface/interface_region_tooltip.c
+++ b/source/blender/editors/interface/interface_region_tooltip.c
@@ -531,7 +531,7 @@ static uiTooltipData *ui_tooltip_data_from_tool(bContext *C, uiBut *but, bool is
{
uiStringInfo op_keymap = {BUT_GET_OP_KEYMAP, NULL};
- UI_but_string_info_get(C, but, NULL, &op_keymap, NULL);
+ UI_but_string_info_get(C, but, &op_keymap, NULL);
shortcut = op_keymap.strinfo;
}
@@ -761,9 +761,7 @@ static uiTooltipData *ui_tooltip_data_from_tool(bContext *C, uiBut *but, bool is
return data;
}
-static uiTooltipData *ui_tooltip_data_from_button(bContext *C,
- uiBut *but,
- uiButExtraOpIcon *extra_icon)
+static uiTooltipData *ui_tooltip_data_from_button(bContext *C, uiBut *but)
{
uiStringInfo but_label = {BUT_GET_LABEL, NULL};
uiStringInfo but_tip = {BUT_GET_TIP, NULL};
@@ -776,29 +774,20 @@ static uiTooltipData *ui_tooltip_data_from_button(bContext *C,
char buf[512];
- wmOperatorType *extra_icon_optype = UI_but_extra_operator_icon_optype_get(extra_icon);
- wmOperatorType *optype = extra_icon ? extra_icon_optype : but->optype;
-
/* create tooltip data */
uiTooltipData *data = MEM_callocN(sizeof(uiTooltipData), "uiTooltipData");
- if (extra_icon) {
- UI_but_string_info_get(C, but, extra_icon, &but_label, &but_tip, &op_keymap, NULL);
- }
- else {
- UI_but_string_info_get(C,
- but,
- NULL,
- &but_label,
- &but_tip,
- &enum_label,
- &enum_tip,
- &op_keymap,
- &prop_keymap,
- &rna_struct,
- &rna_prop,
- NULL);
- }
+ UI_but_string_info_get(C,
+ but,
+ &but_label,
+ &but_tip,
+ &enum_label,
+ &enum_tip,
+ &op_keymap,
+ &prop_keymap,
+ &rna_struct,
+ &rna_prop,
+ NULL);
/* Tip Label (only for buttons not already showing the label).
* Check prefix instead of comparing because the button may include the shortcut. */
@@ -931,16 +920,15 @@ static uiTooltipData *ui_tooltip_data_from_button(bContext *C,
}
}
}
- else if (optype) {
- PointerRNA *opptr = extra_icon_optype ?
- UI_but_extra_operator_icon_opptr_get(extra_icon) :
- UI_but_operator_ptr_get(
- but); /* allocated when needed, the button owns it */
+ else if (but->optype) {
+ PointerRNA *opptr;
+ char *str;
+ opptr = UI_but_operator_ptr_get(but); /* allocated when needed, the button owns it */
/* so the context is passed to fieldf functions (some py fieldf functions use it) */
WM_operator_properties_sanitize(opptr, false);
- char *str = ui_tooltip_text_python_from_op(C, optype, opptr);
+ str = ui_tooltip_text_python_from_op(C, but->optype, opptr);
/* operator info */
if (U.flag & USER_TOOLTIPS_PYTHON) {
@@ -967,7 +955,7 @@ static uiTooltipData *ui_tooltip_data_from_button(bContext *C,
disabled_msg = CTX_wm_operator_poll_msg_get(C);
}
/* alternatively, buttons can store some reasoning too */
- if (!disabled_msg && but->disabled_info) {
+ else if (but->disabled_info) {
disabled_msg = TIP_(but->disabled_info);
}
@@ -1405,8 +1393,11 @@ static ARegion *ui_tooltip_create_with_data(bContext *C,
/** \name ToolTip Public API
* \{ */
-ARegion *UI_tooltip_create_from_button_or_extra_icon(
- bContext *C, ARegion *butregion, uiBut *but, uiButExtraOpIcon *extra_icon, bool is_label)
+/**
+ * \param is_label: When true, show a small tip that only shows the name,
+ * otherwise show the full tooltip.
+ */
+ARegion *UI_tooltip_create_from_button(bContext *C, ARegion *butregion, uiBut *but, bool is_label)
{
wmWindow *win = CTX_wm_window(C);
/* aspect values that shrink text are likely unreadable */
@@ -1423,7 +1414,7 @@ ARegion *UI_tooltip_create_from_button_or_extra_icon(
}
if (data == NULL) {
- data = ui_tooltip_data_from_button(C, but, extra_icon);
+ data = ui_tooltip_data_from_button(C, but);
}
if (data == NULL) {
@@ -1461,15 +1452,6 @@ ARegion *UI_tooltip_create_from_button_or_extra_icon(
return region;
}
-/**
- * \param is_label: When true, show a small tip that only shows the name,
- * otherwise show the full tooltip.
- */
-ARegion *UI_tooltip_create_from_button(bContext *C, ARegion *butregion, uiBut *but, bool is_label)
-{
- return UI_tooltip_create_from_button_or_extra_icon(C, butregion, but, NULL, is_label);
-}
-
ARegion *UI_tooltip_create_from_gizmo(bContext *C, wmGizmo *gz)
{
wmWindow *win = CTX_wm_window(C);