Blender26 Ogre Exporter

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
tristanjl
Gnoblar
Posts: 5
Joined: Mon Apr 08, 2013 5:34 am

Re: Blender26 Ogre Exporter

Post by tristanjl » Mon May 06, 2013 9:21 am

So, I tried following the animation export guide as best I could, but I seem to be experiencing some problems exporting multiple animations. I have 2 NLA tracks, each containing a single action for export. When I open up the exported and converted mesh in Ogre Meshy, both the animations appear in Ogre Meshy. However, the motion of the animation is the same for both animations, with only the length of the animation differing (so the longer animation simply does nothing for a period of time after playing the shorter animation). I wonder if I'm missing something simple.

EDIT: Think I managed to get it to work - I added

Code: Select all

nla.is_solo = True
To the export loop. Seems to have done the trick, but I haven't tested it very much
0 x

LuciaTA
Gnoblar
Posts: 1
Joined: Wed May 08, 2013 11:24 pm

Re: Blender26 Ogre Exporter

Post by LuciaTA » Wed May 08, 2013 11:44 pm

Hi,

I'm having problems sporting an object animated, in blender the animation looks ok but once sported it looks deformed. I don't know what I do wrong, in blender I rotate the bone but in Ogre looks like if I translate it instated rotate it.
I think that I have a problem similar to clevengr's problem because in skeleton.xml file appears too axis negative:

Code: Select all

<track bone="FrontDownLeftLeg" >
          <keyframes >
            <keyframe time="0.0" >
              <translate z="0.000000" x="0.000000" y="0.000000" />
              <rotate angle="0.000000" >
                <axis z="-0.000000" x="-0.000000" y="0.000000" />
              </rotate>
              <scale z="1.000000" x="1.000000" y="1.000000" />
            </keyframe>
            <keyframe time="0.041666666666666664" >
              <translate z="0.000000" x="0.000000" y="0.000000" />
              <rotate angle="0.022355" >
                <axis z="0.000000" x="1.000038" y="0.000000" />
              </rotate>
              <scale z="1.000000" x="1.000000" y="1.000000" />
            </keyframe>


The Blender version is 2.65 and th blender2ogre is 0.5.9

Someboy can help me to solve it please?
Thanks.

I'm not able to solve the problem yet. Any solution? In blender the animation looks right, it's a dog moving up the leg, I do this rotating 90 degrees the bone of the leg, but when I export the mesh with the animation In ogre appears the dog but tha animation is wrong, the leg is deformated, it's as if I rotate up a little the bone and moved it forward too, at the end looks like a gum leg
0 x

Jonathan_Bolten
Gnoblar
Posts: 3
Joined: Sun May 19, 2013 12:18 am

Re: Blender26 Ogre Exporter

Post by Jonathan_Bolten » Thu May 23, 2013 11:50 pm

efaj wrote:How do you use the script inheritance option? Is it what I think it is?
I have a base .material that all my other mats inherit from, and until now, I've just been opening the file myself and adding it..... each time I export. But, does this mean now I can tell the exporter in the blend once and never worry more?
When clicking the dropbox I only get "Script Inheritance", aka probably blank.
Did you ever solve this? I'm having the same problem. I set my "SHADER_PROGRAMS" path in the config file to the path of my OgreSDK\media\materials\programs, I am not seeing any shaders under that dropbox. Anyone have any ideas?

Edit: Fixed, updated to MindCalamity's version:
https://bitbucket.org/MindCalamity/blender2ogre

Might have had a problem because I'm always using the newest version of blender, so maybe the older version (but latest by original maker) wasn't supporting newest blender. I didn't catch it sooner because the rest of the functionality seemed to be working. :o
0 x

xXx
Halfling
Posts: 40
Joined: Tue Apr 02, 2013 9:43 am

Re: Blender26 Ogre Exporter

Post by xXx » Wed May 29, 2013 4:45 pm

When i export my animated model and open it in OgreMeshy (or use it in Ogre), whenever i play an animation, the model is translated down, passing through the bounding box... What's wrong? Anyone knows how to fix this?
0 x

User avatar
Jefferian
Halfling
Posts: 63
Joined: Sun Jun 12, 2011 12:53 am
Location: Italy

