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:
authorPhilipp Oeser <info@graphics-engineer.com>2022-10-21 17:24:53 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2022-10-24 13:20:11 +0300
commit9fc000cc6f55784166be571c06a5f67faba9b47f (patch)
tree9a9d3b8405926f086e662b8f2e47a16db8de804d
parent0584a88046d2a2c069e056e52b37907cd70db8c7 (diff)
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
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.cc b/source/blender/editors/space_outliner/outliner_draw.cc
index f76c0980c4f..699dd6d4844 100644
--- a/source/blender/editors/space_outliner/outliner_draw.cc
+++ b/source/blender/editors/space_outliner/outliner_draw.cc
@@ -3054,6 +3054,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;
@@ -3063,8 +3064,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) {
@@ -3107,8 +3112,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,
@@ -3120,6 +3130,7 @@ static void outliner_draw_iconrow(bContext *C,
offsx,
ys,
alpha_fac,
+ in_bone_hierarchy,
merged);
}
}
@@ -3381,6 +3392,7 @@ static void outliner_draw_tree_element(bContext *C,
&tempx,
*starty,
alpha_fac,
+ false,
&merged);
GPU_blend(GPU_BLEND_NONE);