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.
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 »

Sounds like you are doing it wrong with your blender scene. The mesh exporter exports meshes in their local coordinate. Never in the world coordinate. Likewise, it never exports any scaling and transform described in blender. That is the job of the dotscene exporter.

I believe your objects are all having their center in the center of the scene; I.E. origin of meshes resides at 0, 0, 0.
JeDi
Gnome
Posts: 351
Joined: Thu Oct 21, 2004 1:34 pm
Location: Diepenbeek, Belgium
x 3

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

Post by JeDi »

Thanks for your help. The scene seems to be badly modeled:
- all objects are in world space
- a lot of textures are the same expect for painted-in shadows
- No meshes are shared between the billboards, which are all the same

I didn't find an option to extract a transform from the meshes and change their local coordinates (I can imagine that is not a trivial feature), and because there are only a total of 12 billboards in the scene, I deleted the old ones and am creating new ones in blender (using shared instances). Now the billboards are exported perfectly.

Greetz,
JeDi
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 »

Good to hear. :) As for "extracting" transform from meshes, that's not a very logical thing to do and should not be the job of an exporter. I have no idea how one would try to figure out what orientation a mesh should be in. Either way, the best you could do is probably use the [Center New] button in blender to make mesh center to their bounding center.
JeDi
Gnome
Posts: 351
Joined: Thu Oct 21, 2004 1:34 pm
Location: Diepenbeek, Belgium
x 3

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

Post by JeDi »

yeah, I didn't mean this should be an exporter option, I was just looking for such a feature in Blender. But well, I already created the billboards again from scratch, so I'm done :)
Skorpio
Kobold
Posts: 37
Joined: Sun Sep 24, 2006 9:32 am

Skeleton and Export

Post by Skorpio »

Hello,

I have a question about the exporter and blender. I was able to track the problem to the bones section of the XML
My project involves manipulating the skeleton manually. Here is my problem:

When I create and export a mesh, if the rotation angle is not zero then moving the bone will be messed up,
it seems to inherit this initial rotation. I have tried everything in Blender/Exporter to force these values to come out Zero.
I re-aligned the bones, clear rotations, etc. Nothing seems to work.

All the meshes that I have created, the skeleton has some kind of initial angle that I can't seem to fix.
So when I tried to manipulate the bones manually they rotate real bad.

However, the ninja works great because the angle is zero for all bones. All the meshes that I have seen
that have Zero rotation seem to work great when bones are manipulated manually.


<bones>
<bone id="0" name="Joint1">
<position x="0.185046" y="0.51196" z="0" />
<rotation angle="0">
<axis x="1" y="0" z="0" />
</rotation>
</bone>


Best Regards,

Skorpio
frontier
Gnoblar
Posts: 1
Joined: Fri Jan 08, 2010 10:56 pm

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

Post by frontier »

Hi,

I'd like to run the Blender Ogre mesh export script from the command line as part of an import centric asset pipeline, but it's currently not possible since the export script uses the Blender GUI for parameter input.

The script is quite nicely laid out so it seems like it would be fairly trivial to write command line argument driven script to drive the exporters, which are mainly implemented in the ogrepkg/ scripts.

Before embarking on doing this myself I thought I'd check if anyone else already has done something similar, to save me the effort?

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

Re: Skeleton and Export

Post by lf3thn4d »

@Skorpio:
Hi, I'm not quite sure what your problem is. Base on my understanding of the way ogre's skeleton works, the rotation properties are designed as the initial orientation of a bone. With that, we can be certain that the orientation of the bone is always fixed at the given axis as shown in blender. My assumption would be that the bone's look at axis should be it's local Z axis cast into the world orientation. Maybe you can give more details with screenshot showing the issue you are having?

@frontier:
Hi, I did not have any plan on adding this. If I recall correctly there were a guy who attempted at doing it. Try searching previous posts.
User avatar
sparkprime
Ogre Magi
Posts: 1137
Joined: Mon May 07, 2007 3:43 am
Location: Ossining, New York
x 13

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

