Anim: hierarchical visibility for bone collections #116784
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#116784
Loading…
Reference in New Issue
No description provided.
Delete Branch "dr.sybren/blender:anim/bone-collections-hierarchical-visibility"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bone collection visibility now respects their hierarchy.
A bone collection is only visible when it is marked as visible and all its ancestors (so parents, greatparents, etc.) are visible. Root bone
collections have no ancestors by definition, and only consider their own visibility.
The visibility 'eye' is dimmed when the bone collection is hidden because of its ancestors' visibility.
The effective ancestors' visibility is stored on each bone collection, in its
BONE_COLLECTION_ANCESTORS_VISIBLE
flag. This makes it possible to determine the effective visibility from just the flags of the bone collection itself.Note for the reviewers: some function names (mostly
is_visible_ancestors()
andis_visible_effectively()
) are IMO a bit awkward. I chose those so that all theis_visible…
functions are sorted together. If you have suggestions for better names, let me know!The
BONE_COLLECTION_ANCESTORS_VISIBLE
flag is now stored, with the other flags, inBoneCollection::flags
. This means that it's stored in DNA, even though it's derived data and should actually be stored in a runtime struct. However,BoneCollection
doesn't have any runtime struct yet, and I don't feel that the introduction of this flag is a good enough reason to introduce that just yet. Again, open to other opinions.@blender-bot package
Package build started. Download here when ready.
Aside from a documentation nit and a couple minor spelling/naming issues, this looks great to me! Awesome work.
Also, just want to mention again how much I appreciate your code documentation! It's a lot easier to read/grok code when I know what the intended behavior is. :-)
@ -219,0 +224,4 @@
/**
* Hide this bone collection.
*
* This marks the bone collection as 'hidden'. This also effectively hides its decendants,
Spelling, throughout this PR: decendant -> descendant
(Don't feel bad: I almost didn't catch it myself, ha ha.)
@ -219,0 +231,4 @@
/**
* Show or hide this bone collection.
*
* Do not use this with a hard-coded `is_visible` parameter, but use one of the
Nit: IMO "Do not use..." gives the impression that the results will be incorrect if you do so. It's fairly obvious that that's not the case here, but it did give me minor cognitive dissonance for a moment.
Maybe something like this would be better:
"Calling this with a hard-coded
is_visible
parameter is equivalent to calling the dedicated show/hide functions. Prefer the dedicated functions for clarity."@ -716,0 +750,4 @@
}
/* Set/clear BONE_COLLECTION_ANCESTORS_VISIBLE on this bone collection and all its decendents. */
static void ancestors_visible_update(bArmature *armature,
Just noting a possible alternative, rather than actually suggesting a change per se:
I was waffling back-and-forth on how I feel about the redundancy between this function and
ancestors_visible_decendants_update()
above.I believe if we want to we could reduce both to a single function. Basically, we would effectively move the logic of
ancestors_visible_decendants_update()
into this function. Then at the top of this function, if (and only if)parent_bcoll
is null we scan to find its parent (leaving it null ifbcoll
is a root).That would make this function slower due to the additional linear scan at the initial call (but not subsequent recursive calls), and also because it would always update
bcoll
itself even when not strictly needed. But it would also reduce the API surface. So it's a trade-off.I don't feel strongly either way, so I'm happy with the code as-is. But just wanted to mention the alternative.
I've been pondering the same thing, and to me it was easier to comprehend what was going on with separate "update this bcoll and its descendents" vs. "make sure the descendents are in sync with their parent" functions.
Since these are
static
functions, and thus not part of any public API, I think I'd like to keep them smaller and more specific.@ -456,0 +464,4 @@
BoneCollection *bcoll_r0_child0 = ANIM_armature_bonecoll_new(&arm, "r0_child0", root0_index);
BoneCollection *bcoll_r0_child1 = ANIM_armature_bonecoll_new(&arm, "r0_child1", root0_index);
const int child0_index = armature_bonecoll_find_index(&arm, bcoll_r0_child0);
BoneCollection *bcoll_c1_child0 = ANIM_armature_bonecoll_new(&arm, "c1_child0", child0_index);
Not sure if this is a naming mistake or a choice-of-parent mistake. With the name
c1_child0
, I would expect its parent to ber0_child1
, but in fact the parent is being set tor0_child0
.Looks good to me!
just some minor things
One thing I noticed is that there is no function to get the effective visibility from python. Or am I missing something?
@ -716,0 +749,4 @@
}
}
/* Set/clear BONE_COLLECTION_ANCESTORS_VISIBLE on this bone collection and all its decendents. */
minor, but this could also read "Set or clear" just like the function above
I shortened it, as with "Set or clear" it will rewrap the line and put the closing
*/
on a line by itself. Now it juuuuust fits.@ -267,0 +297,4 @@
*
* \return true when this collection and all its ancestors are visible.
*
* \see is_visisble
typo in
visisble
vsvisible
@ -267,0 +299,4 @@
*
* \see is_visisble
*/
bool is_visible_effectively() const;
I usually went for e.g.
is_visible_in_hierarchy
in such cases."effectively" doesn't tell me much tbh
There is also another way of doing it, where
is_visible
returns the effective visibilityand you have another function
get_collection_visibility
(or similar) to get the actual flagThis is something I've been struggling with indeed, as there are now three "visibilities":
I don't think there's names without any downside;
is_visible_in_hierarchy
to me feels more like the 3rd option, because "the hierarchy" conjures the image of the tree structure.I'll keep the naming as is, and double-check the documentation to ensure things are as clearly described as possible.
hm, imo the bone collection shouldn't need to know if its expanded or not.
but this is an issue of blender in general where the core datastructure and the GUI are too closely connected.
Good point, the logic for which flags to combine to compute that should be in one place, and not replicated in Python as well. So I'll add a read-only property.
lgtm
Landed in
a9d9c3b116
with review comments addressed ind4ce5d6fc9
anda9d9c3b116
.