Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Craddock <nzcraddock@gmail.com>2020-07-03 06:27:04 +0300
committerNathan Craddock <nzcraddock@gmail.com>2020-07-03 06:27:04 +0300
commitb485592901b197279b34cd714a687d70003b90eb (patch)
tree999d009afa30035305643f34416b41cb817b2671 /source/blender/editors/space_outliner/outliner_draw.c
parentcf97bd606ea8b29ed5044e54fa41de7c2302e5a8 (diff)
Theme: Add theming for collection colors
Add a new panel similar to the Bone Color Sets panel to set the collection colors. These draw in the outliner and outliner context menu.
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_draw.c')
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c56
1 files changed, 5 insertions, 51 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 0a872abda06..2708eb84639 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -87,48 +87,6 @@
/* ****************************************************** */
/* Tree Size Functions */
-static void outliner_get_collection_color(float col[4], short color)
-{
- switch (color) {
- case COLLECTION_COLOR_RED:
- col[0] = 0.945f;
- col[1] = 0.568f;
- col[2] = 0.560f;
- col[3] = 1.0f;
- break;
- case COLLECTION_COLOR_ORANGE:
- col[0] = 0.945f;
- col[1] = 0.580f;
- col[2] = 0.384f;
- col[3] = 1.0f;
- break;
- case COLLECTION_COLOR_YELLOW:
- col[0] = 0.752f;
- col[1] = 0.674f;
- col[2] = 0.309f;
- col[3] = 1.0f;
- break;
- case COLLECTION_COLOR_GREEN:
- col[0] = 0.576f;
- col[1] = 0.717f;
- col[2] = 0.305f;
- col[3] = 1.0f;
- break;
- case COLLECTION_COLOR_BLUE:
- col[0] = 0.329f;
- col[1] = 0.733f;
- col[2] = 0.705f;
- col[3] = 1.0f;
- break;
- case COLLECTION_COLOR_PURPLE:
- col[0] = 0.721f;
- col[1] = 0.619f;
- col[2] = 0.929f;
- col[3] = 1.0f;
- break;
- }
-}
-
static void outliner_tree_dimensions_impl(SpaceOutliner *soops,
ListBase *lb,
int *width,
@@ -3254,8 +3212,9 @@ static void outliner_draw_tree_element(bContext *C,
Collection *collection = outliner_collection_from_tree_element(te);
if (collection->color != COLLECTION_COLOR_NONE) {
+ bTheme *btheme = UI_GetTheme();
float color[4];
- outliner_get_collection_color(color, collection->color);
+ rgba_uchar_to_float(color, btheme->collection_color[collection->color - 1].color);
UI_draw_roundbox_corner_set(UI_CNR_ALL);
UI_draw_roundbox_aa(true,
@@ -3501,6 +3460,7 @@ static void outliner_draw_hierarchy_lines_recursive(uint pos,
bool draw_grayed_out,
int *starty)
{
+ bTheme *btheme = UI_GetTheme();
TreeElement *line_start = NULL, *line_end = NULL;
int y = *starty;
short color_start;
@@ -3520,10 +3480,7 @@ static void outliner_draw_hierarchy_lines_recursive(uint pos,
if (tselem->type == TSE_LAYER_COLLECTION) {
if (line_end) {
if (color_start != COLLECTION_COLOR_NONE) {
- float c[4];
- outliner_get_collection_color(c, color_start);
-
- immUniformColor4fv(c);
+ immUniformColor4ubv(btheme->collection_color[color_start - 1].color);
}
else {
immUniformColor4ubv(col);
@@ -3563,10 +3520,7 @@ static void outliner_draw_hierarchy_lines_recursive(uint pos,
if (line_start) {
if (color_start != COLLECTION_COLOR_NONE) {
- float c[4];
- outliner_get_collection_color(c, color_start);
-
- immUniformColor4fv(c);
+ immUniformColor4ubv(btheme->collection_color[color_start - 1].color);
}
else {
immUniformColor4ubv(col);