Post by sparkprime »

I still have this problem

sparkprime wrote:With blender 2.48a I get the following trace:

Code: Select all

Compiled with Python version 2.6.2.
Checking for installed Python... got it!
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/spark/.blender/scripts/ogremeshesexporter.py", line 238, in <module>
    PackageSettings.getSingleton().load()
  File "/home/spark/.blender/scripts/ogrepkg/base.py", line 251, in load
    self.dict = pickle.loads(string.join(settingsText.asLines()[4:],'\n'))
  File "/usr/lib/python2.6/pickle.py", line 1374, in loads
    return Unpickler(file).load()
  File "/usr/lib/python2.6/pickle.py", line 858, in load
    dispatch[key](self)
  File "/usr/lib/python2.6/pickle.py", line 971, in load_string
    self.append(rep.decode("string-escape"))
  File "/usr/lib/python2.6/encodings/__init__.py", line 100, in search_function
    level=0)
TypeError: blimport() takes no keyword arguments
After the first export. This then seems to corrupt the .blend file since no conversions work after this.

Any ideas?
User avatar
Adaon
Gnoblar
Posts: 9
Joined: Thu Jan 14, 2010 11:37 am
Location: Yekaterinburg, Russia

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

Post by Adaon »

Hello.
I don't know why, but current Blender version and some older ones work with a lot of interface lags (OS is Ubuntu), so I'm using Blender v. 2.5a, it works fine.
I have copied exporter files into blender/.blender/scripts folder, restarted Blender, but there are no changes, the program doesn't seem to understand the script. Is there any way to make it work?
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 »

@sparkprime: That's odd, I'm using 2.49b with python 2.6.2 with no issues. You might want to try do a fresh install of the script.

@Adaon: The blender script exporter currently does not support the latest 2.5 version. This is because this version is a whole complete rewrite which caused many API breakage. As mentioned in my posts previously, I do intend to rewrite the exporter for 2.5. However the time is not right yet as 2.5 is currently in Alpha stage and their python script support is still work in progress. Until they stabilize the script support (probably during Beta 2 phase), no work will be done on this. Please use 2.49b for now. :)
User avatar
Adaon
Gnoblar
Posts: 9
Joined: Thu Jan 14, 2010 11:37 am
Location: Yekaterinburg, Russia

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

Post by Adaon »

Thanks for reply :)
As I said, unfortunately previous blender versions work with strange interface lags (more exactly, I can't click most of the buttons and menus), so I'm about to wait for next script version, or use some hacks like 2-step mesh converting through 3ds :)
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 »

I do not know if i post it in a correct forum.

I'm talking about dotSceneExporter for blender.(ogredotscene.py) http://www.ogre3d.org/wiki/index.php/Bl ... e_Exporter
As i know (my version of it) does not suppore exporting spotlight edge blending.
__author__ = ['Michael Reimpell']
__version__ = '0.0.0'
__url__ = ['OGRE website, http://www.ogre3d.org',
'OGRE forum, http://www.ogre3d.org/phpBB2/']
__bpydoc__ = "Please see the external documentation that comes with the script."

# Copyright (C) 2005 Michel Reimpell

It's easy to do it with getSpotBlend().
I post corrected solution:

Code: Select all

angle = lamp.getSpotSize()
innerAngle = angle * (1 - lamp.getSpotBlend())
fileObject.write(self._indent(indent+1) + \
"<lightRange inner=\"%f\" outer=\"%f\" falloff=\"1.0\"/>\n" % (innerAngle, angle))
this is the key line :P
innerAngle = angle * (1 - lamp.getSpotBlend())
This is a block of text that can be added to posts you make. There is a 255 character limit.
oktay
Gnoblar
Posts: 1
Joined: Thu Feb 04, 2010 9:14 pm

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

Post by oktay »

Hi Guys.

