Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
Nuro305
Gnoblar
Posts: 4
Joined: Mon Apr 06, 2009 7:01 pm

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by Nuro305 »

Thanks for the reply,

Ok here's what I got. I created .blender/scripts in my ~/home/ directory and it's definitely seeing it because after refreshing my Script menus all other export options are gone, except Export the Ogre, no biggie I'll move the Dir and get them back later...

Moving on; I selected a simple shape and ran the Ogre Exporter and got a "Python Script Error - Check Console" error. I re-ran Blender form the console and got this error output:

myHd:MacOS myname$ ./blender
guessing './blender' == '/Users/myname/blender/blender.app/Contents/MacOS/./blender'
Compiled with Python version 2.3.5.
Checking for installed Python... got it!
Traceback (most recent call last):
File "<string>", line 1, in ?
ImportError: No module named BPyRegistry
Traceback (most recent call last):
File "<string>", line 1, in ?
File "/Users/myname/.blender/scripts/ogremeshesexporter.app/Contents/Resources/ogremeshesexporter.py", line 232, in ?
from ogrepkg import *
File "/Users/myname/.blender/scripts/ogrepkg/materialexport.py", line 719, in ?
class CustomMaterial(RenderingMaterial):
File "/Users/myname/.blender/scripts/ogrepkg/materialexport.py", line 742, in CustomMaterial
class Template(string.Template):
AttributeError: 'module' object has no attribute 'Template'


I'm running Python 2.51

Additional thoughts are appreciated ;-)
Nuro305
Gnoblar
Posts: 4
Joined: Mon Apr 06, 2009 7:01 pm

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by Nuro305 »

UPDATE:

After more coffee I found the .blender folder in /blender.app/Contents/MacOS and I added the Ogre Exporter files into it.

I now have all my proper script menus and the OGRE Meshes exporter, but when I run it on an object I get:

spaz:MacOS myDir$ ./blender
guessing './blender' == '/Users/myDir/blender/blender.app/Contents/MacOS/./blender'
Compiled with Python version 2.3.5.
Checking for installed Python... got it!
Traceback (most recent call last):
File "<string>", line 1, in ?
File "/Users/myDir/blender/blender.app/Contents/MacOS/./.blender/scripts/ogremeshesexporter.app/Contents/Resources/ogremeshesexporter.py", line 232, in ?
from ogrepkg import *
File "/Users/myDir/.blender/scripts/ogrepkg/materialexport.py", line 719, in ?
File "/Users/myDir/.blender/scripts/ogrepkg/materialexport.py", line 742, in CustomMaterial
AttributeError: 'module' object has no attribute 'Template'

Looks like a PATH error..... toughts?

Thanks.
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by lf3thn4d »

Hi Nuro305,
Sorry for the late reply. What version of blender are you using? Did you compile your own blender? From the looks of it, your blender is compiled with a very old version of Python. The exporter uses a later version of Python(2.5.2) for the custom material Template feature. Either way, due to change of API in blender, this exporter only works with the current latest version of blender (2.48a).

My guess is that you are using the latest blender but the one compiled with python 2.3. Try installing the custom 2.5 version from blender website.
Nuro305
Gnoblar
Posts: 4
Joined: Mon Apr 06, 2009 7:01 pm

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by Nuro305 »

Sweet ;-)

That was it, I'm now using the "Custom Python 2.5 installations: Blender 2.48a, OS X Intel, Python 2.5" install and it works like a champ. Now I'll start tweeking the export setting for our 3-D world. We write Modeling and Simulation software. This will help me justify spending more time on 3-D modeling instead of writing code! Thanks ;-)
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by lf3thn4d »

Cool. :) Glad it worked out for you. :D
pmatrasc
Gnoblar
Posts: 2
Joined: Fri Apr 10, 2009 7:16 pm

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by pmatrasc »

Hi lf3thn4d,

just to thank you for your great work on the exporter and, also, to inform you that I'm using the Material Template feature with great proficency. A very useful feature indeed :)
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by lf3thn4d »

