ScriptSpot

Forum topic · General Scripting

recursively collect layers

By JokerMartini · 2017-02-16

Downloads
Description

How could I go about recursively collecting the layers from a maxfile. For example say i have a file like the image attached. Each array has the name of the layer and the a children field which contains it's child layers.

How could i return nested arrays matching the hierarchy like this:


struct layer_data (name="", childlayers=#())

scene_layers = #(
#(name:"_REF" childlayers:#())
#(name:"0" childlayers:#(
#(name:"A_01" childlayers:#(
#(name:"A_02" childlayers:#()
)
))
...
)