Page 1 of 1

SDNA SpaceX modification help

Posted: Sun May 08, 2005 2:10 am
by Duoas
Hi, I'm playing around with my copy of the source a little to get comfortable with how things fit together.

I've added a flag to the SpaceText structure (an integer) but now the makesdna utility complains that the structure length is wrong.

My problem is I can't figure out what makesdna is comparing the structure length with, and where that information is stored.

A terse note in blenload\intern\genfile.c suggests that I might have to make a file named "StructDNA" with information about the new structure in it. Is this correct? If so, I have no valid example of what that file should look like (just a vaguely-typed description).

If one of you has done this before, please help!

Posted: Sun May 08, 2005 4:26 am
by stiv
You know about, right? Some useful stuff in the Development section. ... 557.0.html

Posted: Sun May 08, 2005 11:57 pm
by Duoas
Heh, yes, I've read all those quite thoroughly to no avail.

As far as I understand it, the whole point of SDNA is that the makesdna utility automatically produces the SDNA data string.

Wait, I just found the answer. I added a single int to the structure, which is a 4-byte type. I think the complaint was that that was only half the amount wanted to keep an 8-byte boundry. By adding another int blender compiled without error. (That's alright because I'll need it for bit-flags...)

The error message DNA_makesdna gave me was not particularly clear about the reason for the error... (Of course, it seems obvious now in hindsight only :? )

Thanks for the quick response though. :)

Posted: Mon May 09, 2005 2:17 am
by stiv
Duoas wrote:HAs far as I understand it, the whole point of SDNA is that the makesdna utility automatically produces the SDNA data string.
No, the key SNDA idea is that the data is aligned. But you know that now!

Posted: Mon May 09, 2005 2:57 am
by Duoas
Er, SDNA produces a bitcode which describes the data structures used in Blender. This bitstring is what gives Blender the ability to load and save .blend files with both forward and backward compatability against any other file version of Blender.

SDNA also forces 8-byte alignment for cross-platform compatability. Thus, a SunSparc and a PC can both read and write the same .blend files by directly dumping or reading memory to file. Only two filters need be applied: the SDNA bitcode to degrade/upgrade the structure gracefully, and endian-ness repair.

I know I'm a newbie here but I know my stuff and I won't flounder about unless something is particularly unclear. Please don't condescend.

Posted: Thu May 12, 2005 5:28 am
by stiv
No condescension involved.

Everyone who has trouble with SDNA has trouble for the same reason: they screwed up the alignment. This is why the "Notes on SDNA" document talks about it in some detail.

Posted: Thu May 12, 2005 6:54 am
by Duoas
Sorry about that. Don't know why I was in such a bad mood. Thanks for being so helpful. I really do appreciate it.