HottBJ exports Node instead of Trimesh

I use the HottBJ exporter to export my model from Blender to a xml file. However when I attempt to import my model, jME sees the model as a node, rather than a trimesh. Have I done something wrong with exporting?



Spatial loadedSpatial = null;
        try {
            loadedSpatial = (Spatial) xmlImporter.load(modelUrl);
            System.out.println("Spatial = "+loadedSpatial.getClass());
        } catch (Exception e) {
            throw new IllegalArgumentException(
                    "Failed to load URL: " + modelUrl, e);
        }

        mg = new MorphingTriMesh("SuzConeMorph", (TriMesh) loadedSpatial);




INFO: Child "labelGraph" attached to this node "Graph node"
Nov 24, 2009 8:26:51 PM com.jme.scene.Node <init>
INFO: Node created.
Spatial = class com.jme.scene.Node
java.lang.ClassCastException: com.jme.scene.Node cannot be cast to com.jme.scene.TriMesh
        at poc.morphing.Main.loadModel(Main.java:85)
        at poc.morphing.Main.simpleInitGame(Main.java:64)
        at com.jme.app.BaseSimpleGame.initGame(BaseSimpleGame.java:545)
        at com.jme.app.BaseGame.start(BaseGame.java:74)
        at poc.morphing.Main.parseAndRun(Main.java:46)
        at poc.morphing.Main.main(Main.java:35)
Nov 24, 2009 8:26:51 PM com.jme.app.BaseSimpleGame cleanup



If more details are required, I will gladly provide.


EDIT: When I use the child of the Node, which is a Trimesh, importing works without any troubles. So basically, somehow, Blender creates a node where it puts my model in when I export.

By default, HottBJ tries to preserve the scene geometry as closely to what is in Blender as possible.  Compare the objects in Blender's Outliner Window to the scene imported to jME.



If you prefer more conservative structures (I do), then you can use a hidden HottBJ feature by setting env. variable FAVORJOINS to value "true" (before running Blender).  This is not advertised because of some incompatibilities with certain scene combinations with auto-axis-rotate on.  I am not using the auto-rotate feature lately and just don't have time to fix or even properly distinguish the problem test case.

Thank you for your input.

When I can find HottBJ enviromental variables to edit?)

just out of intrest, wouldnt it be far simpler instead of settig the variable to jsut search the loaded node for a trimesh and use that then? This way you shouldnt run into the described problems or am i missing something here?

idhuman said:

When I can find HottBJ enviromental variables to edit?


The one described here is the only one.  Production-ready features are implemented in a more user-friendly means such as inference from Blender setting or naming conventions of Blender items.
Empire Phoenix said:

just out of intrest, wouldnt it be far simpler instead of settig the variable to jsut search the loaded node for a trimesh and use that then?


I don't understand how anybody could conclude that searching a scene plus customizing loading could be far simpler than setting one environmental variable.  Besides setting of an env variable taking less than a minute, even in Windows, if the work is done during the Blender export, you have done what you want permanently for that model in any and all jME usage of that model.  The search-plus code work would have to be executed every time the model is loaded in every version of every jME program that you want to work that way.

Empire Phoenix said:

This way you shouldnt run into the described problems or am i missing something here?


Correct.  That would avoid the described compatibility problems.  If you don't use auto-rotate though, you won't hit any problem anways.

Sorry for my English))) I meant WHERE I can find this variable? (config. file or smth. else)

idhuman said:

Sorry for my English))) I meant WHERE I can find this variable? (config. file or smth. else)


You set the environmental variable before running Blender (the indicated variable will not exist until you create it).  How you set environmental variables is a feature of your operating system and/or shell.  Not knowing your operating system or shell, I'll just direct you to the help facilities, documentation, or online searches for whatever operating system or shell you are using.  Look for "environmental variable" or "environmental variables" (translated to the required language).