Quantcast
Channel: Daz Script Developer Discussion - Daz 3D Forums
Viewing all articles
Browse latest Browse all 1036

Loop through root elements in a scene - SOLVED

$
0
0

I'm trying to write a script that will loop through and change only those items within the scene which have no parents. I assumed that such items would be Nodes, and could be identified by checking the isRootNode property, but according to my script, everything is a root node:

I was expecting to see it list the cube and the sphere, but not the cone as it's parented to the cube. Where am I going wrong?

PS. Here's my script in plain text:

// DAZ Studio version 4.10.0.123 filetype DAZ Script
// Define an anonymous function;
// serves as our main loop,
// limits the scope of variables

(function(){

var aAllNodes = Scene.getNodeList();
var nAllNodes = aAllNodes.length;

var oNode;

// Iterate over the nodes
for( var i = 0; i < nAllNodes; i += 1 ){
   // Get the 'current' node
   oNode = aAllNodes[ i ];

   if (oNode.isRootNode) {
      print(oNode.objectName + " is a root node");
   }
}

// Finalize the function and invoke
})();

 


Viewing all articles
Browse latest Browse all 1036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>