New Blender ==> jME Foreign Model Import/Export Support

This post is in refernce to the post "Animation-supporting Blender ==> jME Exporter released" at:



http://www.jmonkeyengine.com/jmeforum/index.php?topic=11580.0



As full testing of foreign (non-Blender) model Import to Blender and Export to jME has not taken place (as resources were not available – like I don't have StudioMax 3D 2009 or whatever), it would be greatly appreciated if you could (when you are in tech research mode (or just bored)):



00) Download and install the latest Blender (2.49, I believe);



0) Install the latest Blender==>jME Exporter from either svn (Ant Build available) at Google Code under jMonkeyEngine->Branches->blenderjme or download the 0.2c beta zip from http://pub.admc.com/misc/jme/blenderjme-0.2c.zip ;


  1. Review the very detailed exporter documentation starting at:  http://www.jmonkeyengine.com/wiki/doku.php?id=blenderjme_basics_tutorial ;


  2. Import your foreign model into Blender and save as a .blend file;


  3. Export the model via Blender->File->Export->"JMonkeyEngine (-jme.xml)" with default values and load it into a basic SimpleGame setup (or whatever heavy handed framework you've got going on for your project);


  4. Report any problem with foreign models you may have on this thread.  We have had some good success with MS3D import/export via Blender and a couple other types;


  • Basic load code:



       XMLImporter xmlFile = XMLImporter.getInstance();
       try {
      Object o = xmlFile.load(modelURL);
           if (!(o instanceof Spatial)){
              throw new IOException("File contains non-spatial root: " + o.getClass().getName());
           } else {
                  Spatial loadedSpatial = (Spatial) o;
                  model = (Node) loadedSpatial;
                  model.setLocalTranslation(new Vector3f(0f,0f,0f));
                    System.out.println("LoadBlenderModel: "+ name + ".xml loaded.");
               }
         
   } catch (IOException e) {   // Just in case anything happens
         System.out.print("Severe Error: " + e);
         System.exit(0);
   }



and basic animation access code:


      try{
         Spatial armature = (Spatial) model.getChild("ArmatureSuperBone");
         int controllerCount = armature.getControllerCount();
         System.out.println("controller count: " + controllerCount);
         if (controllerCount > 0){
            if (armature != null){
               ac = (AnimationController) armature.getController(0);
               List anims = ac.getAnimations();
               for (Object o : anims){
                  System.out.println("anims: " + o.toString());
               }
               ac.setActiveAnimation(anims.get(0).toString());
               ac.setSpeed(1f);
               ac.setRepeatType(Controller.RT_WRAP);
            }
         }
      } catch (NullPointerException npe){
         System.out.println("armature.getControllerCount() npe: " + npe);
      }



Enjoy, work, and have fun.

Hello, I have been testing blenderjme-0.2d (and c) and have noticed the following:


  1. If I export a model with bone animations from blender and open the model with the Modeler application mentioned in the Blender=>Jme Tutorials, everything works fine. I see my animated model.




  2. If I load the same file with the XMLWorld and XMLAnimator code posted in the wikis the model does not display correctly. I only have a partial animated model. I only see meshes directly attached to bones but not the skin mesh.




  3. Finally, if I open my file in Modeler and do a RighClick->Save model as XML and then load that model in jME with XMLAnimator… Everything works fine!





    Does anyone have any idea of what might be happening? Here are both version of the model’s file.

    Directly from Blender: http://www.rrodriguez.org/files/jme/man-jme.xml

    Directly from Modeler: http://www.rrodriguez.org/files/jme/manfixed-jme.xml


ricardojr said:

Hello, I have been testing blenderjme-0.2d (and c) and have noticed the following:

1. If I export a model with bone animations from blender and open the model with the Modeler application mentioned in the Blender=>Jme Tutorials, everything works fine. I see my animated model.
...

2. If I load the same file with the XMLWorld and XMLAnimator code posted in the wikis the model does not display correctly. I only have a partial animated model. I only see meshes directly attached to bones but not the skin mesh.
...


I downloaded your man-jme.xml file, ran XmlAnimator with it and it runs perfectly, with the skin deforming.  I used XmlAnimator.java and XmlWorld.java directly from Subversion, and, other than comment changes, these are exactly what will be in the next exporter release.

Please install and try with 0.3a, using the .java files from the distribution.  I plan to release 0.3a within the hour, so keep an eye on the distribution site or watch for the announcement.

I have been using .2c exporter for the last week or so. Material exports ok, but I was wondering about any of the texture options, such as Nor. Are these going to be available to export, or are there tools within the JME to do this instead?

Banditkills said:

I have been using .2c exporter for the last week or so. Material exports ok, but I was wondering about any of the texture options, such as Nor. Are these going to be available to export, or are there tools within the JME to do this instead?


Check out the following new release post:

http://www.jmonkeyengine.com/jmeforum/index.php?topic=11678.0

Nor is not currently supported.
blaine said:

I downloaded your man-jme.xml file, ran XmlAnimator with it and it runs perfectly, with the skin deforming.  I used XmlAnimator.java and XmlWorld.java directly from Subversion, and, other than comment changes, these are exactly what will be in the next exporter release.

Please install and try with 0.3a, using the .java files from the distribution.  I plan to release 0.3a within the hour, so keep an eye on the distribution site or watch for the announcement.


Everything works fine using 0.3a and .java files from Subversion. I just have minor animation frame skips or artifacts, but that is probably my blender animation. I have to do some tests.

Thanks! ; )

