Question 1: I'm trying to create a recursive function that will start at a parent node and work its way through the children, printing out their assetId, but it only returns the first child in each instance.
function GetChildren(oNode){
ChildrenNode=oNode.getNodeChildren();
if (ChildrenNode!=null) {
for ( i = 0; i < ChildrenNode.length; i++ ) {
print("num "+i+" Length"+ChildrenNode.length+' Parent: '+oNode.assetId+' Child: '+ChildrenNode[i].assetId);
GetChildren(ChildrenNode[i]);
}
}
}
GetChildren(Scene.getPrimarySelection());
If I start with the following parent child structure:
Square
-childSquare1
--Grandchild1
--Grandchild2
-childSquare2
It will only return (-childSquare1, --Grandchild1 )
Any idea what I'm doing wrong?
Question 2: how do I also return the node's label name, and not just its assetId name? *Edit* I figured this one out- have to use .getLabel().