Loading blender files directly Vs importing in the SDK

Hi All,

I was wondering if someone could provide a bit of guidance for me. I am just getting started with both jme and with doing animations and I am wondering about some of the different options for doing this.

I have created a simple animation in blender and I can import it and run it as in TestBlenderAnim.java and this works fine. So, should I worry about importing it using import from the SDK? Is there a trade-off between these two methods or is one considered to be generally superior?

I wanted to try it both ways, but have not been able to get the animation to run after importing. When I import it and it is converted to a j3o the model looks fine and I can find the animation in SceneExplorer and the animation runs there, but when I load the model in my app, calling “getControl(AnimControl.class)” on the node returns null.

What I am really trying to get at here is whether going through and figuring out why I am not getting the import to work is worth the effort or if I should just continue using the blender file directly.

Any advice or suggestions as to what might be going wrong with the import would be appreciated.

If you’re using the ogre exporter you may need to reference the exact child Node that the AnimControl is nested in rather than the parent node, if you aren’t already doing so.

    Spatial animSpatial = spatialParentNode.getChild("Cube.001-ogremesh");
    animControl = animSpatial.getControl(AnimControl.class);

https://i.imgur.com/eJczkew.png

When you import with blender importer the AnimControl is not on the main node. Open the imported blender model in SceneComposer and then locate the animControl, open an Ogre exported model for comparison.

To find the control see,
https://jmonkeyengine.github.io/wiki/jme3/advanced/traverse_scenegraph.html

Example

Thank you both for your quick replies.

I believe that what you are describing is the same whether it is for Ogre or for the blender importer. And you are both correct. I retried this example and did something similar to what TestBlenderAnim.java does to find the child node with the correct name. Now it is working just like it should :slight_smile:

Now that I can get it to work both ways, I am still wondering which way is better. Or does it not really matter that much and it is more a matter of preference?

These two are not the only ways.

XBUF, GLTF, FBX

1 Like

Yeah it most likely will come down to your personal preference and the demands of your project.

If you have asked if you should import the model and store it in the j3o format, then the answer is yes. Mainly because then it is stored in the native format jme is using. Decreased loading time on release and all the post processing (Tangents/BiTangents, Lod levels) is also stored.
Stuff you usually do not want to do each time you load a model

2 Likes