Re: Blender26 Ogre Exporter

Post by Jefferian » Wed Jun 05, 2013 10:01 am

xXx wrote:When i export my animated model and open it in OgreMeshy (or use it in Ogre), whenever i play an animation, the model is translated down, passing through the bounding box... What's wrong? Anyone knows how to fix this?
Did you apply scale/rotation/location to both mesh and armature before actually doing the animation?

Anyway, i've got a question as well. Is there some way to export a lattice-based animation?
I've done an animation following some methods in this tutorial
http://cgcookie.com/blender/2012/05/21/ ... r-part-01/
but i have no idea how to export the result, now.
0 x

User avatar
kromar
Gnoblar
Posts: 13
Joined: Tue Aug 23, 2011 12:52 pm

Re: Blender26 Ogre Exporter

Post by kromar » Wed Jun 05, 2013 12:47 pm

as far as i know only bone animations are supported, so no shape key or lattice deformation will work. but maybe my knowledge is outdated :shock:
0 x

User avatar
Jefferian
Halfling
Posts: 63
Joined: Sun Jun 12, 2011 12:53 am
Location: Italy

Re: Blender26 Ogre Exporter

Post by Jefferian » Thu Jun 06, 2013 10:28 am

I did it in the end.Later in that tutorial, there is a way to apply the animation via shape keys to the mesh, and then i was able to export it with the animation as a pose animation (basically, one shape key per frame).
I'll have to see how well it will work ingame, though.
0 x

xXx
Halfling
Posts: 40
Joined: Tue Apr 02, 2013 9:43 am

Re: Blender26 Ogre Exporter

Post by xXx » Thu Jun 06, 2013 10:54 am

Late response, i'm sorry.

I finally had to learn a bit about the Graph Editor of blender. I saw that my problem was that the bones of the model was animated with a constant offset. I solved in a really simple way: i moved the root bone up :)

This applies for all the frames. of course, i had to do it for every animation.

Thank you for your answers, though :)
0 x

User avatar
Jefferian
Halfling
Posts: 63
Joined: Sun Jun 12, 2011 12:53 am
Location: Italy

Re: Blender26 Ogre Exporter

Post by Jefferian » Tue Jun 11, 2013 9:11 am

Uh, i've got a question regarding the exporter.
Shape key animations are supported, and that's good.
But...are animated normals supported as well?
I would guess not, since i can't see anything to toggle them on export.
That would also explain why the lighting on my page turn - done via shape animation - doesn't change at all during the animation.
0 x

Honas
Gnoblar
Posts: 23
Joined: Thu May 31, 2012 2:09 pm

Re: Blender26 Ogre Exporter

Post by Honas » Wed Jun 19, 2013 10:39 pm

I've got a couple of questions (directed at the community). I got a rigged mesh (think of 'Super Mario 64' Mario) and can provide the .blend.

1) How can I export multiple animations? I made one Idle loop and a Run loop, but I can only export one at a time. (Strangely called 'my_animation' in OgreMeshy).
2) How can I combine my objects? I have my character mesh, two eyes and (trouser) buttons as objects. They are moving nicely together in Pose Mode, but are exported separately. Only my mesh and the buttons have a .skeleton. Here's my hierarchy: http://imgur.com/snmCGr0 ('Renko' is my bigger mesh)
Here's my model (Renko.mesh) in OgreMeshy: http://imgur.com/uD9fD1J
--EDIT --
I added an armature modifier to the eyes, now they have .skeletons, too. But OgreMeshy crashes when I try to load them.

3) My exported material has a scroll_anim parameter, why? :D No biggie deleting it, though.

Using Blender 2.63 and the latest exporter. Thank you so much for it. Never needed skeletal animation until now, but it works really good! :)
0 x

xXx
Halfling
Posts: 40
Joined: Tue Apr 02, 2013 9:43 am

Re: Blender26 Ogre Exporter

Post by xXx » Thu Jun 20, 2013 8:42 am

I had a lot of troubles as well when i tried to export my model, maybe i can help you: i learned how to export all animations in the same skeleton, is this what you are asking?

