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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-07-26 18:35:14 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-07-28 18:48:06 +0300
commitdecd924116d778a524aae49f271f3020e8696ca4 (patch)
tree162651dfaff9dd85b4ef318484cfc4998aad74c8 /source/blender
parent48759580839aa4e2ad2541ff4c19baaaf751721d (diff)
Fix outliner icon row with counters not correct for nested collections.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c67
1 files changed, 33 insertions, 34 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index e1049d02e37..435e0018ac0 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -1441,23 +1441,19 @@ static int tree_element_id_type_to_index(TreeElement *te)
}
}
+typedef struct MergedIconRow {
+ eOLDrawState active[INDEX_ID_MAX + OB_TYPE_MAX];
+ int num_elements[INDEX_ID_MAX + OB_TYPE_MAX];
+ TreeElement *tree_element[INDEX_ID_MAX + OB_TYPE_MAX];
+} MergedIconRow;
+
static void outliner_draw_iconrow(
bContext *C, uiBlock *block, const uiFontStyle *fstyle, Scene *scene, ViewLayer *view_layer, SpaceOops *soops,
- ListBase *lb, int level, int xmax, int *offsx, int ys, float alpha_fac)
+ ListBase *lb, int level, int xmax, int *offsx, int ys, float alpha_fac, MergedIconRow *merged)
{
eOLDrawState active;
const Object *obact = OBACT(view_layer);
- struct {
- eOLDrawState active[INDEX_ID_MAX + OB_TYPE_MAX];
- int num_elements[INDEX_ID_MAX + OB_TYPE_MAX];
- TreeElement *tree_element[INDEX_ID_MAX + OB_TYPE_MAX];
- } data = {
- .active = {0},
- .num_elements = {0},
- .tree_element = {NULL},
- };
-
for (TreeElement *te = lb->first; te; te = te->next) {
/* exit drawing early */
if ((*offsx) - UI_UNIT_X > xmax)
@@ -1488,13 +1484,13 @@ static void outliner_draw_iconrow(
}
else {
const int index = tree_element_id_type_to_index(te);
- data.num_elements[index]++;
- if ((data.tree_element[index] == NULL) ||
- (active > data.active[index]))
+ merged->num_elements[index]++;
+ if ((merged->tree_element[index] == NULL) ||
+ (active > merged->active[index]))
{
- data.tree_element[index] = te;
+ merged->tree_element[index] = te;
}
- data.active[index] = MAX2(active, data.active[index]);
+ merged->active[index] = MAX2(active, merged->active[index]);
}
}
@@ -1502,26 +1498,28 @@ static void outliner_draw_iconrow(
if (tselem->type != TSE_R_LAYER) {
outliner_draw_iconrow(
C, block, fstyle, scene, view_layer, soops,
- &te->subtree, level + 1, xmax, offsx, ys, alpha_fac);
+ &te->subtree, level + 1, xmax, offsx, ys, alpha_fac, merged);
}
}
- for (int i = 0; i < INDEX_ID_MAX; i++) {
- const int num_subtypes = (i == INDEX_ID_OB) ? OB_TYPE_MAX : 1;
- /* See tree_element_id_type_to_index for the index logic. */
- int index_base = i;
- if (i > INDEX_ID_OB) {
- index_base += OB_TYPE_MAX;
- }
- for (int j = 0; j < num_subtypes; j++) {
- const int index = index_base + j;
- if (data.num_elements[index] != 0) {
- outliner_draw_iconrow_doit(block,
- data.tree_element[index],
- fstyle,
- xmax, offsx, ys, alpha_fac,
- data.active[index],
- data.num_elements[index]);
+ if (level == 0) {
+ for (int i = 0; i < INDEX_ID_MAX; i++) {
+ const int num_subtypes = (i == INDEX_ID_OB) ? OB_TYPE_MAX : 1;
+ /* See tree_element_id_type_to_index for the index logic. */
+ int index_base = i;
+ if (i > INDEX_ID_OB) {
+ index_base += OB_TYPE_MAX;
+ }
+ for (int j = 0; j < num_subtypes; j++) {
+ const int index = index_base + j;
+ if (merged->num_elements[index] != 0) {
+ outliner_draw_iconrow_doit(block,
+ merged->tree_element[index],
+ fstyle,
+ xmax, offsx, ys, alpha_fac,
+ merged->active[index],
+ merged->num_elements[index]);
+ }
}
}
}
@@ -1748,9 +1746,10 @@ static void outliner_draw_tree_element(
immUnbindProgram();
}
+ MergedIconRow merged = {{0}};
outliner_draw_iconrow(
C, block, fstyle, scene, view_layer, soops, &te->subtree, 0, xmax, &tempx,
- *starty, alpha_fac);
+ *starty, alpha_fac, &merged);
GPU_blend(false);
}