The title is basically the entirety of the question.
Here’s the entire process I’ve been using.
- Made my model, rigged it, animated it.
- Using the import button at the top of the jME IDE I selected import and selected my model file. I also tried putting the blend file into the same folder path as where the j3o file ended up and converted there with a right click. I assumed it’d work with Blender due to these article on the wiki: https://wiki.jmonkeyengine.org/sdk/3ds_to_blender_to_jmp.html and https://wiki.jmonkeyengine.org/jme3/external/blender.html
- This is from the importer just to show that it’s alive.
- In the scene composer I see this though which doesn’t appear the same as the import screen or at least it doesn’t show the animation line in step 2 above.
- From the wiki I copied the below code. Importing the model alone and attaching it to root works fine enough. But the moment I try to use “channel = control.createChannel();” it throws a null pointer.
Spatial model = (Spatial) assetManager.loadModel("Models/Cubie/Cubie.j3o");
control = model.getControl(AnimControl.class);
System.out.println("Is this null? " + model.getControl(AnimControl.class));
channel = control.createChannel();
I assume I’m doing something boneheaded along the lines of I need to do something different for the blender import to work properly but I’ve poured over the wiki a number of times and forum but coming up with nothing super helpful (or… as I said… I’m being dumb). Any ideas?
I did see this one but the line “Baking is a destructive process so it is recommended that after completion of Creating Blender Animations, test the animation in-game.” was kinda where I went “I don’t think this is for me”.
New weirdness. In the bottom left panel of the scene explorer it does show my animations and I can play them in the Scene Composer. But the code still throws a null pointer.
You do it in a copy of the original because you will need to clear your action from the buffer afterwards or the blender importer will duplicate the animation. The blender importer does not bake actions.
I recommend using the ogre script that comes with the 3.2 sdk. You have to create an NLA strip to use it but that is fully explained in step 8 onward here.
Your anim control is not under the root node.
Huh. So since my AnimControl isn’t under the root node do I just need to alter how I reference it to make it work or is that a fools errand?
Just seems odd that through the Scene Explorer it can play the animation fine but trying to call it with code keeps killing itself.
Blender importer will bury the anim control using the node layout of blender.
Each import/export method is different. Some exporters are easier to use than others.
Ogre will place the anim control under the models root node, others don’t.
Some exporters apply modifiers for you, some don’t.
Some bake actions for you, some don’t.
Some use NLA strips, some don’t.
Using getChild would require ether setting up all your animations to use same node names or knowing in advance the childs name.
Much easier to just traverse and grab the control.
Gotcha. I’ll give that a shot and let you know. Thanks a bunch!
Heh. That 127.0.0.1 address won’t work from over here
I’ll try out your other suggestions tonight.
Sorry bout that, fixed it.
I haven’t read the whole post but the BlenderImporter hasn’t been updated for a while and animations were a problem as of 3.1 already. Even worse: As much as Blender progresses, the importer will break more and more, so I can recommend using xbuf for that
most of us are using gltf it’s works great with animations just export from blender to gltf and use it in jme.
soon blender 2.8 will be released and we won’t be able to use blender importer at all.
Just to save you some search work…
Yep, as things stand gltf is the only solution with any chance of working in the future to get models from blender.
Thanks guys! I’ll be giving this a shot a bit later today. If I manage to get this working from beginning to end would it be of any use to write a how-to for this? Like… not cover how to do the modelling since that’s not jME’s job naturally but at least how to get this portion working right.
In theory there should be plenty of posts for that workflow.
For both xbuf and gltf: Use the Exporter in Blender (for xbuf you need the render set to Xbuf (instead Cycles/Normal)) and (for xbuf: Set the Asset Path in Renderer Options, it’s where textures get placed) and then just right click the xbuf/gltf file and select “create j3o” in the SDK and you are done
Huh. Right clicking and saying convert to j3o throws me a wobbly:
An Exception has occured when trying to load asset Cubie
com.jme3.asset.AssetLoadException: An error occurred loading Models/Cubie/Cubie.gltf
Caused by: com.jme3.asset.AssetNotFoundException: Models/Cubie/Cubie.bin
... 7 more