[Bf-blender-cvs] [cfac269d258] master: UI: tweak display of active, selected and edited items in the outliner
Harley Acheson
noreply at git.blender.org
Thu May 16 14:39:16 CEST 2019
Commit: cfac269d258be8b1ba569a2c8ccffeb271247656
Author: Harley Acheson
Date: Wed May 15 13:51:34 2019 +0200
Branches: master
https://developer.blender.org/rBcfac269d258be8b1ba569a2c8ccffeb271247656
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
===================================================================
M release/datafiles/userdef/userdef_default_theme.c
M release/scripts/presets/interface_theme/blender_light.xml
M source/blender/blenkernel/BKE_blender_version.h
M source/blender/blenloader/intern/versioning_userdef.c
M source/blender/editors/include/UI_resources.h
M source/blender/editors/interface/resources.c
M source/blender/editors/space_outliner/outliner_draw.c
M source/blender/makesdna/DNA_userdef_types.h
M source/blender/makesrna/intern/rna_userdef.c
===================================================================
diff --git a/release/datafiles/userdef/userdef_default_theme.c b/release/datafiles/userdef/userdef_default_theme.c
index 2326b4652a9..e460de6dbc0 100644
--- a/release/datafiles/userdef/userdef_default_theme.c
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -749,6 +749,9 @@ const bTheme U_theme_default = {
.facedot_size = 4,
.match = RGBA(0x337f334c),
.selected_highlight = RGBA(0x314e784c),
+ .selected_object = RGBA(0xed5700ff),
+ .active_object = RGBA(0xffa028ff),
+ .edited_object = RGBA(0xffa02870),
.row_alternate = RGBA(0x91919110),
},
.space_node = {
diff --git a/release/scripts/presets/interface_theme/blender_light.xml b/release/scripts/presets/interface_theme/blender_light.xml
index 766c91cb45c..3b9c19ffda8 100644
--- a/release/scripts/presets/interface_theme/blender_light.xml
+++ b/release/scripts/presets/interface_theme/blender_light.xml
@@ -983,6 +983,9 @@
<ThemeOutliner
match="#337f33"
selected_highlight="#314e78"
+ selected_object="#9a3900ff"
+ active_object="#7e4f14ff"
+ edited_object="#ffad4560"
row_alternate="#3f3f3f1a"
>
<space>
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);
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list