But i can't be helpful very much if you have multiple meshes in blender (one for the eyes, one for the head, one for the body...)
0 x

Aspirer
Halfling
Posts: 61
Joined: Thu Nov 22, 2012 4:57 pm

Re: Blender26 Ogre Exporter

Post by Aspirer » Thu Jun 20, 2013 1:19 pm

Is this project still being worked on? The OP said the last API update was in 2010, that was almost three years ago.

I was curious to know why Blender is so useless. Blender has always been a pain to learn or even use but the newest version 2.67 is quite good. I was able to model a simple object after I watched a few tutorials on youtube. I just really wish there were a current exporter for blender to ogre. The Blender version 2.49b really, really SUCKS imo.

Could someone tell me how exporters are made? Is it time consuming to make one? I thought they were made with a scripting language. Blender uses Python but I don't know if that's the language to use to create an exporter. Must I have some special knowledge to create one? If I were to make one whats a good free place I could host the file for you guys?
0 x

xXx
Halfling
Posts: 40
Joined: Tue Apr 02, 2013 9:43 am

Re: Blender26 Ogre Exporter

Post by xXx » Thu Jun 20, 2013 4:25 pm

There is the exporter by Mind Calamity, but i don't know when was it updated last... Anyway, i use the exporter with blender 2.66, so i don't think it really matters
0 x

Honas
Gnoblar
Posts: 23
Joined: Thu May 31, 2012 2:09 pm

Re: Blender26 Ogre Exporter

Post by Honas » Thu Jun 20, 2013 4:33 pm

@Aspirer
Seems like 'Mind Calamity' is maintaining the script. The exporter is a simple .py file. Just open it. The latest exporter can handle ver2.66 of Blender.

@xXx

How did you do that? And yes, I have multiple meshes. I could actually live with handling multiple objects than not having animation at all.
Here's my .blend: https://www.dropbox.com/s/rm2n8kn1pv9mt ... 0Honas.rar
0 x

Aspirer
Halfling
Posts: 61
Joined: Thu Nov 22, 2012 4:57 pm

Re: Blender26 Ogre Exporter

Post by Aspirer » Thu Jun 20, 2013 4:56 pm

Oh crap, I meant to post that to a different thread about blender exporters. Oh well, this exporter is up to date which suits my needs.

For future reference if I wanted to make an exporter for some given software how would I go about doing that? I thought it had something to do with the API and python in blenders case. I would still like my question about the amount of time used in making one anwered though. Thanks guys.
0 x

xXx
Halfling
Posts: 40
Joined: Tue Apr 02, 2013 9:43 am

Re: Blender26 Ogre Exporter

Post by xXx » Thu Jun 20, 2013 5:18 pm

Honas: Ok, i will try what i can and let you know. I guess that your problem concerns the multiple meshes: why don't you unify them in a single mesh? You can still make different animation tracks that affects only some parts of the mesh (e.g. roll eyes, legs walk, legs run, arms walk, arms run...) and then combine them in Ogre (i think its called Blending animation states).
0 x

Honas
Gnoblar
Posts: 23
Joined: Thu May 31, 2012 2:09 pm

Re: Blender26 Ogre Exporter

Post by Honas » Thu Jun 20, 2013 5:51 pm

@xXx
Merging objects and 'weight painting' the eyes to the head bone works! (Still a hack for exporting, though!) The eyes follow the head bone, and are actually present! :D But I want them connected to the Eye.L/Eye.R bones, which I strangely cannot choose as a vertex group when weight painting. I want this mesh to look around, not staring into my soul.

@Aspirer
You will use Python and if you start from scratch it will take a lot of time. Just take a look at the source code of 'io_export_ogreDotScene.py', the exporter itself.
Check out the quickstart guide for the Blender API:
http://www.blender.org/documentation/bl ... start.html
0 x

xXx
Halfling
Posts: 40
Joined: Tue Apr 02, 2013 9:43 am

Re: Blender26 Ogre Exporter

Post by xXx » Thu Jun 20, 2013 6:16 pm

I think you just have to add to the bones Eye.L and Eye.R a rotation :)

