Human Readable Format

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

colinn
Posts: 10
Joined: Sat Jan 28, 2012 3:26 am

Human Readable Format

Postby colinn » Tue Mar 27, 2012 6:13 pm

Hi everyone.

I was doing a little poking around regarding moving away from a binary file format to an ascii file format. The motivation for this is better integration with RCS which would increase our workflow considerably. (Being able to merge blender files would be a gigantic plus)

The best approach that I can think of is using DNA / SDNA names to spit out tags for basic types and use special REF tags where needed. It would be structured something like this:

<BlenderVersion>
{
Blender-v2.61
}

<Scene> MySceneName
{
<property> gravity[3] { 0 0 0 }
...
<SceneGraph>
{
<Ref> MyObject { 1 }
}
}

<Object> MyObject
{
<uid> { 1 }
...
}

I'm not sure what to do with binary data (like textures).

I'm not that familiar with the Blender source code, but I have been able to find the code that can get the property names from SDNA stucts. I don't yet know how to get values for these property names though.

So aside from the gigantic files that this will produce, are there any other shortcomings you can think of before I fully commit to this task? Since I am not adding new information to SDNA etc this should still preserve the backwards/forwards compatibility and not require additional programming in other areas of Blender.

Thanks!
Colin

ldo
Posts: 544
Joined: Sun Nov 07, 2010 11:30 pm
Location: Hamilton, New Zealand

Postby ldo » Wed Mar 28, 2012 9:19 am

Others have suggested this over the years, so you’re not the only one to think this is a good idea. Doing it for version control is definitely a good reason.

If it’s any help, I wrote some Python code to read the Blender file format into Python structures here https://github.com/ldo/blendparser. I also started trying to write it back again.

colinn
Posts: 10
Joined: Sat Jan 28, 2012 3:26 am

Postby colinn » Wed Mar 28, 2012 3:20 pm

Thanks for the link. I'll check it out.

It definitely is a daunting task. The solution I provided above seems good to me since it shouldn't make additional work for others. I'd just need to write a general reader/parser similar to what is there with binary data.

The only changes I can think of are:

Using unique ID refs instead of pointers
Writing reading values by name

There have got to be other things I'm not considering though, which is why I am reaching out to the community for a little mentoring.


Return to “Coding Blender”

Who is online

Users browsing this forum: No registered users and 2 guests