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
User avatar
sparkprime
Ogre Magi
Posts: 1137
Joined: Mon May 07, 2007 3:43 am
Location: Ossining, New York
x 13
Contact:

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

Post by sparkprime »

Ah right, this happened when I upgraded ubuntu so more and more people will have this problem as they upgrade :(

I can work around it by NEVER saving a .blend file after doing an ogre export. I.e. instead of exporting i do this:
  • save
  • export
  • quit
  • reload
banal
Halfling
Posts: 59
Joined: Tue Jan 22, 2008 11:06 am

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

Post by banal »

Hi

I think this issue has been brought up already, but I thought I'll re-post it since it didn't found it's way into the Export Script (AFAIK). I'm talking about the naming of SubMeshes (or SubEntities). Whenever I export a Mesh with different materials, the resulting XML contains all these materials as submeshes. I can then access these in Ogre using:

Code: Select all

myEntity->getSubEntity(index);
where index is an unsigned integer. However, there's also a string based accessor, which is more intuitive and results in better readable code IMHO:

Code: Select all

myEntity->getSubEntity("SubEntityName");
For this to work, the xml file must contain a list of submeshnames that map a name to an index. This list doesn't seem to be generated by the Blender Exporter.
Would it be possible, to generate this list of submeshnames by simply using the material name?
Something like:

Code: Select all

<mesh>
	<submeshes>
		<submesh material="Sword" >
		...
		</submesh>
		<submesh material="Ninja" >
		...
		</submesh>
	</submeshes>
	<submeshnames>
		<submeshname name="Sword" index="0" />
		<submeshname name="Ninja" index="1" />
	</submeshnames>
</mesh>
Or am I missing something obvious that speaks against this?
Thanks for reading and keep up the good work. The exporter is awesome!
User avatar
LiMuBei
Goblin
Posts: 297
Joined: Mon Jun 09, 2008 3:56 pm
Location: Karlsruhe, Germany
x 10

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

Post by LiMuBei »

I had the same error as sparkprime when using the exporter in Ubuntu 9.04 with Blender 2.48a and Python 2.6. Everything is mighty fine though it seems when using Python 2.5.2 (in Windows). Well, one more reason to avoid Linux :roll:
User avatar
bencevoltam
Gnoblar
Posts: 14
Joined: Thu Feb 12, 2009 4:10 pm

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

Post by bencevoltam »

I've started to debug this issue with python26.

Did somebody made any debugging and can share any info?

The most ugly way would be to reimplement (means copy and hack a bit) the pickle+encodings package and add them to the exporter codebase. It must work, but probably this is not the quality what we want :D .

I think Blender kills the show instead of python. It uses his own __import__ method which fails in this case. But i will make further investigation.
User avatar
bencevoltam
Gnoblar
Posts: 14
Joined: Thu Feb 12, 2009 4:10 pm

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

Post by bencevoltam »

Update: Sorry, now it works. :D

This doesn't work for me. Did you build Blender on your own? Or what distro do you use?
blaine wrote: 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)
User avatar
LiMuBei
Goblin
Posts: 297
Joined: Mon Jun 09, 2008 3:56 pm
Location: Karlsruhe, Germany
x 10

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

Post by LiMuBei »

I was using Ubuntu 9.04 x64 with Blender installed via package managment. I'm running with windows now, but maybe I'll check this fix.
Banditkills
Gnoblar
Posts: 1
Joined: Thu Jun 25, 2009 12:24 pm

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

Post by Banditkills »

In the "Scripts Window" run "Scripts → Update Menus".
Er, not sure what this is. Blender does not have a script window. Do you mean the text window?

I have look for script update menus in the script button options, looked in at the different scripts themselves.

I got part of the OgreXML program working. I can export meshes to XML and get scene materials.

However the command line program is not working as expected. When I select the OgreXMLConverter in Blender, it tells me: OgreXMLConverter not found! Please specify the path to OgreXMLConverter in the preferences.

Yet my python script preference folder is pointing to my blender/script folder and OgreXMLConverter.py is there.
User avatar
dustbin1_uk
Halfling
Posts: 55
Joined: Sat Dec 22, 2007 6:56 pm
x 1

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

