Blender 2.5 Exporter [Official]

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
QuantumFlux
Gnoblar
Posts: 13
Joined: Sat Oct 01, 2011 12:41 pm

Re: Blender 2.5 Exporter [Official]

Post by QuantumFlux »

Is this still being kept up?
kyleburton
Gnoblar
Posts: 1
Joined: Fri Jan 27, 2012 5:14 pm

Re: Blender 2.5 Exporter [Official]

Post by kyleburton »

hi i thinks we are both on the same situation others helped you though but the best thing is that you read very carefully :)
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Blender 2.5 Exporter [Official]

Post by lf3thn4d »

Hey guys, sorry for the long hiatus. I've been totally swamped with work and daily life activities for a while now. However, good news is that I recently am coming close to completing a contract project. Which means I will have more free time soon. In a few days time, I will attempt at getting at least the mesh export part working so you guys can test it out. Sorry for the long wait! I will get this "long should have been done" exporter out! I promise! ;-)

P.S. Blender's version ticks so fast it's no longer a 2.5 exporter anymore. >_< Maybe I should rename it to 2.6 now?
User avatar
merlinblack
Goblin
Posts: 223
Joined: Thu Mar 15, 2007 10:05 am
Location: Sydney, Australia
x 7
Contact:

Re: Blender 2.5 Exporter [Official]

Post by merlinblack »

At least now you'll have a fairly locked down API to work against. :)
"He'd never realized that, deep down inside, what he really wanted to do was make things go splat."
Terry Pratchett, Reaper Man
Image
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Blender 2.5 Exporter [Official]

Post by lf3thn4d »

That is true. :-) Every time I looked into working on the exporter when I had time, blender API changes confused me a little. In fact the Api docs for vertex color in 2.62.0 seems to be different again. Yet from testing, nothing has changed yet. :? I'm very confused.

Talking about that, it baffles me that blender doesn't have alpha in their vertex colors yet! :shock: It's the year 2012 and they still lack of that. 3dsMAX had it decades ago. I wonder why it's taking them so long to get this right. Also, blender doesn't allow custom vertex normal assignment. You could apply them through script, but I'm not too sure it reflects in the mesh. Though I'm pretty sure they reset and recalculates them once you enter edit mode. This kinda sucks for real-time graphics where we want to perturb normals the "wrong" way to give fluffy result to a polygon soup. (Very useful for stuffs like bushes and trees)

So I'm actually thinking to have some sort of new way to support alpha and custom vertex normal.
Vertex Alpha Support: have color layers named "blah_alpha" to be the alpha layer of "blah".
[s]Custom Normal Support: have color layers named "_norms" to be applied as custom normals.[/s]

P.S. On second thought, if blender allows perturbing normals and doesn't recalculate the vertex normal as long as we don't edit it, maybe that should be safe enough to assume we do not need to support custom vertex normal channel. I'd imagine the only time we would ever deal with perturb normals is to generate them by ways of copying normals from another blob mesh instead of manually editing each normals by hand. This means generation of the normals should always be done after we are happy with the mesh and will not be modifying anymore.

Anyways, I'm pretty close to getting a basic mesh.xml file exported. I've just managed to extract blender's mesh info into proper Ogre ready structure. :-) Stay tuned.
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Blender 2.5 Exporter [Official]

Post by lf3thn4d »

Just a head up, I've got basic mesh.xml export with UV and colour done. The exporter only generates the xml part for now. xmlconverter execution to binary mesh format will come later. The code is in the repository. Do check it out and report any bugs related to generated mesh. (e.g. malformed meshes and the likes, NOT exporter UI settings not working stuff mind you, most settings are not used at the moment) :-) You will need the latest blender release (2.6.2)

P.S. Also updated the wiki page.
P.P.S I have in mind to turn old exporter's folder to BlenderExport249 and keep BlenderExport for the latest build. It is a better idea i believe.
Demarii
Gnoblar
Posts: 18
Joined: Thu Jan 26, 2012 2:58 am
Location: Canada
x 9

Re: Blender 2.5 Exporter [Official]

Post by Demarii »

Whats the link to the download?

I'm not exactly sure what repository your referring, I've looked over the addon repo and didn't see anything that jumped out at me as being it and the location of your old script doesn't appear to contain a new version that I can see... but maybe I'm just being dense this morning! But a link would be handy. :) Thanks!
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Blender 2.5 Exporter [Official]

Post by lf3thn4d »

It's in the mercurial trunk.
https://bitbucket.org/sinbad/ogre/

It's quite a huge download since it ties in with the whole Ogre branch and mercurial isn't like SVN where you can grab just a sub folder. Sorry for this since it's still in development stage and totally half done, I don't plan to provide a direct download.
Arkiruthis
Gremlin
Posts: 178
Joined: Fri Dec 24, 2010 7:55 pm
x 10

Re: Blender 2.5 Exporter [Official]

Post by Arkiruthis »

Woohoo! Nice to see some work going into the 2.6 version.

