New Blender 2.5 Ogre Exporter

Hi all,



i just saw this link. I don’t know if it’s already known. But want to share this.

Sounds like a useful exporter, but didn’t test it by my self jet.

1 Like

Yeah, finally things get rolling ^^

Anyone had try it?

Great new!!!

i’ll try it for sure

Good find. Here’s another user-contributed alternative:

http://www.ogre3d.org/forums/viewtopic.php?f=8&t=60170&p=403392



Apparently neither of these are “official” (I don’t know what that extends to in the context of the Ogre3D project). An official version is planned, but as of this posting it’s not yet started:

http://www.ogre3d.org/forums/viewtopic.php?t=45922



It seems the either of the two “unofficial” exporters mentioned here might very well be incorporated into the official release once Blender is deemed stable enough.



If you choose to test either of these scripts, I suggest you take an active part and report back to the author with any feedback you can come up with. It’s important to let these guys know that their work is being used and appreciated, even by developers outside of the Ogre3D domain.

It is a very nice development! I am sure that they will be ready for use in no time. There are bugs reported and the author fixes them rather quickly so that is good.

I just tested blender 2.56a with version 0.2.9 of the ogre exporter.

The blender export seems to be ok.



See exported files http://fishheadsoftware.de/jme/ogretest/Cube/

It’s the default cube with just one bone.



Then i tried to load the cube with jme3test.model.TestOgreLoading test class but get the following error.



[java]

java.lang.ClassCastException: com.jme3.scene.Geometry cannot be cast to com.jme3.scene.Node

at com.jme3.animation.AnimControl.cloneForSpatial(AnimControl.java:145)

at com.jme3.scene.Spatial.clone(Spatial.java:1120)

at com.jme3.scene.Node.clone(Node.java:573)

at com.jme3.scene.Node.clone(Node.java:59)

at com.jme3.asset.ModelKey.createClonedInstance(ModelKey.java:54)

at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:252)

at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:348)

at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:358)

at jme3test.model.anim.TestOgreAnim.simpleInitApp(TestOgreAnim.java:74)

at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:186)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:134)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:183)

at java.lang.Thread.run(Thread.java:619)

[/java]



Maybe someone who knows the ogre importer can have a look on this.

you probably trying to load the file into a Node…but it’s a Geometry. Try to load it into a Geometry and it should be fine

Well but the problem is not in “my” code. As you can see it’s while the model is loaded from the asset manager.



[java]Spatial elephant = (Spatial) assetManager.loadModel(“Models/Cube/Cube.mesh.xml”);[/java]



And the problem is in the deep of the AnimControl.

I don’t see where i should do what you suggest.

mhh right sorry, did not read properly the stack trace

That’s strange indeed.



Btw, i didn’t get the exporter to work on my blender version, i’m gonna try with the fresh 2.56a

Never mind. ^^



I have done to changes to get it working with current blender versions.



[java]

4087c4087

< wm.add_fileselect(self) # writes to filepath



> wm.fileselect_add(self) # writes to filepath

4292c4292

< scn.setAttribute(‘exported_by’, os.getlogin())



> #scn.setAttribute(‘exported_by’, os.getlogin())

[/java]

Today, with the current version of blender [2.56 beta] and with the latests updates from jme3:

  • OgreXML Support 0.8.0.6269
  • OgreXML Tolls 0.6.1.6275

    is it possibile to create model and import them in applications without many troubles? Or is still better to stay with the stable 2…49?

    Thanks

Your guess is as good as ours :slight_smile: It will require proper testing.

2.49 is still the recommended import path, otherwise what erlend said :stuck_out_tongue:

I have the same problem now, when I switched to sharedgeometry and boneassignments inside a mesh instead of having geometry and boneassignments inside a submesh.

[java]com.jme3.scene.Geometry cannot be cast to com.jme3.scene.Node

com.jme3.animation.AnimControl.cloneForSpatial(AnimControl.java:145)

com.jme3.scene.Spatial.clone(Spatial.java:1114)

com.jme3.scene.Node.clone(Node.java:574)

com.jme3.scene.Node.clone(Node.java:60)

com.jme3.scene.Spatial.clone(Spatial.java:1141)

com.jme3.asset.ModelKey.createClonedInstance(ModelKey.java:54)

com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:252)

com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:348)

com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:358)[/java]

Probably this line makes some wrong assumptions:

[java]Node clonedAttachNode = (Node) clonedNode.getChild(i);[/java]

Can this be fixed soon by the jME3 team?



As far as I understand it now (and I understand very little) a Node with shared geometry will have attached that Geometry and a submesh Node:

[java]Node

  • Geometry
  • Node[/java]

    So it’s really a bug in the code that assumes all children of the main Node are Nodes as well. Without shared geometry it would work:

    [java]Node
  • Node
  • Geometry[/java]



    From the log:

    2011-01-20 16:11:52 com.jme3.scene.Node attachChild

    INFO: Child (x-sharedgeom) attached to this node (x-ogremesh)

    2011-01-20 16:11:52 com.jme3.scene.Node attachChild

    INFO: Child (x-geom-1) attached to this node (x-ogremesh)



    And then you want to cast all those objects to Node which doesn’t work.



    The models themselves are ok (I’m using my own tool to create mesh and skeleton xml files) because when I leave the skeleton out the model displays properly. Maybe it would be sufficient to ignore that first object if it’s a Geometry but I don’t know the inner workings of skeleton animation.
Momoko_Fan said:
Should be fixed in SVN now

Great, thanks, will test that on Monday. I have one more question about xml to j3o conversion. Binary format packs skeleton with animations in one file with the mesh, so when I have more meshes sharing a single skeleton, then this data will be duplicated. Is there a way to use j3o but with shared skeleton file?

For some reason I can’t get the exporter to work, I am using Blender 2.56 and export script 0.3.0.

I get “RuntimeError: matrix(): row and column sizes must be between 2 and 4”



Can you please upload the problematic mesh.xml and skeleton.xml files? Thanks

madlion said:
See exported files http://fishheadsoftware.de/jme/ogretest/Cube/
It's the default cube with just one bone.

There you can find all 3 exported files. ^^

Should be fixed in SVN now

Oh cool! ^^

I will check it if i’m back home.