Notifications
Clear all
[Closed] Get all children
Oct 11, 2013 3:17 pm
I’m sure this is one when using an Out Parameter would be a good idea, but I can’t get it doing what I want in less lines of code. How can I make this work without having to predefine an empty array? I want to get all children of the selected objects including the selection.
fn getChildren theObjs newObjs=
(
for o in theObjs do
(
append newObjs o
getChildren o.children newObjs
)
newObjs
)
newObjs = #()
getChildren (selection as array) newObjs
3 Replies
Oct 11, 2013 3:17 pm
mapped fn getAllChildren node &children = (join children node.children)
/*
a = #()
getAllChildren selection &a
a
*/
Oct 11, 2013 3:17 pm
there is the same with foolproof
mapped fn getAllChildren node children = (if isvalidnode node and iskindof children Array do join children node.children)