UI: Icon number indicator for data-blocks
Adds the possibility of having a little number on top of icons.
At the moment this is used for:
* Outliner
* Node Editor bread-crumb
* Node Group node header
For the outliner there is almost no functional change. It is mostly a refactor
to handle the indicators as part of the icon shader instead of the outliner
draw code. (note that this was already recently changed in a5d3b648e3).
The difference is that now we use rounded border rectangle instead of
circles, and we can go up to 999 elements.
So for the outliner this shows the number of collapsed elements of a
certain type (e.g., mesh objects inside a collapsed collection).
For the node editors is being used to show the use count for the data-block.
This is important for the node editor, so users know whether the node-group
they are editing (or are about to edit) is used elsewhere. This is
particularly important when the Node Options are hidden, which is the
default for node groups appended from the asset libraries.
---
Note: This can be easily enabled for ID templates which can then be part
of T84669. It just need to call UI_but_icon_indicator_number_set in the
function template_add_button_search_menu.
---
Special thanks Clément Foucault for the help figuring out the shader,
Julian Eisel for the help navigating the UI code, and Pablo Vazquez for
the collaboration in this design solution.
For images showing the result check the Differential Revision.
Differential Revision: https://developer.blender.org/D16284
This commit is contained in:
@@ -1683,6 +1683,7 @@ int UI_search_items_find_index(uiSearchItems *items, const char *name);
|
||||
* Adds a hint to the button which draws right aligned, grayed out and never clipped.
|
||||
*/
|
||||
void UI_but_hint_drawstr_set(uiBut *but, const char *string);
|
||||
void UI_but_icon_indicator_number_set(uiBut *but, const int indicator_number);
|
||||
|
||||
void UI_but_node_link_set(uiBut *but, struct bNodeSocket *socket, const float draw_color[4]);
|
||||
|
||||
@@ -2788,7 +2789,8 @@ typedef struct uiPropertySplitWrapper {
|
||||
uiPropertySplitWrapper uiItemPropertySplitWrapperCreate(uiLayout *parent_layout);
|
||||
|
||||
void uiItemL(uiLayout *layout, const char *name, int icon); /* label */
|
||||
void uiItemL_ex(uiLayout *layout, const char *name, int icon, bool highlight, bool redalert);
|
||||
struct uiBut *uiItemL_ex(
|
||||
uiLayout *layout, const char *name, int icon, bool highlight, bool redalert);
|
||||
/**
|
||||
* Helper to add a label and creates a property split layout if needed.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user