Edit: i misinterpreted what you wrote. In this case, have you tried moving the eyes (select them, press "g", then the axis you want to move them on and finally the distance: this is useful for later moving them back perfectly) and the weight paint them again?
0 x

Honas
Gnoblar
Posts: 23
Joined: Thu May 31, 2012 2:09 pm

Re: Blender26 Ogre Exporter

Post by Honas » Sun Jun 23, 2013 7:19 pm

Just weight painted the eyes to those bones, did work nicely now. Didn't manage to select the right bone beforehand, but now I'm not confused anymore. If you don't connect your old objects explicitly, you can still easily select them, even when they clip other parts of the mesh, by using CTRL and +.
But I still have no idea how I export multiple animations like idle, jump, run, walk, etc.
0 x

xXx
Halfling
Posts: 40
Joined: Tue Apr 02, 2013 9:43 am

Re: Blender26 Ogre Exporter

Post by xXx » Mon Jun 24, 2013 9:35 am

When you export, all the animations are saved into the .skeleton file: you then load them in ogre separately with getAnimationState(String Name).

Of course, in blender you must set the name of each NLA track and then call that name in getAnimationState.
0 x

Honas
Gnoblar
Posts: 23
Joined: Thu May 31, 2012 2:09 pm

Re: Blender26 Ogre Exporter

Post by Honas » Mon Jun 24, 2013 3:23 pm

Thanks xXx, now it is working! I needed to link my animations in the ActionEditor, select them and then click the snowflake in the NLA editor to create separate tracks. Tried doing it in other ways, but I only got blended animations, which I do not want. :D
0 x

xXx
Halfling
Posts: 40
Joined: Tue Apr 02, 2013 9:43 am

Re: Blender26 Ogre Exporter

Post by xXx » Tue Jun 25, 2013 5:40 pm

I'm glad i helped you! it was a pain for me to learn this simple thing all alone...
0 x

ali1234
Gnoblar
Posts: 17
Joined: Sun Nov 22, 2009 2:34 am

Re: Blender26 Ogre Exporter

Post by ali1234 » Sun Jun 30, 2013 4:02 pm

How should I use this with blender --background --python?

I'm trying to make a script that will export the mesh associated with a single object.

EDIT: I figured it out.

EDIT 2: Updated so it ignores any saved user config and overrides defaults as needed.

I run blender like this:

Code: Select all

blender <my.blend> --factory-settings --background --python /absolute/path/to/blender-export-mesh.py -- <object> <mesh_name> <material_name> <outdir>
io_export_ogreDotScene.py is in the same directory as blender-export-mesh.py:

Code: Select all

import sys, os
import bpy

try:
    myargs = sys.argv[sys.argv.index('--')+1:]
except:
    print("Bad arguments.")
    exit(-1)

# In case blender2ogre is not in the user's blender installation, also try to 
# load it from the same directory as this helper script.
try:
    helper_path = os.path.dirname(os.path.abspath(sys.argv[sys.argv.index('--python')+1]))
    if helper_path not in sys.path:
        sys.path.append(helper_path)
except:
    print("Can't find helper path.")
    exit(-1)

import io_export_ogreDotScene

# reset all config to default, overriding anything saved by the user
for tag in io_export_ogreDotScene._CONFIG_DEFAULTS_ALL:
    io_export_ogreDotScene.CONFIG[ tag ] = io_export_ogreDotScene._CONFIG_DEFAULTS_ALL[ tag ]

# enable edge lists for stencil shadows
io_export_ogreDotScene.CONFIG['generateEdgeLists'] = True;

def export_mesh(o, mesh_name, material_name, outdir):
    o.data.materials[0].name = material_name
    o.data.update(calc_tessface=True)
    io_export_ogreDotScene.dot_mesh(o, path=outdir, force_name=mesh_name)


export_mesh(bpy.data.objects[myargs[0]], myargs[1], myargs[2], myargs[3])
0 x

TimeFliesLikeABanana
Gnoblar
Posts: 13
Joined: Tue Jul 02, 2013 6:21 am

Re: Blender26 Ogre Exporter

Post by TimeFliesLikeABanana » Thu Jul 04, 2013 5:32 pm

