[Bf-blender-cvs] [661ee21e69d] soc-2020-outliner: Outliner: Draw left column for activation/mode toggle
Nathan Craddock
noreply at git.blender.org
Sat Jun 6 00:47:03 CEST 2020
Commit: 661ee21e69d31254649b9768d01e9095a54474e6
Author: Nathan Craddock
Date: Fri Jun 5 13:42:59 2020 -0600
Branches: soc-2020-outliner
https://developer.blender.org/rB661ee21e69d31254649b9768d01e9095a54474e6
Outliner: Draw left column for activation/mode toggle
In Scenes view mode, a column is added when the toggle is enabled. In
view layer mode, the scene collection has a space next to it where a
expand/collapse triangle could be drawn, so this also offsets the tree a
unit to the left when in view layer display mode.
===================================================================
M source/blender/editors/space_outliner/outliner_draw.c
===================================================================
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 7d3b95721c6..e6c1ebd98c4 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -3523,11 +3523,18 @@ static void outliner_draw_tree(bContext *C,
ARegion *region,
SpaceOutliner *soops,
const float restrict_column_width,
+ const bool use_left_column,
TreeElement **te_edit)
{
const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
int starty, startx;
+ /* Move the tree a unit left in view layer mode */
+ short left_column_offset = use_left_column ? UI_UNIT_X : 0;
+ if (soops->outlinevis & SO_VIEW_LAYER) {
+ left_column_offset -= UI_UNIT_X;
+ }
+
GPU_blend_set_func_separate(
GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); // only once
@@ -3555,12 +3562,12 @@ static void outliner_draw_tree(bContext *C,
// gray hierarchy lines
starty = (int)region->v2d.tot.ymax - UI_UNIT_Y / 2 - OL_Y_OFFSET;
- startx = UI_UNIT_X / 2 - (U.pixelsize + 1) / 2;
+ startx = left_column_offset + UI_UNIT_X / 2 - (U.pixelsize + 1) / 2;
outliner_draw_hierarchy_lines(soops, &soops->tree, startx, &starty);
// items themselves
starty = (int)region->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
- startx = 0;
+ startx = left_column_offset;
LISTBASE_FOREACH (TreeElement *, te, &soops->tree) {
outliner_draw_tree_element(C,
block,
@@ -3683,11 +3690,16 @@ void draw_outliner(const bContext *C)
/* set matrix for 2d-view controls */
UI_view2d_view_ortho(v2d);
+ /* Only show mode toggle and activation column in View Layers and Scenes view */
+ const bool use_left_column = (soops->flag & SO_LEFT_COLUMN) &&
+ (ELEM(soops->outlinevis, SO_VIEW_LAYER, SO_SCENES));
+
/* draw outliner stuff (background, hierarchy lines and names) */
const float restrict_column_width = outliner_restrict_columns_width(soops);
outliner_back(region);
block = UI_block_begin(C, region, __func__, UI_EMBOSS);
- outliner_draw_tree((bContext *)C, block, &tvc, region, soops, restrict_column_width, &te_edit);
+ outliner_draw_tree(
+ (bContext *)C, block, &tvc, region, soops, restrict_column_width, use_left_column, &te_edit);
/* Compute outliner dimensions after it has been drawn. */
int tree_width, tree_height;
More information about the Bf-blender-cvs
mailing list