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
Rhynedahll
Halfling
Posts: 77
Joined: Thu Jan 08, 2009 2:03 am
x 1

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by Rhynedahll »

I have Blender 2.49b and Python 2.6.2. After reading some of the other posts, it seems as if the Exporter should work with these.

However, when I run the latest version of the script I get this error:

Code: Select all

File "C:\Program Files\Blender Foundation\Blender\.blender\scripts\ogremeshesexporter.py", line 1315, in export
materialManager = MaterialManager(exportPath, materialScriptName, gameEngineMaterials, customMaterial, customMaterialTplPath, requireFaceMats)
TypeError: _init_() takes at most 6 arguments (7 given)
So, does any suggestions as to what I am doing wrong?
The Key to Magic -- Book One: ORPHAN
An epic fantasy by H. Jonas Rhynedahll available on Kindle.
The Key to Magic
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 [Sun Nov 8, 2009 - v1.3]

Post by jacmoe »

What does the Blender console say?
Does it pick up the installed Python?
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Rhynedahll
Halfling
Posts: 77
Joined: Thu Jan 08, 2009 2:03 am
x 1

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by Rhynedahll »

jacmoe wrote:What does the Blender console say?
Does it pick up the installed Python?

Code: Select all

Compiled with Python version 2.62.
Checking for installed python...got it!
The above error is from the console.
The Key to Magic -- Book One: ORPHAN
An epic fantasy by H. Jonas Rhynedahll available on Kindle.
The Key to Magic
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by lf3thn4d »

Are you doing this from scratch or are you updating the exporter? You might have missed updating some files. From the looks at it the materialexport.py file is not updated correctly.
Rhynedahll
Halfling
Posts: 77
Joined: Thu Jan 08, 2009 2:03 am
x 1

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by Rhynedahll »

lf3thn4d wrote:Are you doing this from scratch or are you updating the exporter? You might have missed updating some files. From the looks at it the materialexport.py file is not updated correctly.
I am using the export script from the link in the first post.

Is there a newer version? Or are you saying that my Python is not updated completely?
The Key to Magic -- Book One: ORPHAN
An epic fantasy by H. Jonas Rhynedahll available on Kindle.
The Key to Magic
cyrfer
Orc
Posts: 424
Joined: Wed Aug 01, 2007 8:13 pm
Location: Venice, CA, USA
x 7

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by cyrfer »

@lf3thn4d: Yeah, some way to divide the resulting Ogre mesh in Blender seems very useful, and named vertex groups might be the only way Blender lets you do this. BTW, I worked around the issues with my work-around, I just match a material name's substring to know which SubEntity to use in my code. For example, if I need to modify the "red_light" SubEntity in every stoplight model in my scene, I find a match even when the name of the SubEntity's material is "red_light_rural" and also on a different stoplight model I would match "red_light_urban". This works well, but it makes us have a naming convention on materials, where I would prefer to find segmented parts of a Mesh by name. Not a big deal but others might also see benefit to using named vertex groups.

Also, I may have contacted you before about this, but I'm wondering how in the world to export a spinning wheel animation and play it in Ogre. I'd like to use skeletal animation where the wheel is connected to a car, export the animation, and play it back at various speeds. I've got it working mostly now, except for some weirdness, as discussed in this post. If you can give me any advice, that would be great!
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by lf3thn4d »

@Rhynedahll: Yes, I mean your python script isn't fully updated.

@Cyrfer: I guess using the material work around kinda works. Though you might loose the advantage of lesser render state change. Anyways, for your animation problem, I've no real clue what's going on. However, I would recommend you manually grab the bone and rotate it yourself base on the speed of your car. That way, it's much easier to control and calculate. The math behind it isn't too difficult. As long as you know your radius of the wheel, you can find the angle to rotate from the delta distance as the arc length of a circle. ;)
Rhynedahll
Halfling
Posts: 77
Joined: Thu Jan 08, 2009 2:03 am
x 1

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by Rhynedahll »

