Notifications
Clear all

[Closed] Maxscript – Creating selection set for master Layer

hey all

im kinda new to max script and im trying to write a script that selects the master layer in the layer manager and all the sub layers with the objects and out of that creates a selection set that the name of it is the name of the master layer .

i tried to run

layersToSelectionSets()

fn layersToSelectionSets = for k=1 to LayerManager.count-1 do
(
layer = LayerManager.getLayer k
if selectionsets[layer.name] == undefined do selectionsets[layer.name] = #()
layer.nodes &nodes
selectionsets[layer.name] = join nodes selectionsets[layer.name]
)
layersToSelectionSets()

but what it dose is that it creates selection sets for all the sub layer and leave the master layer as an empty selection set

thanks
Dan