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();
rootNode.attachChild(model);
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.
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.
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
at com.jme3.scene.plugins.gltf.GltfLoader.loadFromStream(GltfLoader.java:150)
at com.jme3.scene.plugins.gltf.GltfLoader.load(GltfLoader.java:78)
at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:259)
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:373)
at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:416)
at com.jme3.gde.core.assets.SpatialAssetDataObject.loadAsset(SpatialAssetDataObject.java:94)
at com.jme3.gde.core.assets.actions.ConvertModel$1.run(ConvertModel.java:65)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.jme3.asset.AssetNotFoundException: Models/Cubie/Cubie.bin
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:370)
at com.jme3.scene.plugins.gltf.GltfLoader.getBytes(GltfLoader.java:535)
at com.jme3.scene.plugins.gltf.GltfLoader.readData(GltfLoader.java:513)
at com.jme3.scene.plugins.gltf.GltfLoader.readBuffer(GltfLoader.java:484)
at com.jme3.scene.plugins.gltf.GltfLoader$Matrix4fArrayPopulator.populate(GltfLoader.java:1436)
at com.jme3.scene.plugins.gltf.GltfLoader$Matrix4fArrayPopulator.populate(GltfLoader.java:1423)
at com.jme3.scene.plugins.gltf.GltfLoader.readAccessorData(GltfLoader.java:465)
at com.jme3.scene.plugins.gltf.GltfLoader.readSkins(GltfLoader.java:952)
at com.jme3.scene.plugins.gltf.GltfLoader.loadFromStream(GltfLoader.java:122)
... 7 more