I have a trouble.
I tried to use converter from Blender(2.49) to OGRE for convert an Animation.
Install last Python (2.6.4) and your scripts.
Make simply animation (Cube + one bone: bone is parent of mesh).
Make animation by scaling the armature(with linked mesh). So my model was like to worm.
I have made converting with any sets of parameters, but OGRE shows trouble. My worm scaled in different direction. Not along the body, but across the body-axis.

Would you please to explain me - what it was happened?
And how I can resolve this situation?

Thanks.
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: I don't maintain the blender dot scene exporter. This thread is for the blender mesh exporter. ;)

@oktay: It would be good if you show an example of what is going on. Including the settings you used on the exporter. :)
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 »

OK so here is Mesh exporter question/(humble request).

It's about texture mapping [UV] and some settings.
Is Texture mapping (Map Input) method "global" with "cube" projection supported ?
Cuz it does not look like it's working, it's exporting uv like with"uv" button pressed.
I'm talking about this buttons like on this blender screenshot.

Is there a way to set (bake ?) mesh UV to UV as with "global" "cube" settings before exporting ?.

I think this possibility is realy usefull for level making in blender.

See red paint around buttons.
You do not have the required permissions to view the files attached to this post.
This is a block of text that can be added to posts you make. There is a 255 character limit.
User avatar
Shockeye
Gremlin
Posts: 154
Joined: Mon Nov 24, 2008 10:34 am
Location: 'Straya
x 1

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

Post by Shockeye »

I think you need to have the TexFace button set to ON
User avatar
Matheus Martino
Gremlin
Posts: 164
Joined: Mon Sep 07, 2009 10:44 pm
Location: Brazil

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

Post by Matheus Martino »

Hi!
I'm new to Blender, i remember having already used blender exporter but now i want to use it again, but i can't install it now!
I'm using Windows XP, Blender 2.49b and Python 2.6.2.

Since my copy of Blender is installed in "C:\Arquivos de programas\Blender Foundation\Blender\", if i understod the instructions in the first post, apparently i need to install the blender export script in the folder "C:\Arquivos de programas\Blender Foundation\Blender\.Blender\scripts\", is that right?

I can't do that.... For some reason my system can't rename folders to ".something", it won't accept folder names starting with "." and there is no other folder in my blender directory... only executables, dlls and one zip file (the system is alread defined to show hidden files and folders).
I tried to install the script in the folders:

C:\Arquivos de programas\Blender Foundation\Blender\
C:\Arquivos de programas\Blender Foundation\Blender\scripts\
C:\Arquivos de programas\Blender Foundation\Blender\Blender\scripts\

None worked.

Can someone point me to the right direction?
Thanks.

EDIT: Fixed!
In Windows XP, some times the blender scripts are installed in other folder (chose while runing the installer)... I found then in the defaut location:
C:\Documents and Settings\USER_NAME_HERE\Application Data\Blender Foundation\Blender\.blender\scripts
For Windows Vista the defaut folder is:
C:\Users\USER_NAME_HERE\AppData\Roaming\Blender Foundation\Blender\.blender\scripts

Of course, I forgot it because i installed blender long time ago...
Excuse me if my english fail!
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 »

Shockeye wrote:I think you need to have the TexFace button set to ON
No it is not working, UV are exported as you assign them in an UV/Image editor.
This is a block of text that can be added to posts you make. There is a 255 character limit.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179

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

Post by jacmoe »

Just press the 'U' button in face selection mode and select 'Cube'.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
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 »

I know how to unwrap model.
What I want to do is to map world coordinates into texture uv.
For example plane of size 2x2 in place (0,0) [plane corner]
will have uv pairs [0 0,0 2 ,2 2,2 0].

This is very helpful when modeling a level, you are just preparing textures that will represent 1x1 unit exactly.
In my case it will be 1x1 meter and texture 512x512 so you do not have to play with unwrapping since uv cords are taken from coordinates.
This is perfect for making levels with seamless textures/walls.
This is a block of text that can be added to posts you make. There is a 255 character limit.
User avatar
sparkprime
Ogre Magi
Posts: 1137
Joined: Mon May 07, 2007 3:43 am
Location: Ossining, New York
x 13

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

