Author Topic: [TOOL] Blender .blb Export Script [v1.1]  (Read 6659 times)

Blender .blb Exporter
Written in Python 2.6

v1.1 for Blender 2.49b

Script that exports your scene in Blender as a (mostly) complete .blb file. Positions, UV coords, colours and normals are all fully supported. Just plop the script into your Blender 2.49b scripts folder.

Get the most recent version here!
Read the documentation!

Features:
  • Allows you to define custom collision(s), bounds, vertex colours, uv coords and textures
  • Bricks are exported per-object, so you can export multiple bricks at once
  • Generates workable (albeit poorly optimized) placement grid and coverage, also sorts quads
  • Bounding box and face count limitations (its a feature!)
  • "TOP" texture UVs automatically aligned to the grid, and are set up so that they rotate properly in-game

To do:
  • Optimize placement grid generation
  • Optimize coverage generation
  • Optimize quad sorting
  • Write GUI and allow room for more options

You should optimize the brick manually before you release anything made using this exporter!
It handles actual mesh data fine, but stuff like coverage needs some manual work. The good news is, as long as you're not making huge bricks, this is a piece of cake.

As the first release, you should expect bugs. Please inform me if you come across any ASAP.
« Last Edit: June 02, 2013, 05:10:45 PM by Tophius »




Blender 2.49b
>:C
Let me fix that todo list:

To do:
  • Port script to newest blender version
  • Optimize placement grid generation
  • Optimize coverage generation
  • Optimize quad sorting
  • Write GUI and allow room for more options

Wow this is really cool

>:C
Let me fix that todo list:


2.49b is the most "optimized" and stable version of Blender for creating Blockland stuff.

2.49b is the most "optimized" and stable version of Blender for creating Blockland stuff.
2.6 is so much nicer.

2.49b is the most "optimized" and stable version of Blender for creating Blockland stuff.
I don't see why. You still need to read vertex and UV coordinates and those are just numbers. Their formatting might have changed slightly between 2.49 and the 2.6 versions but it shouldn't be anything too different.
« Last Edit: May 26, 2013, 04:03:03 PM by Demian »

Update: v1.1 now available in the OP.

Changes:
  • UVs for faces with the "TOP" texture assigned are now automatically set to align with the brick grid, and rotate properly with the brick.
  • Cleaned up bugs and console spam



I'm working on .49 because I'm working with python 2. This was a little project I took on when I decided I wanted to have a go at learning Python. I found it was much easier to find resources for Python 2, so I stuck with Python 2. You probably already have .49 anyway, if you work with Blockland.

I could look into porting it over in the future, but I don't really consider that hugely important.

Hello.
May I ask, how could you determine the correct stretching etc. of the UV for bricks?
Also what are you supposed to name things?

Hello.
May I ask, how could you determine the correct stretching etc. of the UV for bricks?
Also what are you supposed to name things?

Import some of the default brick textures (make them non-trans first) into the UV/Image editor, so you can use them to set the UV Coords right - they won't affect the actual textures applied to the brick in-game.

The documentation contains everything you should need to know about naming things and more, but in case you happen to miss it:

Object names:
  • starts with "col" - collision box (if child of brick)
  • "bounds" - bounding box (if child of brick)

Material names:
“TOP", "BOTTOMEDGE", "BOTTOMLOOP", "SIDE", "RAMP", "PRINT” - self explanatory

There are also names you can give your object's VCol layers but you should read the bit under "Colours" in the doc for those.

Oh. The confusing part is the material names. I didn't know that you are supposed to have different objects for every different material, though it should've been obvious. Though I am having a problem. I am attempting to name one "SIDE" but it keeps coming out as "BRICKTOP". I think there is a problem when you try to split an object or something. Could there be a way I could debug this to see why is the "SIDE" coming as "BRICKTOP"? More exactly where does the script get the BRICKTOP from?
« Last Edit: May 27, 2013, 04:12:03 PM by LeetZero »

You can have multiple materials on the same mesh - look in the "Links and Materials" box in the editing panel. If you export the brick as different objects, the exporter will just make one brick for every object.

As for your problem - you mean it comes out as the top texture in-game, yes? Or no? The script should be getting the tex name straight from the material name assigned to the face.

Ninja'd. I made an oopsie somewhere. I'll check it out as soon as I can.

Yeah Links and Materials somehow had 3 materials for the same face. It selected BRICKTOP for it despite it being on SIDE.
 Whatever, removing Bricktop from there helped.

Next problem.

This is the same brick, different rotation.