forked from bartvdbraak/blender
UI: add icon color coding for different data types in the outliner.
For now we have categories collection, object, object data, modifiers & constraints, and shading. The icons can be categorized by adding e.g. DEF_ICON_OBJECT() in UI_icons.h. Light themes will need to be updated to use darker colors to keep icons visible in the outliner.
This commit is contained in:
parent
2ac65f6153
commit
cf8e71db61
@ -244,6 +244,11 @@ const bTheme U_theme_default = {
|
||||
.gizmo_secondary = RGBA(0x63ffffff),
|
||||
.gizmo_a = RGBA(0x4da84dff),
|
||||
.gizmo_b = RGBA(0xa33535ff),
|
||||
.icon_collection = RGBA(0xccccccff),
|
||||
.icon_object = RGBA(0xcc986eff),
|
||||
.icon_object_data = RGBA(0x98cc98ff),
|
||||
.icon_modifier = RGBA(0x6e98ccff),
|
||||
.icon_shading = RGBA(0xcc6e6eff),
|
||||
},
|
||||
.tbuts = {
|
||||
.back = RGBA(0x42424200),
|
||||
|
@ -819,6 +819,30 @@ class USERPREF_PT_theme(Panel):
|
||||
|
||||
col.separator()
|
||||
col.separator()
|
||||
|
||||
col.label(text="Icon Colors:")
|
||||
|
||||
row = col.row()
|
||||
|
||||
subsplit = row.split(factor=0.95)
|
||||
|
||||
padding = subsplit.split(factor=0.15)
|
||||
colsub = padding.column()
|
||||
colsub = padding.column()
|
||||
colsub.row().prop(ui, "icon_collection")
|
||||
colsub.row().prop(ui, "icon_object")
|
||||
colsub.row().prop(ui, "icon_object_data")
|
||||
|
||||
subsplit = row.split(factor=0.85)
|
||||
|
||||
padding = subsplit.split(factor=0.15)
|
||||
colsub = padding.column()
|
||||
colsub = padding.column()
|
||||
colsub.row().prop(ui, "icon_modifier")
|
||||
colsub.row().prop(ui, "icon_shading")
|
||||
|
||||
col.separator()
|
||||
col.separator()
|
||||
elif theme.theme_area == 'BONE_COLOR_SETS':
|
||||
col = split.column()
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
* and keep comment above the defines.
|
||||
* Use STRINGIFY() rather than defining with quotes */
|
||||
#define BLENDER_VERSION 280
|
||||
#define BLENDER_SUBVERSION 25
|
||||
#define BLENDER_SUBVERSION 26
|
||||
/* Several breakages with 280, e.g. collections vs layers */
|
||||
#define BLENDER_MINVERSION 280
|
||||
#define BLENDER_MINSUBVERSION 0
|
||||
|
@ -57,6 +57,14 @@ static void do_versions_theme(UserDef *userdef, bTheme *btheme)
|
||||
copy_v4_v4_char(btheme->tnla.anim_preview_range, btheme->tnla.anim_active);
|
||||
copy_v4_v4_char(btheme->tipo.anim_preview_range, btheme->tact.anim_active);
|
||||
}
|
||||
|
||||
if (!USER_VERSION_ATLEAST(280, 26)) {
|
||||
copy_v4_v4_char(btheme->tui.icon_collection, U_theme_default.tui.icon_collection);
|
||||
copy_v4_v4_char(btheme->tui.icon_object, U_theme_default.tui.icon_object);
|
||||
copy_v4_v4_char(btheme->tui.icon_object_data, U_theme_default.tui.icon_object_data);
|
||||
copy_v4_v4_char(btheme->tui.icon_modifier, U_theme_default.tui.icon_modifier);
|
||||
copy_v4_v4_char(btheme->tui.icon_shading, U_theme_default.tui.icon_shading);
|
||||
}
|
||||
#undef USER_VERSION_ATLEAST
|
||||
|
||||
}
|
||||
|
@ -30,6 +30,26 @@
|
||||
|
||||
/* Note: this is included multiple times with different #defines for DEF_ICON. */
|
||||
|
||||
/* Auto define more specific types for places that do not need the distinction. */
|
||||
#ifndef DEF_ICON_COLLECTION
|
||||
#define DEF_ICON_COLLECTION DEF_ICON
|
||||
#endif
|
||||
#ifndef DEF_ICON_OBJECT
|
||||
#define DEF_ICON_OBJECT DEF_ICON
|
||||
#endif
|
||||
#ifndef DEF_ICON_OBJECT_DATA
|
||||
#define DEF_ICON_OBJECT_DATA DEF_ICON
|
||||
#endif
|
||||
#ifndef DEF_ICON_MODIFIER
|
||||
#define DEF_ICON_MODIFIER DEF_ICON
|
||||
#endif
|
||||
#ifndef DEF_ICON_SHADING
|
||||
#define DEF_ICON_SHADING DEF_ICON
|
||||
#endif
|
||||
#ifndef DEF_ICON_COLOR
|
||||
#define DEF_ICON_COLOR DEF_ICON
|
||||
#endif
|
||||
|
||||
/* ICON_ prefix added */
|
||||
DEF_ICON_COLOR(NONE)
|
||||
DEF_ICON(QUESTION)
|
||||
@ -115,17 +135,17 @@ DEF_ICON(FULLSCREEN_EXIT)
|
||||
DEF_ICON(ONIONSKIN)
|
||||
|
||||
/* BUTTONS */
|
||||
DEF_ICON(LIGHT)
|
||||
DEF_ICON(MATERIAL)
|
||||
DEF_ICON(TEXTURE)
|
||||
DEF_ICON_SHADING(LIGHT)
|
||||
DEF_ICON_SHADING(MATERIAL)
|
||||
DEF_ICON_SHADING(TEXTURE)
|
||||
DEF_ICON(ANIM)
|
||||
DEF_ICON(WORLD)
|
||||
DEF_ICON_SHADING(WORLD)
|
||||
DEF_ICON(SCENE)
|
||||
DEF_ICON(EDIT)
|
||||
DEF_ICON(GAME)
|
||||
DEF_ICON(RADIO)
|
||||
DEF_ICON_COLOR(SCRIPT)
|
||||
DEF_ICON(PARTICLES)
|
||||
DEF_ICON_MODIFIER(PARTICLES)
|
||||
DEF_ICON(PHYSICS)
|
||||
DEF_ICON(SPEAKER)
|
||||
DEF_ICON(TEXTURE_SHADED)
|
||||
@ -200,34 +220,34 @@ DEF_ICON_BLANK(77b)
|
||||
/* DATA */
|
||||
DEF_ICON(SCENE_DATA)
|
||||
DEF_ICON(RENDERLAYERS)
|
||||
DEF_ICON(WORLD_DATA)
|
||||
DEF_ICON_SHADING(WORLD_DATA)
|
||||
DEF_ICON(OBJECT_DATA)
|
||||
DEF_ICON(MESH_DATA)
|
||||
DEF_ICON(CURVE_DATA)
|
||||
DEF_ICON(META_DATA)
|
||||
DEF_ICON(LATTICE_DATA)
|
||||
DEF_ICON(LIGHT_DATA)
|
||||
DEF_ICON(MATERIAL_DATA)
|
||||
DEF_ICON(TEXTURE_DATA)
|
||||
DEF_ICON_SHADING(LIGHT_DATA)
|
||||
DEF_ICON_SHADING(MATERIAL_DATA)
|
||||
DEF_ICON_SHADING(TEXTURE_DATA)
|
||||
DEF_ICON(ANIM_DATA)
|
||||
DEF_ICON(CAMERA_DATA)
|
||||
DEF_ICON(PARTICLE_DATA)
|
||||
DEF_ICON(LIBRARY_DATA_DIRECT)
|
||||
DEF_ICON(GROUP)
|
||||
DEF_ICON_COLLECTION(GROUP)
|
||||
DEF_ICON(ARMATURE_DATA)
|
||||
DEF_ICON(POSE_DATA)
|
||||
DEF_ICON(BONE_DATA)
|
||||
DEF_ICON(CONSTRAINT)
|
||||
DEF_ICON_MODIFIER(CONSTRAINT)
|
||||
DEF_ICON_COLOR(SHAPEKEY_DATA)
|
||||
DEF_ICON(CONSTRAINT_BONE)
|
||||
DEF_ICON_MODIFIER(CONSTRAINT_BONE)
|
||||
DEF_ICON(CAMERA_STEREO)
|
||||
DEF_ICON(PACKAGE)
|
||||
DEF_ICON(UGLYPACKAGE)
|
||||
DEF_ICON_BLANK(79b)
|
||||
|
||||
/* DATA */
|
||||
DEF_ICON(BRUSH_DATA)
|
||||
DEF_ICON(IMAGE_DATA)
|
||||
DEF_ICON_SHADING(BRUSH_DATA)
|
||||
DEF_ICON_SHADING(IMAGE_DATA)
|
||||
DEF_ICON(FILE)
|
||||
DEF_ICON(FCURVE)
|
||||
DEF_ICON(FONT_DATA)
|
||||
@ -242,7 +262,7 @@ DEF_ICON_COLOR(BOIDS)
|
||||
DEF_ICON(STRANDS)
|
||||
DEF_ICON(LIBRARY_DATA_INDIRECT)
|
||||
DEF_ICON(GREASEPENCIL)
|
||||
DEF_ICON(LINE_DATA)
|
||||
DEF_ICON_SHADING(LINE_DATA)
|
||||
DEF_ICON_COLOR(LIBRARY_DATA_OVERRIDE)
|
||||
DEF_ICON(GROUP_BONE)
|
||||
DEF_ICON(GROUP_VERTEX)
|
||||
@ -282,22 +302,22 @@ DEF_ICON(SYSTEM)
|
||||
DEF_ICON(SETTINGS)
|
||||
|
||||
/* OUTLINER */
|
||||
DEF_ICON(OUTLINER_OB_EMPTY)
|
||||
DEF_ICON(OUTLINER_OB_MESH)
|
||||
DEF_ICON(OUTLINER_OB_CURVE)
|
||||
DEF_ICON(OUTLINER_OB_LATTICE)
|
||||
DEF_ICON(OUTLINER_OB_META)
|
||||
DEF_ICON(OUTLINER_OB_LIGHT)
|
||||
DEF_ICON(OUTLINER_OB_CAMERA)
|
||||
DEF_ICON(OUTLINER_OB_ARMATURE)
|
||||
DEF_ICON(OUTLINER_OB_FONT)
|
||||
DEF_ICON(OUTLINER_OB_SURFACE)
|
||||
DEF_ICON(OUTLINER_OB_SPEAKER)
|
||||
DEF_ICON(OUTLINER_OB_FORCE_FIELD)
|
||||
DEF_ICON(OUTLINER_OB_GROUP_INSTANCE)
|
||||
DEF_ICON(OUTLINER_OB_GREASEPENCIL)
|
||||
DEF_ICON(OUTLINER_OB_LIGHTPROBE)
|
||||
DEF_ICON(OUTLINER_OB_IMAGE)
|
||||
DEF_ICON_OBJECT(OUTLINER_OB_EMPTY)
|
||||
DEF_ICON_OBJECT(OUTLINER_OB_MESH)
|
||||
DEF_ICON_OBJECT(OUTLINER_OB_CURVE)
|
||||
DEF_ICON_OBJECT(OUTLINER_OB_LATTICE)
|
||||
DEF_ICON_OBJECT(OUTLINER_OB_META)
|
||||
DEF_ICON_OBJECT(OUTLINER_OB_LIGHT)
|
||||
DEF_ICON_OBJECT(OUTLINER_OB_CAMERA)
|
||||
DEF_ICON_OBJECT(OUTLINER_OB_ARMATURE)
|
||||
DEF_ICON_OBJECT(OUTLINER_OB_FONT)
|
||||
DEF_ICON_OBJECT(OUTLINER_OB_SURFACE)
|
||||
DEF_ICON_OBJECT(OUTLINER_OB_SPEAKER)
|
||||
DEF_ICON_OBJECT(OUTLINER_OB_FORCE_FIELD)
|
||||
DEF_ICON_OBJECT(OUTLINER_OB_GROUP_INSTANCE)
|
||||
DEF_ICON_OBJECT(OUTLINER_OB_GREASEPENCIL)
|
||||
DEF_ICON_OBJECT(OUTLINER_OB_LIGHTPROBE)
|
||||
DEF_ICON_OBJECT(OUTLINER_OB_IMAGE)
|
||||
DEF_ICON_BLANK(125)
|
||||
DEF_ICON(RESTRICT_COLOR_OFF)
|
||||
DEF_ICON(RESTRICT_COLOR_ON)
|
||||
@ -311,19 +331,19 @@ DEF_ICON_BLANK(127b)
|
||||
|
||||
/* OUTLINER */
|
||||
DEF_ICON_BLANK(128)
|
||||
DEF_ICON(OUTLINER_DATA_MESH)
|
||||
DEF_ICON(OUTLINER_DATA_CURVE)
|
||||
DEF_ICON(OUTLINER_DATA_LATTICE)
|
||||
DEF_ICON(OUTLINER_DATA_META)
|
||||
DEF_ICON(OUTLINER_DATA_LIGHT)
|
||||
DEF_ICON(OUTLINER_DATA_CAMERA)
|
||||
DEF_ICON(OUTLINER_DATA_ARMATURE)
|
||||
DEF_ICON(OUTLINER_DATA_FONT)
|
||||
DEF_ICON(OUTLINER_DATA_SURFACE)
|
||||
DEF_ICON(OUTLINER_DATA_SPEAKER)
|
||||
DEF_ICON(OUTLINER_DATA_POSE)
|
||||
DEF_ICON_OBJECT_DATA(OUTLINER_DATA_MESH)
|
||||
DEF_ICON_OBJECT_DATA(OUTLINER_DATA_CURVE)
|
||||
DEF_ICON_OBJECT_DATA(OUTLINER_DATA_LATTICE)
|
||||
DEF_ICON_OBJECT_DATA(OUTLINER_DATA_META)
|
||||
DEF_ICON_OBJECT_DATA(OUTLINER_DATA_LIGHT)
|
||||
DEF_ICON_OBJECT_DATA(OUTLINER_DATA_CAMERA)
|
||||
DEF_ICON_OBJECT_DATA(OUTLINER_DATA_ARMATURE)
|
||||
DEF_ICON_OBJECT_DATA(OUTLINER_DATA_FONT)
|
||||
DEF_ICON_OBJECT_DATA(OUTLINER_DATA_SURFACE)
|
||||
DEF_ICON_OBJECT_DATA(OUTLINER_DATA_SPEAKER)
|
||||
DEF_ICON_OBJECT_DATA(OUTLINER_DATA_POSE)
|
||||
DEF_ICON_BLANK(130)
|
||||
DEF_ICON(OUTLINER_DATA_GREASEPENCIL)
|
||||
DEF_ICON_OBJECT_DATA(OUTLINER_DATA_GREASEPENCIL)
|
||||
DEF_ICON_BLANK(132)
|
||||
DEF_ICON_BLANK(133)
|
||||
DEF_ICON_BLANK(134)
|
||||
@ -350,11 +370,11 @@ DEF_ICON(MESH_TORUS)
|
||||
DEF_ICON(MESH_CONE)
|
||||
DEF_ICON(MESH_CAPSULE)
|
||||
DEF_ICON_BLANK(611)
|
||||
DEF_ICON(LIGHT_POINT)
|
||||
DEF_ICON(LIGHT_SUN)
|
||||
DEF_ICON(LIGHT_SPOT)
|
||||
DEF_ICON(LIGHT_HEMI)
|
||||
DEF_ICON(LIGHT_AREA)
|
||||
DEF_ICON_SHADING(LIGHT_POINT)
|
||||
DEF_ICON_SHADING(LIGHT_SUN)
|
||||
DEF_ICON_SHADING(LIGHT_SPOT)
|
||||
DEF_ICON_SHADING(LIGHT_HEMI)
|
||||
DEF_ICON_SHADING(LIGHT_AREA)
|
||||
DEF_ICON_BLANK(617)
|
||||
DEF_ICON_BLANK(618)
|
||||
DEF_ICON_COLOR(META_EMPTY)
|
||||
@ -380,9 +400,9 @@ DEF_ICON(CURVE_BEZCIRCLE)
|
||||
DEF_ICON(CURVE_NCURVE)
|
||||
DEF_ICON(CURVE_NCIRCLE)
|
||||
DEF_ICON(CURVE_PATH)
|
||||
DEF_ICON(LIGHTPROBE_CUBEMAP)
|
||||
DEF_ICON(LIGHTPROBE_PLANAR)
|
||||
DEF_ICON(LIGHTPROBE_GRID)
|
||||
DEF_ICON_SHADING(LIGHTPROBE_CUBEMAP)
|
||||
DEF_ICON_SHADING(LIGHTPROBE_PLANAR)
|
||||
DEF_ICON_SHADING(LIGHTPROBE_GRID)
|
||||
DEF_ICON_BLANK(647)
|
||||
DEF_ICON_BLANK(648)
|
||||
DEF_ICON(COLOR_RED)
|
||||
@ -506,7 +526,7 @@ DEF_ICON_BLANK(784)
|
||||
DEF_ICON_BLANK(785)
|
||||
|
||||
/* MODIFIERS */
|
||||
DEF_ICON(MODIFIER)
|
||||
DEF_ICON_MODIFIER(MODIFIER)
|
||||
DEF_ICON_COLOR(MOD_WAVE)
|
||||
DEF_ICON_COLOR(MOD_BUILD)
|
||||
DEF_ICON_COLOR(MOD_DECIM)
|
||||
@ -1034,3 +1054,15 @@ DEF_ICON_COLOR(EVENT_HOME)
|
||||
DEF_ICON_COLOR(EVENT_END)
|
||||
DEF_ICON_COLOR(EVENT_RETURN)
|
||||
/* add as needed. */
|
||||
|
||||
/* Undefine all types. */
|
||||
|
||||
#undef DEF_ICON
|
||||
#undef DEF_ICON_COLLECTION
|
||||
#undef DEF_ICON_OBJECT
|
||||
#undef DEF_ICON_OBJECT_DATA
|
||||
#undef DEF_ICON_MODIFIER
|
||||
#undef DEF_ICON_SHADING
|
||||
#undef DEF_ICON_VECTOR
|
||||
#undef DEF_ICON_COLOR
|
||||
#undef DEF_ICON_BLANK
|
||||
|
@ -29,11 +29,12 @@
|
||||
* \ingroup editorui
|
||||
*/
|
||||
|
||||
#include "BLI_sys_types.h"
|
||||
|
||||
#ifndef __UI_RESOURCES_H__
|
||||
#define __UI_RESOURCES_H__
|
||||
|
||||
/* elubie: TODO: move the typedef for icons to UI_interface_icons.h */
|
||||
/* and add/replace include of UI_resources.h by UI_interface_icons.h */
|
||||
/* Define icon enum. */
|
||||
#define DEF_ICON(name) ICON_##name,
|
||||
#define DEF_ICON_VECTOR(name) ICON_##name,
|
||||
#define DEF_ICON_COLOR(name) ICON_##name,
|
||||
@ -47,11 +48,6 @@ typedef enum {
|
||||
|
||||
#define BIFICONID_FIRST (ICON_NONE)
|
||||
|
||||
#undef DEF_ICON
|
||||
#undef DEF_ICON_VECTOR
|
||||
#undef DEF_ICON_COLOR
|
||||
#undef DEF_ICON_BLANK
|
||||
|
||||
/* use to denote intentionally unset theme color */
|
||||
#define TH_UNDEFINED -1
|
||||
|
||||
@ -267,6 +263,12 @@ typedef enum ThemeColorID {
|
||||
TH_ANIM_INACTIVE, /* no active action */
|
||||
TH_ANIM_PREVIEW_RANGE,/* preview range overlay */
|
||||
|
||||
TH_ICON_COLLECTION,
|
||||
TH_ICON_OBJECT,
|
||||
TH_ICON_OBJECT_DATA,
|
||||
TH_ICON_MODIFIER,
|
||||
TH_ICON_SHADING,
|
||||
|
||||
TH_NLA_TWEAK, /* 'tweaking' track in NLA */
|
||||
TH_NLA_TWEAK_DUPLI, /* error/warning flag for other strips referencing dupli strip */
|
||||
|
||||
@ -366,6 +368,9 @@ void UI_GetThemeColor4ubv(int colorid, unsigned char col[4]);
|
||||
// get a theme color from specified space type
|
||||
void UI_GetThemeColorType4ubv(int colorid, int spacetype, char col[4]);
|
||||
|
||||
// get theme color for coloring monochrome icons
|
||||
bool UI_GetIconThemeColor4fv(int colorid, float col[4]);
|
||||
|
||||
// shade a 3 byte color (same as UI_GetColorPtrBlendShade3ubv with 0.0 factor)
|
||||
void UI_GetColorPtrShade3ubv(const unsigned char cp1[3], unsigned char col[3], int offset);
|
||||
|
||||
|
@ -129,6 +129,7 @@ typedef struct DrawInfo {
|
||||
} buffer;
|
||||
struct {
|
||||
int x, y, w, h;
|
||||
int theme_color;
|
||||
} texture;
|
||||
struct {
|
||||
/* Can be packed into a single int. */
|
||||
@ -149,29 +150,35 @@ typedef struct IconTexture {
|
||||
float invh;
|
||||
} IconTexture;
|
||||
|
||||
typedef struct IconType {
|
||||
int type;
|
||||
int theme_color;
|
||||
} IconType;
|
||||
|
||||
/* ******************* STATIC LOCAL VARS ******************* */
|
||||
/* static here to cache results of icon directory scan, so it's not
|
||||
* scanning the filesystem each time the menu is drawn */
|
||||
static struct ListBase iconfilelist = {NULL, NULL};
|
||||
static IconTexture icongltex = {0, 0, 0, 0.0f, 0.0f};
|
||||
|
||||
static const int icontypes[] = {
|
||||
#define DEF_ICON(name) ICON_TYPE_MONO_TEXTURE,
|
||||
#define DEF_ICON_VECTOR(name) ICON_TYPE_VECTOR,
|
||||
#define DEF_ICON_COLOR(name) ICON_TYPE_COLOR_TEXTURE,
|
||||
#define DEF_ICON_BLANK(name) ICON_TYPE_BLANK,
|
||||
static const IconType icontypes[] = {
|
||||
#define DEF_ICON(name) {ICON_TYPE_MONO_TEXTURE, 0},
|
||||
#define DEF_ICON_COLLECTION(name) {ICON_TYPE_MONO_TEXTURE, TH_ICON_COLLECTION},
|
||||
#define DEF_ICON_OBJECT(name) {ICON_TYPE_MONO_TEXTURE, TH_ICON_OBJECT},
|
||||
#define DEF_ICON_OBJECT_DATA(name) {ICON_TYPE_MONO_TEXTURE, TH_ICON_OBJECT_DATA},
|
||||
#define DEF_ICON_MODIFIER(name) {ICON_TYPE_MONO_TEXTURE, TH_ICON_MODIFIER},
|
||||
#define DEF_ICON_SHADING(name) {ICON_TYPE_MONO_TEXTURE, TH_ICON_SHADING},
|
||||
#define DEF_ICON_VECTOR(name) {ICON_TYPE_VECTOR, 0},
|
||||
#define DEF_ICON_COLOR(name) {ICON_TYPE_COLOR_TEXTURE, 0},
|
||||
#define DEF_ICON_BLANK(name) {ICON_TYPE_BLANK, 0},
|
||||
#include "UI_icons.h"
|
||||
#undef DEF_ICON
|
||||
#undef DEF_ICON_VECTOR
|
||||
#undef DEF_ICON_COLOR
|
||||
#undef DEF_ICON_BLANK
|
||||
};
|
||||
|
||||
/* **************************************************** */
|
||||
|
||||
#ifndef WITH_HEADLESS
|
||||
|
||||
static DrawInfo *def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs, int size, int type)
|
||||
static DrawInfo *def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs, int size, int type, int theme_color)
|
||||
{
|
||||
Icon *new_icon = NULL;
|
||||
IconImage *iimg = NULL;
|
||||
@ -186,6 +193,7 @@ static DrawInfo *def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs,
|
||||
di->type = type;
|
||||
|
||||
if (ELEM(type, ICON_TYPE_COLOR_TEXTURE, ICON_TYPE_MONO_TEXTURE)) {
|
||||
di->data.texture.theme_color = theme_color;
|
||||
di->data.texture.x = xofs;
|
||||
di->data.texture.y = yofs;
|
||||
di->data.texture.w = size;
|
||||
@ -439,7 +447,7 @@ static void init_brush_icons(void)
|
||||
int size = datatoc_ ##name## _png_size; \
|
||||
DrawInfo *di; \
|
||||
\
|
||||
di = def_internal_icon(NULL, icon_id, 0, 0, w, ICON_TYPE_BUFFER); \
|
||||
di = def_internal_icon(NULL, icon_id, 0, 0, w, ICON_TYPE_BUFFER, 0); \
|
||||
di->data.buffer.image->datatoc_rect = rect; \
|
||||
di->data.buffer.image->datatoc_size = size; \
|
||||
}
|
||||
@ -580,7 +588,7 @@ static void init_event_icons(void)
|
||||
|
||||
#define INIT_EVENT_ICON(icon_id, type, value) \
|
||||
{ \
|
||||
DrawInfo *di = def_internal_icon(NULL, icon_id, 0, 0, w, ICON_TYPE_EVENT); \
|
||||
DrawInfo *di = def_internal_icon(NULL, icon_id, 0, 0, w, ICON_TYPE_EVENT, 0); \
|
||||
di->data.input.event_type = type; \
|
||||
di->data.input.event_value = value; \
|
||||
di->data.input.icon = icon_id; \
|
||||
@ -741,15 +749,15 @@ static void init_internal_icons(void)
|
||||
for (y = 0; y < ICON_GRID_ROWS; y++) {
|
||||
/* Row W has monochrome icons. */
|
||||
for (x = 0; x < ICON_GRID_COLS; x++) {
|
||||
int icontype = icontypes[y * ICON_GRID_COLS + x];
|
||||
if (!ELEM(icontype, ICON_TYPE_COLOR_TEXTURE, ICON_TYPE_MONO_TEXTURE)) {
|
||||
IconType icontype = icontypes[y * ICON_GRID_COLS + x];
|
||||
if (!ELEM(icontype.type, ICON_TYPE_COLOR_TEXTURE, ICON_TYPE_MONO_TEXTURE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
def_internal_icon(b32buf, BIFICONID_FIRST + y * ICON_GRID_COLS + x,
|
||||
x * (ICON_GRID_W + ICON_GRID_MARGIN) + ICON_GRID_MARGIN,
|
||||
y * (ICON_GRID_H + ICON_GRID_MARGIN) + ICON_GRID_MARGIN, ICON_GRID_W,
|
||||
icontype);
|
||||
icontype.type, icontype.theme_color);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1528,11 +1536,13 @@ static void icon_draw_size(
|
||||
else if (di->type == ICON_TYPE_MONO_TEXTURE) {
|
||||
/* icon that matches text color, assumed to be white */
|
||||
float color[4];
|
||||
if (mono_rgba) {
|
||||
rgba_uchar_to_float(color, (const uchar *)mono_rgba);
|
||||
}
|
||||
else {
|
||||
UI_GetThemeColor4fv(TH_TEXT, color);
|
||||
if (!UI_GetIconThemeColor4fv(di->data.texture.theme_color, color)) {
|
||||
if (mono_rgba) {
|
||||
rgba_uchar_to_float(color, (const uchar *)mono_rgba);
|
||||
}
|
||||
else {
|
||||
UI_GetThemeColor4fv(TH_TEXT, color);
|
||||
}
|
||||
}
|
||||
|
||||
if (rgb) {
|
||||
|
@ -686,6 +686,17 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
|
||||
case TH_GIZMO_B:
|
||||
cp = btheme->tui.gizmo_b; break;
|
||||
|
||||
case TH_ICON_COLLECTION:
|
||||
cp = btheme->tui.icon_collection; break;
|
||||
case TH_ICON_OBJECT:
|
||||
cp = btheme->tui.icon_object; break;
|
||||
case TH_ICON_OBJECT_DATA:
|
||||
cp = btheme->tui.icon_object_data; break;
|
||||
case TH_ICON_MODIFIER:
|
||||
cp = btheme->tui.icon_modifier; break;
|
||||
case TH_ICON_SHADING:
|
||||
cp = btheme->tui.icon_shading; break;
|
||||
|
||||
case TH_INFO_SELECTED:
|
||||
cp = ts->info_selected;
|
||||
break;
|
||||
@ -1109,6 +1120,31 @@ void UI_GetThemeColorType4ubv(int colorid, int spacetype, char col[4])
|
||||
col[3] = cp[3];
|
||||
}
|
||||
|
||||
bool UI_GetIconThemeColor4fv(int colorid, float col[4])
|
||||
{
|
||||
if (colorid == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Only colored icons in outliner and popups, overall UI is intended
|
||||
* to stay monochrome and out of the way except a few places where it
|
||||
* is important to communicate different data types. */
|
||||
if (!((theme_spacetype == SPACE_OUTLINER) ||
|
||||
(theme_regionid == RGN_TYPE_TEMPORARY)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const unsigned char *cp;
|
||||
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
|
||||
col[0] = ((float)cp[0]) / 255.0f;
|
||||
col[1] = ((float)cp[1]) / 255.0f;
|
||||
col[2] = ((float)cp[2]) / 255.0f;
|
||||
col[3] = ((float)cp[3]) / 255.0f;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void UI_GetColorPtrShade3ubv(const unsigned char cp[3], unsigned char col[3], int offset)
|
||||
{
|
||||
int r, g, b;
|
||||
|
@ -1426,7 +1426,7 @@ static void outliner_draw_iconrow_doit(
|
||||
|
||||
if (active != OL_DRAWSEL_NONE) {
|
||||
float ufac = UI_UNIT_X / 20.0f;
|
||||
float color[4] = {1.0f, 1.0f, 1.0f, 0.4f};
|
||||
float color[4] = {1.0f, 1.0f, 1.0f, 0.2f};
|
||||
|
||||
UI_draw_roundbox_corner_set(UI_CNR_ALL);
|
||||
color[3] *= alpha_fac;
|
||||
|
@ -200,7 +200,13 @@ typedef struct ThemeUI {
|
||||
char gizmo_secondary[4];
|
||||
char gizmo_a[4];
|
||||
char gizmo_b[4];
|
||||
char pad2[4];
|
||||
|
||||
/* Icon Colors. */
|
||||
char icon_collection[4]; /* Collection items */
|
||||
char icon_object[4]; /* Object items */
|
||||
char icon_object_data[4]; /* Object data items */
|
||||
char icon_modifier[4]; /* Modifier and constraint items */
|
||||
char icon_shading[4]; /* Shading related items */
|
||||
} ThemeUI;
|
||||
|
||||
/* try to put them all in one, if needed a special struct can be created as well
|
||||
|
@ -55,10 +55,6 @@ const EnumPropertyItem rna_enum_icon_items[] = {
|
||||
#include "UI_icons.h"
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
#undef DEF_ICON
|
||||
#undef DEF_ICON_VECTOR
|
||||
#undef DEF_ICON_COLOR
|
||||
#undef DEF_ICON_BLANK
|
||||
|
||||
#ifdef RNA_RUNTIME
|
||||
|
||||
|
@ -1229,6 +1229,37 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna)
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_ui_text(prop, "Gizmo B", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
|
||||
/* Icon colors. */
|
||||
prop = RNA_def_property(srna, "icon_collection", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_float_sdna(prop, NULL, "icon_collection");
|
||||
RNA_def_property_array(prop, 4);
|
||||
RNA_def_property_ui_text(prop, "Collection", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
|
||||
prop = RNA_def_property(srna, "icon_object", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_float_sdna(prop, NULL, "icon_object");
|
||||
RNA_def_property_array(prop, 4);
|
||||
RNA_def_property_ui_text(prop, "Object", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
|
||||
prop = RNA_def_property(srna, "icon_object_data", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_float_sdna(prop, NULL, "icon_object_data");
|
||||
RNA_def_property_array(prop, 4);
|
||||
RNA_def_property_ui_text(prop, "Object Data", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
|
||||
prop = RNA_def_property(srna, "icon_modifier", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_float_sdna(prop, NULL, "icon_modifier");
|
||||
RNA_def_property_array(prop, 4);
|
||||
RNA_def_property_ui_text(prop, "Modifier", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
|
||||
prop = RNA_def_property(srna, "icon_shading", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_float_sdna(prop, NULL, "icon_shading");
|
||||
RNA_def_property_array(prop, 4);
|
||||
RNA_def_property_ui_text(prop, "Shading", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
}
|
||||
|
||||
static void rna_def_userdef_theme_space_common(StructRNA *srna)
|
||||
|
Loading…
Reference in New Issue
Block a user