Importing models to any game engine is as important as using them. The quality of the models depends on the abilities of the people who create it and on the tools they use. Blender is one of the best free tools for creating 3D enviroments. Its high amount of features attract many model designers. So far jMonkeyEngine used Ogre mesh files to import 3D data. These files were created by the python script that exported data from blender. It was important to have always the lates version of the script that is compatible with the version of blender and to use it before importing data to jme. Now we have an opportunity to simplify the import process by loading data directly from blender binary files: *.blend.
To use it in your game or the SDK you should follow the standard asset loading instructions. By default a BlenderModelLoader is registered with your assetManager to load blend files. This means you can load and convert .blend model files to .j3o format, just like any other supported model format.
I'll fix these when I fix more important stuff ;)
You have two loaders available.
public static class LoadingResults extends Spatial { /** Bitwise mask of features that are to be loaded. */ private final int featuresToLoad; /** The scenes from the file. */ private List<Node> scenes; /** Objects from all scenes. */ private List<Node> objects; /** Materials from all objects. */ private List<Material> materials; /** Textures from all objects. */ private List<Texture> textures; /** Animations of all objects. */ private List<AnimData> animations; /** All cameras from the file. */ private List<Camera> cameras; /** All lights from the file. */ private List<Light> lights; /** Access Methods goes here. */ }
To register the model do the following:
assetManager.registerLoader(BlenderLoader.class, "blend");
or
assetManager.registerLoader(BlenderModelLoader.class, "blend");
You can use com.jme3.asset.BlenderKey for that. The simplest use is to create the key with the asset's name. It has many differens settings descibing the blender file more precisely, but all of them have default values so you do not need to worry about it at the beggining. You can use ModelKey as well. This will give the same result as using default BlenderKey.
BlenderLoader (as well as BlenderModelLoader) is looking for all kinds of known assets to load. It's primary use is of course to load the models withon the files. Each blender object is imported as scene Node. The node should have applied textures and materials as well. If you define animations in your BlenderKey the animations will as well be imported and attached to the model.
Here is the list of how blender features are mapped into jme.
Using BlenderLoader can allow you to use blend file as your local assets repository. You can store your textures, materials or meshes there and simply import it when needed. Currently blender 2.49 and 2.5+ are supported (only the stable versions). Probably versions before 2.49 will work pretty well too, but I never checked that :)
I know that the current version of loader is not yet fully functional, but belive me – Blender is a very large issue ;) Hope I will meet your expectations.
Cheers, Marcin Roguski (Kaelthas)
P.S. This text might be edited in a meantime if I forgot about something ;)