Blender26 Ogre Exporter

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia
x 201

Re: Blender26 Ogre Exporter

Post by bstone »

hymerman
Halfling
Posts: 66
Joined: Wed Dec 20, 2006 10:15 pm
x 1
Contact:

Re: Blender26 Ogre Exporter

Post by hymerman »

bstone is right; there's an updated version a few posts up. Here's the link for your convenience:

http://www.ogre3d.org/forums/download/file.php?id=4293

I don't think the original author is updating the google code page any more, I'm afraid.

Waruck; thank you so much for looking at exporting Rigify meshes! I've managed to export my rigify rig without error and the xml files look ok, but I've not been able to load them into my game just yet as I've had some build troubles - I'll have a proper go tomorrow though. I'm not very familiar with Blender's API so I doubt I can add much to the script, but I can certainly have a go at helping out with things like documentation, which seems to be one of the main things this tool needs right now!
User avatar
amigoface
Greenskin
Posts: 132
Joined: Mon Oct 13, 2008 3:01 pm

Re: Blender26 Ogre Exporter

Post by amigoface »

thanks guys ! it's working now

so if i understand this thread is where to look for updated script not at google code ?

- and just a small last thing :
after exporting the default blender cube the resulting file is named cube.mesh instead of my given name
bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia
x 201

Re: Blender26 Ogre Exporter

Post by bstone »

That's how it works. It lets you pick the name of the .scene file but since you can export multiple meshes along with it their files are named according to object names.
hymerman
Halfling
Posts: 66
Joined: Wed Dec 20, 2006 10:15 pm
x 1
Contact:

Re: Blender26 Ogre Exporter

Post by hymerman »

Also note that it's exporting meshes and not objects. That's why if you only rename your object, the .mesh file name will not change - you need to rename the mesh too (expand one more level in the outliner). Also that's why so many people have problems with things being scaled/rotated/positioned incorrectly - they moved the object and not the underlying mesh.
hymerman
Halfling
Posts: 66
Joined: Wed Dec 20, 2006 10:15 pm
x 1
Contact:

Re: Blender26 Ogre Exporter

Post by hymerman »

Update: Thanks Waruck, it works perfectly! This is going to be a massive productivity boost for anyone wanting to do some decent animations from easy to use rigs!
User avatar
amigoface
Greenskin
Posts: 132
Joined: Mon Oct 13, 2008 3:01 pm

Re: Blender26 Ogre Exporter

Post by amigoface »

got it !
EthanD
Gnoblar
Posts: 7
Joined: Fri Jun 29, 2012 10:43 pm

Re: Blender26 Ogre Exporter

Post by EthanD »

Hello all, I just want to ask a quick question - I've been trying to export Ogre meshes from Blender, but am running into an issue with the XML Converter. I'm using Blender 2.63, and whenever I try to export, I get an error saying "OgreXMLConverter has stopped working". All I get in the export location is a .scene and a .xml, no .mesh or .material. I have successfully exported many meshes without issue before, in Blender 2.49.

I wish I could tell you more, however this is all I know - is there some sort of log I can post to you guys? If so, where would I find it?

A bit lost and confused here. I would really appreciate any help. Thanks! :)
User avatar
Waruck
Goblin
Posts: 210
Joined: Mon Dec 12, 2011 12:52 pm
Location: Germany
x 34

Re: Blender26 Ogre Exporter

Post by Waruck »

have you tried converting the .xml manually using the OgreXMLConverter? The converter also should give you a .txt file with its log.
EthanD
Gnoblar
Posts: 7
Joined: Fri Jun 29, 2012 10:43 pm

Re: Blender26 Ogre Exporter

Post by EthanD »

Waruck wrote:have you tried converting the .xml manually using the OgreXMLConverter? The converter also should give you a .txt file with its log.
Thanks for responding - I did try that, and it did indeed work. My main issue was simply with the converter crashing, and not converting the .xml into .mesh (for the sake of convenience), however I just installed the latest Command Line Tools and that cleared the issue up. It exports and converts just fine, but now I find myself with another problem.

The mesh doesn't appear to be linked to a material - in the XML, where it would usually say the name of the material section, it simply says "_missing_material_". I have the "Export Materials" box checked in Blender. I could create a material myself and write that into the XML, but it would be rather inconvenient and time consuming. Everything is working fine but this - what am I missing? Why isn't it creating and exporting a material, and then linking the mesh to this?

Cheers
User avatar
Waruck
Goblin
Posts: 210
Joined: Mon Dec 12, 2011 12:52 pm
Location: Germany
x 34

Re: Blender26 Ogre Exporter

