Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface.c
| Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | |||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "BPY_extern.h" | #include "BPY_extern.h" | ||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "ED_numinput.h" | #include "ED_numinput.h" | ||||
| #include "IMB_colormanagement.h" | #include "IMB_colormanagement.h" | ||||
campbellbarton: No need to include these headers AFAICS, the argument can be listed as `struct ImBuf` since… | |||||
| #include "DEG_depsgraph_query.h" | #include "DEG_depsgraph_query.h" | ||||
| #include "interface_intern.h" | #include "interface_intern.h" | ||||
| /* prototypes. */ | /* prototypes. */ | ||||
| static void ui_but_to_pixelrect(struct rcti *rect, | static void ui_but_to_pixelrect(struct rcti *rect, | ||||
| const struct ARegion *region, | const struct ARegion *region, | ||||
| struct uiBlock *block, | struct uiBlock *block, | ||||
| ▲ Show 20 Lines • Show All 4,346 Lines • ▼ Show 20 Lines | uiBut *uiDefBut(uiBlock *block, | ||||
| uiBut *but = ui_def_but( | uiBut *but = ui_def_but( | ||||
| block, type, retval, str, x, y, width, height, poin, min, max, a1, a2, tip); | block, type, retval, str, x, y, width, height, poin, min, max, a1, a2, tip); | ||||
| ui_but_update(but); | ui_but_update(but); | ||||
| return but; | return but; | ||||
| } | } | ||||
| uiBut *uiDefButImage( | |||||
| uiBlock *block, void *imbuf, int x, int y, short width, short height, const uchar color[4]) | |||||
| { | |||||
| uiBut *but = ui_def_but( | |||||
Not Done Inline ActionsPass color as const, unless there is reason not to. campbellbarton: Pass color as const, unless there is reason not to. | |||||
| block, UI_BTYPE_IMAGE, 0, "", x, y, width, height, imbuf, 0, 0, 0, 0, ""); | |||||
| if (color) { | |||||
| copy_v4_v4_uchar(but->col, color); | |||||
| } | |||||
| else { | |||||
| but->col[0] = 255; | |||||
| but->col[1] = 255; | |||||
| but->col[2] = 255; | |||||
| but->col[3] = 255; | |||||
| } | |||||
| ui_but_update(but); | |||||
| return but; | |||||
| } | |||||
| uiBut *uiDefButAlert(uiBlock *block, int icon, int x, int y, short width, short height) | |||||
| { | |||||
| struct ImBuf *ibuf = UI_alert_image(icon); | |||||
| if (icon == ALERT_ICON_BLENDER) { | |||||
| return uiDefButImage(block, ibuf, x, y, width, height, NULL); | |||||
| } | |||||
| else { | |||||
| uchar icon_color[4]; | |||||
| ThemeColorID color_id = TH_INFO_WARNING; | |||||
| if (icon == ALERT_ICON_ERROR) { | |||||
| color_id = TH_INFO_ERROR; | |||||
| } | |||||
| else if (icon == ALERT_ICON_INFO) { | |||||
| color_id = TH_INFO_INFO; | |||||
| } | |||||
| else if (icon == ALERT_ICON_QUESTION) { | |||||
| color_id = TH_INFO_PROPERTY; | |||||
| } | |||||
| UI_GetThemeColorType4ubv(color_id, SPACE_INFO, icon_color); | |||||
| return uiDefButImage(block, ibuf, x, y, width, height, icon_color); | |||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * if \a _x_ is a power of two (only one bit) return the power, | * if \a _x_ is a power of two (only one bit) return the power, | ||||
| * otherwise return -1. | * otherwise return -1. | ||||
| * | * | ||||
| * for powers of two: | * for powers of two: | ||||
| * \code{.c} | * \code{.c} | ||||
| * ((1 << findBitIndex(x)) == x); | * ((1 << findBitIndex(x)) == x); | ||||
| * \endcode | * \endcode | ||||
| ▲ Show 20 Lines • Show All 2,276 Lines • Show Last 20 Lines | |||||
No need to include these headers AFAICS, the argument can be listed as struct ImBuf since it's only forwarded.