Post by dustbin1_uk »

Install:

1. Download python and install: http://www.python.org/download/ (Note: Get v2.5.4. Blender is compiled against this version. Hence only this version will work.)
Urm.... my blender uses 2.6....

That going to be an issue?

Guess to try is to find out..... but thought I'd ask.
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 »

dustbin1_uk wrote:my blender uses 2.6....

That going to be an issue?
Yes. Use the version of Python your Blender was compiled with. The exact same version. :wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
dustbin1_uk
Halfling
Posts: 55
Joined: Sat Dec 22, 2007 6:56 pm
x 1

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

Post by dustbin1_uk »

Sorry yeah, I misunderstood.

Blender was compiled with 2.6, I have 2.6 installed. I just wondered if the exporter required 2.5.

But I see that's not the point...... ok..... shutting up now..... :roll:

LOL
TopFlite
Gnoblar
Posts: 2
Joined: Tue Jul 14, 2009 5:02 pm

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

Post by TopFlite »

Ok I'm still confused, current blender is 2.6. Is the exporter still 2.5.4 & thus won't work?
User avatar
LiMuBei
Goblin
Posts: 297
Joined: Mon Jun 09, 2008 3:56 pm
Location: Karlsruhe, Germany
x 10

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

Post by LiMuBei »

I'm currently using Blender 2.49a with Python 2.6.2 in Windows Vista x64. No problems with the exporter. Only had those in Ubuntu...
User avatar
dustbin1_uk
Halfling
Posts: 55
Joined: Sat Dec 22, 2007 6:56 pm
x 1

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

Post by dustbin1_uk »

Yeah sorry Topflite, my comments confused things.

The exporter instructions are basically saying get the python version appropriate to your Blender install.

The exporter works with both 2.6 and 2.5 and I now know.
Thumpin3D
Gnoblar
Posts: 5
Joined: Wed May 06, 2009 6:58 pm

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

Post by Thumpin3D »

Hi lf3thn4d,

you have mentioned in the BlenderExporter manual the following,
"# All vertices must be assigned to at least one bone.
# In OGRE, you can have no more than four weighted bone assignments per mesh vertex.
"
How do we make sure this is done..Since i am getting warnings as

"Warning: Vertex with more than 4 bone assignments!"
"Warning: Vertex without Bone assignment!"

Thanks,

Thumpin3D
tanliyoung
Gnoblar
Posts: 5
Joined: Fri Jul 03, 2009 3:27 am

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

Post by tanliyoung »

Hi guys, I met a problem when I tried to convert a animation 3ds file into mesh. Firstly, I used 3ds2mesh tool to do this job, everything seems fine except the skeleton file could not be generated. So I turned to blender export. I import the 3ds model into blend corrrectly and tried to export it. Issues as below:

In Blender Exporter Dialog
1. Animation setting is empty
2. There are too many object in "Select", after exporting there are also a lot of meshes.

About issue2, someone told me to join all the objects in blender before exporting. However, maybe that is not what I want. Actually, I can generate only one mesh in this way, but I still want to control the sub-part of the model. I am not sure if this is the proper way.

Anyone can give me some hints? Thanks in advance~ :D
Otherearth
Gnoblar
Posts: 20
Joined: Wed Apr 22, 2009 4:40 pm

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

Post by Otherearth »

Hi lf3thn4d,
Your script is great and it worked perfectly 'til now.
I wanted to export a human character fully rigged and with two animations.
When I export I get about 200 or 300 of those vertex warnings maybe more...
error.JPG
error.JPG (180.73 KiB) Viewed 10589 times
But the model seems to be converted successfully.
When I load my Ogre Application it works fine until the character is to be displayed. Once the camera should display the character, the program crashes.

Ogre Log at the time of the crash:

00:13:32: OGRE EXCEPTION(3:RenderingAPIException): Failed to create Direct3D9 Device: Invalid call in D3D9RenderWindow::createD3DResources at ..\src\OgreD3D9RenderWindow.cpp (line 606)

I think that the crash and the warnings have something in common...but how to make the warnings disappear? I'm quite new in Ogre character modeling so if anybody could explain me it'd be great :)
Thumpin3D
Gnoblar
Posts: 5
Joined: Wed May 06, 2009 6:58 pm

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

