How to modify B.blend in Blender binary?

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

Post Reply
Lazareus
Posts: 0
Joined: Sun Jul 23, 2006 5:24 am

How to modify B.blend in Blender binary?

Post by Lazareus » Wed Jul 26, 2006 2:40 am

I wanted to make a build that had some of the UI Themes built in.

I appended the blend file with the theme scripts to an empty (default) file, and then did control-U. Restarting blender showed the themes available at startup.
Then I figured out how to use datatoc.c to turn that .B.blend file into a B.blend.c file, but I noticed it was HUGE by comparison to the one in the original source. So I re-created .B.blend by saving it with compression turned on, then re-created B.blend.c - still big, but much better.

Compiling went fine, and the resulting binary was less than a meg larger than other builds, and ran okay. At first.
I realized that my .B.blend file was still there, so to get a real test, I moved it. running blender at that point resulted in a blank full-screen GL window, with an error dialog, no text, just a caution icon, until I move the mouse and it goes away.
Is the problem that I compressed the .B.blend file before converting it to C? Or have I missed something entirely?
I found instructions on using datatoc to create the splash screen, but I didn't find anything anywhere on hacking B.blend. I would also like to have the ability to provide additional screens, and this is a stopper on that too.
Can anyone point me in the right direction w/ this? I think it's a rich area for customization.
TIA! :-)

EDIT: Okay, uncompressing the .B.blend file works. However, the size of my blender binary causes me to think this method of customizing blender has drawbacks. Which leads me to propose a feature.

Blender has support for compressed .blend files.
Blender has support for creating a default .B.blend file from a chunk of itself if one does not exist.
Why not connect the 2 things? I looked at B.blend.c, and there's a lot of '0's in there. Those should compress well. :-)
The kinds of things I want to add are script files, ascii text, which should also compress well, so my custom builds won't bloat the binary size too much, and stock builds might be reduced in size a bit. No harm in that, right?
I know it's not sexy like a new modelling tool, or a new rendering engine, but it might make several things I've heard other ask about easier or even feasible. Say, store a python script in the B.blend, that runs automatically when .B.blend doesn't exist, and prompts the (obviously new) user to register. It wouldn't hurt to have some idea who's using blender and where they are. (make it optional of course...) Or that script could run a mini-tutorial, or all sorts of things.
You might decide to use the space savings to include a basic set of materials in the default blend file, so that brand new users would have say, half a dozen choices of colors in drop-down list in the materials panel.
To sum up, a lot of potential benefits are available for what might not be a lot of work.
Comments anybody? :-)

Post Reply