[Layer picker] - Retrieve (sub-)layer by path & index

To create a layer picker script in which you can pick a layer and subsequent nested layers, I would like to condense the purple part of my script. The advantage to this script is that layer names in Rhino can be updated and propagated to Grasshopper and by doing so, you avoid making typing mistakes for the layer names.

This part works as follows: you pick a layer, it then retrieves the branches of the layer tree corresponding to this layer and retrieves sublayers (primary layer index number +1 and cull the primary layer name). Then pick a sublayer, retrieve sub-sublayers (minus primary layer and sublayer) and repeat.
The goal is to create a cluster to the left hand side of the item selectors and a cluster on the right hand side after the item selectors. The Human plugin is required.

Pick layer.gh (22.0 KB)