diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-01-11 22:17:17 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-01-12 00:58:50 +0300 |
commit | de176b75b2040cde2ff0e60932f6a0b0b880ed41 (patch) | |
tree | d0f4f2f0fe76c18b8d3e01493285e5f19161f2df /source/blender/editors/space_outliner | |
parent | 79b0bce8908bf525f07f0dc21a098a3d92ee6454 (diff) |
Fix T53764: vertical line glitch for collections with objects and collections
The code for vertical line was assuming that we necessarily neeeded vertical
lines for all the elements. Which is not true since we are not drawing
vertical and horizontal lines for collections.
Patch made in contribution with Philippe Schmid (@Quetzal).
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_draw.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index dd7a9f2880a..e2d60ef2f43 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1599,7 +1599,7 @@ static void outliner_draw_hierarchy_lines_recursive(unsigned pos, SpaceOops *soo const unsigned char col[4], bool draw_grayed_out, int *starty) { - TreeElement *te; + TreeElement *te, *te_vertical_line_last = NULL; TreeStoreElem *tselem; int y1, y2; @@ -1609,10 +1609,10 @@ static void outliner_draw_hierarchy_lines_recursive(unsigned pos, SpaceOops *soo const unsigned char grayed_alpha = col[3] / 2; - y1 = y2 = *starty; /* for vertical lines between objects */ + /* For vertical lines between objects. */ + y1 = *starty; for (te = lb->first; te; te = te->next) { bool draw_childs_grayed_out = draw_grayed_out || (te->drag_data != NULL); - y2 = *starty; tselem = TREESTORE(te); if (draw_childs_grayed_out) { @@ -1622,10 +1622,17 @@ static void outliner_draw_hierarchy_lines_recursive(unsigned pos, SpaceOops *soo immUniformColor4ubv(col); } - /* horizontal line? */ - if (tselem->type == 0 && (te->idcode == ID_OB || te->idcode == ID_SCE)) + /* Horizontal Line? */ + if (tselem->type == 0 && (te->idcode == ID_OB || te->idcode == ID_SCE)) { immRecti(pos, startx, *starty, startx + UI_UNIT_X, *starty - 1); - + + /* Vertical Line? */ + if (te->idcode == ID_OB) { + te_vertical_line_last = te; + y2 = *starty; + } + } + *starty -= UI_UNIT_Y; if (TSELEM_OPEN(tselem, soops)) @@ -1640,12 +1647,10 @@ static void outliner_draw_hierarchy_lines_recursive(unsigned pos, SpaceOops *soo immUniformColor4ubv(col); } - /* vertical line */ - te = lb->last; - if (te->parent || lb->first != lb->last) { - tselem = TREESTORE(te); - if (tselem->type == 0 && te->idcode == ID_OB) - immRecti(pos, startx, y1 + UI_UNIT_Y, startx + 1, y2); + /* Vertical line. */ + te = te_vertical_line_last; + if ((te != NULL) && (te->parent || lb->first != lb->last)) { + immRecti(pos, startx, y1 + UI_UNIT_Y, startx + 1, y2); } } |