[Bf-blender-cvs] [3bedf723192] soc-2019-outliner: Outliner: Active element
Nathan Craddock
noreply at git.blender.org
Wed May 29 04:53:01 CEST 2019
Commit: 3bedf72319270aff7438953e0b9da6cd388ee2f8
Author: Nathan Craddock
Date: Tue May 28 20:47:25 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rB3bedf72319270aff7438953e0b9da6cd388ee2f8
Outliner: Active element
Initial implementation for active elements. Currently works for select and extend selection
===================================================================
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/editors/space_outliner/outliner_select.c
===================================================================
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 6dc632921ad..df7fd2cffa9 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -255,6 +255,7 @@ typedef enum ThemeColorID {
TH_MATCH, /* highlight color for search matches */
TH_SELECT_HIGHLIGHT, /* highlight color for selected outliner item */
+ TH_SELECT_ACTIVE, /* highlight color for active 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 */
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 06acf59e07c..d8db0634bce 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -795,6 +795,10 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
cp = ts->selected_highlight;
break;
+ case TH_SELECT_ACTIVE:
+ cp = ts->active_highlight;
+ break;
+
case TH_SELECTED_OBJECT:
cp = ts->selected_object;
break;
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index aed7af3911f..2fe918ff18e 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -3181,6 +3181,7 @@ static void outliner_draw_highlights_recursive(unsigned pos,
const SpaceOutliner *soops,
const ListBase *lb,
const float col_selection[4],
+ const float col_active[4],
const float col_highlight[4],
const float col_searchmatch[4],
int start_x,
@@ -3194,7 +3195,11 @@ static void outliner_draw_highlights_recursive(unsigned pos,
const int start_y = *io_start_y;
/* selection status */
- if (tselem->flag & TSE_SELECTED) {
+ if ((tselem->flag & TSE_ACTIVE) && (tselem->flag & TSE_SELECTED)) {
+ immUniformColor4fv(col_active);
+ immRecti(pos, 0, start_y, (int)ar->v2d.cur.xmax, start_y + UI_UNIT_Y);
+ }
+ else if (tselem->flag & TSE_SELECTED) {
immUniformColor4fv(col_selection);
immRecti(pos, 0, start_y, (int)ar->v2d.cur.xmax, start_y + UI_UNIT_Y);
}
@@ -3248,6 +3253,7 @@ static void outliner_draw_highlights_recursive(unsigned pos,
soops,
&te->subtree,
col_selection,
+ col_active,
col_highlight,
col_searchmatch,
start_x + UI_UNIT_X,
@@ -3259,10 +3265,12 @@ static void outliner_draw_highlights_recursive(unsigned pos,
static void outliner_draw_highlights(ARegion *ar, SpaceOutliner *soops, int startx, int *starty)
{
const float col_highlight[4] = {1.0f, 1.0f, 1.0f, 0.13f};
- float col_selection[4], col_searchmatch[4];
+ float col_selection[4], col_active[4], col_searchmatch[4];
UI_GetThemeColor3fv(TH_SELECT_HIGHLIGHT, col_selection);
col_selection[3] = 1.0f; /* no alpha */
+ UI_GetThemeColor3fv(TH_SELECT_ACTIVE, col_active);
+ col_active[3] = 1.0f; /* no alpha */
UI_GetThemeColor4fv(TH_MATCH, col_searchmatch);
col_searchmatch[3] = 0.5f;
@@ -3270,8 +3278,16 @@ static void outliner_draw_highlights(ARegion *ar, SpaceOutliner *soops, int star
GPUVertFormat *format = immVertexFormat();
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
- outliner_draw_highlights_recursive(
- pos, ar, soops, &soops->tree, col_selection, col_highlight, col_searchmatch, startx, starty);
+ outliner_draw_highlights_recursive(pos,
+ ar,
+ soops,
+ &soops->tree,
+ col_selection,
+ col_active,
+ col_highlight,
+ col_searchmatch,
+ startx,
+ starty);
immUnbindProgram();
GPU_blend(false);
}
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index bee615108f9..d70dc5ac5f0 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -1213,10 +1213,13 @@ void outliner_item_select(SpaceOutliner *soops,
TreeStoreElem *tselem = TREESTORE(te);
const short new_flag = toggle ? (tselem->flag ^ TSE_SELECTED) : (tselem->flag | TSE_SELECTED);
+ // Change active element
+ outliner_flag_set(&soops->tree, TSE_ACTIVE, false);
+
if (extend == false) {
outliner_flag_set(&soops->tree, TSE_SELECTED, false);
}
- tselem->flag = new_flag;
+ tselem->flag = new_flag | TSE_ACTIVE;
}
static void outliner_item_toggle_closed(TreeElement *te, const bool toggle_children)
More information about the Bf-blender-cvs
mailing list