Post by Thumpin3D »

I get the same warnings too..
I even tried exporting a simple rig with three cubes stitched. This works fine.
Any ideas?
Thumpin3D
Gnoblar
Posts: 5
Joined: Wed May 06, 2009 6:58 pm

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

Post by Thumpin3D »

Is there any way of finding out which vertices ( or vertices of which vertex group) that has got more than 4 or 0 bone assignments??
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, as of now, i think there's no real way to find out. My recommendation for now is to do manual vertex weight painting. It's the most sure way to get full control over your character skinning. Maybe we should have a helper script to highlight bad vertices that has more than 4 bone assignments.
User avatar
LiMuBei
Goblin
Posts: 297
Joined: Mon Jun 09, 2008 3:56 pm
Location: Karlsruhe, Germany
x 10

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

Post by LiMuBei »

While researching possibilities to work around this issue in Blender I came across this. Haven't looked at it, but as stated there with a few modifications this script could be helpful.
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 »

Looks interesting. That might come in handy for something like this. I suppose we could use the normalise script and add feature to highlight vertices over the bone limits. Though I'm not quite sure if this feature should be part of the exporter. It might fit better as another blender script since it's actually helpful for anybody who is working on game related armature animations. I believe most game engine has similar limitations.
cyrfer
Orc
Posts: 424
Joined: Wed Aug 01, 2007 8:13 pm
Location: Venice, CA, USA
x 7

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

Post by cyrfer »

I'm trying to make vertex animation in Blender so that it exports well. In Blender, I made an animation with a basis and 2 shape keys, based on a tutorial here. I used the Action editor to create a large animation with keyframes going back and forth between the 2 shapes. I have a shape for the character speaking the letter 'M' and the letter 'O', and I have strips that make an animation show Basis-M-O-M-Basis. The exported .xml file only shows 2 'poses'. When trying to play the M-O-M animation, I only see the model jump from the basis shape to the 'M' shape. My export is set to use the first frame (1) to the last frame (41). What would explain why I only see a jump from one pose to another instead of a smoothe interpolation? I don't know if the problem is with my modeling skills, a bug in the exporter, or my c++ OGRE code. Will someone confirm my Blender animation and export settings? My file can be found here. Many thanks!
Arkus
Gnoblar
Posts: 8
Joined: Mon Aug 31, 2009 3:55 pm

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

Post by Arkus »

The exporter seems to work nice, but how can i export multiple textures?
I created two textures in the material window but just one of them got exported in the ogre material file.
It would be very good to have multiple textures on a model, for example a color and a normal map, with the normalmap "MapTo" setting set to "Nor" and the exporter writes two textures with the information which texture should be mapped to what in the material file.
Is there any way to do this?
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 »

cyrfer: I'm not sure what your problem is, but it's definitely not the exporter. My last experiment with the exporter gave correct result for shape keys. Maybe it's to do with your code? Do remember that shape key is about morphing from one pose to another, so frames doesn't matter.

Arkus: Please have a look at the custom material template option. What you want is there with enough flexibility for your own choice of naming and material design. There is no way the exporter can generate proper and optimized material due to different users uses Ogre's rendering differently (forward single pass rendering / shadow casting / deferred rendering). Hence their shader would be different as well. This is why the custom material template system was designed. Look it up with the help file.
Arkus
Gnoblar
Posts: 8
Joined: Mon Aug 31, 2009 3:55 pm

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

Post by Arkus »

Thanks, custom materials seems to work good for me. :)
But i have another problem: Im not using ogre, i'm just using the ogre blender exporter and now i'm writing a importer for my game "engine". Now i exported a animated model with multiple submeshs and each one got it's owne file. The problem is, ervery submesh got also it's own skeleton, and the are all different (i think they are realtiv to the submesh origin).
Is there any way to get all submeshs in one ogre File? It is XML based and technically there would be no problem to have multiple submesh nodes. Than i qould only have one skeleton and everything would be nice and easy.
I don't use Blender so much, so maybe i must just use an other way to make the submeshes and export them?
Post Reply