Thanks :) That's good to hear. :D If only I can find time to work out a wiki example/tutorial or something, then more people will be able to learn to use it. :P
User avatar
aguru
Goblin
Posts: 236
Joined: Tue Feb 26, 2008 5:48 pm
x 3

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by aguru »

Hey lf3thn4d :)

Today my linux box updated to python 2.6 and since then I have troubles with the blender export script. I think its something about pickle incompatibility between python versions. Uncommenting line 238 seems to work, but without "PackageSettings.getSingleton().load()", my blend file's no longer get loaded inside ogreexporter (I can load them myself, though). Have you any experience with 2.6 already?

This is the traceback:
Compiled with Python version 2.6.1.
Checking for installed Python... got it!
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/share/blender/scripts/ogremeshesexporter.py", line 238, in <module>
PackageSettings.getSingleton().load()
File "/usr/share/blender/scripts/ogrepkg/base.py", line 251, in load
self.dict = pickle.loads(string.join(settingsText.asLines()[4:],'\n'))
File "/usr/lib64/python2.6/pickle.py", line 1374, in loads
return Unpickler(file).load()
File "/usr/lib64/python2.6/pickle.py", line 858, in load
dispatch[key](self)
File "/usr/lib64/python2.6/pickle.py", line 971, in load_string
self.append(rep.decode("string-escape"))
File "/usr/lib64/python2.6/encodings/__init__.py", line 100, in search_function
level=0)
TypeError: blimport() takes no keyword arguments
User avatar
nikki
Old One
Posts: 2730
Joined: Sat Sep 17, 2005 10:08 am
Location: San Francisco
x 13
Contact:

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by nikki »

aguru wrote:Hey lf3thn4d :)

Today my linux box updated to python 2.6 and since then I have troubles with the blender export script. I think its something about pickle incompatibility between python versions. Uncommenting line 238 seems to work, but without "PackageSettings.getSingleton().load()", my blend file's no longer get loaded inside ogreexporter (I can load them myself, though). Have you any experience with 2.6 already?
This happened to me too. The problem lies in Blender itself, AFAIK. The prebuilt Blender versions are built with Python 2.5. You'll have to rebuild Blender with 2.6. I did this by getting Blender from SVN, and it worked. There was no change required with the Ogre exporter code.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by jacmoe »

nikki wrote:This happened to me too. The problem lies in Blender itself, AFAIK. The prebuilt Blender versions are built with Python 2.5. You'll have to rebuild Blender with 2.6. I did this by getting Blender from SVN, and it worked. There was no change required with the Ogre exporter code.
That's not the problem here:
Compiled with Python version 2.6.1.
Checking for installed Python... got it!
:wink:
Maybe the release notes for Python will tell us the breaking changes?
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by lf3thn4d »

Hmm yeah.. sounds like Python broke compatibility AGAIN. Sigh... I'll look into it soon.
pmatrasc
Gnoblar
Posts: 2
Joined: Fri Apr 10, 2009 7:16 pm

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by pmatrasc »

