Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_widgets.c
| Show First 20 Lines • Show All 2,248 Lines • ▼ Show 20 Lines | #endif | ||||
| } | } | ||||
| } | } | ||||
| static void widget_draw_extra_icons(const uiWidgetColors *wcol, | static void widget_draw_extra_icons(const uiWidgetColors *wcol, | ||||
| uiBut *but, | uiBut *but, | ||||
| rcti *rect, | rcti *rect, | ||||
| float alpha) | float alpha) | ||||
| { | { | ||||
| /* inverse order, from right to left. */ | const float icon_size = ICON_SIZE_FROM_BUTRECT(rect); | ||||
| /* Offset of icons from the right edge. Keep in sync | |||||
| with 'ui_but_extra_operator_icon_mouse_over_get'. */ | |||||
| if (!BLI_listbase_is_empty(&but->extra_op_icons)) { | |||||
| /* Eyeballed. */ | |||||
Severin: Use `BLI_listbase_is_empty()`. | |||||
| rect->xmax -= 0.2 * icon_size; | |||||
Not Done Inline ActionsWhere does this come from? Would be good to note in a comment even if it's just eyeballed. Severin: Where does this come from? Would be good to note in a comment even if it's just eyeballed.
Or… | |||||
| } | |||||
| /* Inverse order, from right to left. */ | |||||
| LISTBASE_FOREACH_BACKWARD (uiButExtraOpIcon *, op_icon, &but->extra_op_icons) { | LISTBASE_FOREACH_BACKWARD (uiButExtraOpIcon *, op_icon, &but->extra_op_icons) { | ||||
| rcti temp = *rect; | rcti temp = *rect; | ||||
| float alpha_this = alpha; | float alpha_this = alpha; | ||||
| temp.xmin = temp.xmax - (BLI_rcti_size_y(rect) * 1.08f); | temp.xmin = temp.xmax - icon_size; | ||||
| if (!op_icon->highlighted) { | if (!op_icon->highlighted) { | ||||
| alpha_this *= 0.75f; | alpha_this *= 0.75f; | ||||
| } | } | ||||
| /* Draw the icon at the center, and restore the flags after. */ | |||||
| const int old_drawflags = but->drawflag; | |||||
| UI_but_drawflag_disable(but, UI_BUT_ICON_LEFT); | |||||
| widget_draw_icon(but, op_icon->icon, alpha_this, &temp, wcol->text); | widget_draw_icon(but, op_icon->icon, alpha_this, &temp, wcol->text); | ||||
Done Inline ActionsThink this shouldn't assume that UI_BUT_ICON_LEFT was enabled. It should check if it was previously enabled and only set it again if so. Severin: Think this shouldn't assume that `UI_BUT_ICON_LEFT` was enabled. It should check if it was… | |||||
| but->drawflag = old_drawflags; | |||||
Done Inline Actionsflags could be any kind of flag. Better call it old_drawflags. Severin: `flags` could be any kind of flag. Better call it `old_drawflags`. | |||||
| rect->xmax -= ICON_SIZE_FROM_BUTRECT(rect); | rect->xmax -= icon_size; | ||||
| } | } | ||||
| } | } | ||||
| static void widget_draw_node_link_socket(const uiWidgetColors *wcol, | static void widget_draw_node_link_socket(const uiWidgetColors *wcol, | ||||
| const rcti *rect, | const rcti *rect, | ||||
| uiBut *but, | uiBut *but, | ||||
| float alpha) | float alpha) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 3,132 Lines • Show Last 20 Lines | |||||
Use BLI_listbase_is_empty().