This may have been asked a thousand times, but a quick search didn't turn it up:

I'm trying to export a simple animation from blender, I've got 1 bone in an object and I'm applying rotations to it. In blender when I apply a rotation around x, it looks the same in either blender or in Ogre, but y and z get flipped. Now before you point out the 'xyz' 'x-yz' flip, I've done that. It corrects the orientation of the MODEL in ogre, but the bones don't get the message. So when I ask for a rotation about Z in blender, it should be reinterpreted as a rotation about Y in Ogre, and that doesn't happen. So my model that should be rotating towards the sky instead spins on it's axis. I note that there is a rotation setting bar directly below the rotation panel, but it doesn't seem to do anything at all here. Help?

Edit: I'm still not sure why this happened, or why it fixes it, but the first thing I did before was rotate the bone into the XY plane. If I don't do that, everything works out correctly. I have no idea why. I was applying rotations to all the objects(Ctrl-A), so I think this should have been fine. Would still be very curious to hear what went wrong here.
0 x

germ2
Gnoblar
Posts: 3
Joined: Fri Jul 12, 2013 5:39 am

Blender Ogre Exporter Problems

Post by germ2 » Fri Jul 19, 2013 3:24 am

(Crossposted from the Ogre Help forum.)

Hi everyone.

I'm trying to export a model with animations from Blender for use in Ogre. I'm using the current version of Blender and MindCalamity's Blender2Ogre exporter. After I export my models and skeleton files, naturally, I try to view them in OgreMeshy. OgreMeshy feels otherwise about the situation, and freezes, then dies.

If I remove the skeleton file, the model will load and view fine in OgreMeshy. When I look at the contents of my skeleton XML file, it all looks syntactically reasonable to my untrained eye, except every frame of the animation looks the same:

Code: Select all

<keyframe time="0.75" >
     <translate z="0.000000" y="0.000000" x="0.000000" />
     <rotate angle="0.000000" >
          <axis z="0.000000" y="0.000000" x="1.000000" />
     </rotate>
     <scale z="1.000000" y="1.000000" x="1.000000" />
</keyframe>
I've done a lot of searching and watching of Blender tutorials (did I also mention I know next to nothing about Blender?), and I believe I'm building the animations correctly: NLA tracks, armatures, etc.I just can't see what I'm doing wrong... I'm starting to believe it might be a problem with the exporter, but I'm not confident enough in my Blender skills to say that.

These are the steps that I'm following to create an animation that causes this problem. If you want to see just the end result, I've attached the Blender file. I'd appreciate it if anyone can let me know what I'm doing wrong, or perhaps if anyone can say if this is a bug in the exporter?

Creating the model and bone:
  • Open Blender. This creates the standard cube file.
  • Select and delete the camera (with <X>), then the light.
  • Press <Z> to view in wireframe mode.
  • Press <Shift-A>, and select Armature -> Single Bone to add a bone.
  • Move the bone inside the cube. I didn't worry about positioning at the centre.
  • Press <Ctrl-A> and apply the location. Repeat for rotation and scale.
  • Select the cube, and repeat (6) to apply the location, rotation and scale. (This step is probably not necessary, but worthwhile.)
  • Select the cube, hold <Shift>, and then select the bone. Press <Ctrl-P> to bring up the parenting menu, and select "Armature Deform" to bind the model to the bone.
Creating the animation:
  • Open a second editor, and bring up the Dopesheet editor, and select the Action Editor context. Click "New" to add a new action. Frame 1 will be the current, default, frame.
  • In the 3D View, ensure that only the bone is selected. Press <I> to bring up the Insert Keyframe menu. Insert a LocRotScale keyframe.
  • In the Dopesheet Editor, move to frame 30.
  • In the 3D View, move, rotate and scale the bone somewhere else. Doesn't matter where or how exactly.
  • Press <I> to bring up the Insert Keyframe menu. Insert a LocRotScale keyframe here at frame 30.
  • Change the Dopesheet editor to the NLA editor view.
  • Next to the Armature Action, click the "snowflake" to make this action a NLA track.
Export!
Attachments
test.blend.zip
(76.16 KiB) Downloaded 87 times
0 x

Post Reply