lf3thn4d wrote:Thanks :) That's good to hear. :D If only I can find time to work out a wiki example/tutorial or something, then more people will be able to learn to use it. :P
Once we finish to experiment (we're trying to use the exported models with jMonkeyEngine) maybe we could help in some ways :)
shega
Gnoblar
Posts: 22
Joined: Fri Dec 29, 2006 9:55 am

billboard or halo

Post by shega »

hi!
just a question here...could halo or billboard (texture face) be exported from blender?
Image
the building itself only cost 2369 poly's, but the trees cost 827 poly's.
i want to make the trees only 1 poly each and facing the camera to reduce the polycount.
can i achieve it with the current exporter?

i'm just an artist, so i don't have the "power" to call billboard or billboard set.

thx before
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by lf3thn4d »

Hi, unfortunately, it's not possible. Camera facing billboard is not a material thing. You will need billboardset for it.
LaboPie
Gnoblar
Posts: 12
Joined: Tue Mar 03, 2009 7:51 pm
x 1

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by LaboPie »

Hi! i have a problem:
i wanna export my 3d creation, make with blender, to ogre. I have downloaded the exporter, e i have followed the instruction of the tutorial, so i have a .mesh.xml file. Now i have downloaded the OgreXMLConverter, with all the suite of command line programs, but, i can't start it. When i go to the command prompt, what is the directory where i have to stay for make the program started?
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by jacmoe »

If it's only one or two files: drop them on the exe. :wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
LaboPie
Gnoblar
Posts: 12
Joined: Tue Mar 03, 2009 7:51 pm
x 1

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by LaboPie »

ok, but, where is the exe file?
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by jacmoe »

Please keep track of what you install. :)
C:\OgreCommandLineTools, maybe?
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
LaboPie
Gnoblar
Posts: 12
Joined: Tue Mar 03, 2009 7:51 pm
x 1

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by LaboPie »

It's my fault, i don't have take a look of the path of installation; then, after a hour of try, i have erase the pack and reinstalled it. Now he work fine.
Thank you for help :D
blaine
Gnoblar
Posts: 14
Joined: Fri Apr 24, 2009 11:05 pm

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by blaine »

lf3thn4d wrote:Hmm yeah.. sounds like Python broke compatibility AGAIN. Sigh... I'll look into it soon.
I have a workaround. Edit .../python*/encodings/__init__.py (mine is at /usr/lib64/python2/encodings/__init__.py). Make the following change:

Code: Select all

            #mod = __import__('encodings.' + modname, fromlist=_import_tail,
                             #level=0)
            mod = __import__('encodings.' + modname, None, None,
                        _import_tail, 0)
blaine
Gnoblar
Posts: 14
Joined: Fri Apr 24, 2009 11:05 pm

Request for basic Material use cases

Post by blaine »

There are some good reasons why a mesh would have no material assigned, like that I want it to show up with the Object's color (i.e. BlenderObject.color) in my external app; or that I want it to inherit color from an ancestor node. Probably most commonly, if I am modeling and concentrating on geometry or animation and I just don't want to bother with materials yet. In any of these cases where there is a mesh without a material assigned, the result is the same. The exporter writes an invalid BasicWhite material record, and sometimes (seems if > 1 mesh) writes nasty "Error: Face without material assignment in mesh "X"!" messages. I say that the material record is invalid because it does not contain the color values of white... or any values whatsoever. This, understandably, chokes my app when I try to load the scene, and I have to hand edit.

Secondly, Blender gives one the ability to attach materials to either Blender Meshes or Blender Objects. The Mesh exporter saves materials assigned to meshes but the dotScene and Mesh exporters completely ignore these Object-assigned materials. This is unfortunate since materials attached to objects allows one to leverage inheritance... the major benefit of a scene graph. I do see that the DTD does not allow for a material attribute or element at the node element level, but I think supporting a very basic Blender feature would justify using some unused tag or element for the purpose... or provide an export toggle to write an extended attribute. With my own exporter, I can assign a parent Object yellow and have child nodes inherit or override that material.

Please contact me if you'd like help adding these features. I am a Python expert and have my own exporter (for a different output format, http://jmonkeyengine.googlecode.com/svn ... orter.html).
Last edited by blaine on Sat Apr 25, 2009 12:10 pm, edited 2 times in total.
wetneb
Gnoblar
Posts: 8
Joined: Wed Aug 27, 2008 8:18 am

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by wetneb »

Hi lf3thn4d,

I'm trying to export an animated object, without using any armature : my animation has been generated using SoftBody, and backed. But when I run the exporter, the mesh isn't handled like an animated object. I tried adding a "fake" armature to force the script export the animation, but it doesn't work.
I think the problem isn't due to the Softbody feature since everything is backed and the animation is managed like any other one (eg. with a Wave or Build modifier).
Is there a way to export this animation ?

Thanks,

Wetneb
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by lf3thn4d »