Do you just drag "Blender2.5Export" (with it's .py files) from Mercurial/Ogre/Tools into your Blender/2.62/scripts/addons as per other plugins?

I can't seem to find it in the Addons section inside Blender Preferences once blender has loaded?
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Blender 2.5 Exporter [Official]

Post by lf3thn4d »

Yes, that's what you do. copy the whole folder into the addons directory as the subfolder in that directory. You should be able to find it if you type "ogre" in the search. It is under the "import-export" category. :)
Arkiruthis
Gremlin
Posts: 178
Joined: Fri Dec 24, 2010 7:55 pm
x 10

Re: Blender 2.5 Exporter [Official]

Post by Arkiruthis »

Hmm, odd... I changed the "Blender2.5Export" folder name to "io_ogre" and now the module appears in Blender.

However, I've now got that problem where the little add-on check box for the add-on won't check. It's not the old click-and-wait-a-bit problem (i.e., where there's a delay before the add-on is enabled), it simply won't enable at all and stays disabled no matter how or when I click on it.

This is Blender 2.62 regular 32-bit downloadable from blender.org, nothing special.
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Blender 2.5 Exporter [Official]

Post by lf3thn4d »

Ah.. hmm i guess blender doesn't like the "." in a folder name. In my dev folder i actually named it ogre_mesh_exporter.
Can you open up the blender's console log (Help->Toggle System Console)? There's probably some error during registration for some strange reason. I'm using Blender 2.62 64-bit btw, though i doubt it affects anything.
User avatar
merlinblack
Goblin
Posts: 223
Joined: Thu Mar 15, 2007 10:05 am
Location: Sydney, Australia
x 7
Contact:

Re: Blender 2.5 Exporter [Official]

Post by merlinblack »

Ahhhh, there it is - the defualt mercural branch. :oops: :)

My quick testing just now suggests that the folder inside addons needs to be ogre_mesh_exporter otherwise parts can not be found, and you can't tick the box as a result.

This was on a fresh install of 2.62 64bit on Win7.

I see there is (but I didn't use) there is a "Install Addon..." button. I wonder how this works? It might be the easiest method perhaps.

Right, now to go play with the exporting again... :D

EDIT: Yay I now have a nice cube.mesh.xml which looks to casual inspection (of the xml) to be good. Had to remember that the export does not appear in the File->Export... menu which confused me for a little bit. (Scroll the left panel)
"He'd never realized that, deep down inside, what he really wanted to do was make things go splat."
Terry Pratchett, Reaper Man
Image
Arkiruthis
Gremlin
Posts: 178
Joined: Fri Dec 24, 2010 7:55 pm
x 10

Re: Blender 2.5 Exporter [Official]

Post by Arkiruthis »

Hurrah! "ogre_mesh_exporter" indeed. It checks correctly now, thank you! :)
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Blender 2.5 Exporter [Official]

Post by lf3thn4d »

Ah.. ok. Sorry about that. My bad. I used "ogre_mesh_exporter" as part of the module access in my script. I totally forgot about that :shock:
Glad that you guys got it working. :-)

Anyways, I'm currently looking into proper export UI progress logging. The way blender works now, you can never refresh the UI halfway through the script. This sucks really bad for huge batches of mesh exports. Imagine selecting hundreds of meshes to be exported all at once. You'll get an unresponsive blender that will freeze for a few seconds if not minutes. So I'm thinking of trying to use blender's new MODAL operator concept to execute each mesh export one by one. This way we can at least have some sort of indicator in the UI while exporting. Also, blender's UI is really limiting when it comes to custom stuffs. I'm also looking into a good work around to displaying export log messages. It's really time consuming trying to tinker with blender's new python API to find a solution that works. :-(
User avatar
merlinblack
Goblin
Posts: 223
Joined: Thu Mar 15, 2007 10:05 am
Location: Sydney, Australia
x 7
Contact:

Re: Blender 2.5 Exporter [Official]

Post by merlinblack »

I wondering about that - I was thinking a progress bar or at least text widget with a count down would be good when there are lots of meshes. Sounds really annoying to do.... Surely the Blender guys thought of this though.
"He'd never realized that, deep down inside, what he really wanted to do was make things go splat."
Terry Pratchett, Reaper Man
Image
Demarii
Gnoblar
Posts: 18
Joined: Thu Jan 26, 2012 2:58 am
Location: Canada
x 9

Re: Blender 2.5 Exporter [Official]

Post by Demarii »

Ahh excellent thanks for the info, I've pulled the repo so I'll be able to keep up to date more easily.
Looking forward to giving this a go and seeing how it all comes together.
Keep up the great work! This sort of add-on will be a great benefit to improving an artists workflow.
User avatar
duststorm
Minaton
Posts: 921
Joined: Sat Jul 31, 2010 6:29 pm
Location: Belgium
x 80
Contact:

Re: Blender 2.5 Exporter [Official]

Post by duststorm »

Great to see this thing is alive! :)
Developer @ MakeHuman.org
User avatar
merlinblack
Goblin
Posts: 223
Joined: Thu Mar 15, 2007 10:05 am
Location: Sydney, Australia
x 7
Contact:

