Notifications
                
            
                Clear all
    
            
        [Closed] List Children
Sep 06, 2006 2:04 am
                      Hello,
Is there a way to list all the children of an object, including the children’s children and so on down the heirarchy? Just like checking select subtree in the select objects window, only I want to list the subtree and put it into a variable.
Thanks,
Stev
                             3 Replies                        
                    Sep 06, 2006 2:04 am
                      Hi Stev,
Sure you need to build a recursive function. Try this…
fn getChildrenRecursive obj arr=
 (
 if obj.children.count > 0 then
  (
  for c in obj.children do
   (
   append arrObj c
   getChildrenRecursive c arr
   )
  )
 )
 
arrObj = #()
getChildrenRecursive $ arrObj
print arrObj
                      Sep 06, 2006 2:04 am
                      amazing, I just couldn’t imagine it was possible to use a function within itself !
Good news !!
thanks