@blaine:
From what I understand, for any mesh to be rendered in Ogre, a material must be assigned to it. There is actually a mode where the exporter obeys and exports a material that follows vertex colours. However since I don't really use them, I'm not quite certain how to do it. If you like to help improve on the material generation system, by all means, I would love to see some of your suggestions. Material export is quite a headache.

As for the dotscene format, that isn't covered in this exporter. I think it's better if you point it out to the maintainer of the dotscene exporter. I do agree that they should have material as part of their mesh properties. However it's not quite simple since it has to be dealt with at the submesh level. Still, that doesn't mean it can't be done. Just need to standardise on the format. :)

I'll be great to have some helping hand on python scripting. I'm no python expert and am only taking over maintaining this exporter because there is a need for it. :)

@wetneb:
From what I understand, it should be possible as long as you baked it as a shape key and animate with the IPO of the mesh. The exporter should show the proper tab for them. What you want is the pose tab. It should appear if there's an IPO animation set to the mesh. I remember there's a pdf teaching how to do it but I can't seem to find it anymore. :(
blaine
Gnoblar
Posts: 14
Joined: Fri Apr 24, 2009 11:05 pm

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by blaine »

lf3thn4d wrote:@blaine:
From what I understand, for any mesh to be rendered in Ogre, a material must be assigned to it. There is actually a mode where the exporter obeys and exports a material that follows vertex colours. However since I don't really use them, I'm not quite certain how to do it.
I do know how to use that feature. My goal, though, is to support a Blender model in its default state, without a material. Seems there is a conflict between Ogre's use case (no need to handle non-material Meshes) and mine. :( I'll have to think about how to get what I want without needing to maintain an independent source branch.
...
As for the dotscene format, that isn't covered in this exporter. I think it's better if you point it out to the maintainer of the dotscene exporter. I do agree that they should have material as part of their mesh properties. However it's not quite simple since it has to be dealt with at the submesh level. Still, that doesn't mean it can't be done. Just need to standardise on the format. :)
Excellent points. I'll take it up over there.
I'll be great to have some helping hand on python scripting. I'm no python expert and am only taking over maintaining this exporter because there is a need for it. :)
You can PM me with Python questions as they arise.
If you want me to actually fix stuff or code, please send one of the Sourceforge project admin's a request to add me as a developer, and I'll sync up a r/w work area. My sourceforge uid is "unsaved".
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by lf3thn4d »

blaine wrote:
lf3thn4d wrote:@blaine:
From what I understand, for any mesh to be rendered in Ogre, a material must be assigned to it. There is actually a mode where the exporter obeys and exports a material that follows vertex colours. However since I don't really use them, I'm not quite certain how to do it.
I do know how to use that feature. My goal, though, is to support a Blender model in its default state, without a material. Seems there is a conflict between Ogre's use case (no need to handle non-material Meshes) and mine. :( I'll have to think about how to get what I want without needing to maintain an independent source branch.
Hmm.. I take it that you're manually assigning materials within your engine when there's no materials assigned. Maybe a toggle flag can be added to disable the BaseWhite material auto assignment.
blaine wrote: You can PM me with Python questions as they arise.
If you want me to actually fix stuff or code, please send one of the Sourceforge project admin's a request to add me as a developer, and I'll sync up a r/w work area. My sourceforge uid is "unsaved".
I believe the exporter is in a pretty acceptable stage for most people for now. Only a few very minor bug issues like that weird pickler ones remains. However, as I mentioned before, when Blender release their new revamped UI/Python interface system, there will be a need to do a complete port/rewrite. I believe when that time comes, your help would be a great asset here. :) For now, I can still cope with simple bug fixing and what nots. :)

I feel until the next major blender release comes, It's not very wise to add anymore fancy cool feature to the exporter for now. Would be a waste of effort. But if you do spot any certain bad coding or bugs in the exporter, it'll be a great help if you do submit patches :) It'll be much better and organised that way than having everybody getting access to the SVN repository. :)
Post Reply