lf3thn4d wrote:@Rhynedahll: Yes, I mean your python script isn't fully updated.
I uninstalled everything Python related and did a fresh install of Python 2.6.4. I get the same error.
The Key to Magic -- Book One: ORPHAN
An epic fantasy by H. Jonas Rhynedahll available on Kindle.
The Key to Magic
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by lf3thn4d »

What about the ogre export script? Try removing ogremeshexporter.py and the ogrepkg folder and reinstall the script from the main page. I just updated to Blender 2.49b and am not having any issues. I'm pretty sure you did not do a complete file replace of the mesh exporter. Note that the exporter uses more than a file. You need to update the ogrepkg folder files. Your error shows that your ogrepkg's files are old.
jblovloss
Halfling
Posts: 42
Joined: Sat Nov 07, 2009 6:59 am
Location: USA
Contact:

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

Post by jblovloss »

lf3thn4d wrote:You're welcome. :)

On the side note, I've looked into the apply modifier option and figured that it's quite simple to add. There's a catch with this feature though. That is that some modifier will screw up vertex ordering due to addition/removal/sorting of vertices. This will mess up any vertex morph animation. So user has to use with caution.

However, the submesh name issue is not that simple. The problem was that vertex grouping doesn't really link one to one with ogre submesh. Ogre submesh is designed to group vertices of the same material together. Aside from this, vertex grouping is also used for armature bone weighting. Hence this feature is totally inapplicable for submesh naming. I see no way to solve this through blender. This is probably better done through an in-house mesh editor that can alter submesh grouping and naming.

[edit]
Updated new release with apply modifier option.
[/edit]
Woot! I'll try it.
Come visit me at Bit Bards: http://www.bitbards.com
Rhynedahll
Halfling
Posts: 77
Joined: Thu Jan 08, 2009 2:03 am
x 1

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by Rhynedahll »

lf3thn4d wrote:What about the ogre export script? Try removing ogremeshexporter.py and the ogrepkg folder and reinstall the script from the main page. I just updated to Blender 2.49b and am not having any issues. I'm pretty sure you did not do a complete file replace of the mesh exporter. Note that the exporter uses more than a file. You need to update the ogrepkg folder files. Your error shows that your ogrepkg's files are old.
Thanks! That got it working! :D
The Key to Magic -- Book One: ORPHAN
An epic fantasy by H. Jonas Rhynedahll available on Kindle.
The Key to Magic
Smuel
Kobold
Posts: 37
Joined: Sat Oct 03, 2009 5:49 pm

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

Post by Smuel »

lf3thn4d wrote:Updated new release with apply modifier option.
Wow, I wasn't expecting you to do this so soon, and then it was a couple of days before I could test it, but I've just tried it and it works. Awesome! Thank you very much.