Post by sparkprime »

lf3thn4d wrote:@sparkprime: That's odd, I'm using 2.49b with python 2.6.2 with no issues. You might want to try do a fresh install of the script.
I upgraded ubuntu which brought in a newer version of blender and that fixed it, thanks for the hint. I think it was ubuntu that broke it somehow. Sorry for taking so long to reply :)
User avatar
sparkprime
Ogre Magi
Posts: 1137
Joined: Mon May 07, 2007 3:43 am
Location: Ossining, New York
x 13

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

Post by sparkprime »

Is there any chance of exporting multiple colour sets, and for having an option to export the colours as a UV channel of the user's choice?
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: That's an interesting feature. We could probably add that as a special export feature. However, basing on material option is not a good idea since this is a mesh UV export. What could be done is to have a reserved special naming for the given UV channel that wants this. So when exporter detects the given name, it will export the global position in the UV. Though in practice, if you're already using shaders, you should be just grabbing the vertex coord and feed them as tex coord to the pixel shader. ;)

@sparkprime: Yes we can add that. Blender supports multiple vertex colour channel. So it should be possible. A patch would be welcomed if you don't want to wait as I'm rather busy with work.
User avatar
sparkprime
Ogre Magi
Posts: 1137
Joined: Mon May 07, 2007 3:43 am
Location: Ossining, New York
x 13

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

Post by sparkprime »

lf3thn4d wrote:@koirat: That's an interesting feature. We could probably add that as a special export feature. However, basing on material option is not a good idea since this is a mesh UV export. What could be done is to have a reserved special naming for the given UV channel that wants this. So when exporter detects the given name, it will export the global position in the UV. Though in practice, if you're already using shaders, you should be just grabbing the vertex coord and feed them as tex coord to the pixel shader. ;)
Can't blender's unwrap already do this? Just aim top down on the meshes in orthographic and map from there?
@sparkprime: Yes we can add that. Blender supports multiple vertex colour channel. So it should be possible. A patch would be welcomed if you don't want to wait as I'm rather busy with work.
OK I am also busy, I have to implement it for 3ds max first, which is what most people are using, it is just me who uses blender as I can't get 3ds Max working on Linux :) I had a quick look to see if it's an easy fix but then discovered I have never bothered learning python so couldn't do it, heh. If it comes to the point where I absolutely need it then I'll sit down for a few days and work out what's going on, but if you can do it in a few hours before then it would be greatly appreaciated :)
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 »

sparkprime wrote:
lf3thn4d wrote:@koirat: That's an interesting feature. We could probably add that as a special export feature. However, basing on material option is not a good idea since this is a mesh UV export. What could be done is to have a reserved special naming for the given UV channel that wants this. So when exporter detects the given name, it will export the global position in the UV. Though in practice, if you're already using shaders, you should be just grabbing the vertex coord and feed them as tex coord to the pixel shader. ;)
Can't blender's unwrap already do this? Just aim top down on the meshes in orthographic and map from there?
Yes you are quite right. Though I thought he was meaning 3D UV coordinate with UVW; something blender's UV map doesn't support.
sparkprime wrote:
@sparkprime: Yes we can add that. Blender supports multiple vertex colour channel. So it should be possible. A patch would be welcomed if you don't want to wait as I'm rather busy with work.
OK I am also busy, I have to implement it for 3ds max first, which is what most people are using, it is just me who uses blender as I can't get 3ds Max working on Linux :) I had a quick look to see if it's an easy fix but then discovered I have never bothered learning python so couldn't do it, heh.
lol. Yeah, I had that issue the first time I tried to add Y-up-axis support. Eventually got the hang of it though I don't really fancy python in any way. Personally, I wish the Parrot VM is ready and blender uses it. Then we could pretty much use any parrot supported language we fancy. Too bad it's wishful thinking and will probably never happen. At least not anytime soon.