Post by Waruck »

Did you assign the material to the mesh in blender? The exporter should export every material that is given to the mesh and create submeshes per material if i'm not mistaken. Check the properties of your object in blender and look in the material-section if there are any materials assigned to it.
Though generating a working .material file with the exporter is a little bit tricky. I usually write them on my own and just use the blender-material to give it the right name in the .mesh file
EthanD
Gnoblar
Posts: 7
Joined: Fri Jun 29, 2012 10:43 pm

Re: Blender26 Ogre Exporter

Post by EthanD »

Ah, that was the problem. I hadn't assigned one. I'm just so used to the 2.49 exporting, where it would just automatically create a material. I have to say, I like the new UI and modelling capabilities of 2.63, however the OGRE exporter for 2.49 was a lot easier for me to use :P

Guess I'll be writing materials myself then. Thanks so much for your help :)
User avatar
kromar
Gnoblar
Posts: 13
Joined: Tue Aug 23, 2011 12:52 pm
x 1

Re: Blender26 Ogre Exporter

Post by kromar »

is the animation export supposed to work correctly?
i spent several days on trying to figure out how to set up a scene for animation exporting but every time i export the result is different. this is mainly about rotation of bones, i can not reproduce a solid export of different scenes. its like a lucky shot to get it correct even if i do the exact same thing....
so anyone knows "exactly" how to export animations so they actually are exported as they work in blender?
User avatar
duststorm
Minaton
Posts: 921
Joined: Sat Jul 31, 2010 6:29 pm
Location: Belgium
x 80
Contact:

Re: Blender26 Ogre Exporter

Post by duststorm »

kromar wrote:anyone knows "exactly" how to export animations so they actually are exported as they work in blender?
Make sure there are no object transformations on both armature and mesh when exporting. CTRL+A "Apply all" can help.
Developer @ MakeHuman.org
hymerman
Halfling
Posts: 66
Joined: Wed Dec 20, 2006 10:15 pm
x 1
Contact:

Re: Blender26 Ogre Exporter

Post by hymerman »

I know there's a warning about object and root bone transforms in the script, but people keep coming back with the same problem time and time again... perhaps we could make the warning a bit more in-your-face, or informative, or both?
User avatar
duststorm
Minaton
Posts: 921
Joined: Sat Jul 31, 2010 6:29 pm
Location: Belgium
x 80
Contact:

Re: Blender26 Ogre Exporter

Post by duststorm »

hymerman wrote:I know there's a warning about object and root bone transforms in the script, but people keep coming back with the same problem time and time again... perhaps we could make the warning a bit more in-your-face, or informative, or both?
Maybe it would be even easier to properly fix the script itself (not sure though as I have not yet looked at the source). Allowing proper transformations instead of the x-y-z component fiddling would fix a couple of issues, instead of circumventing them.
Developer @ MakeHuman.org
User avatar
Waruck
Goblin
Posts: 210
Joined: Mon Dec 12, 2011 12:52 pm
Location: Germany
x 34

Re: Blender26 Ogre Exporter

Post by Waruck »

actully the root-bone issue should've been fixed in the latest version. Not sure if the warning is still there but the issue shouldn't.

The only issue appearing when exporting skeletons should be that global rotation and translation of all objects are ignored. So if the mesh or the skeleton has been moved in object-mode and their global translation and rotation aren't the same the exported .mesh and .skeleton won't align.
User avatar
kromar
Gnoblar
Posts: 13
Joined: Tue Aug 23, 2011 12:52 pm
x 1

Re: Blender26 Ogre Exporter

Post by kromar »

Waruck wrote:actully the root-bone issue should've been fixed in the latest version. Not sure if the warning is still there but the issue shouldn't.