Re: Blender 2.5 Exporter [Official]

Post by merlinblack »

I've done a tiny bit of research into giving UI feed back while doing a loooong export and modal operators looks to be the way.

I'm volunteering to investigate how to do a progress bar, so you (l3fth4nd) can do more critical stuff. Unless you've already figured that part out of course. :)
"He'd never realized that, deep down inside, what he really wanted to do was make things go splat."
Terry Pratchett, Reaper Man
Image
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Blender 2.5 Exporter [Official]

Post by lf3thn4d »

I think the logs are rather critical. :-) It would help in the rest of the development. I can actually put warning and error logs which I can easily trace for bugs.

I've figured it out partially already. I gave up on the idea of progress bar. Can't seem to find any ways to do it. However I'll be doing something similar to a console log. Will be committing my changes soon. You'll see what I mean. :-) Blender's API really needs more docs. It's hard to figure out which context I'm in. Either way, I'm fixed on having blender stalling per model export. It should be reasonable. So the blender UI will only refresh once every model exports. However due to this change, it wouldn't be as easy to come up with an api that other add-ons can just execute. I need to think of a way to encapsulate it such that when other add-ons uses the exporter to export meshes, they can do so without interfering with the logs.
User avatar
merlinblack
Goblin
Posts: 223
Joined: Thu Mar 15, 2007 10:05 am
Location: Sydney, Australia
x 7
Contact:

Re: Blender 2.5 Exporter [Official]

Post by merlinblack »

I think an operator, even a modal one will not be difficult to call from other scripts. Perhaps it just needs an 'execute' method in addition to an 'invoke' one (which perhaps just calls invoke). Perhaps have a flag saying if to log to the console or not.

So far my googling and experimenting has brought me to using bgl to draw a very basic progress bar in the top corner of a panel. Untill I crashed blender and lost my code! :oops: :?

I know roughly how it worked so I think if there is a modal operator that returns between each mesh output, I can make yet another operator that draws a progress bar, calls the export operator on a timer tick, then itself returns 'RUNNING_MODAL' or whatever the exporter operator returned, at which point blender will update the view.

Code: Select all

def modal( self, context, event ):
    if event.type == 'ESC':
        return {'CANCELLED'}
    if event.type == 'TIMER':
        drawProgressBar( context )
        return self._ogre_export.modal( context, event )
Or something like that...


I'll have another play tonight.
"He'd never realized that, deep down inside, what he really wanted to do was make things go splat."
Terry Pratchett, Reaper Man
Image
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Blender 2.5 Exporter [Official]

Post by lf3thn4d »

hmm.. is it possible to draw GL stuffs with offset along the UI? Is there a way to get the scroll or panel offset information? It'll be great if we can actually draw stuffs that fits into the UI :)
User avatar
merlinblack
Goblin
Posts: 223
Joined: Thu Mar 15, 2007 10:05 am
Location: Sydney, Australia
x 7
Contact:

Re: Blender 2.5 Exporter [Official]

Post by merlinblack »

lf3thn4d wrote:hmm.. is it possible to draw GL stuffs with offset along the UI? Is there a way to get the scroll or panel offset information? It'll be great if we can actually draw stuffs that fits into the UI :)
Thats what I'm trying to figure out now. :P I'll keep you posted, but the blender docs are still a bit lacking. I was looking at having a popup window and drawing on that, but I think they disappear once they "execute", so I'm back to drawing on the Panel that the whole thing was invoked from.
"He'd never realized that, deep down inside, what he really wanted to do was make things go splat."
Terry Pratchett, Reaper Man
Image
jonim8or
Goblin
Posts: 287
Joined: Mon Dec 08, 2008 4:49 pm
x 10

Re: Blender 2.5 Exporter [Official]

Post by jonim8or »

Haven't seen any updates here recently, but for my work I need an easy-to-use blender-to-ogre exporter.
I've done some changes myself, here are my patches.
Fixes:
  • Y-flipped the V coordinate: texture coords were incorrect.
  • Ported to blender 2.63a
  • moved files to sub-directory named ogre_mesh_exporter, so installation is just drag-drop the folder
Added features:
  • OgreXMLConverter automatically called
  • Y-up rotation automatically applied for meshes
Attachments
BlenderExporterPatch.zip
Two patches for blender to ogre exporter
(2.84 KiB) Downloaded 438 times
jonim8or
Goblin
Posts: 287
Joined: Mon Dec 08, 2008 4:49 pm
x 10

Re: Blender 2.5 Exporter [Official]

Post by jonim8or »

Or, for people who don't want to bother with mercurial: here's the zip file. You can unzip it to the addons directory, or import it using the blender addons panel.
Attachments
ogre_mesh_exporter.zip
blender exporter script as zip package
(17.66 KiB) Downloaded 456 times
Post Reply