SDNA SpaceX modification help

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

Post Reply
Duoas
Posts: 0
Joined: Mon Apr 18, 2005 10:32 am

SDNA SpaceX modification help

Post 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!

stiv
Posts: 0
Joined: Tue Aug 05, 2003 7:58 am
Location: 45N 86W

Post by stiv »

You know about blender3d.org, right? Some useful stuff in the Development section.

http://www.blender3d.org/cms/Notes_on_SDNA.436.0.html

http://www.blender3d.org/cms/Adding_new ... 557.0.html

Duoas
Posts: 0
Joined: Mon Apr 18, 2005 10:32 am

Post 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. :)

stiv
Posts: 0
Joined: Tue Aug 05, 2003 7:58 am
Location: 45N 86W

Post 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!

Duoas
Posts: 0
Joined: Mon Apr 18, 2005 10:32 am

Post 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.

stiv
Posts: 0
Joined: Tue Aug 05, 2003 7:58 am
Location: 45N 86W

Post 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.

Duoas
Posts: 0
Joined: Mon Apr 18, 2005 10:32 am

Post 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.

Post Reply