The only issue appearing when exporting skeletons should be that global rotation and translation of all objects are ignored. So if the mesh or the skeleton has been moved in object-mode and their global translation and rotation aren't the same the exported .mesh and .skeleton won't align.
ok, i assume the same is true when using the skeleton files with a .obj instead of.mesh, or is there a difference in the "center" of the 2 formats? (obj will have the center at the global scene center (0,0,0).
so lets say i rotate an .obj around (1,1,1) but its pivot is in (0,0,0) where does the bone pivot need to be?

EDIT: tried it again with everything pivoted to scene origin and all possible export axis... rotation is never correct and some meshes have an offset as well.
i can export it with blender 2.49 without any problems. am i the only one that is not able to export animations like they are in blender?
User avatar
Waruck
Goblin
Posts: 210
Joined: Mon Dec 12, 2011 12:52 pm
Location: Germany
x 34

Re: Blender26 Ogre Exporter

Post by Waruck »

you can easily check to local position and orientation of your objects in blender:

- go the object mode
- activate the 3d manipulator widget
- set the widget's orientation to local
- select the mesh and the skeleton and check if the widget's position and orientation are the same for both. if not something is off and won't be exported properly

you can use apply->location/rotation (ctrl+a) to align the skeleton to the mesh.
User avatar
kromar
Gnoblar
Posts: 13
Joined: Tue Aug 23, 2011 12:52 pm
x 1

Re: Blender26 Ogre Exporter

Post by kromar »

Waruck wrote:you can easily check to local position and orientation of your objects in blender:

- go the object mode
- activate the 3d manipulator widget
- set the widget's orientation to local
- select the mesh and the skeleton and check if the widget's position and orientation are the same for both. if not something is off and won't be exported properly

you can use apply->location/rotation (ctrl+a) to align the skeleton to the mesh.
well i tried that, i still get offset and rotation around some weired position...
here is a pic of the setup, really really simple and a pic of the export log, can you see something wrong?
i will see if i can get the import code that we use, maybe there is something wrong on our side.

Image
Image


EDIT: just to make sure, the exported format should be the same as from the old blender (2.49) right? or do wee need to change it so we can import these "new" animations?
Last edited by kromar on Tue Jul 03, 2012 12:51 pm, edited 1 time in total.
User avatar
duststorm
Minaton
Posts: 921
Joined: Sat Jul 31, 2010 6:29 pm
Location: Belgium
x 80
Contact:

Re: Blender26 Ogre Exporter

Post by duststorm »

Maybe the script should do this for you (applying object transformations), or at least have a checkbox that allows you to perform the transformations before exporting.

About that picture, I can't see the object center on it so I can't help you with weird rotations around object center. But know that you can define the object center in blender anywhere you want.
Developer @ MakeHuman.org
User avatar
kromar
Gnoblar
Posts: 13
Joined: Tue Aug 23, 2011 12:52 pm
x 1

Re: Blender26 Ogre Exporter

Post by kromar »

duststorm wrote:Maybe the script should do this for you (applying object transformations), or at least have a checkbox that allows you to perform the transformations before exporting.

About that picture, I can't see the object center on it so I can't help you with weird rotations around object center. But know that you can define the object center in blender anywhere you want.
the object center is in the same position as the armature, both are in the scene origin.

EDIT: just to make sure, the exported format should be the same as from the old blender (2.49) right? or do wee need to change it so we can import these "new" animations?
User avatar
Waruck
Goblin
Posts: 210
Joined: Mon Dec 12, 2011 12:52 pm
Location: Germany
x 34

Re: Blender26 Ogre Exporter

Post by Waruck »

duststorm wrote:Maybe the script should do this for you (applying object transformations), or at least have a checkbox that allows you to perform the transformations before exporting.
I don't think that's a good idea. if you want to export a scene you don't want to apply the transformations. Although I admid that it's the most common problem, applying the transformation in the script can't be undone and can really mess things up if you click it by accident.
kromar wrote:The object center is in the same position as the armature, both are in the scene origin.
Have you tried to look at your model with OgreMeshy and checked whether the skeleton is aligned to the mesh?

Also: I don't really know how you want your objects exported, but in the picture I don't see any object around the origin. If the Objects center is in the scene's origin then they will have the same offset to their scene-node in ogre. But as duststorm said: it's hard to help you if you can't give some pictures that show the difference between your objects in blender and in Ogre.
lukors
Gnoblar
Posts: 1
Joined: Thu Jul 12, 2012 10:56 am

Re: Blender26 Ogre Exporter

Post by lukors »

I had an issue where the exporter couldn't export saying "ValueError: Matrix.invert(ed): matrix does not have an inverse".

I looked through my file and I found that I had a bone that was scaled to 0 on one axis sometimes, so I forced that bone to always have 1 in size on that axis and my file exported successfully.
Last edited by lukors on Sun Jul 15, 2012 12:53 pm, edited 1 time in total.
LBDude
Gnome
Posts: 389
Joined: Mon Jul 26, 2010 10:53 pm
x 22

Re: Blender26 Ogre Exporter

Post by LBDude »

How do you correctly export multiple actions? Instead of read the ogre help re. the animation and NLA editor, I went ahead and created two actions. I then tried to create NLA strips after that, but only a single animation called "my_animation" was exported out. I then started messing around with the NLA editor and sometimes it would unlink my action, basically removing the action all together. It's pretty confusing.
My blog here.
Game twitter here
Post Reply