[Bf-blender-cvs] [a49a960a586] blender-v3.3-release: Fix T101946: Outliner data-block counter treats bones as collection

Philipp Oeser noreply at git.blender.org
Mon Nov 28 13:43:37 CET 2022


Commit: a49a960a5868ad4d1bfe2187525b1dee4f5df677
Author: Philipp Oeser
Date:   Fri Oct 21 16:24:53 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rBa49a960a5868ad4d1bfe2187525b1dee4f5df677

Fix T101946: Outliner data-block counter treats bones as collection

Mistake in own rBb6a35a8153c3 which caused code to always recurse into
bone hierarchies (no matter which collapsed level an armature was
found).
This led to bone counts always being displayed even outside a collapsed
armature (e.g. if an armature was somewhere down a object or collection,
the collapsed object or collection would show this bonecount).
This is inconsistent with other data counting in the Outliner, e.g.
vertexgroups or bonegroups do have their indicator at object level,
however the counter only shows if `Vertex Groups` or `Bone Groups` line
shows (so if the object is not collapsed).

And this also led to the bug reported in T101946 which was that the bone
counts would be treated as collections when further down a collapsed
hierarchy.
Background: The whole concept of `MergedIconRow` is based on the concept
of counting **objects types or collectinons/groups**. If other things
like overrides, vertexgroups or bonegroups are displayed in a counted/
merged manner, then these will always be counted in the array spots that
are usually reserved for groups/collections. But for things this is not
a problem (since these are only displayed below their respective
outliner entry -- and will never be reached otherwise).

So to correct all this, we now only recurse into a bone hierarchy if a
bone is at the "root-level" of a collapsed subtree (direct child of the
collapsed element to merge into).

NOTE: there are certainly other candidates for counted/merged display
further up the hierarchy (not just bones -- constraints come to my mind
here, but that is for another commit)

Maniphest Tasks: T101946

Differential Revision: https://developer.blender.org/D16319

===================================================================

M	source/blender/editors/space_outliner/outliner_draw.cc

===================================================================

diff --git a/source/blender/editors/space_outliner/outliner_draw.cc b/source/blender/editors/space_outliner/outliner_draw.cc
index e8f205a711e..903944b68a7 100644
--- a/source/blender/editors/space_outliner/outliner_draw.cc
+++ b/source/blender/editors/space_outliner/outliner_draw.cc
@@ -3099,6 +3099,7 @@ static void outliner_draw_iconrow(bContext *C,
                                   int *offsx,
                                   int ys,
                                   float alpha_fac,
+                                  bool in_bone_hierarchy,
                                   MergedIconRow *merged)
 {
   eOLDrawState active = OL_DRAWSEL_NONE;
@@ -3108,8 +3109,12 @@ static void outliner_draw_iconrow(bContext *C,
     te->flag &= ~(TE_ICONROW | TE_ICONROW_MERGED);
 
     /* object hierarchy always, further constrained on level */
+    /* Bones are also hierarchies and get a merged count, but we only start recursing into them if
+     * an they are at the root level of a collapsed subtree (e.g. not "hidden" in a collapsed
+     * collection). */
+    const bool is_bone = ELEM(tselem->type, TSE_BONE, TSE_EBONE, TSE_POSE_CHANNEL);
     if ((level < 1) || ((tselem->type == TSE_SOME_ID) && (te->idcode == ID_OB)) ||
-        ELEM(tselem->type, TSE_BONE, TSE_EBONE, TSE_POSE_CHANNEL)) {
+        (in_bone_hierarchy && is_bone)) {
       /* active blocks get white circle */
       if (tselem->type == TSE_SOME_ID) {
         if (te->idcode == ID_OB) {
@@ -3152,8 +3157,13 @@ static void outliner_draw_iconrow(bContext *C,
       }
     }
 
-    /* this tree element always has same amount of branches, so don't draw */
-    if (tselem->type != TSE_R_LAYER) {
+    /* TSE_R_LAYER tree element always has same amount of branches, so don't draw. */
+    /* Also only recurse into bone hierarchies if a direct child of the collapsed element to merge
+     * into. */
+    const bool is_root_level_bone = is_bone && (level == 0);
+    in_bone_hierarchy |= is_root_level_bone;
+    if (!ELEM(tselem->type, TSE_R_LAYER, TSE_BONE, TSE_EBONE, TSE_POSE_CHANNEL) ||
+        in_bone_hierarchy) {
       outliner_draw_iconrow(C,
                             block,
                             fstyle,
@@ -3165,6 +3175,7 @@ static void outliner_draw_iconrow(bContext *C,
                             offsx,
                             ys,
                             alpha_fac,
+                            in_bone_hierarchy,
                             merged);
     }
   }
@@ -3423,6 +3434,7 @@ static void outliner_draw_tree_element(bContext *C,
                                 &tempx,
                                 *starty,
                                 alpha_fac,
+                                false,
                                 &merged);
 
           GPU_blend(GPU_BLEND_NONE);



More information about the Bf-blender-cvs mailing list