I'm almost new to this and I'm just trying to load xml textures. I just can't do it, I get the IllegalArgumentException (thrown by the catch of an IOException) thrown when the URL is being read. I tried using file instead, but I get the same. I suppose it is caused because I'm not entering the URL correctly or something like that, I don't know. I'm a linux user, if that's an issue but I doubt it is. Here is the whole stack trace:

(I'm using eclipse, and I have the program arguments like "file:man-jme.xml")



INFO: Node created.

java.lang.IllegalArgumentException: Failed to load URL: file:man-jme.xml

at XmlWorld.loadModel(XmlWorld.java:68)

at XmlWorld.simpleInitGame(XmlWorld.java:51)

at com.jme.app.BaseSimpleGame.initGame(BaseSimpleGame.java:544)

at com.jme.app.BaseGame.start(BaseGame.java:74)

at XmlWorld.parseAndRun(XmlWorld.java:35)

at XmlWorld.main(XmlWorld.java:20)

Caused by: java.io.IOException

at com.jme.util.export.xml.DOMInputCapsule.readSavable(DOMInputCapsule.java:784)

at com.jme.util.export.xml.XMLImporter.load(XMLImporter.java:75)

at com.jme.util.export.xml.XMLImporter.load(XMLImporter.java:119)

at XmlWorld.loadModel(XmlWorld.java:65)

… 5 more

Caused by: java.io.IOException

at com.jme.util.export.xml.DOMInputCapsule.readSavableArrayList(DOMInputCapsule.java:961)

at com.jme.scene.Node.read(Node.java:673)

at com.jme.util.export.xml.DOMInputCapsule.readSavableFromCurrentElem(DOMInputCapsule.java:817)

at com.jme.util.export.xml.DOMInputCapsule.readSavable(DOMInputCapsule.java:777)

… 8 more

Caused by: java.lang.NumberFormatException: For input string: ""

at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)

at java.lang.Integer.parseInt(Integer.java:493)

at java.lang.Integer.parseInt(Integer.java:514)

at com.jme.util.export.xml.DOMInputCapsule.readSavableArrayList(DOMInputCapsule.java:948)

… 11 more

Aug 11, 2009 1:22:48 PM com.jme.app.BaseSimpleGame cleanup

INFO: Cleaning up resources.

Aug 11, 2009 1:22:48 PM com.jme.app.BaseGame start

INFO: Application ending.

krumstone said:

I'm almost new to this and I'm just trying to load xml textures. I just can't do it, I get the IllegalArgumentException (thrown by the catch of an IOException) thrown when the URL is being read. I tried using file instead, but I get the same. I suppose it is caused because I'm not entering the URL correctly or something like that, I don't know. I'm a linux user, if that's an issue but I doubt it is. Here is the whole stack trace:
(I'm using eclipse, and I have the program arguments like "file:man-jme.xml")
...


Looks like your loading program and syntax is good.  XMLImporter doesn't like the XML file.  What jME code are you running (most importantly, is it the 2.0 baseline and when did you last update and build from svn), and how/where/when was your man-jme.xml file created?  To avoid some potential back-and-forth, make your model file available somewhere on the Internet (along with referenced resources) and post the URL here.

It is 2.0. I haven’t updated like a month ago (I didn’t consider that…). I just searched the internet for some models to test the HottBJ: http://e2-productions.com/repository/modules/PDdownloads/visit.php?cid=1&lid=274

krumstone said:

It is 2.0. I haven't updated like a month ago (I didn't consider that...). I just searched the internet for some models to test the HottBJ: http://e2-productions.com/repository/modules/PDdownloads/visit.php?cid=1&lid=274



You definitely need to update your jME code.

Can't believe I missed that… Thanks a lot for the help.

Hi. I'm following the HottbBJ tutorial. Right now I'm on the animations using skelletons part, but i just can't export the armature to jme. When i press "Export" a menu appears that says "[Object: Armature]" and two options "Try other settings" and "Abort Export". The console output says only "Object: Armature". I tried other settings, but still got the same. Please help. Thanx.

krumstone said:

Hi. I'm following the HottbBJ tutorial. Right now I'm on the animations using skelletons part, but i just can't export the armature to jme. When i press "Export" a menu appears that says "[Object: Armature]" and two options "Try other settings" and "Abort Export". The console output says only "Object: Armature". I tried other settings, but still got the same. Please help. Thanx.


What versions of HottBJ and of Blender are you running?

Actually, as this is an entirely new issue, please open a new Topic and include those details.

Ok. I opened a new topic called "HottBJ - Problems exporting Objects".