UI: Tooltips for Bone Collection Active & Selected #120268

Open
Harley Acheson wants to merge 6 commits from Harley/blender:BoneCollectionActiveSelectedTip into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
3 changed files with 22 additions and 4 deletions

View File

@ -2927,7 +2927,12 @@ struct uiPropertySplitWrapper {
uiPropertySplitWrapper uiItemPropertySplitWrapperCreate(uiLayout *parent_layout);
void uiItemL(uiLayout *layout, const char *name, int icon); /* label */
uiBut *uiItemL_ex(uiLayout *layout, const char *name, int icon, bool highlight, bool redalert);
uiBut *uiItemL_ex(uiLayout *layout,
const char *name,
int icon,
bool highlight,
bool redalert,
const char *tip = nullptr);
/**
* Helper to add a label and creates a property split layout if needed.
*/

View File

@ -3297,8 +3297,12 @@ static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon)
return but;
}
uiBut *uiItemL_ex(
uiLayout *layout, const char *name, int icon, const bool highlight, const bool redalert)
uiBut *uiItemL_ex(uiLayout *layout,
const char *name,
int icon,
const bool highlight,
const bool redalert,
const char *tip)
{
uiBut *but = uiItemL_(layout, name, icon);
@ -3311,6 +3315,12 @@ uiBut *uiItemL_ex(
UI_but_flag_enable(but, UI_BUT_REDALERT);
}
if (tip) {
/* UI_BTYPE_LABEL doesn't show tooltips. */
but->type = UI_BTYPE_BUT;
but->tip = tip;
}
return but;
}

View File

@ -229,16 +229,19 @@ class BoneCollectionItem : public AbstractTreeViewItem {
* assigned to. And this happens for each redraw of each bone collection in the armature. */
{
int icon;
const char *tip = nullptr;
if (ANIM_armature_bonecoll_contains_active_bone(&armature_, &bone_collection_)) {
icon = ICON_LAYER_ACTIVE;
tip = TIP_("Contains the active bone");
}
else if (has_any_selected_bones_) {
icon = ICON_LAYER_USED;
tip = TIP_("Contains one or more selected bones");
}
else {
icon = ICON_BLANK1;
}
uiItemL(sub, "", icon);
uiBut *but = uiItemL_ex(sub, "", icon, false, false, tip);
}
/* Visibility eye icon. */