is there anyway to get leaf nodes from a node? If not may want to think about that. Then only Curves, Lines, Points, Texts, and TriMeshs will have access to the leaf node.
what do you mean by access?
like I load a model(milkshape or what have you)is there anyway to get the leaf node?
I see. We might do something like add a method to grab all the items from a scenegraph node on down that match a given type (as defined by getType()) Add a RFE to the Issue Tracker
I have this method I use to rip an imported model down to it's leaf nodes and attach them directly to the passed in topNode. I cast getChildren to array so I don't get errors everytime I remove a child, which will shorten the list.
public static void flatten(Spatial elem, Node topNode) {
int nKids = 0;
if (elem instanceof Node ) {
Node branch = (Node) elem;
nKids = branch.getQuantity();
System.out.println(elem.getName()+" kids="+nKids);
Object[] kids = branch.getChildren().toArray();
for (int boot = 0; boot < kids.length; boot++) {
flatten((Spatial)kids[boot],topNode);
}
}
if (nKids == 0) {
//a leaf
System.out.println(elem.getName()+" attaching");
topNode.attachChild(elem);
} else {
System.out.println(elem.getName()+" not attaching");
}
}
renanse said:
I see. We might do something like add a method to grab all the items from a scenegraph node on down that match a given type (as defined by getType()) Add a RFE to the Issue Tracker
add a RFE to the Issue Tracker? Sorry I feel dumb, how do I do this?
jme.dev.java.net (you'll need a java.net account and might require to be an observer on jme if you aren't already).
Go into the Issue Tracker and create a New issue giving it the Enhancement tag.