Author Topic: [WIP] Blender to BLB Automation Script  (Read 1770 times)

WORK IN PROGRESS NOT RELEASED YET
It will be released when it's done
Don't expect it to be done any time soon

I'm slowly working on an AutoHotkey script that automates most/all of the monotonous and mechanical work of converting a Blender model to a BLB. It not only saves you several minutes of work but also removes human error. It's possible that there are errors in the script itself but it has been working fine for me so far.

The script is useless on it's own. It's just a macro. You need Blender, Notepad++ (Regular Notepad will not work), and 3dtoblb. It's a delicate thing as you need to use the macros in rather specific situations and some preparations need to be done for everything work smoothly. I've added rudimentary idiot proofing (You can only use the hotkeys in the specified processes.) but for example executing the Blender preparation script without having a mesh selected can mess things up.

I also have no idea how well it will work on resolutions other than 1680x1050 since mouse movement is included. You will need AutoHotkey to run the .AHK script. (Which is plain text so open source.) I could make it an exe but Badspot doesn't like exes and open source is always nice. Other people could learn from it. I have no idea if the script/AutoHotkey runs on other operating systems than Windows.

Each macro runs for ~1 second.



So far the following has been done.

Blender: Prepare model for 3dtoblb
    Duplicating, rotating, scaling, mirroring, removing materials (They aren't exported), and moving the modified mesh to a new layer.

Blender: PLY export (3dtoblb only reads PLY properly)
    Asks for a filename, exports to PLY into whatever folder is open by default. (Windows drive for me.)

Blender extra: Create 1x1x1 brick (Added because I can.)
Blender extra: Create 1x1f brick (Added because I can.)

Notepad++: BLB brick grid fix (3dtotblb flips X and Y values)
    Reads the brick size, removes all but one block, removes excess characters from the block, copies the block and pastes the correct amount.

Notepad++: BLB UV blanking
    Sets all UV values to 0.5 which is the center of the side texture, thus blank.

Notepad++: BLB coverage removal
    Sets the coverage of the BLB to 99 which doesn't hide any adjacent faces.

Notepad++: BLB quad coloring
    Asks for RGB decimal color, writes the color into every quad in the BLB, counts the amount of omni quads, copies the colored quads, moves into previous tab ("Main blb"), adds the amount of colored quads and regular quads together, pastes the colored quads into the beginning of the omni quads.



Stuff I will try to do.

Notepad++: Write 3dtoblb convert script



AutoHotkey has limited GUI design but as long as it works I'm fine with it. I still haven't done the actual GUI that explains the macros and such.





« Last Edit: October 23, 2012, 02:30:32 PM by Demian »

This is amazing! it would help me a lot!!! :D oh yeah what about the food release 2?

This is amazing! it would help me a lot!!! :D oh yeah what about the food release 2?
It's been out for hours: http://forum.blockland.us/index.php?topic=207980.0

Edit: Finished brick grid fix.
« Last Edit: October 23, 2012, 02:36:53 PM by Demian »

Good Job! I will look forward for this. What about show image of BLB format?
« Last Edit: October 24, 2012, 12:51:59 PM by Cubelands »

Good Job! I will look forward for this. What about show image of BLB format?
Way beyond my skills. There's always the BLBEditor but it has major problems which make it kinda unusable.

There's always the BLBEditor but it has major problems which make it kinda unusable.
True! I hope you can do it better than him...

GJ Badspot. First you released the coffin and skull bricks a day before I was done. Now he done and released an official OBJ to BLB converter which makes this program almost entirely useless. I gotta scrap half of what I did here and rework the other half.

Now he done and released an official OBJ to BLB converter
WHERE
omg cool