blend2java  Donate to this project

Homepage :
Sourceforge page : : Download : Donate
License : GPL
HOWTO : here

This is the amazing Python script for exporting blender models to XML that can be loaded by the standard java.beans.XMLDecoder class (since 1.4) and cast to the standard Java3D Shape3D object. All clear now?

This allows you to take your amazing Blender models, and bring them across into your Java3D game / app / whatever.

You'll need:
    Blender 2.25 or newer (could work with older ones, never used to) from
    Java from (1.4 is when the java.beans.XMLDecoder arrived)
    Java3D from
    A reasonable understanding of Blender and Java3d

To use it, you must first select an object you would like to export (in blender)
then load the script, then run it. A file is created for each different Material the mesh has. This is because a Shape3D object can only have a single Appearance node. (But you already knew that)

To load the XML into Java, the following does nicely;

    XMLDecoder e = new XMLDecoder(
        new BufferedInputStream(
            new FileInputStream(filename)));
    Shape3D fred = (Shape3D) e.readObject();

You can see this in action in the demo. To run the demo, go to the demo folder and run

java Viewer

Under windows I think you can just double click on the Viewer.class file, and it will start up, not sure.
There's also a Java3D demo using keyframes, it's bundled in a jar file.

java -jar moo.jar

ithink you can probably double click on that one in windows too.

If you get a class not found "java.beans.XMLDecoder" it probably means you don't have a new enough java runtime, you'll need atleast 1.4.

If you get a class not found "GraphicsConfiguration" or the like, there's a problem with your Java3D installation (did you do one?).

    - Gasdia Roberto has added support for textures!!! His work is truly awesome, he's responsible for the funny two legged dinosaur demo too.
    - Added demo of keyframe animation (moo.jar)

    - Added a warning about blend2java not exporting a mesh without atleast one material assigned to it, to this document
    - Added a recent changes section to the documentation.
    - The code hasn't changed at all.
    - Completely rewritten to write XML, not java source.
    - The first Logo