Blender export script
-
Guest
Blender export script
For those who prefer eye candy and ease of use, I uploaded a blender script version ogreexport-0.8.py which has a graphical user interface. Please report any problems.
Regards,
Michael
[ 815849 ] Blender export script updated
https://sourceforge.net/tracker/index.p ... tid=302997
Known issue: In the current blender release (2.31a) the Draw.Scrollbar button from blenders python interface is broken. You therefore may have to resize the export window to fit the dictionary for animation renaming.
Regards,
Michael
[ 815849 ] Blender export script updated
https://sourceforge.net/tracker/index.p ... tid=302997
Known issue: In the current blender release (2.31a) the Draw.Scrollbar button from blenders python interface is broken. You therefore may have to resize the export window to fit the dictionary for animation renaming.
-
sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
-
iovsal
- Kobold
- Posts: 33
- Joined: Sun Mar 30, 2003 3:20 pm
- Location: Finland
That's a great job, from the beginning. Honestly the GUI is nice and ok, but it was hard to make it simpler than it was! 
There's something probably wrong, or I'm missing something, don't know: some faces aren't translated in the exporting process. In the log i get some "ignored face with 2 edges" messages, but there are few of them, while the faces not being created at all are quite more. This is something I noticed in the previous version too. If you find it necessary I'll provide you some screenshots.
_jones
There's something probably wrong, or I'm missing something, don't know: some faces aren't translated in the exporting process. In the log i get some "ignored face with 2 edges" messages, but there are few of them, while the faces not being created at all are quite more. This is something I noticed in the previous version too. If you find it necessary I'll provide you some screenshots.
_jones
-
reimpell
missing faces
AFAIK the ogre format only allows for faces with 3 or 4 vertices, so does the exporter.iovsal wrote:some faces aren't translated in the exporting process. In the log i get some "ignored face with 2 edges" messages, but there are few of them, while the faces not being created at all are quite more.
Workaround:
Faces with only 2 edges aren't really faces, so try to remove them with the "Remove Doubles" option with an appropriate limit setting.
Triangulize your mesh if you also got a warning about faces with more than 4 edges: In "edit mode" select all vertices and choose
Edit->Faces->Convert to Triangles (Ctrl+T).
You may need to assign a dummy material to all faces even if it has a texture assigned to it, but I'm not sure about that.
Only textures assigned in the "UV-Face Select" mode are exported.
Hope that helps,
Michael
-
reimpell
Blender export script
Blender 2.32 menu integration is supported by ogreexport-0.9.py.
Regards,
Michael
[ 815849 ] Blender export script updated
https://sourceforge.net/tracker/index.p ... tid=302997
Regards,
Michael
[ 815849 ] Blender export script updated
https://sourceforge.net/tracker/index.p ... tid=302997
-
iovsal
- Kobold
- Posts: 33
- Joined: Sun Mar 30, 2003 3:20 pm
- Location: Finland
Great job, i will check better for that problem.
I'd suggest you two changes:
1) According to recent OGRE modification, i'd line 414 from:
to:
2) Since all the .material files are supposed to be in the same directory (usualle the Media/ dir of one's project) i'd remove the full path of the material leaving only the material name, which OGRE can find thank to resources.cfg. My personal solution has been to change line 1214 from:
to:
Obviously this assumes that all your textures are in the same dir when you loaded them into your blender file. And you could of course replace the string "/path/to/your/textures/" with a variable to which an user could assign the proper value via a GUI element.
I find this much better than having to edit the .material file at the end.
Greetings, _jones
I'd suggest you two changes:
1) According to recent OGRE modification, i'd line 414 from:
Code: Select all
self.v = vCode: Select all
self.v = -vCode: Select all
f.write(tab(2)+"texture %s\n" % material.texture)Code: Select all
f.write(tab(2)+"texture %s\n" % string.replace(material.texture, "/path/to/your/textures/", ""))I find this much better than having to edit the .material file at the end.
Greetings, _jones
-
reimpell
missing faces
Well, of course "Remove Doubles" does only work if the 2 edges of the "face" are nearby. Otherwise you must remove them by hand. To find unusual normals and needless edges/faces it often helps to use the SubSurf Mesh option: You get strange artefacts if something is wrong.
Regards,
Michael
Another possible reason why there are vanishing faces is, that the normals of these faces point in the wrong direction. Maybe a simple Mesh->Normals->Recalculate outside (Ctrl+N) does help. Does it also correct the UV mapping?iovsal wrote: 1) According to recent OGRE modification, i'd line 414 from:to:Code: Select all
self.v = vCode: Select all
self.v = -v
I totally agree with that one.iovsal wrote: 2) Since all the .material files are supposed to be in the same directory (usualle the Media/ dir of one's project) i'd remove the full path of the material leaving only the material name, which OGRE can find thank to resources.cfg.
Regards,
Michael
-
reimpell
UV mapping
I just saw the "Change in 'v' texture coordinate origin in 0.13" announcement. Well, what aboutiovsal wrote: 1) According to recent OGRE modification, i'd line 414 from:to:Code: Select all
self.v = vCode: Select all
self.v = -v
Code: Select all
self.v = (1 - v)Regards,
Michael
-
iovsal
- Kobold
- Posts: 33
- Joined: Sun Mar 30, 2003 3:20 pm
- Location: Finland
Sorry, you just posted a minute before me 
Anyways, i think that
could work as well.
works for me, so it's supposed to be ok.
_jones
Anyways, i think that
Code: Select all
self.v = (1-v)Code: Select all
self.v = -v_jones
-
reimpell
UV mapping
Well, looking at line 920pp:iovsal wrote:works for me, so it's supposed to be ok.Code: Select all
self.v = -v
Code: Select all
if submesh.material.texture:
uv = [face.uv[i][0], face.uv[i][1]]
if not vertex.uvmaps:
vertex.uvmaps.append(UVMap(*uv))
elif (vertex.uvmaps[0].u != uv[0]) or (vertex.uvmaps[0].v != uv[1]):
# the vertex in blender has different uv maps for each face
# we need to clone the vertex for each uv coordinate
Code: Select all
uv = [face.uv[i][0], face.uv[i][1]]
Code: Select all
uv = [face.uv[i][0],(1 - face.uv[i][1])]
Regards,
Michael
-
reimpell
UV mapping
It was supposed to replace the first change, since changing the UVMap constructor may lead to unwanted vertex clones. Also v -> 1 - v and v -> -v has the same effect as long as the texture is treated with periodic boundary conditions. Since I am not willing to read specifications of Ogre, OpenGL and DirectX to ensure this behaviour, I just take sinbad's words for granted.iovsal wrote:it voids the effects of the first change.
By the way, last night I wrote a replacement class for blenders broken scrollbar. It will be in the next version. Having a scrollbar I will also display the export log in the message window that appears at the end of the export process. The texture path dictionary you proposed probably won't make it into the next version since I am not quite sure about implementation details: At the moment, it is no problem to change your selection while the gui is shown. Of course, the used textures highly depend on your selection, but checking for selction changes in every update cycle may lead to poor performance.
Regards,
Michael
-
sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
-
reimpell
ogreexport-0.10.py
ogreexport-0.10.py is now available!
The blender python interface is a somewhat moving target but I try to catch up. This release has all features I thought of in the first place.
Some additional notes:
ogrenew/Docs/Readme/Readme_Features.html should change:
<Blender3D (meshes)
>Blender (meshes and animation)
Should I write a 4.1 Exporters subsection for the manual? I though of a short explanation of the interface, maybe with one or two nice screenshots.
Regards,
Michael
[ 815849 ] Blender export script updated
https://sourceforge.net/tracker/index.p ... tid=302997
The blender python interface is a somewhat moving target but I try to catch up. This release has all features I thought of in the first place.
Some additional notes:
ogrenew/Docs/Readme/Readme_Features.html should change:
<Blender3D (meshes)
>Blender (meshes and animation)
Should I write a 4.1 Exporters subsection for the manual? I though of a short explanation of the interface, maybe with one or two nice screenshots.
Regards,
Michael
[ 815849 ] Blender export script updated
https://sourceforge.net/tracker/index.p ... tid=302997
-
reimpell
ogreexport-0.11.py
ogreexport-0.11.py is now available!
It supports the new material script schema. I noticed that the "Prebuilt exporters" version 0.13.0a still have the old blender export script. Due to some changes in the blender python interface, the old script version 0.7 will not work with blender version 2.32. Therefore it would be nice if someone could just check in the new version and commit the following changes to the manual.
ogrenew/Docs/Readme/Readme_Features.html:
<Blender3D (meshes)
>Blender (meshes and animation)
Thanks,
Michael
It supports the new material script schema. I noticed that the "Prebuilt exporters" version 0.13.0a still have the old blender export script. Due to some changes in the blender python interface, the old script version 0.7 will not work with blender version 2.32. Therefore it would be nice if someone could just check in the new version and commit the following changes to the manual.
ogrenew/Docs/Readme/Readme_Features.html:
<Blender3D (meshes)
>Blender (meshes and animation)
Thanks,
Michael
-
sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
-
reimpell
Plans for ogreexport-0.12.py
Thank you!sinbad wrote:I've committed this (and the doc update).
In ogreexport-0.12 the way multiple animations are treated will be enhanced. It will be possible to export keyframe ranges to different animations in the same way blender's action actuators work. Therefore you can easily export baked actions (actions with constraints). Of course the old way of exporting multiple animations will still work, too.
After that, I will write the exporter documentation with a blender modelling and animation guide.
Regards,
Michael
-
sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
-
cTh
- Halfling
- Posts: 81
- Joined: Wed Dec 11, 2002 10:47 am
- Location: Moscow/Russia
Just what I thought of when reading this upsinbad wrote:Sounds great mate, maybe I should have another crack at learning how to use Blender
Blender is sure a good tool, but the only think keeping me away from it is it's, to me, strange and non intuitive user interface, and I must admit that I would like to use it.
-
reimpell
ogreexport-0.12.py
ogreexport-0.12.py is now available!
Don't be confused by its version number: It is intended for the latest ogre version. As indicated in my previous post, you can now export animations based on frame ranges. Also new: You can toggle the material color (ambient, diffuse, specular and emissive) with the material TexFace mode button on and off. This way you can combine uv textures with the material modes Shadeless, ZInvert, Env and No Mist and mix pure textures and materials within the same mesh.
Sinbad, since this update enhances the flexibility of the exporter it would be nice if you could do just another check-in.
Thanks,
Michael
[ 815849 ] Blender export script updated
https://sourceforge.net/tracker/index.p ... tid=302997
Don't be confused by its version number: It is intended for the latest ogre version. As indicated in my previous post, you can now export animations based on frame ranges. Also new: You can toggle the material color (ambient, diffuse, specular and emissive) with the material TexFace mode button on and off. This way you can combine uv textures with the material modes Shadeless, ZInvert, Env and No Mist and mix pure textures and materials within the same mesh.
Sinbad, since this update enhances the flexibility of the exporter it would be nice if you could do just another check-in.
Thanks,
Michael
[ 815849 ] Blender export script updated
https://sourceforge.net/tracker/index.p ... tid=302997
-
sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
-
MMind
- Gnoblar
- Posts: 10
- Joined: Tue Jan 20, 2004 6:05 pm
- Location: Dresden / Saxony / Germany
I don't think Blender is non intuitive, just differentcTh wrote:Blender is sure a good tool, but the only think keeping me away from it is it's, to me, strange and non intuitive user interface, and I must admit that I would like to use it.
Blender has it's own ways and quirks.
Myself I have just started the 3D-thingie ... so I'm new to any modeler and if you haven't touched any modeler before, you won't notice any difference
A few days ago, I got to take a look on 3DS and it seems much more complicated to me, simply because it uses a different approach to the user interface
Blender has a wonderful beginners tutorial where you model and texture a cake man ... I just started with that as it introduced many functions (including their keys) of Blender-every-day-use.
Last night I began modelling a bus for my game project, after some mistakes on my side, I have now an outline of the side view and can now extrude it and complete it.
Short: I think Blender is a wonderful program with lots of potential, if one can get himself to adapt to Blenders interface
-
cTh
- Halfling
- Posts: 81
- Joined: Wed Dec 11, 2002 10:47 am
- Location: Moscow/Russia
-
reimpell
BlenderExport-0.12.1.tar.gz
For those who always wanted to know what these funny buttons of the exporter are all about, you can read it in the documentation. The documentation will also give you a clue, which of Blender's material and face settings take effect in Ogre. Check out BlenderExport-0.12.1.tar.gz. In the next version you will be able to save and load your exporter settings.
Regards,
Michael
[ 815849 ] Blender export script updated
https://sourceforge.net/tracker/index.p ... tid=302997
Regards,
Michael
[ 815849 ] Blender export script updated
https://sourceforge.net/tracker/index.p ... tid=302997