comments translated for blenloader files
This commit is contained in:
@@ -1,4 +1,8 @@
|
|||||||
/**
|
/*
|
||||||
|
* readfile.c
|
||||||
|
*
|
||||||
|
* .blend file reading
|
||||||
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||||
@@ -28,7 +32,7 @@
|
|||||||
* Contributor(s): none yet.
|
* Contributor(s): none yet.
|
||||||
*
|
*
|
||||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||||
* .blend file reading
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
@@ -127,50 +131,52 @@
|
|||||||
#include "mydevice.h"
|
#include "mydevice.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ZWAK PUNT: newadres berekening en meerdere files: oplossen
|
Remark: still a weak point is the newadress() function, that doesnt solve reading from
|
||||||
bijvoorbeeld door per file aparte newadresarrays te maken?
|
multiple files at the same time
|
||||||
|
|
||||||
LEZEN
|
(added remark: oh, i thought that was solved? will look at that... (ton)
|
||||||
- Bestaande Library (Main) pushen of vrijgeven
|
|
||||||
- Nieuwe Main alloceren
|
READ
|
||||||
|
- Existing Library (Main) push or free
|
||||||
|
- allocate new Main
|
||||||
- load file
|
- load file
|
||||||
- read SDNA
|
- read SDNA
|
||||||
- for each LibBlock
|
- for each LibBlock
|
||||||
- read LibBlock
|
- read LibBlock
|
||||||
- als Library
|
- if a Library
|
||||||
- make a new Main
|
- make a new Main
|
||||||
- ID's eraan hangen
|
- attach ID's to it
|
||||||
- else
|
- else
|
||||||
- lees bijhorende direkte data
|
- read associated 'direct data'
|
||||||
- link direkte data (intern en aan LibBlock)
|
- link direct data (internal and to LibBlock)
|
||||||
- lees FileGlobal
|
- read FileGlobal
|
||||||
- lees USER data, als aangegeven (~/.B.blend)
|
- read USER data, only when indicated (file is ~/.B.blend)
|
||||||
- file vrijgeven
|
- free file
|
||||||
- per Library met Scene (per Main)
|
- per Library (per Main)
|
||||||
- file inlezen
|
- read file
|
||||||
- lees SDNA
|
- read SDNA
|
||||||
- alle LibBlocks uit Scene opzoeken en ID's aan Main hagen
|
- find LibBlocks and attach IDs to Main
|
||||||
- als extern LibBlock
|
- if external LibBlock
|
||||||
- zoek Main's af
|
- search all Main's
|
||||||
- is al ingelezen:
|
- or it's already read,
|
||||||
- nog niet ingelezen
|
- or not read yet
|
||||||
- of nieuwe Main maken
|
- or make new Main
|
||||||
- per LibBlock
|
- per LibBlock
|
||||||
- recursief dieper lezen
|
- read recursive
|
||||||
- lees bijhorende direkte data
|
- read associated direct data
|
||||||
- link direkte data (intern en aan LibBlock)
|
- link direct data (internal and to LibBlock)
|
||||||
- file vrijgeven
|
- free file
|
||||||
- per Library met nog niet gelezen LibBlocks
|
- per Library with unread LibBlocks
|
||||||
- file inlezen
|
- read file
|
||||||
- lees SDNA
|
- read SDNA
|
||||||
- per LibBlock
|
- per LibBlock
|
||||||
- recursief dieper lezen
|
- read recursive
|
||||||
- lees bijhorende direkte data
|
- read associated direct data
|
||||||
- link direkte data (intern en aan LibBlock)
|
- link direct data (internal and to LibBlock)
|
||||||
- file vrijgeven
|
- free file
|
||||||
- alle Main's samenvoegen
|
- join all Mains
|
||||||
- alle LibBlocks linken en indirekte pointers naar libblocks
|
- link all LibBlocks and indirect pointers to libblocks
|
||||||
- FileGlobal goedzetten en pointers naar Global kopieeren
|
- initialize FileGlobal and copy pointers to Global
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* also occurs in library.c */
|
/* also occurs in library.c */
|
||||||
@@ -370,7 +376,7 @@ static void oldnewmap_free(OldNewMap *onm) {
|
|||||||
|
|
||||||
static void read_libraries(FileData *basefd, ListBase *mainlist);
|
static void read_libraries(FileData *basefd, ListBase *mainlist);
|
||||||
|
|
||||||
/* ************ OTHER CRAP ***************** */
|
/* ************ help functions ***************** */
|
||||||
|
|
||||||
static void add_main_to_main(Main *mainvar, Main *from)
|
static void add_main_to_main(Main *mainvar, Main *from)
|
||||||
{
|
{
|
||||||
@@ -467,7 +473,7 @@ static Main *blo_find_main(ListBase *mainlist, char *name)
|
|||||||
|
|
||||||
static void switch_endian_bh4(BHead4 *bhead)
|
static void switch_endian_bh4(BHead4 *bhead)
|
||||||
{
|
{
|
||||||
/* de ID_.. codes */
|
/* the ID_.. codes */
|
||||||
if((bhead->code & 0xFFFF)==0) bhead->code >>=16;
|
if((bhead->code & 0xFFFF)==0) bhead->code >>=16;
|
||||||
|
|
||||||
if (bhead->code != ENDB) {
|
if (bhead->code != ENDB) {
|
||||||
@@ -479,7 +485,7 @@ static void switch_endian_bh4(BHead4 *bhead)
|
|||||||
|
|
||||||
static void switch_endian_bh8(BHead8 *bhead)
|
static void switch_endian_bh8(BHead8 *bhead)
|
||||||
{
|
{
|
||||||
/* de ID_.. codes */
|
/* the ID_.. codes */
|
||||||
if((bhead->code & 0xFFFF)==0) bhead->code >>=16;
|
if((bhead->code & 0xFFFF)==0) bhead->code >>=16;
|
||||||
|
|
||||||
if (bhead->code != ENDB) {
|
if (bhead->code != ENDB) {
|
||||||
@@ -890,7 +896,7 @@ static void *newlibadr(FileData *fd, void *lib, void *adr) /* only lib data */
|
|||||||
return oldnewmap_liblookup_and_inc(fd->libmap, adr, lib);
|
return oldnewmap_liblookup_and_inc(fd->libmap, adr, lib);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *newlibadr_us_type(FileData *fd, short type, void *adr) /* alleen Lib datablokken */
|
static void *newlibadr_us_type(FileData *fd, short type, void *adr) /* only Lib data */
|
||||||
{
|
{
|
||||||
ID *id= oldnewmap_typelookup_and_inc(fd->libmap, adr, type);
|
ID *id= oldnewmap_typelookup_and_inc(fd->libmap, adr, type);
|
||||||
|
|
||||||
@@ -901,7 +907,7 @@ static void *newlibadr_us_type(FileData *fd, short type, void *adr) /* alleen Li
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *newlibadr_us(FileData *fd, void *lib, void *adr) /* hoogt usernummer op */
|
static void *newlibadr_us(FileData *fd, void *lib, void *adr) /* increases user number */
|
||||||
{
|
{
|
||||||
ID *id= newlibadr(fd, lib, adr);
|
ID *id= newlibadr(fd, lib, adr);
|
||||||
|
|
||||||
@@ -926,7 +932,7 @@ static void change_libadr(FileData *fd, void *old, void *new)
|
|||||||
* Ton seemed to think it was necessary to look
|
* Ton seemed to think it was necessary to look
|
||||||
* through all entries, and not return after finding
|
* through all entries, and not return after finding
|
||||||
* a match, leaving this cryptic comment,
|
* a match, leaving this cryptic comment,
|
||||||
* // geen return blijkbaar kunnen er meer zijn?
|
* // no return, maybe there can be more?
|
||||||
*
|
*
|
||||||
* That doesn't make sense to me either but I am
|
* That doesn't make sense to me either but I am
|
||||||
* too scared to remove it... it only would make
|
* too scared to remove it... it only would make
|
||||||
@@ -941,6 +947,12 @@ static void change_libadr(FileData *fd, void *old, void *new)
|
|||||||
* but I'm afraid I don't have time now. -zr
|
* but I'm afraid I don't have time now. -zr
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
/* the code is nasty, and needs a lot of energy to get into full understanding
|
||||||
|
again... i now translate dutch comments, maybe that gives me more insight!
|
||||||
|
But i guess it has to do with the assumption that 2 addresses can be allocated
|
||||||
|
in different sessions, and therefore be the same... like the remark in the top
|
||||||
|
of this c file (ton) */
|
||||||
|
|
||||||
for (i=0; i<fd->libmap->nentries; i++) {
|
for (i=0; i<fd->libmap->nentries; i++) {
|
||||||
OldNew *entry= &fd->libmap->entries[i];
|
OldNew *entry= &fd->libmap->entries[i];
|
||||||
|
|
||||||
@@ -952,7 +964,7 @@ static void change_libadr(FileData *fd, void *old, void *new)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ********** END OUDE POINTERS ****************** */
|
/* ********** END OLD POINTERS ****************** */
|
||||||
/* ********** READ FILE ****************** */
|
/* ********** READ FILE ****************** */
|
||||||
|
|
||||||
static void switch_endian_structs(struct SDNA *filesdna, BHead *bhead)
|
static void switch_endian_structs(struct SDNA *filesdna, BHead *bhead)
|
||||||
@@ -992,7 +1004,7 @@ static void *read_struct(FileData *fd, BHead *bh)
|
|||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void link_list(FileData *fd, ListBase *lb) /* alleen direkte data */
|
static void link_list(FileData *fd, ListBase *lb) /* only direct data */
|
||||||
{
|
{
|
||||||
Link *ln, *prev;
|
Link *ln, *prev;
|
||||||
|
|
||||||
@@ -1154,7 +1166,7 @@ static void direct_link_ika(FileData *fd, Ika *ika)
|
|||||||
|
|
||||||
ika->def= newdataadr(fd, ika->def);
|
ika->def= newdataadr(fd, ika->def);
|
||||||
|
|
||||||
/* afvangen fout uit V.138 en ouder */
|
/* error from V.138 and older */
|
||||||
if(ika->def==0) ika->totdef= 0;
|
if(ika->def==0) ika->totdef= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1468,7 +1480,7 @@ static void switch_endian_keyblock(Key *key, KeyBlock *kb)
|
|||||||
cp= key->elemstr;
|
cp= key->elemstr;
|
||||||
poin= data;
|
poin= data;
|
||||||
|
|
||||||
while( cp[0] ) { /* cp[0]==aantal */
|
while( cp[0] ) { /* cp[0]==amount */
|
||||||
|
|
||||||
switch(cp[1]) { /* cp[1]= type */
|
switch(cp[1]) { /* cp[1]= type */
|
||||||
case IPO_FLOAT:
|
case IPO_FLOAT:
|
||||||
@@ -1872,7 +1884,7 @@ static void direct_link_material(FileData *fd, Material *ma)
|
|||||||
for(a=0; a<8; a++) {
|
for(a=0; a<8; a++) {
|
||||||
ma->mtex[a]= newdataadr(fd, ma->mtex[a]);
|
ma->mtex[a]= newdataadr(fd, ma->mtex[a]);
|
||||||
}
|
}
|
||||||
ma->ren= 0; /* mag niet blijven hangen, maarja */
|
ma->ren= 0; /* should not be needed, nevertheless... */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************ READ MESH ***************** */
|
/* ************ READ MESH ***************** */
|
||||||
@@ -2004,9 +2016,7 @@ static void lib_link_object(FileData *fd, Main *main)
|
|||||||
for(a=0; a<ob->totcol; a++) ob->mat[a]= newlibadr_us(fd, ob->id.lib, ob->mat[a]);
|
for(a=0; a<ob->totcol; a++) ob->mat[a]= newlibadr_us(fd, ob->id.lib, ob->mat[a]);
|
||||||
|
|
||||||
ob->id.flag -= LIB_NEEDLINK;
|
ob->id.flag -= LIB_NEEDLINK;
|
||||||
/* dit stond er eerst: weggehaald omdat de fie give_base_to... er niet meer is */
|
/* if id.us==0 a new base will be created later on */
|
||||||
/* if(ob->id.us) ob->id.flag -= LIB_NEEDLINK; */
|
|
||||||
/* als us==0 wordt verderop nog een base gemaakt */
|
|
||||||
|
|
||||||
/* WARNING! Also check expand_object(), should reflect the stuff below. */
|
/* WARNING! Also check expand_object(), should reflect the stuff below. */
|
||||||
lib_link_pose(fd, &ob->id, ob->pose);
|
lib_link_pose(fd, &ob->id, ob->pose);
|
||||||
@@ -2286,7 +2296,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
|
|||||||
|
|
||||||
ed->metastack.first= ed->metastack.last= 0;
|
ed->metastack.first= ed->metastack.last= 0;
|
||||||
|
|
||||||
/* recursief sequenties linken, ook lb wordt goedgezet */
|
/* recursive link sequences, lb will be correctly initialized */
|
||||||
link_recurs_seq(fd, &ed->seqbase);
|
link_recurs_seq(fd, &ed->seqbase);
|
||||||
|
|
||||||
ed->seqbasep= &ed->seqbase;
|
ed->seqbasep= &ed->seqbase;
|
||||||
@@ -2295,7 +2305,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
|
|||||||
seq->seq1= newdataadr(fd, seq->seq1);
|
seq->seq1= newdataadr(fd, seq->seq1);
|
||||||
seq->seq2= newdataadr(fd, seq->seq2);
|
seq->seq2= newdataadr(fd, seq->seq2);
|
||||||
seq->seq3= newdataadr(fd, seq->seq3);
|
seq->seq3= newdataadr(fd, seq->seq3);
|
||||||
/* eigenlijk een patch: na invoering drie-seq effects */
|
/* a patch: after introduction of effects with 3 input strips */
|
||||||
if(seq->seq3==0) seq->seq3= seq->seq2;
|
if(seq->seq3==0) seq->seq3= seq->seq2;
|
||||||
|
|
||||||
seq->curelem= 0;
|
seq->curelem= 0;
|
||||||
@@ -2307,7 +2317,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
|
|||||||
if(seq->strip && seq->strip->done==0) {
|
if(seq->strip && seq->strip->done==0) {
|
||||||
seq->strip->done= 1;
|
seq->strip->done= 1;
|
||||||
|
|
||||||
/* standaard: strips van effecten/meta's worden niet weggeschreven, wel malloccen */
|
/* standard: strips from effects/metas are not written, but are mallocced */
|
||||||
|
|
||||||
if(seq->type==SEQ_IMAGE) {
|
if(seq->type==SEQ_IMAGE) {
|
||||||
seq->strip->stripdata= newdataadr(fd, seq->strip->stripdata);
|
seq->strip->stripdata= newdataadr(fd, seq->strip->stripdata);
|
||||||
@@ -2320,7 +2330,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(seq->type==SEQ_MOVIE) {
|
else if(seq->type==SEQ_MOVIE) {
|
||||||
/* alleen eerste stripelem zit in file */
|
/* only first stripelem is in file */
|
||||||
se= newdataadr(fd, seq->strip->stripdata);
|
se= newdataadr(fd, seq->strip->stripdata);
|
||||||
|
|
||||||
if(se) {
|
if(se) {
|
||||||
@@ -2526,7 +2536,7 @@ static void direct_link_library(FileData *fd, Library *lib)
|
|||||||
{
|
{
|
||||||
Main *newmain;
|
Main *newmain;
|
||||||
|
|
||||||
/* nieuwe main */
|
/* new main */
|
||||||
newmain= MEM_callocN(sizeof(Main), "directlink");
|
newmain= MEM_callocN(sizeof(Main), "directlink");
|
||||||
BLI_addtail(&fd->mainlist, newmain);
|
BLI_addtail(&fd->mainlist, newmain);
|
||||||
newmain->curlib= lib;
|
newmain->curlib= lib;
|
||||||
@@ -2618,12 +2628,12 @@ static void lib_link_group(FileData *fd, Main *main)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************** ALG & MAIN ******************** */
|
/* ************** GENERAL & MAIN ******************** */
|
||||||
|
|
||||||
static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID **id_r)
|
static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID **id_r)
|
||||||
{
|
{
|
||||||
/* deze routine leest libblock en direkte data. Met linkfunkties
|
/* this routine reads a libblock and its direct data. Use link functions
|
||||||
* alles aan elkaar hangen.
|
* to connect it all
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ID *id;
|
ID *id;
|
||||||
@@ -2638,7 +2648,7 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID
|
|||||||
lb= wich_libbase(main, bhead->code);
|
lb= wich_libbase(main, bhead->code);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* libblock inlezen */
|
/* read libblock */
|
||||||
id = read_struct(fd, bhead);
|
id = read_struct(fd, bhead);
|
||||||
if (id_r)
|
if (id_r)
|
||||||
*id_r= id;
|
*id_r= id;
|
||||||
@@ -2648,21 +2658,20 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID
|
|||||||
oldnewmap_insert(fd->libmap, bhead->old, id, 1);
|
oldnewmap_insert(fd->libmap, bhead->old, id, 1);
|
||||||
BLI_addtail(lb, id);
|
BLI_addtail(lb, id);
|
||||||
|
|
||||||
/* eerste acht bits wissen */
|
/* clear first 8 bits */
|
||||||
id->flag= (id->flag & 0xFF00) | flag | LIB_NEEDLINK;
|
id->flag= (id->flag & 0xFF00) | flag | LIB_NEEDLINK;
|
||||||
id->lib= main->curlib;
|
id->lib= main->curlib;
|
||||||
if(id->flag & LIB_FAKEUSER) id->us= 1;
|
if(id->flag & LIB_FAKEUSER) id->us= 1;
|
||||||
else id->us= 0;
|
else id->us= 0;
|
||||||
|
|
||||||
/* deze mag niet door de direct_link molen: is alleen het ID deel */
|
/* this case cannot be direct_linked: it's just the ID part */
|
||||||
|
|
||||||
if(bhead->code==ID_ID) {
|
if(bhead->code==ID_ID) {
|
||||||
return blo_nextbhead(fd, bhead);
|
return blo_nextbhead(fd, bhead);
|
||||||
}
|
}
|
||||||
|
|
||||||
bhead = blo_nextbhead(fd, bhead);
|
bhead = blo_nextbhead(fd, bhead);
|
||||||
|
|
||||||
/* alle data inlezen */
|
/* read all data */
|
||||||
while(bhead && bhead->code==DATA) {
|
while(bhead && bhead->code==DATA) {
|
||||||
void *data= read_struct(fd, bhead);
|
void *data= read_struct(fd, bhead);
|
||||||
|
|
||||||
@@ -2673,7 +2682,7 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID
|
|||||||
bhead = blo_nextbhead(fd, bhead);
|
bhead = blo_nextbhead(fd, bhead);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* pointers directe data goedzetten */
|
/* init pointers direct data */
|
||||||
switch( GS(id->name) ) {
|
switch( GS(id->name) ) {
|
||||||
case ID_SCR:
|
case ID_SCR:
|
||||||
direct_link_screen(fd, (bScreen *)id);
|
direct_link_screen(fd, (bScreen *)id);
|
||||||
@@ -2805,10 +2814,10 @@ static int map_223_keybd_code_to_224_keybd_code(int code)
|
|||||||
|
|
||||||
static void do_versions(Main *main)
|
static void do_versions(Main *main)
|
||||||
{
|
{
|
||||||
/* PAS OP: pointers van libdata zijn nog niet omgezet */
|
/* watch it: pointers from libdata have not been converted */
|
||||||
|
|
||||||
if(main->versionfile == 100) {
|
if(main->versionfile == 100) {
|
||||||
/* tex->extend en tex->imageflag veranderd: */
|
/* tex->extend and tex->imageflag have changed: */
|
||||||
Tex *tex = main->tex.first;
|
Tex *tex = main->tex.first;
|
||||||
while(tex) {
|
while(tex) {
|
||||||
if(tex->id.flag & LIB_NEEDLINK) {
|
if(tex->id.flag & LIB_NEEDLINK) {
|
||||||
@@ -2840,7 +2849,7 @@ static void do_versions(Main *main)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(main->versionfile <= 102) {
|
if(main->versionfile <= 102) {
|
||||||
/* init halo's op 1.0 */
|
/* init halo's at 1.0 */
|
||||||
Material *ma = main->mat.first;
|
Material *ma = main->mat.first;
|
||||||
while(ma) {
|
while(ma) {
|
||||||
ma->add= 1.0;
|
ma->add= 1.0;
|
||||||
@@ -2848,7 +2857,7 @@ static void do_versions(Main *main)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(main->versionfile <= 103) {
|
if(main->versionfile <= 103) {
|
||||||
/* nieuwe variabele in object: colbits */
|
/* new variable in object: colbits */
|
||||||
Object *ob = main->object.first;
|
Object *ob = main->object.first;
|
||||||
int a;
|
int a;
|
||||||
while(ob) {
|
while(ob) {
|
||||||
@@ -2862,7 +2871,7 @@ static void do_versions(Main *main)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(main->versionfile <= 104) {
|
if(main->versionfile <= 104) {
|
||||||
/* de timeoffs zit op betere plek */
|
/* timeoffs moved */
|
||||||
Object *ob = main->object.first;
|
Object *ob = main->object.first;
|
||||||
while(ob) {
|
while(ob) {
|
||||||
if(ob->transflag & 1) {
|
if(ob->transflag & 1) {
|
||||||
@@ -2881,7 +2890,7 @@ static void do_versions(Main *main)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(main->versionfile <= 106) {
|
if(main->versionfile <= 106) {
|
||||||
/* mcol is veranderd */
|
/* mcol changed */
|
||||||
Mesh *me = main->mesh.first;
|
Mesh *me = main->mesh.first;
|
||||||
while(me) {
|
while(me) {
|
||||||
if(me->mcol) vcol_to_fcol(me);
|
if(me->mcol) vcol_to_fcol(me);
|
||||||
@@ -2905,7 +2914,7 @@ static void do_versions(Main *main)
|
|||||||
|
|
||||||
}
|
}
|
||||||
if(main->versionfile <= 109) {
|
if(main->versionfile <= 109) {
|
||||||
/* nieuwe variabele: gridlines */
|
/* new variable: gridlines */
|
||||||
bScreen *sc = main->screen.first;
|
bScreen *sc = main->screen.first;
|
||||||
while(sc) {
|
while(sc) {
|
||||||
ScrArea *sa= sc->areabase.first;
|
ScrArea *sa= sc->areabase.first;
|
||||||
@@ -2945,7 +2954,7 @@ static void do_versions(Main *main)
|
|||||||
MFace *mface;
|
MFace *mface;
|
||||||
int a_int;
|
int a_int;
|
||||||
|
|
||||||
/* edge drawflags veranderd */
|
/* edge drawflags changed */
|
||||||
while(me) {
|
while(me) {
|
||||||
a_int= me->totface;
|
a_int= me->totface;
|
||||||
mface= me->mface;
|
mface= me->mface;
|
||||||
@@ -2960,74 +2969,8 @@ static void do_versions(Main *main)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eentje overgeslagen voor bug in freeware versie */
|
|
||||||
|
|
||||||
if(main->versionfile <= 121) {
|
|
||||||
/* O2 versie gemaakt. */
|
|
||||||
}
|
|
||||||
if(main->versionfile <= 122) {
|
|
||||||
/* dithering gaat soms af (backbuf, pas sinds 121) */
|
|
||||||
/* relatieve paden hersteld */
|
|
||||||
/* sequences: endframe van seq wordt op betere plek geprint */
|
|
||||||
}
|
|
||||||
if(main->versionfile <= 123) {
|
|
||||||
/* nog een paar O2 foutjes: keylines in ipo window */
|
|
||||||
/* vertices halo object (O2) nu ook goed */
|
|
||||||
/* zoomwin: ook op O2 */
|
|
||||||
/* bug eruit: schaduw render in ortho */
|
|
||||||
}
|
|
||||||
if(main->versionfile <= 124) {
|
|
||||||
/* inventor lezer */
|
|
||||||
/* key kleur 24 bits beveiligd */
|
|
||||||
/* schrijf plaatje: je kun niet naderhand 24bits naar 32
|
|
||||||
* omzetten */
|
|
||||||
}
|
|
||||||
if(main->versionfile <= 125) {
|
|
||||||
/* bug vanwege compileer fout (makefile/.h dependency)*/
|
|
||||||
}
|
|
||||||
if(main->versionfile <= 126) {
|
|
||||||
/* overdraw text beter (clever numbuts) */
|
|
||||||
/* bug uit inventor lezer: node ambientColor werd niet
|
|
||||||
* herkend */
|
|
||||||
/* bugje uit toolbox: clear loc= alt-g */
|
|
||||||
}
|
|
||||||
|
|
||||||
if(main->versionfile <= 131) {
|
|
||||||
/* jpeq quality button */
|
|
||||||
/* anim5 and blacksmith demo */
|
|
||||||
/* foutje uit transp zbuf: te vroege afbreek */
|
|
||||||
/* geen paarse code meer als imap onvindbaar is meer */
|
|
||||||
/* locx werd niet geprint: string overflow! */
|
|
||||||
/* unieke namen: werkte niet */
|
|
||||||
/* toolbox menu: ook alt en ctrl keys */
|
|
||||||
}
|
|
||||||
if(main->versionfile <= 132) {
|
|
||||||
/* strings in Userdef: eroverheen! */
|
|
||||||
/* betere overdraw implementatie (numbuts) */
|
|
||||||
/* snapmenu redraw */
|
|
||||||
/* warp met 1 vertex */
|
|
||||||
}
|
|
||||||
if(main->versionfile <= 133) {
|
|
||||||
/* bug uit 'make edge face' (array overflow */
|
|
||||||
/* volledig X getekende menu's */
|
|
||||||
/* storage.c terug */
|
|
||||||
}
|
|
||||||
if(main->versionfile <= 134) {
|
if(main->versionfile <= 134) {
|
||||||
/* Play (flipbook) restored */
|
|
||||||
/* Timecursor restored */
|
|
||||||
/* Debug option -d; prints a lot of info in console */
|
|
||||||
/* Text Object. Accentcodes fixed: ALT+BACKSPACE */
|
|
||||||
/* Cursor was sometimes wrong after reading files */
|
|
||||||
/* Texspace draw error: dashed lines */
|
|
||||||
/* Draw Schematic View now with icons in Objects */
|
|
||||||
/* Ortho camera: zbuffer improved. Near/far still not OK */
|
|
||||||
/* Text Object. Character pound= alt-l */
|
|
||||||
/* In editmode and 'set', draw error fixed. */
|
|
||||||
/* Scanline display during rendering had dropouts */
|
|
||||||
/* Sometimes-after render- frontbuffer drawing wasnt disabled */
|
|
||||||
/* Sometimes the render window got black and Blender 'hung' */
|
|
||||||
/* Better 'active window' implementation. */
|
|
||||||
/* Automatic name was too critical, more intuitive now */
|
|
||||||
Tex *tex = main->tex.first;
|
Tex *tex = main->tex.first;
|
||||||
while (tex) {
|
while (tex) {
|
||||||
if ((tex->rfac == 0.0) &&
|
if ((tex->rfac == 0.0) &&
|
||||||
@@ -3041,39 +2984,6 @@ static void do_versions(Main *main)
|
|||||||
tex = tex->id.next;
|
tex = tex->id.next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(main->versionfile <= 135) {
|
|
||||||
/* 'Windows' key resistant */
|
|
||||||
/* Preview-render: RGB flip (material, lamp, world) */
|
|
||||||
/* Fileselect draw error: 2nd time no redraw! */
|
|
||||||
/* Names error: names were not unique automatically */
|
|
||||||
/* Metaball display error: because of previous */
|
|
||||||
/* CTRL and ALT and SHIFT keys sometimes were locked */
|
|
||||||
}
|
|
||||||
if(main->versionfile <= 136) {
|
|
||||||
/* Files incompatibility Colorband PC-SGI solved */
|
|
||||||
/* RightMouse selecting was blocked after border-select */
|
|
||||||
/* Border select: print size */
|
|
||||||
/* Inventor: reads some 2.0 syntaxes too. Under development */
|
|
||||||
/* Shift/Ctrl/Alt release events got lost while moving view */
|
|
||||||
/* Particles draw (size) error fixed */
|
|
||||||
/* Display type 'DispView' works */
|
|
||||||
/* Metaballs convert to Mesh, normals error fixed. */
|
|
||||||
}
|
|
||||||
if(main->versionfile <= 137) {
|
|
||||||
/* who know */
|
|
||||||
}
|
|
||||||
if(main->versionfile <= 138) {
|
|
||||||
/* fixed: z buffer draw and Mesh with no materials: coredump! */
|
|
||||||
/* bug removed from calculation 3D Bevel Objects */
|
|
||||||
/* view translation in perspective fixed */
|
|
||||||
/* Drawing with ortho camera fixed */
|
|
||||||
/* timing error FreeBSD version fixed */
|
|
||||||
/* Mesa 3.0 included in static version */
|
|
||||||
/* New: LeftMouse+RightMouse allowed at numerber-button
|
|
||||||
* to type in values */
|
|
||||||
/* Vertex paint bug fixed */
|
|
||||||
/* New: ALT+(1, 2, 3...) for layers 11, 12, 13... */
|
|
||||||
}
|
|
||||||
if(main->versionfile <= 140) {
|
if(main->versionfile <= 140) {
|
||||||
/* r-g-b-fac in texure */
|
/* r-g-b-fac in texure */
|
||||||
Tex *tex = main->tex.first;
|
Tex *tex = main->tex.first;
|
||||||
@@ -3766,7 +3676,7 @@ static void do_versions(Main *main)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* onder in blender.c de nummers wijzigen! */
|
/* don't forget to set version number in blender.c! */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lib_link_all(FileData *fd, Main *main)
|
static void lib_link_all(FileData *fd, Main *main)
|
||||||
@@ -3793,9 +3703,9 @@ static void lib_link_all(FileData *fd, Main *main)
|
|||||||
lib_link_action(fd, main);
|
lib_link_action(fd, main);
|
||||||
lib_link_vfont(fd, main);
|
lib_link_vfont(fd, main);
|
||||||
|
|
||||||
lib_link_mesh(fd, main); /* als laatste: tpage images met users op nul */
|
lib_link_mesh(fd, main); /* as last: tpage images with users at zero */
|
||||||
|
|
||||||
lib_link_library(fd, main); /* alleen users goedzetten */
|
lib_link_library(fd, main); /* only init users */
|
||||||
}
|
}
|
||||||
|
|
||||||
BlendFileData *blo_read_file_internal(FileData *fd, BlendReadError *error_r)
|
BlendFileData *blo_read_file_internal(FileData *fd, BlendReadError *error_r)
|
||||||
@@ -3851,7 +3761,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, BlendReadError *error_r)
|
|||||||
blo_join_main(&fd->mainlist);
|
blo_join_main(&fd->mainlist);
|
||||||
|
|
||||||
lib_link_all(fd, bfd->main);
|
lib_link_all(fd, bfd->main);
|
||||||
link_global(fd, bfd, fg); /* als laatste */
|
link_global(fd, bfd, fg); /* as last */
|
||||||
|
|
||||||
if (!bfd->curscreen)
|
if (!bfd->curscreen)
|
||||||
bfd->curscreen= bfd->main->screen.first;
|
bfd->curscreen= bfd->main->screen.first;
|
||||||
@@ -3960,7 +3870,7 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
oldnewmap_insert(fd->libmap, bhead->old, id, 1);
|
oldnewmap_insert(fd->libmap, bhead->old, id, 1);
|
||||||
/* printf("expand: al ingelezen %s\n", id->name); */
|
/* printf("expand: already read %s\n", id->name); */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4356,7 +4266,7 @@ static void give_base_to_objects(Scene *sce, ListBase *lb)
|
|||||||
Object *ob;
|
Object *ob;
|
||||||
Base *base;
|
Base *base;
|
||||||
|
|
||||||
/* alle objects die LIB_EXTERN en LIB_NEEDLINK zijn, een base geven */
|
/* give all objects which are LIB_EXTERN and LIB_NEEDLINK a base */
|
||||||
ob= lb->first;
|
ob= lb->first;
|
||||||
while(ob) {
|
while(ob) {
|
||||||
|
|
||||||
@@ -4416,7 +4326,7 @@ static void append_named_part(SpaceFile *sfile, Main *mainvar, Scene *scene, cha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(idcode==ID_OB) { /* los object: base geven */
|
if(idcode==ID_OB) { /* loose object: give a base */
|
||||||
base= MEM_callocN( sizeof(Base), "app_nam_part");
|
base= MEM_callocN( sizeof(Base), "app_nam_part");
|
||||||
BLI_addtail(&scene->base, base);
|
BLI_addtail(&scene->base, base);
|
||||||
|
|
||||||
@@ -4457,7 +4367,7 @@ static void append_id_part(FileData *fd, Main *mainvar, ID *id, ID **id_r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* append aan G.scene */
|
/* append to G.scene */
|
||||||
void BLO_library_append(SpaceFile *sfile, char *dir, int idcode)
|
void BLO_library_append(SpaceFile *sfile, char *dir, int idcode)
|
||||||
{
|
{
|
||||||
FileData *fd= (FileData*) sfile->libfiledata;
|
FileData *fd= (FileData*) sfile->libfiledata;
|
||||||
@@ -4465,7 +4375,7 @@ void BLO_library_append(SpaceFile *sfile, char *dir, int idcode)
|
|||||||
Main *mainl;
|
Main *mainl;
|
||||||
int a, totsel=0;
|
int a, totsel=0;
|
||||||
|
|
||||||
/* zijn er geselecteerde files? */
|
/* are there files selected? */
|
||||||
for(a=0; a<sfile->totfile; a++) {
|
for(a=0; a<sfile->totfile; a++) {
|
||||||
if(sfile->filelist[a].flags & ACTIVE) {
|
if(sfile->filelist[a].flags & ACTIVE) {
|
||||||
totsel++;
|
totsel++;
|
||||||
@@ -4473,7 +4383,7 @@ void BLO_library_append(SpaceFile *sfile, char *dir, int idcode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(totsel==0) {
|
if(totsel==0) {
|
||||||
/* is de aangegeven file in de filelist? */
|
/* is the indicated file in the filelist? */
|
||||||
if(sfile->file[0]) {
|
if(sfile->file[0]) {
|
||||||
for(a=0; a<sfile->totfile; a++) {
|
for(a=0; a<sfile->totfile; a++) {
|
||||||
if( strcmp(sfile->filelist[a].relname, sfile->file)==0) break;
|
if( strcmp(sfile->filelist[a].relname, sfile->file)==0) break;
|
||||||
@@ -4488,15 +4398,15 @@ void BLO_library_append(SpaceFile *sfile, char *dir, int idcode)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* nu hebben OF geselecteerde, OF 1 aangegeven file */
|
/* now we have or selected, or an indicated file */
|
||||||
|
|
||||||
mainlist.first= mainlist.last= G.main;
|
mainlist.first= mainlist.last= G.main;
|
||||||
G.main->next= NULL;
|
G.main->next= NULL;
|
||||||
|
|
||||||
/* mains maken */
|
/* make mains */
|
||||||
blo_split_main(&mainlist);
|
blo_split_main(&mainlist);
|
||||||
|
|
||||||
/* welke moeten wij hebben? */
|
/* which one do we need? */
|
||||||
mainl = blo_find_main(&mainlist, dir);
|
mainl = blo_find_main(&mainlist, dir);
|
||||||
|
|
||||||
if(totsel==0) {
|
if(totsel==0) {
|
||||||
@@ -4510,10 +4420,10 @@ void BLO_library_append(SpaceFile *sfile, char *dir, int idcode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* de main consistent maken */
|
/* make main consistant */
|
||||||
expand_main(fd, mainl);
|
expand_main(fd, mainl);
|
||||||
|
|
||||||
/* als expand nog andere libs gevonden heeft: */
|
/* do this when expand found other libs */
|
||||||
read_libraries(fd, &mainlist);
|
read_libraries(fd, &mainlist);
|
||||||
|
|
||||||
blo_join_main(&mainlist);
|
blo_join_main(&mainlist);
|
||||||
@@ -4521,14 +4431,11 @@ void BLO_library_append(SpaceFile *sfile, char *dir, int idcode)
|
|||||||
|
|
||||||
lib_link_all(fd, G.main);
|
lib_link_all(fd, G.main);
|
||||||
|
|
||||||
/* losse objects aan G.scene hangen deze hebben nog een linkflag
|
/* give a base to loose objects */
|
||||||
moet na lib_link ivm gelinkte scenes (ob->us==0) */
|
|
||||||
|
|
||||||
/* indirecte objects kunnen geen kwaad */
|
|
||||||
/* als je deze terugzet, denk aan de 'need_link' flag: doe een find naar 'give_base_to' */
|
|
||||||
/* give_base_to_objects(G.scene, &(G.main->object)); */
|
/* give_base_to_objects(G.scene, &(G.main->object)); */
|
||||||
|
/* has been removed... erm, why? (ton) */
|
||||||
|
|
||||||
/* voorlopige patch om te voorkomen dat de switch_endian 2x gebeurt */
|
/* patch to prevent switch_endian happens twice */
|
||||||
if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
|
if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
|
||||||
blo_freefiledata((FileData*) sfile->libfiledata);
|
blo_freefiledata((FileData*) sfile->libfiledata);
|
||||||
sfile->libfiledata= 0;
|
sfile->libfiledata= 0;
|
||||||
@@ -4563,7 +4470,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
|
|||||||
while(doit) {
|
while(doit) {
|
||||||
doit= 0;
|
doit= 0;
|
||||||
|
|
||||||
/* test 1: inlezen libdata */
|
/* test 1: read libdata */
|
||||||
mainptr= main->next;
|
mainptr= main->next;
|
||||||
|
|
||||||
while(mainptr) {
|
while(mainptr) {
|
||||||
@@ -4620,7 +4527,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
|
|||||||
}
|
}
|
||||||
mainptr= main->next;
|
mainptr= main->next;
|
||||||
while(mainptr) {
|
while(mainptr) {
|
||||||
/* test of er libblocken niet zijn gelezen */
|
/* test if there are unread libblocks */
|
||||||
a= set_listbasepointers(mainptr, lbarray);
|
a= set_listbasepointers(mainptr, lbarray);
|
||||||
while(a--) {
|
while(a--) {
|
||||||
ID *id= lbarray[a]->first;
|
ID *id= lbarray[a]->first;
|
||||||
@@ -4638,8 +4545,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sommige mains moeten nog worden ingelezen, dan is
|
/* some mains still have to be read, then
|
||||||
* versionfile nog nul! */
|
* versionfile is still zero! */
|
||||||
if(mainptr->versionfile) do_versions(mainptr);
|
if(mainptr->versionfile) do_versions(mainptr);
|
||||||
|
|
||||||
if(mainptr->curlib->filedata) blo_freefiledata(mainptr->curlib->filedata);
|
if(mainptr->curlib->filedata) blo_freefiledata(mainptr->curlib->filedata);
|
||||||
|
@@ -1,4 +1,7 @@
|
|||||||
/**
|
/* writefile.c
|
||||||
|
*
|
||||||
|
* .blend file writing
|
||||||
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||||
@@ -28,52 +31,54 @@
|
|||||||
* Contributor(s): none yet.
|
* Contributor(s): none yet.
|
||||||
*
|
*
|
||||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||||
* .blend file writing
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
MIXED MODEL
|
FILEFORMAT: IFF-style structure (but not IFF compatible!)
|
||||||
FILEFORMAAT: IFF-achtige structuur (niet meer IFF compatible!)
|
|
||||||
|
|
||||||
start file:
|
start file:
|
||||||
BLENDER_V100 12 bytes (versie 1.00)
|
BLENDER_V100 12 bytes (versie 1.00)
|
||||||
V = big endian, v = little endian
|
V = big endian, v = little endian
|
||||||
_ = 4 byte pointer, - = 8 byte pointer
|
_ = 4 byte pointer, - = 8 byte pointer
|
||||||
|
|
||||||
datablokken: zie ook struct BHead
|
datablocks: also see struct BHead
|
||||||
<bh.code> 4 chars
|
<bh.code> 4 chars
|
||||||
<bh.len> int, len data achter BHead
|
<bh.len> int, len data after BHead
|
||||||
<bh.old> void, oude pointer
|
<bh.old> void, old pointer
|
||||||
<bh.SDNAnr> int
|
<bh.SDNAnr> int
|
||||||
<bh.nr> int, bij array: aantal structs
|
<bh.nr> int, in case of array: amount of structs
|
||||||
data
|
data
|
||||||
...
|
...
|
||||||
...
|
...
|
||||||
|
|
||||||
Vrijwel alle data in blender zijn structs. Elke struct krijgt
|
Almost all data in Blender are structures. Each struct saved
|
||||||
een BHead header mee. Met BHead kan de struktuur weer worden
|
gets a BHead header. With BHead the struct can be linked again
|
||||||
gelinkt en wordt met StructDNA vergeleken.
|
and compared with StructDNA .
|
||||||
|
|
||||||
SCHRIJVEN
|
WRITE
|
||||||
|
|
||||||
Voorkeur volgorde schrijven: (waarschijnlijk mag ook door
|
Preferred writing order: (not really a must, but why would you do it random?)
|
||||||
elkaar, maar waarom zou je? ) In ieder geval MOET indirekte data
|
Any case: direct data is ALWAYS after the lib block
|
||||||
ACHTER LibBlock
|
|
||||||
|
|
||||||
(Locale data)
|
(Local file data)
|
||||||
- voor elk LibBlock
|
- for each LibBlock
|
||||||
- schrijf LibBlock
|
- write LibBlock
|
||||||
- schrijf bijhorende direkte data
|
- write associated direct data
|
||||||
(Externe data)
|
(External file data)
|
||||||
- per library
|
- per library
|
||||||
- schrijf library block
|
- write library block
|
||||||
- per LibBlock
|
- per LibBlock
|
||||||
- schrijf ID LibBlock
|
- write the ID of LibBlock
|
||||||
- schrijf FileGlobal (een selectie uit globale data )
|
- write FileGlobal (some global vars)
|
||||||
- schrijf SDNA
|
- write SDNA
|
||||||
- schrijf USER als aangegeven (~/.B.blend)
|
- write USER if filename is ~/.B.blend
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* for version 2.2+
|
||||||
|
Important to know is that 'streaming' has been added to files, for Blender Publisher
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -399,7 +404,7 @@ static void writestruct(WriteData *wd, int filecode, char *structname, int nr, v
|
|||||||
|
|
||||||
if(adr==0 || nr==0) return;
|
if(adr==0 || nr==0) return;
|
||||||
|
|
||||||
/* BHead vullen met data */
|
/* init BHead */
|
||||||
bh.code= filecode;
|
bh.code= filecode;
|
||||||
bh.old= adr;
|
bh.old= adr;
|
||||||
bh.nr= nr;
|
bh.nr= nr;
|
||||||
@@ -419,7 +424,7 @@ static void writestruct(WriteData *wd, int filecode, char *structname, int nr, v
|
|||||||
mywrite(wd, adr, bh.len);
|
mywrite(wd, adr, bh.len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void writedata(WriteData *wd, int filecode, int len, void *adr) /* geen struct */
|
static void writedata(WriteData *wd, int filecode, int len, void *adr) /* do not use for structs */
|
||||||
{
|
{
|
||||||
BHead bh;
|
BHead bh;
|
||||||
|
|
||||||
@@ -429,7 +434,7 @@ static void writedata(WriteData *wd, int filecode, int len, void *adr) /* geen s
|
|||||||
len+= 3;
|
len+= 3;
|
||||||
len-= ( len % 4);
|
len-= ( len % 4);
|
||||||
|
|
||||||
/* BHead vullen met data */
|
/* init BHead */
|
||||||
bh.code= filecode;
|
bh.code= filecode;
|
||||||
bh.old= adr;
|
bh.old= adr;
|
||||||
bh.nr= 1;
|
bh.nr= 1;
|
||||||
@@ -446,7 +451,7 @@ static void write_scriptlink(WriteData *wd, ScriptLink *slink)
|
|||||||
writedata(wd, DATA, sizeof(short)*slink->totscript, slink->flag);
|
writedata(wd, DATA, sizeof(short)*slink->totscript, slink->flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void write_renderinfo(WriteData *wd) /* alleen voor renderdaemon */
|
static void write_renderinfo(WriteData *wd) /* for renderdaemon */
|
||||||
{
|
{
|
||||||
Scene *sce;
|
Scene *sce;
|
||||||
int data[8];
|
int data[8];
|
||||||
@@ -729,10 +734,10 @@ static void write_objects(WriteData *wd, ListBase *idbase)
|
|||||||
ob= idbase->first;
|
ob= idbase->first;
|
||||||
while(ob) {
|
while(ob) {
|
||||||
if(ob->id.us>0) {
|
if(ob->id.us>0) {
|
||||||
/* schrijf LibData */
|
/* write LibData */
|
||||||
writestruct(wd, ID_OB, "Object", 1, ob);
|
writestruct(wd, ID_OB, "Object", 1, ob);
|
||||||
|
|
||||||
/* alle direkte data */
|
/* direct data */
|
||||||
writedata(wd, DATA, sizeof(void *)*ob->totcol, ob->mat);
|
writedata(wd, DATA, sizeof(void *)*ob->totcol, ob->mat);
|
||||||
write_effects(wd, &ob->effect);
|
write_effects(wd, &ob->effect);
|
||||||
write_properties(wd, &ob->prop);
|
write_properties(wd, &ob->prop);
|
||||||
@@ -759,10 +764,10 @@ static void write_vfonts(WriteData *wd, ListBase *idbase)
|
|||||||
vf= idbase->first;
|
vf= idbase->first;
|
||||||
while(vf) {
|
while(vf) {
|
||||||
if(vf->id.us>0) {
|
if(vf->id.us>0) {
|
||||||
/* schrijf LibData */
|
/* write LibData */
|
||||||
writestruct(wd, ID_VF, "VFont", 1, vf);
|
writestruct(wd, ID_VF, "VFont", 1, vf);
|
||||||
|
|
||||||
/* alle direkte data */
|
/* direct data */
|
||||||
|
|
||||||
if (vf->packedfile) {
|
if (vf->packedfile) {
|
||||||
pf = vf->packedfile;
|
pf = vf->packedfile;
|
||||||
@@ -783,10 +788,10 @@ static void write_ipos(WriteData *wd, ListBase *idbase)
|
|||||||
ipo= idbase->first;
|
ipo= idbase->first;
|
||||||
while(ipo) {
|
while(ipo) {
|
||||||
if(ipo->id.us>0) {
|
if(ipo->id.us>0) {
|
||||||
/* schrijf LibData */
|
/* write LibData */
|
||||||
writestruct(wd, ID_IP, "Ipo", 1, ipo);
|
writestruct(wd, ID_IP, "Ipo", 1, ipo);
|
||||||
|
|
||||||
/* alle direkte data */
|
/* direct data */
|
||||||
icu= ipo->curve.first;
|
icu= ipo->curve.first;
|
||||||
while(icu) {
|
while(icu) {
|
||||||
writestruct(wd, DATA, "IpoCurve", 1, icu);
|
writestruct(wd, DATA, "IpoCurve", 1, icu);
|
||||||
@@ -813,10 +818,10 @@ static void write_keys(WriteData *wd, ListBase *idbase)
|
|||||||
key= idbase->first;
|
key= idbase->first;
|
||||||
while(key) {
|
while(key) {
|
||||||
if(key->id.us>0) {
|
if(key->id.us>0) {
|
||||||
/* schrijf LibData */
|
/* write LibData */
|
||||||
writestruct(wd, ID_KE, "Key", 1, key);
|
writestruct(wd, ID_KE, "Key", 1, key);
|
||||||
|
|
||||||
/* alle direkte data */
|
/* direct data */
|
||||||
kb= key->block.first;
|
kb= key->block.first;
|
||||||
while(kb) {
|
while(kb) {
|
||||||
writestruct(wd, DATA, "KeyBlock", 1, kb);
|
writestruct(wd, DATA, "KeyBlock", 1, kb);
|
||||||
@@ -836,10 +841,10 @@ static void write_cameras(WriteData *wd, ListBase *idbase)
|
|||||||
cam= idbase->first;
|
cam= idbase->first;
|
||||||
while(cam) {
|
while(cam) {
|
||||||
if(cam->id.us>0) {
|
if(cam->id.us>0) {
|
||||||
/* schrijf LibData */
|
/* write LibData */
|
||||||
writestruct(wd, ID_CA, "Camera", 1, cam);
|
writestruct(wd, ID_CA, "Camera", 1, cam);
|
||||||
|
|
||||||
/* alle direkte data */
|
/* direct data */
|
||||||
write_scriptlink(wd, &cam->scriptlink);
|
write_scriptlink(wd, &cam->scriptlink);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -855,10 +860,10 @@ static void write_mballs(WriteData *wd, ListBase *idbase)
|
|||||||
mb= idbase->first;
|
mb= idbase->first;
|
||||||
while(mb) {
|
while(mb) {
|
||||||
if(mb->id.us>0) {
|
if(mb->id.us>0) {
|
||||||
/* schrijf LibData */
|
/* write LibData */
|
||||||
writestruct(wd, ID_MB, "MetaBall", 1, mb);
|
writestruct(wd, ID_MB, "MetaBall", 1, mb);
|
||||||
|
|
||||||
/* alle direkte data */
|
/* direct data */
|
||||||
writedata(wd, DATA, sizeof(void *)*mb->totcol, mb->mat);
|
writedata(wd, DATA, sizeof(void *)*mb->totcol, mb->mat);
|
||||||
|
|
||||||
ml= mb->elems.first;
|
ml= mb->elems.first;
|
||||||
@@ -879,17 +884,17 @@ static void write_curves(WriteData *wd, ListBase *idbase)
|
|||||||
cu= idbase->first;
|
cu= idbase->first;
|
||||||
while(cu) {
|
while(cu) {
|
||||||
if(cu->id.us>0) {
|
if(cu->id.us>0) {
|
||||||
/* schrijf LibData */
|
/* write LibData */
|
||||||
writestruct(wd, ID_CU, "Curve", 1, cu);
|
writestruct(wd, ID_CU, "Curve", 1, cu);
|
||||||
|
|
||||||
/* alle direkte data */
|
/* direct data */
|
||||||
writedata(wd, DATA, sizeof(void *)*cu->totcol, cu->mat);
|
writedata(wd, DATA, sizeof(void *)*cu->totcol, cu->mat);
|
||||||
|
|
||||||
if(cu->vfont) {
|
if(cu->vfont) {
|
||||||
writedata(wd, DATA, cu->len+1, cu->str);
|
writedata(wd, DATA, cu->len+1, cu->str);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* is ook volgorde van inlezen */
|
/* is also the order of reading */
|
||||||
nu= cu->nurb.first;
|
nu= cu->nurb.first;
|
||||||
while(nu) {
|
while(nu) {
|
||||||
writestruct(wd, DATA, "Nurb", 1, nu);
|
writestruct(wd, DATA, "Nurb", 1, nu);
|
||||||
@@ -935,10 +940,10 @@ static void write_meshs(WriteData *wd, ListBase *idbase)
|
|||||||
mesh= idbase->first;
|
mesh= idbase->first;
|
||||||
while(mesh) {
|
while(mesh) {
|
||||||
if(mesh->id.us>0) {
|
if(mesh->id.us>0) {
|
||||||
/* schrijf LibData */
|
/* write LibData */
|
||||||
writestruct(wd, ID_ME, "Mesh", 1, mesh);
|
writestruct(wd, ID_ME, "Mesh", 1, mesh);
|
||||||
|
|
||||||
/* alle direkte data */
|
/* direct data */
|
||||||
writedata(wd, DATA, sizeof(void *)*mesh->totcol, mesh->mat);
|
writedata(wd, DATA, sizeof(void *)*mesh->totcol, mesh->mat);
|
||||||
writestruct(wd, DATA, "MVert", mesh->totvert, mesh->mvert);
|
writestruct(wd, DATA, "MVert", mesh->totvert, mesh->mvert);
|
||||||
write_dverts(wd, mesh->totvert, mesh->dvert);
|
write_dverts(wd, mesh->totvert, mesh->dvert);
|
||||||
@@ -960,7 +965,7 @@ static void write_images(WriteData *wd, ListBase *idbase)
|
|||||||
ima= idbase->first;
|
ima= idbase->first;
|
||||||
while(ima) {
|
while(ima) {
|
||||||
if(ima->id.us>0) {
|
if(ima->id.us>0) {
|
||||||
/* schrijf LibData */
|
/* write LibData */
|
||||||
writestruct(wd, ID_IM, "Image", 1, ima);
|
writestruct(wd, ID_IM, "Image", 1, ima);
|
||||||
|
|
||||||
if (ima->packedfile) {
|
if (ima->packedfile) {
|
||||||
@@ -980,10 +985,10 @@ static void write_textures(WriteData *wd, ListBase *idbase)
|
|||||||
tex= idbase->first;
|
tex= idbase->first;
|
||||||
while(tex) {
|
while(tex) {
|
||||||
if(tex->id.us>0) {
|
if(tex->id.us>0) {
|
||||||
/* schrijf LibData */
|
/* write LibData */
|
||||||
writestruct(wd, ID_TE, "Tex", 1, tex);
|
writestruct(wd, ID_TE, "Tex", 1, tex);
|
||||||
|
|
||||||
/* alle direkte data */
|
/* direct data */
|
||||||
if(tex->plugin) writestruct(wd, DATA, "PluginTex", 1, tex->plugin);
|
if(tex->plugin) writestruct(wd, DATA, "PluginTex", 1, tex->plugin);
|
||||||
if(tex->coba) writestruct(wd, DATA, "ColorBand", 1, tex->coba);
|
if(tex->coba) writestruct(wd, DATA, "ColorBand", 1, tex->coba);
|
||||||
if(tex->env) writestruct(wd, DATA, "EnvMap", 1, tex->env);
|
if(tex->env) writestruct(wd, DATA, "EnvMap", 1, tex->env);
|
||||||
@@ -1000,7 +1005,7 @@ static void write_materials(WriteData *wd, ListBase *idbase)
|
|||||||
ma= idbase->first;
|
ma= idbase->first;
|
||||||
while(ma) {
|
while(ma) {
|
||||||
if(ma->id.us>0) {
|
if(ma->id.us>0) {
|
||||||
/* schrijf LibData */
|
/* write LibData */
|
||||||
writestruct(wd, ID_MA, "Material", 1, ma);
|
writestruct(wd, ID_MA, "Material", 1, ma);
|
||||||
|
|
||||||
for(a=0; a<8; a++) {
|
for(a=0; a<8; a++) {
|
||||||
@@ -1021,7 +1026,7 @@ static void write_worlds(WriteData *wd, ListBase *idbase)
|
|||||||
wrld= idbase->first;
|
wrld= idbase->first;
|
||||||
while(wrld) {
|
while(wrld) {
|
||||||
if(wrld->id.us>0) {
|
if(wrld->id.us>0) {
|
||||||
/* schrijf LibData */
|
/* write LibData */
|
||||||
writestruct(wd, ID_WO, "World", 1, wrld);
|
writestruct(wd, ID_WO, "World", 1, wrld);
|
||||||
|
|
||||||
for(a=0; a<8; a++) {
|
for(a=0; a<8; a++) {
|
||||||
@@ -1042,10 +1047,10 @@ static void write_lamps(WriteData *wd, ListBase *idbase)
|
|||||||
la= idbase->first;
|
la= idbase->first;
|
||||||
while(la) {
|
while(la) {
|
||||||
if(la->id.us>0) {
|
if(la->id.us>0) {
|
||||||
/* schrijf LibData */
|
/* write LibData */
|
||||||
writestruct(wd, ID_LA, "Lamp", 1, la);
|
writestruct(wd, ID_LA, "Lamp", 1, la);
|
||||||
|
|
||||||
/* alle direkte data */
|
/* direct data */
|
||||||
for(a=0; a<8; a++) {
|
for(a=0; a<8; a++) {
|
||||||
if(la->mtex[a]) writestruct(wd, DATA, "MTex", 1, la->mtex[a]);
|
if(la->mtex[a]) writestruct(wd, DATA, "MTex", 1, la->mtex[a]);
|
||||||
}
|
}
|
||||||
@@ -1063,10 +1068,10 @@ static void write_lattices(WriteData *wd, ListBase *idbase)
|
|||||||
lt= idbase->first;
|
lt= idbase->first;
|
||||||
while(lt) {
|
while(lt) {
|
||||||
if(lt->id.us>0) {
|
if(lt->id.us>0) {
|
||||||
/* schrijf LibData */
|
/* write LibData */
|
||||||
writestruct(wd, ID_LT, "Lattice", 1, lt);
|
writestruct(wd, ID_LT, "Lattice", 1, lt);
|
||||||
|
|
||||||
/* alle direkte data */
|
/* direct data */
|
||||||
writestruct(wd, DATA, "BPoint", lt->pntsu*lt->pntsv*lt->pntsw, lt->def);
|
writestruct(wd, DATA, "BPoint", lt->pntsu*lt->pntsv*lt->pntsw, lt->def);
|
||||||
}
|
}
|
||||||
lt= lt->id.next;
|
lt= lt->id.next;
|
||||||
@@ -1081,10 +1086,10 @@ static void write_ikas(WriteData *wd, ListBase *idbase)
|
|||||||
ika= idbase->first;
|
ika= idbase->first;
|
||||||
while(ika) {
|
while(ika) {
|
||||||
if(ika->id.us>0) {
|
if(ika->id.us>0) {
|
||||||
/* schrijf LibData */
|
/* write LibData */
|
||||||
writestruct(wd, ID_IK, "Ika", 1, ika);
|
writestruct(wd, ID_IK, "Ika", 1, ika);
|
||||||
|
|
||||||
/* alle direkte data */
|
/* direct data */
|
||||||
li= ika->limbbase.first;
|
li= ika->limbbase.first;
|
||||||
while(li) {
|
while(li) {
|
||||||
writestruct(wd, DATA, "Limb", 1, li);
|
writestruct(wd, DATA, "Limb", 1, li);
|
||||||
@@ -1107,10 +1112,10 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
|
|||||||
|
|
||||||
sce= scebase->first;
|
sce= scebase->first;
|
||||||
while(sce) {
|
while(sce) {
|
||||||
/* schrijf LibData */
|
/* write LibData */
|
||||||
writestruct(wd, ID_SCE, "Scene", 1, sce);
|
writestruct(wd, ID_SCE, "Scene", 1, sce);
|
||||||
|
|
||||||
/* alle direkte data */
|
/* direct data */
|
||||||
base= sce->base.first;
|
base= sce->base.first;
|
||||||
while(base) {
|
while(base) {
|
||||||
writestruct(wd, DATA, "Base", 1, base);
|
writestruct(wd, DATA, "Base", 1, base);
|
||||||
@@ -1124,7 +1129,7 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
|
|||||||
if(ed) {
|
if(ed) {
|
||||||
writestruct(wd, DATA, "Editing", 1, ed);
|
writestruct(wd, DATA, "Editing", 1, ed);
|
||||||
|
|
||||||
/* ook schrijfflags op nul */
|
/* reset write flags too */
|
||||||
WHILE_SEQ(&ed->seqbase) {
|
WHILE_SEQ(&ed->seqbase) {
|
||||||
if(seq->strip) seq->strip->done= 0;
|
if(seq->strip) seq->strip->done= 0;
|
||||||
writestruct(wd, DATA, "Sequence", 1, seq);
|
writestruct(wd, DATA, "Sequence", 1, seq);
|
||||||
@@ -1133,7 +1138,7 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
|
|||||||
|
|
||||||
WHILE_SEQ(&ed->seqbase) {
|
WHILE_SEQ(&ed->seqbase) {
|
||||||
if(seq->strip && seq->strip->done==0) {
|
if(seq->strip && seq->strip->done==0) {
|
||||||
/* strip wegschrijven met done op 0 ivm readfile */
|
/* write strip with 'done' at 0 because readfile */
|
||||||
|
|
||||||
if(seq->plugin) writestruct(wd, DATA, "PluginSeq", 1, seq->plugin);
|
if(seq->plugin) writestruct(wd, DATA, "PluginSeq", 1, seq->plugin);
|
||||||
|
|
||||||
@@ -1172,10 +1177,10 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
|
|||||||
|
|
||||||
sc= scrbase->first;
|
sc= scrbase->first;
|
||||||
while(sc) {
|
while(sc) {
|
||||||
/* schrijf LibData */
|
/* write LibData */
|
||||||
writestruct(wd, ID_SCR, "Screen", 1, sc);
|
writestruct(wd, ID_SCR, "Screen", 1, sc);
|
||||||
|
|
||||||
/* alle direkte data */
|
/* direct data */
|
||||||
sv= sc->vertbase.first;
|
sv= sc->vertbase.first;
|
||||||
while(sv) {
|
while(sv) {
|
||||||
writestruct(wd, DATA, "ScrVert", 1, sv);
|
writestruct(wd, DATA, "ScrVert", 1, sv);
|
||||||
@@ -1229,7 +1234,7 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
|
|||||||
oops= oopsn;
|
oops= oopsn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NA de cleanup, ivm listbase! */
|
/* ater cleanup, because of listbase! */
|
||||||
writestruct(wd, DATA, "SpaceOops", 1, so);
|
writestruct(wd, DATA, "SpaceOops", 1, so);
|
||||||
|
|
||||||
oops= so->oops.first;
|
oops= so->oops.first;
|
||||||
@@ -1276,7 +1281,7 @@ static void write_libraries(WriteData *wd, Main *main)
|
|||||||
|
|
||||||
a=tot= set_listbasepointers(main, lbarray);
|
a=tot= set_listbasepointers(main, lbarray);
|
||||||
|
|
||||||
/* test: wordt lib nog gebruikt */
|
/* test: is lib being used */
|
||||||
foundone= 0;
|
foundone= 0;
|
||||||
while(tot--) {
|
while(tot--) {
|
||||||
id= lbarray[tot]->first;
|
id= lbarray[tot]->first;
|
||||||
@@ -1541,7 +1546,7 @@ static int write_file_handle(int handle, int write_user_block, int write_flags)
|
|||||||
write_userdef(wd);
|
write_userdef(wd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* dna als laatste i.v.m. (nog te schrijven) test op welke gebruikt zijn */
|
/* dna as last, because (to be implemented) test for which structs are written */
|
||||||
writedata(wd, DNA1, wd->sdna->datalen, wd->sdna->data);
|
writedata(wd, DNA1, wd->sdna->datalen, wd->sdna->data);
|
||||||
|
|
||||||
data= ENDB;
|
data= ENDB;
|
||||||
|
Reference in New Issue
Block a user