Page MenuHome

Select Hierarchy (Child) error, when object is not on view layer
Confirmed, NormalPublicBUG


System Information
Operating system: Linux-4.15.0-88-generic-x86_64-with-debian-buster-sid 64 Bits
Graphics card: GeForce GTX 1050/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 435.21

Blender Version
Broken: version: 2.82 (sub 7), branch: master, commit date: 2020-03-12 05:06, hash: rB375c7dc4caf4

Short description of error
Select Hierarchy will throw the following error when a child object is not linked to the scene.

Traceback (most recent call last):
  File "/opt/blender 2.82a/2.82/scripts/startup/bl_operators/", line 217, in execute
RuntimeError: Error: Object 'child2' can't be selected because it is not in View Layer 'View Layer'!

Curiously it doesn't seem to happen when the object is unlinked from the Outliner, only when done via python. Updating the depsgraph and/or view layer seems to have no effect either.

Selecting the child via Select Grouped works fine.

video demo

Exact steps for others to reproduce the error

  • open the blend and run the script to unlink the selected child object
  • run the Select Hierarchy tool (in Child direction)

Event Timeline

Germano Cavalcante (mano-wii) changed the task status from Needs Triage to Confirmed.Wed, Mar 25, 8:51 PM
Germano Cavalcante (mano-wii) changed the subtype of this task from "Report" to "Bug".

I can confirm.
The operator should check if the child is in the View Layer before trying to select.
But I haven't found a utility that does this.
Without changing the API, I think the most efficient way to resolve this would be to use a try: Exception:

The original code was added in rBa305a729
So ... @Campbell Barton (campbellbarton)?

This is probably not the right place, but I've just noticed that unlinking from the outliner will actually remove the object for good, hence why it doesn't cause the issue with Select Hierarchy.
Is this intended behaviour? Caught me by surprise.