Page MenuHome

Outliner: Show parenting hierarchy in view layer view
ClosedPublic

Authored by Dalai Felinto (dfelinto) on Apr 17 2019, 12:42 AM.

Details

Summary

If the "Object Children" filter is enabled, we nest the object children inside
the object. If the child itself is not in the collection, it is grayed out,
connected by a dash line, and its restriction flags and contents are not shown.

If "Object Children" filter is disabled, it works as before.

Note: This is not super fast, but at least we traverse the tree only once to get the
children of an object. That said, there is a lot of loops going on here.

Task T63526.

Development notes:
I could use the GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR shader, but
that would mean I would need to iterate over the tree twice (once for
each shader) - or do some bigger refactor.

Also I could not get that shader to work. This shader expects float
vertices while the current one is using integers, so converting the code
would make the dash line drawing to diverge from the regular lines even
further.

To store the objects children I'm "borrowing" id.py_instance to store
the list with the object children. My original plan was to use id.newid
(as we do already in the outliner). However this is re-set when adding
new children, so I'm happy staying away from (I got it to work with
newid though, I just think it is not as clean as using py_instance.

Diff Detail

Repository
rB Blender

Event Timeline

Harbormaster completed remote builds in B3341: Diff 14766.

Fix misplaced break.

Note there is still a bug when I filter out object contents. In this case
we don't have the vertical line leading to the child. I will look at it later.

In this example I took the startup file and parented the camera to the cube.
I then created a collection with all the objects (All Hands on Board), and one with only the Cube and the Light:

Maybe we don't need to gray out the child? Thoughts?

Seems fine to me. And we have the toggle regardless.

I do wonder if there is some other clever way to display children outside the collection, other than showing them greyed out, which makes them see disabled. I can’t immediately think of something better so I think it’s ok for now.

( idea: stippled relationship lines?)

This revision is now accepted and ready to land.Apr 17 2019, 8:38 AM

Stippled hierarchy line might be best, indeed it's confusing to have it greyout because we already style collections like that when they're not enabled/visible in the viewport.

We could also not display the actual child objects, and instead show "5 children in other collection". Not sure that's a good solution, just throwing it out there.

Update to clang-format

I think perhaps 1) + 5), both stipple and gray out icon and text? Or 3) + 5).

I like that the stipple is something extra that isn't used to indicate anything else.

I'd go for 1 + 5 (grayed out + stippled line)

Grayout only icon or only name feels like a glitch/bug.

Stipple lines I like it because that's what is used in the viewport to represent parent/children as well.

For me 5+1.

A solution for the stipple line could be change the line color to represent that the child object is not present in the same collection, instead of doing the line stipple, that colored line will also help to avoid a feeling of "disable", you will recognize the object inmediately as "non present here"

Just 3 makes harder to identify that the object is not present in the collection.

What if you showed it normally, but prefix the regular icon with a "link" icon showing that this is a link to elsewhere, similar to what's done for externally linked stuff?

  • Outliner: Use dash lines for children not in collections and fixes

    First let's talk about the fixes. In many cases the previous patch was failing. For instance when we had children of children.

    The old patch was also having issues when the object content filter was used.

    As for drawing there are two steps to that. First it means I had to sort the object list in the children from the collection and the ones not from the collection.

    This rule had to be followed both when using alphabetically sorting, and when not.

    The second step was the drawing itself. Although I considered using the real dashed shader I couldn't make it work AND I think it would require more refactor or to iterate over the tree twice (once for each line shader). So I'm actually happy with the hardcoded dash lines.

And we have dashed lines now. Not trivial to get them, but they do look nice:

The patch is ready for a full review, and @Campbell Barton (campbellbarton) may want to take a look at how I'm abusing py_instance here.

Dalai Felinto (dfelinto) retitled this revision from Show parenting hierarchy in outliner view layer view to Outliner: Show parenting hierarchy in view layer view.Apr 20 2019, 3:44 AM
Dalai Felinto (dfelinto) edited the summary of this revision. (Show Details)
Dalai Felinto (dfelinto) edited the summary of this revision. (Show Details)

A few comments, possibly all dumb, so no laughing... LOL

At one point we're going to have to increase the thickness of the relationship lines according to U.pixelsize as these one pixel-wide lines can be hard to read on high pixel density displays.

This patch is trying to show parent-child relationships and the current problem is showing children that are not in the parent's collection. But what of children whose parents are not in their collection? Is that less important? In the following capture, there are two sets of relationships: A "Father" and "Son" and a "Mother" and "Daughter", and I've put the children in opposite collections. As you can see in each collection we can now see one relationship (the missing child) but not the other (the missing parent). Again, not sure that this matters.

A bit more importantly though, the stippled lines are affecting everything that is inside the parent. So it appears that there is something special with the father's mesh data and vertex groups

Note to self, gotta fix vertical draw lines color (it should be gray - or the horizontal made white too).

@Harley Acheson (harley) I hear you, but this is really working by design in that regard. I'm bringing back something we had in 2.79, not trying to revamp the way we see relationships in Blender.

As for the line width, we are using rectangles to draw those lines, so not so hard to increase them. In fact we should indeed use pixel size instead of 1 for the rects. Can be done after the patch is committed and tested by some high density pixel monitor user (not me :/).

As for the stippled line over the obdata, not sure we should bother. There is no horizontal line maybe that ie enough?

This comment was removed by Harley Acheson (harley).

Use white line for the parenting dashed line in the outliner.

  • Use GHash instead of py_instance
This revision was automatically updated to reflect the committed changes.