Jme binary format and scenegraph loading

Hi all,

My question is regarding the loading of an external scene file which contains various models with different states.

Is a scenegraph tree automatically created upon loading and how can i control which model gets attached to what node ?

I tried the following

String s = rootNode.getChild(0).getName();
System.out.println("Node name is:" + s);

in order to see what kind of tree was created after loading, but all i get is "Node name is: XML loaded scene". Is this the correct way to access the node names and their hierarchy ?

Is the JME binary format documented anywhere ?

Thanks in advance for your time.

The format isn’t documented. It’s basicly an XML hierarchy of the spatial in a scene graph with their attributes. If you output a few models exported to XML and look, it should become clear.

Each model format stores its “things” in a different hierarchy. MS3D may have the model first with its parts while 3ds may make it all one thing. This is mostly out of jME’s control because we’re just loading how they format their 3d model formats. The best way to figure out where the names of a model are stored is to export the model to XML and look at the hierarchy. From there you can tell who’s child is what.

Ok. Thanks for the info. I’ve been looking at JME-outputted XML data, 3d-modeller-outputted XML data and JBinaryReader source code and it all makes more sense now. Actually it’s quite impresive and powerful !

The second part of my question though was more in the sense of once the XML hierarchy is read and loaded, how can i access the individual nodes from within my application should i want, for instance, to change a state at runtime etc… Any clues or maybe it’s more of a java issue (which i’m also a newbie to) ?

Thanks again. Appreciate it.

((Node)((Node)rootNode.getChild(0)).getChild(0)).getName(), or some other string of children. Again it’s specific to the original file’s format. You’ll probably want to get the “root” node of the file, which is usually one child deep, then enumerate chidren and look for the one you need by name. Let me know if this doesn’t seem to work.

Works fine. Thanks a million !