(I would say "All hail lf3thn4d", but your handle isn't very... uh... phonetic.)
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by lf3thn4d »

You're welcome guys. :) The feature was simple to add. ;) Blender 2.5 is coming soon and our export script will completely fail on the new app. So there will be a complete overhaul. I hope I really can find time to rewrite all features that is already part of this exporter. :P
cyrfer
Orc
Posts: 424
Joined: Wed Aug 01, 2007 8:13 pm
Location: Venice, CA, USA
x 7

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by cyrfer »

I have recently been wondering about is how to control the Submesh feature of the Ogre mesh. I think each Ogre SubMesh is more equivalent to a Blender mesh than the Ogre Mesh. For example, I believe that in Ogre, part of a Mesh can have have mulitiple UV coordinates, while other SubMeshes can have one or zero UV coordinates. The Blender mesh does not directly map to the Ogre Mesh, but may map directly to the Ogre Submesh. I wonder how this is handled in the OgreMax exporters for Max/Maya? Can the Ogre exporter be extended to use a hierarchy of Blender mesh Objects? Has this already been discussed? Ogre's mesh seems much more flexible than the Blender mesh definition. Maybe the Ogre community should suggest improvements. Unfortunately, I don't have any 'pull'. Perhaps I'll try anyway. :)
MVelez93
Gnoblar
Posts: 4
Joined: Tue Nov 03, 2009 5:20 am

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by MVelez93 »

Hi.

First, Excuse me. i'm bad with Blender, Ketchup, Bees and English.

I need help; I can export meshes with Blender. But the material is incorrect. For an example: I export a bullet with a material which have Black color, but when i render it in Ogre, the material displayed is gray: the same as the blender untouched meshes (yes, the gray which appears in Blender by default when you make a Cube or a Sphere).

Please help me!. :roll:
Thanks a lot.
cyrfer
Orc
Posts: 424
Joined: Wed Aug 01, 2007 8:13 pm
Location: Venice, CA, USA
x 7

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by cyrfer »

@MVelez: I think you must adjust the 'ambient' color on the Ogre material. In Blender, find the 'ambient' slider, and make it go to zero. Also, you can try adjusting the Ogre::SceneManager's ambient light.
User avatar
koirat
Orc
Posts: 446
Joined: Mon Feb 25, 2008 7:56 pm
x 13

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by koirat »

Some ERROR.

I have got a model in a blender. I select all the bones and create Action called "Bind" that is exact pose of my mesh/skeleton edit pose (no skeleton modification(rot/loc/scale)). I insert this pose in a first keyframe of my animation. End export this one frame (0 length) animation to the xml format.
What I get is:

part of skeleton.xml file

Code: Select all

		<animation name="Bind" length="0.000000">
		</animation>
And this results in a crash during OgreXMLConverter.

Note that it is possible to export 0 length animation when there is some changes in skeleton (I check this out).
And with the trial and error method. I Can say that you can do it by adding <tracks></tracks> tags.

This will convert.

Code: Select all

		<animation name="Bind" length="0.000000">
                           <tracks>
                           </tracks>
		</animation>


I just do not know if the result is what to be expected.

Anyway somewhere is a bug I just do not know if it belongs OgreXmlConverter or BlenderMeshExporter.
This is a block of text that can be added to posts you make. There is a 255 character limit.
shega
Gnoblar
Posts: 22
Joined: Fri Dec 29, 2006 9:55 am

Post by shega »

hey all...
just checking out blender site today. Ton said probably tomorrow they will releasing 2.5 alpha.
BTW great job lefthand. Can't wait 2.5 export script.
Rhynedahll
Halfling
Posts: 77
Joined: Thu Jan 08, 2009 2:03 am
x 1

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by Rhynedahll »

Yes, now that the 2.5 alpha 0 is available, what kind of time frame are we looking at for a new export script?
Weeks? Months? Just wondering if I should try to get up to speed with 2.5 or just hang in with 2.49b.
The Key to Magic -- Book One: ORPHAN
An epic fantasy by H. Jonas Rhynedahll available on Kindle.
The Key to Magic
User avatar
Kentamanos
Minaton
Posts: 980
Joined: Sat Aug 07, 2004 12:08 am
Location: Dallas, TX

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by Kentamanos »

No idea if anyone is working on it, but the fact Blender is using Python 3.1 as opposed to a 2.X might make it a slightly tougher challenge.
akem321
Bronze Sponsor
Bronze Sponsor
Posts: 153
Joined: Mon Jul 31, 2006 8:29 pm
Location: France
x 7
Contact:

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by akem321 »

Not especially python 3 but the fact that the BPY API is apparently going to change a lot.
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by lf3thn4d »

Hey guys,
It's better to stick to 2.49b for now. I'm following on the release of 2.5. However looking at the current state of things, they are not quite ready for actual stable work yet. I'm planning to only start working on a whole new exporter when they stabilize the script side of 2.5 build. That means their beta 0 build hopefully. However, I believe a proper port with full features will only be available when they release their final stable build which basically means their 2.6. See: http://www.blender.org/development/rele ... ender-250/

Personally, looking at what they have changed and the core stuffs they have modified, they should call it 3.0 :P

At any rate, I will call for testers when the WIP exporter is ready for testing. ;) So until then, all production work should still stick to 2.49b.
cyrfer wrote:I have recently been wondering about is how to control the Submesh feature of the Ogre mesh. I think each Ogre SubMesh is more equivalent to a Blender mesh than the Ogre Mesh. For example, I believe that in Ogre, part of a Mesh can have have mulitiple UV coordinates, while other SubMeshes can have one or zero UV coordinates. The Blender mesh does not directly map to the Ogre Mesh, but may map directly to the Ogre Submesh. I wonder how this is handled in the OgreMax exporters for Max/Maya? Can the Ogre exporter be extended to use a hierarchy of Blender mesh Objects? Has this already been discussed? Ogre's mesh seems much more flexible than the Blender mesh definition. Maybe the Ogre community should suggest improvements. Unfortunately, I don't have any 'pull'. Perhaps I'll try anyway. :)
I've looked much into blender's mesh and yes, like you said, they are less descriptive than ogre meshes. Hence it's impossible to do stuffs like naming submeshes or having more optimal UV allocation on different submeshes. What can be done is to have a special mode where the exporter assumes that all selected meshes in blender must be exported as a single mesh. With this, it is possible to better describe Ogre's submesh using multiple blender meshes. However, this complicates things and only makes it difficult for the artist. In the end, the only proper way to do this is to have the feature build in as part of blender's mesh. It would undoubtedly make things more complicated for the artist though. Note that ogre supports both shared vertices and non shared vertices for their submesh. Trying to introduce that idea to an artist would be nightmarish.
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by lf3thn4d »

