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:
authorHarley Acheson <harley.acheson@gmail.com>2019-05-15 14:51:34 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-16 15:38:51 +0300
commitcfac269d258be8b1ba569a2c8ccffeb271247656 (patch)
treea396498aa465c33e783d321a7d570d5e9d42ad98 /source/blender
parent960496f8d181def9ac5e18e430893fde89d06a05 (diff)
UI: tweak display of active, selected and edited items in the outliner
* Change circle to roundbox around active icons, so they don't overflow. * Change text color to indicate selected and active state. Differential Revision: https://developer.blender.org/D4650
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_blender_version.h2
-rw-r--r--source/blender/blenloader/intern/versioning_userdef.c5
-rw-r--r--source/blender/editors/include/UI_resources.h3
-rw-r--r--source/blender/editors/interface/resources.c11
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c130
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h8
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c15
7 files changed, 116 insertions, 58 deletions
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index 1ca63eacec3..e6692959c95 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -27,7 +27,7 @@
* \note Use #STRINGIFY() rather than defining with quotes.
*/
#define BLENDER_VERSION 280
-#define BLENDER_SUBVERSION 66
+#define BLENDER_SUBVERSION 67
/** Several breakages with 280, e.g. collections vs layers. */
#define BLENDER_MINVERSION 280
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index 574f708764f..d1cb9d32212 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -134,7 +134,10 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
FROM_DEFAULT_V4_UCHAR(space_clip.scrubbing_background);
}
- if (!USER_VERSION_ATLEAST(280, 65)) {
+ if (!USER_VERSION_ATLEAST(280, 67)) {
+ FROM_DEFAULT_V4_UCHAR(space_outliner.selected_object);
+ FROM_DEFAULT_V4_UCHAR(space_outliner.active_object);
+ FROM_DEFAULT_V4_UCHAR(space_outliner.edited_object);
FROM_DEFAULT_V4_UCHAR(space_outliner.row_alternate);
}
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 7a88cf02679..6dc632921ad 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -255,6 +255,9 @@ typedef enum ThemeColorID {
TH_MATCH, /* highlight color for search matches */
TH_SELECT_HIGHLIGHT, /* highlight color for selected outliner item */
+ TH_SELECTED_OBJECT, /* selected object color for outliner */
+ TH_ACTIVE_OBJECT, /* active object color for outliner */
+ TH_EDITED_OBJECT, /* edited object color for outliner */
TH_ROW_ALTERNATE, /* overlay on every other row */
TH_SKIN_ROOT,
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 9f64643a4f0..04cb0d27d69 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -795,6 +795,17 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
cp = ts->selected_highlight;
break;
+ case TH_SELECTED_OBJECT:
+ cp = ts->selected_object;
+ break;
+
+ case TH_ACTIVE_OBJECT:
+ cp = ts->active_object;
+ break;
+
+ case TH_EDITED_OBJECT:
+ cp = ts->edited_object;
+
case TH_ROW_ALTERNATE:
cp = ts->row_alternate;
break;
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 9801eba872c..622c0b2ff22 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -2400,6 +2400,17 @@ static void outliner_draw_iconrow_number(const uiFontStyle *fstyle,
GPU_blend(true); /* Roundbox and text drawing disables. */
}
+static void outliner_icon_background_colors(float icon_color[4], float icon_border[4])
+{
+ float text[4];
+ UI_GetThemeColor4fv(TH_TEXT, text);
+
+ copy_v3_v3(icon_color, text);
+ icon_color[3] = 0.4f;
+ copy_v3_v3(icon_border, text);
+ icon_border[3] = 0.2f;
+}
+
static void outliner_draw_iconrow_doit(uiBlock *block,
TreeElement *te,
const uiFontStyle *fstyle,
@@ -2414,23 +2425,34 @@ static void outliner_draw_iconrow_doit(uiBlock *block,
if (active != OL_DRAWSEL_NONE) {
float ufac = UI_UNIT_X / 20.0f;
- float color[4] = {1.0f, 1.0f, 1.0f, 0.2f};
-
+ float icon_color[4], icon_border[4];
+ outliner_icon_background_colors(icon_color, icon_border);
+ icon_color[3] *= alpha_fac;
+ if (active == OL_DRAWSEL_ACTIVE) {
+ UI_GetThemeColor4fv(TH_EDITED_OBJECT, icon_color);
+ icon_border[3] = 0.3f;
+ }
UI_draw_roundbox_corner_set(UI_CNR_ALL);
- color[3] *= alpha_fac;
UI_draw_roundbox_aa(true,
- (float)*offsx + 1.0f * ufac,
- (float)ys + 1.0f * ufac,
- (float)*offsx + UI_UNIT_X - 1.0f * ufac,
+ (float)*offsx,
+ (float)ys + ufac,
+ (float)*offsx + UI_UNIT_X,
(float)ys + UI_UNIT_Y - ufac,
- (float)UI_UNIT_Y / 2.0f - ufac,
- color);
+ (float)UI_UNIT_Y / 4.0f,
+ icon_color);
+ /* border around it */
+ UI_draw_roundbox_aa(false,
+ (float)*offsx,
+ (float)ys + ufac,
+ (float)*offsx + UI_UNIT_X,
+ (float)ys + UI_UNIT_Y - ufac,
+ (float)UI_UNIT_Y / 4.0f,
+ icon_border);
GPU_blend(true); /* Roundbox disables. */
}
- /* No inlined icon should be clickable. */
- tselem_draw_icon(block, xmax, (float)*offsx, (float)ys, tselem, te, 0.8f * alpha_fac, false);
+ tselem_draw_icon(block, xmax, (float)*offsx, (float)ys, tselem, te, alpha_fac, false);
te->xs = *offsx;
te->ys = ys;
te->xend = (short)*offsx + UI_UNIT_X;
@@ -2484,7 +2506,7 @@ static void outliner_draw_iconrow(bContext *C,
float alpha_fac,
MergedIconRow *merged)
{
- eOLDrawState active;
+ eOLDrawState active = OL_DRAWSEL_NONE;
const Object *obact = OBACT(view_layer);
for (TreeElement *te = lb->first; te; te = te->next) {
@@ -2504,7 +2526,7 @@ static void outliner_draw_iconrow(bContext *C,
OL_DRAWSEL_NONE;
}
else if (is_object_data_in_editmode(tselem->id, obact)) {
- active = OL_DRAWSEL_NORMAL;
+ active = OL_DRAWSEL_ACTIVE;
}
else {
active = tree_element_active(C, scene, view_layer, soops, te, OL_SETSEL_NONE, false);
@@ -2603,19 +2625,20 @@ static void outliner_draw_tree_element(bContext *C,
const float restrict_column_width,
TreeElement **te_edit)
{
- TreeStoreElem *tselem;
+ TreeStoreElem *tselem = TREESTORE(te);
float ufac = UI_UNIT_X / 20.0f;
int offsx = 0;
eOLDrawState active = OL_DRAWSEL_NONE;
- float color[4];
- tselem = TREESTORE(te);
+ unsigned char text_color[4];
+ UI_GetThemeColor4ubv(TH_TEXT, text_color);
+ float icon_bgcolor[4], icon_border[4];
+ outliner_icon_background_colors(icon_bgcolor, icon_border);
if (*starty + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && *starty <= ar->v2d.cur.ymax) {
const float alpha_fac = ((te->flag & TE_DISABLED) || (te->flag & TE_CHILD_NOT_IN_COLLECTION) ||
draw_grayed_out) ?
0.5f :
1.0f;
- const float alpha = 0.5f * alpha_fac;
int xmax = ar->v2d.cur.xmax;
if ((tselem->flag & TSE_TEXTBUT) && (*te_edit == NULL)) {
@@ -2634,7 +2657,8 @@ static void outliner_draw_tree_element(bContext *C,
const Object *obact = OBACT(view_layer);
if (te->idcode == ID_SCE) {
if (tselem->id == (ID *)scene) {
- rgba_float_args_set(color, 1.0f, 1.0f, 1.0f, alpha);
+ /* active scene */
+ icon_bgcolor[3] = 0.2f;
active = OL_DRAWSEL_ACTIVE;
}
}
@@ -2645,34 +2669,28 @@ static void outliner_draw_tree_element(bContext *C,
const bool is_selected = (base != NULL) && ((base->flag & BASE_SELECTED) != 0);
if (ob == obact || is_selected) {
- uchar col[4] = {0, 0, 0, 0};
-
- /* outliner active ob: always white text, circle color now similar to view3d */
-
- active = OL_DRAWSEL_ACTIVE;
if (ob == obact) {
- if (is_selected) {
- UI_GetThemeColorType4ubv(TH_ACTIVE, SPACE_VIEW3D, col);
- col[3] = alpha;
- }
-
- active = OL_DRAWSEL_NORMAL;
+ /* active selected object */
+ UI_GetThemeColor3ubv(TH_ACTIVE_OBJECT, text_color);
+ text_color[3] = 255;
}
- else if (is_selected) {
- UI_GetThemeColorType4ubv(TH_SELECT, SPACE_VIEW3D, col);
- col[3] = alpha;
+ else {
+ /* other selected objects */
+ UI_GetThemeColor3ubv(TH_SELECTED_OBJECT, text_color);
+ text_color[3] = 255;
}
- rgba_float_args_set(
- color, (float)col[0] / 255, (float)col[1] / 255, (float)col[2] / 255, alpha);
}
}
else if (is_object_data_in_editmode(tselem->id, obact)) {
- rgba_float_args_set(color, 1.0f, 1.0f, 1.0f, alpha);
+ /* objects being edited */
+ UI_GetThemeColor4fv(TH_EDITED_OBJECT, icon_bgcolor);
+ icon_border[3] = 0.3f;
active = OL_DRAWSEL_ACTIVE;
}
else {
if (tree_element_active(C, scene, view_layer, soops, te, OL_SETSEL_NONE, false)) {
- rgba_float_args_set(color, 0.85f, 0.85f, 1.0f, alpha);
+ /* active items like camera or material */
+ icon_bgcolor[3] = 0.2f;
active = OL_DRAWSEL_ACTIVE;
}
}
@@ -2680,7 +2698,8 @@ static void outliner_draw_tree_element(bContext *C,
else {
active = tree_element_type_active(
C, scene, view_layer, soops, te, tselem, OL_SETSEL_NONE, false);
- rgba_float_args_set(color, 0.85f, 0.85f, 1.0f, alpha);
+ /* active collection*/
+ icon_bgcolor[3] = 0.2f;
}
/* Checkbox to enable collections. */
@@ -2695,12 +2714,20 @@ static void outliner_draw_tree_element(bContext *C,
if (active != OL_DRAWSEL_NONE) {
UI_draw_roundbox_corner_set(UI_CNR_ALL);
UI_draw_roundbox_aa(true,
- (float)startx + offsx + UI_UNIT_X + 1.0f * ufac,
- (float)*starty + 1.0f * ufac,
- (float)startx + offsx + 2.0f * UI_UNIT_X - 1.0f * ufac,
- (float)*starty + UI_UNIT_Y - 1.0f * ufac,
- UI_UNIT_Y / 2.0f - 1.0f * ufac,
- color);
+ (float)startx + offsx + UI_UNIT_X,
+ (float)*starty + ufac,
+ (float)startx + offsx + 2.0f * UI_UNIT_X,
+ (float)*starty + UI_UNIT_Y - ufac,
+ UI_UNIT_Y / 4.0f,
+ icon_bgcolor);
+ /* border around it */
+ UI_draw_roundbox_aa(false,
+ (float)startx + offsx + UI_UNIT_X,
+ (float)*starty + ufac,
+ (float)startx + offsx + 2.0f * UI_UNIT_X,
+ (float)*starty + UI_UNIT_Y - ufac,
+ UI_UNIT_Y / 4.0f,
+ icon_border);
GPU_blend(true); /* roundbox disables it */
te->flag |= TE_ACTIVE; // for lookup in display hierarchies
@@ -2772,21 +2799,12 @@ static void outliner_draw_tree_element(bContext *C,
/* name */
if ((tselem->flag & TSE_TEXTBUT) == 0) {
- unsigned char text_col[4];
-
- if (active == OL_DRAWSEL_NORMAL) {
- UI_GetThemeColor4ubv(TH_TEXT_HI, text_col);
- }
- else if (ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
- UI_GetThemeColorBlend3ubv(TH_BACK, TH_TEXT, 0.75f, text_col);
- text_col[3] = 255;
+ if (ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
+ UI_GetThemeColorBlend3ubv(TH_BACK, TH_TEXT, 0.75f, text_color);
+ text_color[3] = 255;
}
- else {
- UI_GetThemeColor4ubv(TH_TEXT, text_col);
- }
- text_col[3] *= alpha_fac;
-
- UI_fontstyle_draw_simple(fstyle, startx + offsx, *starty + 5 * ufac, te->name, text_col);
+ text_color[3] *= alpha_fac;
+ UI_fontstyle_draw_simple(fstyle, startx + offsx, *starty + 5 * ufac, te->name, text_color);
}
offsx += (int)(UI_UNIT_X + UI_fontstyle_string_width(fstyle, te->name));
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 43191ec97d7..9cab63dbfeb 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -363,6 +363,12 @@ typedef struct ThemeSpace {
char match[4];
/** Outliner - selected item. */
char selected_highlight[4];
+ /** Outliner - selected object. */
+ char selected_object[4];
+ /** Outliner - active object. */
+ char active_object[4];
+ /** Outliner - edited object. */
+ char edited_object[4];
/** Outliner - row color difference. */
char row_alternate[4];
@@ -401,6 +407,8 @@ typedef struct ThemeSpace {
char metadatabg[4];
char metadatatext[4];
+
+ char _pad2[4];
} ThemeSpace;
/* set of colors for use as a custom color set for Objects/Bones wire drawing */
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 367d0af1078..217beea7dae 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -2236,6 +2236,21 @@ static void rna_def_userdef_theme_space_outliner(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Selected Highlight", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "selected_object", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Selected Objects", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "active_object", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Active Object", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "edited_object", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Edited Object", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
prop = RNA_def_property(srna, "row_alternate", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Alternate Rows", "Overlay color on every other row");