koirat wrote:I have got a model in a blender. I select all the bones and create Action called "Bind" that is exact pose of my mesh/skeleton edit pose (no skeleton modification(rot/loc/scale)). I insert this pose in a first keyframe of my animation. End export this one frame (0 length) animation to the xml format.
From what you have shown, it shows that the xml converter is expecting a <track> tag but none was given. I do not have the dtd with me now so I'm not sure if it's a required tag(it probably is). Either way, the converter should have given warning about the tag not found instead of crashing.

As for the exporter side, it should probably just add empty <track> tags when animation is zero length. Though I do wonder why would you need zero length animation tracks? Are you using it as a simple fixed pose?

So, I believe the bug is on both sides. However, fix on my side should remove that "bug" on the other side. Personally, the exporter should wail about it instead of crashing. That would help debugging easier for future exporter programmers. Will get to it soon. ;)
User avatar
koirat
Orc
Posts: 446
Joined: Mon Feb 25, 2008 7:56 pm
x 13

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by koirat »

Yes I need it for a fixed pose.
This is a minor bug since nobody reported it yet. And you can avoid it without a big fuss.
But a bug is still a bug. :P
This is a block of text that can be added to posts you make. There is a 255 character limit.
JeDi
Gnome
Posts: 351
Joined: Thu Oct 21, 2004 1:34 pm
Location: Diepenbeek, Belgium
x 3
Contact:

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by JeDi »

Hi,

I am new to blender, so this could be a very dumb question...

We are using the blender exporter from the first post of this thread (v1.3), and the dotscene exporter from ogreaddons SVN. I noticed that all meshes are saved in world coordinates, and all transforms in the exported .scene file are identity transforms (apart from the scale, which is 0.1 for some reason).

I am exporting a scene with billboards in it. I am using Navi to display websites on these billboards, and I need to do 3D picking on them. That is why I would need the objects exported with their local vertex positions, so the bounding boxes used for picking fit the actual objects. is this possible with this exporter?

Greetz,
JeDi
Post Reply