diff options
Diffstat (limited to 'source/blender/blenloader/intern/readfile.c')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 3000 |
1 files changed, 1518 insertions, 1482 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 3b69c84bb62..0026f3fa74d 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -272,7 +272,7 @@ static void BKE_reportf_wrap(ReportList *reports, ReportType type, const char *f BKE_report(reports, type, fixed_buf); - if(G.background==0) { + if (G.background==0) { printf("%s\n", fixed_buf); } } @@ -291,8 +291,8 @@ static int verg_oldnewmap(const void *v1, const void *v2) { const struct OldNew *x1=v1, *x2=v2; - if( x1->old > x2->old) return 1; - else if( x1->old < x2->old) return -1; + if ( x1->old > x2->old) return 1; + else if ( x1->old < x2->old) return -1; return 0; } @@ -308,7 +308,7 @@ static void oldnewmap_insert(OldNewMap *onm, void *oldaddr, void *newaddr, int n { OldNew *entry; - if(oldaddr==NULL || newaddr==NULL) return; + if (oldaddr==NULL || newaddr==NULL) return; if (onm->nentries==onm->entriessize) { int osize= onm->entriessize; @@ -331,7 +331,7 @@ static void *oldnewmap_lookup_and_inc(OldNewMap *onm, void *addr) { int i; - if(addr==NULL) return NULL; + if (addr==NULL) return NULL; if (onm->lasthit<onm->nentries-1) { OldNew *entry= &onm->entries[++onm->lasthit]; @@ -361,16 +361,16 @@ static void *oldnewmap_liblookup(OldNewMap *onm, void *addr, void *lib) { int i; - if(addr==NULL) return NULL; + if (addr==NULL) return NULL; /* lasthit works fine for non-libdata, linking there is done in same sequence as writing */ - if(onm->sorted) { + if (onm->sorted) { OldNew entry_s, *entry; entry_s.old= addr; entry= bsearch(&entry_s, onm->entries, onm->nentries, sizeof(OldNew), verg_oldnewmap); - if(entry) { + if (entry) { ID *id= entry->newp; if (id && (!lib || id->lib)) { @@ -459,10 +459,10 @@ static void split_libdata(ListBase *lb, Main *first) id= lb->first; while(id) { idnext= id->next; - if(id->lib) { + if (id->lib) { mainvar= first; while(mainvar) { - if(mainvar->curlib==id->lib) { + if (mainvar->curlib==id->lib) { lbn= which_libbase(mainvar, GS(id->name)); BLI_remlink(lb, id); BLI_addtail(lbn, id); @@ -470,7 +470,7 @@ static void split_libdata(ListBase *lb, Main *first) } mainvar= mainvar->next; } - if(mainvar==NULL) printf("error split_libdata\n"); + if (mainvar==NULL) printf("error split_libdata\n"); } id= idnext; } @@ -485,7 +485,7 @@ void blo_split_main(ListBase *mainlist, Main *main) mainlist->first= mainlist->last= main; main->next= NULL; - if(main->library.first==NULL) + if (main->library.first==NULL) return; for (lib= main->library.first; lib; lib= lib->id.next) { @@ -516,7 +516,7 @@ static void read_file_version(FileData *fd, Main *main) for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) { if (bhead->code==GLOB) { FileGlobal *fg= read_struct(fd, bhead, "Global"); - if(fg) { + if (fg) { main->subversionfile= fg->subversion; main->minversionfile= fg->minversion; main->minsubversionfile= fg->minsubversion; @@ -544,7 +544,7 @@ static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *filepat char *libname= (m->curlib)?m->curlib->filepath:m->name; if (BLI_path_cmp(name1, libname) == 0) { - if(G.f & G_DEBUG) printf("blo_find_main: found library %s\n", libname); + if (G.f & G_DEBUG) printf("blo_find_main: found library %s\n", libname); return m; } } @@ -560,7 +560,7 @@ static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *filepat read_file_version(fd, m); - if(G.f & G_DEBUG) printf("blo_find_main: added new lib %s\n", filepath); + if (G.f & G_DEBUG) printf("blo_find_main: added new lib %s\n", filepath); return m; } @@ -570,7 +570,7 @@ static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *filepat static void switch_endian_bh4(BHead4 *bhead) { /* the ID_.. codes */ - if((bhead->code & 0xFFFF)==0) bhead->code >>=16; + if ((bhead->code & 0xFFFF)==0) bhead->code >>=16; if (bhead->code != ENDB) { SWITCH_INT(bhead->len); @@ -582,7 +582,7 @@ static void switch_endian_bh4(BHead4 *bhead) static void switch_endian_bh8(BHead8 *bhead) { /* the ID_.. codes */ - if((bhead->code & 0xFFFF)==0) bhead->code >>=16; + if ((bhead->code & 0xFFFF)==0) bhead->code >>=16; if (bhead->code != ENDB) { SWITCH_INT(bhead->len); @@ -666,14 +666,17 @@ static BHeadN *get_bhead(FileData *fd) if (fd->flags & FD_FLAGS_POINTSIZE_DIFFERS) { bh8_from_bh4(&bhead, &bhead4); - } else { + } + else { memcpy(&bhead, &bhead4, sizeof(bhead)); } - } else { + } + else { fd->eof = 1; bhead.len= 0; } - } else { + } + else { bhead8.code = DATA; readsize = fd->read(fd, &bhead8, sizeof(bhead8)); @@ -684,10 +687,12 @@ static BHeadN *get_bhead(FileData *fd) if (fd->flags & FD_FLAGS_POINTSIZE_DIFFERS) { bh4_from_bh8(&bhead, &bhead8, (fd->flags & FD_FLAGS_SWITCH_ENDIAN)); - } else { + } + else { memcpy(&bhead, &bhead8, sizeof(bhead)); } - } else { + } + else { fd->eof = 1; bhead.len= 0; } @@ -712,7 +717,8 @@ static BHeadN *get_bhead(FileData *fd) MEM_freeN(new_bhead); new_bhead = NULL; } - } else { + } + else { fd->eof = 1; } } @@ -792,18 +798,19 @@ static void decode_blender_header(FileData *fd) readsize = fd->read(fd, header, sizeof(header)); if (readsize == sizeof(header)) { - if(strncmp(header, "BLENDER", 7) == 0) { + if (strncmp(header, "BLENDER", 7) == 0) { int remove_this_endian_test= 1; fd->flags |= FD_FLAGS_FILE_OK; // what size are pointers in the file ? - if(header[7]=='_') { + if (header[7]=='_') { fd->flags |= FD_FLAGS_FILE_POINTSIZE_IS_4; if (sizeof(void *) != 4) { fd->flags |= FD_FLAGS_POINTSIZE_DIFFERS; } - } else { + } + else { if (sizeof(void *) != 8) { fd->flags |= FD_FLAGS_POINTSIZE_DIFFERS; } @@ -841,7 +848,8 @@ static int read_file_dna(FileData *fd) } return 1; - } else if (bhead->code==ENDB) + } + else if (bhead->code==ENDB) break; } @@ -854,7 +862,8 @@ static int fd_read_from_file(FileData *filedata, void *buffer, unsigned int size if (readsize < 0) { readsize = EOF; - } else { + } + else { filedata->seek += readsize; } @@ -867,7 +876,8 @@ static int fd_read_gzip_from_file(FileData *filedata, void *buffer, unsigned int if (readsize < 0) { readsize = EOF; - } else { + } + else { filedata->seek += readsize; } @@ -892,14 +902,14 @@ static int fd_read_from_memfile(FileData *filedata, void *buffer, unsigned int s static MemFileChunk *chunk=NULL; unsigned int chunkoffset, readsize, totread; - if(size==0) return 0; + if (size==0) return 0; - if(seek != (unsigned int)filedata->seek) { + if (seek != (unsigned int)filedata->seek) { chunk= filedata->memfile->chunks.first; seek= 0; while(chunk) { - if(seek + chunk->size > (unsigned) filedata->seek) break; + if (seek + chunk->size > (unsigned) filedata->seek) break; seek+= chunk->size; chunk= chunk->next; } @@ -907,18 +917,18 @@ static int fd_read_from_memfile(FileData *filedata, void *buffer, unsigned int s seek= filedata->seek; } - if(chunk) { + if (chunk) { totread= 0; do { /* first check if it's on the end if current chunk */ - if(seek-offset == chunk->size) { + if (seek-offset == chunk->size) { offset+= chunk->size; chunk= chunk->next; } /* debug, should never happen */ - if(chunk==NULL) { + if (chunk==NULL) { printf("illegal read, chunk zero\n"); return 0; } @@ -929,7 +939,7 @@ static int fd_read_from_memfile(FileData *filedata, void *buffer, unsigned int s /* data can be spread over multiple chunks, so clamp size * to within this chunk, and then it will read further in * the next chunk */ - if(chunkoffset+readsize > chunk->size) + if (chunkoffset+readsize > chunk->size) readsize= chunk->size-chunkoffset; memcpy((char*)buffer+totread, chunk->buf+chunkoffset, readsize); @@ -995,7 +1005,8 @@ FileData *blo_openblenderfile(const char *filepath, ReportList *reports) if (gzfile == (gzFile)Z_NULL) { BKE_reportf(reports, RPT_ERROR, "Unable to open \"%s\": %s.", filepath, errno ? strerror(errno) : "Unknown error reading file"); return NULL; - } else { + } + else { FileData *fd = filedata_new(); fd->gzfiledes = gzfile; fd->read = fd_read_gzip_from_file; @@ -1012,7 +1023,8 @@ FileData *blo_openblendermemory(void *mem, int memsize, ReportList *reports) if (!mem || memsize<SIZEOFBLENDERHEADER) { BKE_report(reports, RPT_ERROR, (mem)? "Unable to read": "Unable to open"); return NULL; - } else { + } + else { FileData *fd= filedata_new(); fd->buffer= mem; fd->buffersize= memsize; @@ -1028,7 +1040,8 @@ FileData *blo_openblendermemfile(MemFile *memfile, ReportList *reports) if (!memfile) { BKE_report(reports, RPT_ERROR, "Unable to open blend <memory>"); return NULL; - } else { + } + else { FileData *fd= filedata_new(); fd->memfile= memfile; @@ -1102,8 +1115,8 @@ int BLO_is_a_library(const char *path, char *dir, char *group) strcpy(dir, path); len= strlen(dir); - if(len<7) return 0; - if( dir[len-1] != '/' && dir[len-1] != '\\') return 0; + if (len<7) return 0; + if ( dir[len-1] != '/' && dir[len-1] != '\\') return 0; group[0]= 0; dir[len-1]= 0; @@ -1111,9 +1124,9 @@ int BLO_is_a_library(const char *path, char *dir, char *group) /* Find the last slash */ fd= BLI_last_slash(dir); - if(fd==NULL) return 0; + if (fd==NULL) return 0; *fd= 0; - if(BLO_has_bfile_extension(fd+1)) { + if (BLO_has_bfile_extension(fd+1)) { /* the last part of the dir is a .blend file, no group follows */ *fd= '/'; /* put back the removed slash separating the dir and the .blend file name */ } @@ -1146,14 +1159,14 @@ static void *newglobadr(FileData *fd, void *adr) /* direct datablocks with glob static void *newimaadr(FileData *fd, void *adr) /* used to restore image data after undo */ { - if(fd->imamap && adr) + if (fd->imamap && adr) return oldnewmap_lookup_and_inc(fd->imamap, adr); return NULL; } static void *newmclipadr(FileData *fd, void *adr) /* used to restore movie clip data after undo */ { - if(fd->movieclipmap && adr) + if (fd->movieclipmap && adr) return oldnewmap_lookup_and_inc(fd->movieclipmap, adr); return NULL; } @@ -1168,7 +1181,7 @@ static void *newlibadr_us(FileData *fd, void *lib, void *adr) /* increases user { ID *id= newlibadr(fd, lib, adr); - if(id) + if (id) id->us++; return id; @@ -1183,7 +1196,7 @@ static void change_idid_adr_fd(FileData *fd, void *old, void *new) if (old==entry->newp && entry->nr==ID_ID) { entry->newp= new; - if(new) entry->nr= GS( ((ID *)new)->name ); + if (new) entry->nr= GS( ((ID *)new)->name ); break; } } @@ -1193,13 +1206,13 @@ static void change_idid_adr(ListBase *mainlist, FileData *basefd, void *old, voi { Main *mainptr; - for(mainptr= mainlist->first; mainptr; mainptr= mainptr->next) { + for (mainptr= mainlist->first; mainptr; mainptr= mainptr->next) { FileData *fd; - if(mainptr->curlib) fd= mainptr->curlib->filedata; + if (mainptr->curlib) fd= mainptr->curlib->filedata; else fd= basefd; - if(fd) { + if (fd) { change_idid_adr_fd(fd, old, new); } } @@ -1213,8 +1226,8 @@ void blo_clear_proxy_pointers_from_lib(Main *oldmain) { Object *ob= oldmain->object.first; - for(;ob; ob= ob->id.next) - if(ob->id.lib) + for (;ob; ob= ob->id.next) + if (ob->id.lib) ob->proxy_from= NULL; } @@ -1226,20 +1239,20 @@ void blo_make_image_pointer_map(FileData *fd, Main *oldmain) fd->imamap= oldnewmap_new(); - for(;ima; ima= ima->id.next) { + for (;ima; ima= ima->id.next) { Link *ibuf= ima->ibufs.first; - for(; ibuf; ibuf= ibuf->next) + for (; ibuf; ibuf= ibuf->next) oldnewmap_insert(fd->imamap, ibuf, ibuf, 0); - if(ima->gputexture) + if (ima->gputexture) oldnewmap_insert(fd->imamap, ima->gputexture, ima->gputexture, 0); - for(a=0; a<IMA_MAX_RENDER_SLOT; a++) - if(ima->renders[a]) + for (a=0; a<IMA_MAX_RENDER_SLOT; a++) + if (ima->renders[a]) oldnewmap_insert(fd->imamap, ima->renders[a], ima->renders[a], 0); } - for(; sce; sce= sce->id.next) { - if(sce->nodetree) { + for (; sce; sce= sce->id.next) { + if (sce->nodetree) { bNode *node; - for(node= sce->nodetree->nodes.first; node; node= node->next) + for (node= sce->nodetree->nodes.first; node; node= node->next) oldnewmap_insert(fd->imamap, node->preview, node->preview, 0); } } @@ -1260,27 +1273,27 @@ void blo_end_image_pointer_map(FileData *fd, Main *oldmain) entry->newp= NULL; } - for(;ima; ima= ima->id.next) { + for (;ima; ima= ima->id.next) { Link *ibuf, *next; /* this mirrors direct_link_image */ - for(ibuf= ima->ibufs.first; ibuf; ibuf= next) { + for (ibuf= ima->ibufs.first; ibuf; ibuf= next) { next= ibuf->next; - if(NULL==newimaadr(fd, ibuf)) { /* so was restored */ + if (NULL==newimaadr(fd, ibuf)) { /* so was restored */ BLI_remlink(&ima->ibufs, ibuf); ima->bindcode= 0; ima->gputexture= NULL; } } - for(i=0; i<IMA_MAX_RENDER_SLOT; i++) + for (i=0; i<IMA_MAX_RENDER_SLOT; i++) ima->renders[i]= newimaadr(fd, ima->renders[i]); ima->gputexture= newimaadr(fd, ima->gputexture); } - for(; sce; sce= sce->id.next) { - if(sce->nodetree) { + for (; sce; sce= sce->id.next) { + if (sce->nodetree) { bNode *node; - for(node= sce->nodetree->nodes.first; node; node= node->next) + for (node= sce->nodetree->nodes.first; node; node= node->next) node->preview= newimaadr(fd, node->preview); } } @@ -1293,19 +1306,19 @@ void blo_make_movieclip_pointer_map(FileData *fd, Main *oldmain) fd->movieclipmap= oldnewmap_new(); - for(;clip; clip= clip->id.next) { - if(clip->cache) + for (;clip; clip= clip->id.next) { + if (clip->cache) oldnewmap_insert(fd->movieclipmap, clip->cache, clip->cache, 0); - if(clip->tracking.camera.intrinsics) + if (clip->tracking.camera.intrinsics) oldnewmap_insert(fd->movieclipmap, clip->tracking.camera.intrinsics, clip->tracking.camera.intrinsics, 0); } - for(; sce; sce= sce->id.next) { - if(sce->nodetree) { + for (; sce; sce= sce->id.next) { + if (sce->nodetree) { bNode *node; - for(node= sce->nodetree->nodes.first; node; node= node->next) - if(node->type==CMP_NODE_MOVIEDISTORTION) + for (node= sce->nodetree->nodes.first; node; node= node->next) + if (node->type==CMP_NODE_MOVIEDISTORTION) oldnewmap_insert(fd->movieclipmap, node->storage, node->storage, 0); } } @@ -1326,16 +1339,16 @@ void blo_end_movieclip_pointer_map(FileData *fd, Main *oldmain) entry->newp= NULL; } - for(;clip; clip= clip->id.next) { + for (;clip; clip= clip->id.next) { clip->cache= newmclipadr(fd, clip->cache); clip->tracking.camera.intrinsics= newmclipadr(fd, clip->tracking.camera.intrinsics); } - for(; sce; sce= sce->id.next) { - if(sce->nodetree) { + for (; sce; sce= sce->id.next) { + if (sce->nodetree) { bNode *node; - for(node= sce->nodetree->nodes.first; node; node= node->next) - if(node->type==CMP_NODE_MOVIEDISTORTION) + for (node= sce->nodetree->nodes.first; node; node= node->next) + if (node->type==CMP_NODE_MOVIEDISTORTION) node->storage= newmclipadr(fd, node->storage); } } @@ -1348,11 +1361,11 @@ void blo_add_library_pointer_map(ListBase *mainlist, FileData *fd) Main *ptr= mainlist->first; ListBase *lbarray[MAX_LIBARRAY]; - for(ptr= ptr->next; ptr; ptr= ptr->next) { + for (ptr= ptr->next; ptr; ptr= ptr->next) { int i= set_listbasepointers(ptr, lbarray); while(i--) { ID *id; - for(id= lbarray[i]->first; id; id= id->next) + for (id= lbarray[i]->first; id; id= id->next) oldnewmap_insert(fd->libmap, id, id, GS(id->name)); } } @@ -1388,9 +1401,10 @@ static void *read_struct(FileData *fd, BHead *bh, const char *blockname) switch_endian_structs(fd->filesdna, bh); if (fd->compflags[bh->SDNAnr]) { /* flag==0: doesn't exist anymore */ - if(fd->compflags[bh->SDNAnr]==2) { + if (fd->compflags[bh->SDNAnr]==2) { temp= DNA_struct_reconstruct(fd->memsdna, fd->filesdna, fd->compflags, bh->SDNAnr, bh->nr, (bh+1)); - } else { + } + else { temp= MEM_mallocN(bh->len, blockname); memcpy(temp, (bh+1), bh->len); } @@ -1404,7 +1418,7 @@ static void link_list(FileData *fd, ListBase *lb) /* only direct data */ { Link *ln, *prev; - if(lb->first==NULL) return; + if (lb->first==NULL) return; lb->first= newdataadr(fd, lb->first); ln= lb->first; @@ -1423,9 +1437,9 @@ static void link_glob_list(FileData *fd, ListBase *lb) /* for glob data */ Link *ln, *prev; void *poin; - if(lb->first==NULL) return; + if (lb->first==NULL) return; poin= newdataadr(fd, lb->first); - if(lb->first) { + if (lb->first) { oldnewmap_insert(fd->globmap, lb->first, poin, 0); } lb->first= poin; @@ -1434,7 +1448,7 @@ static void link_glob_list(FileData *fd, ListBase *lb) /* for glob data */ prev= NULL; while(ln) { poin= newdataadr(fd, ln->next); - if(ln->next) { + if (ln->next) { oldnewmap_insert(fd->globmap, ln->next, poin, 0); } ln->next= poin; @@ -1459,15 +1473,15 @@ static void test_pointer_array(FileData *fd, void **mat) * the old dna format to a pointer array in * the new dna format. */ - if(*mat) { + if (*mat) { len= MEM_allocN_len(*mat)/fd->filesdna->pointerlen; - if(fd->filesdna->pointerlen==8 && fd->memsdna->pointerlen==4) { + if (fd->filesdna->pointerlen==8 && fd->memsdna->pointerlen==4) { ipoin=imat= MEM_mallocN( len*4, "newmatar"); lpoin= *mat; while(len-- > 0) { - if((fd->flags & FD_FLAGS_SWITCH_ENDIAN)) + if ((fd->flags & FD_FLAGS_SWITCH_ENDIAN)) SWITCH_LONGINT(*lpoin); *ipoin= (int) ((*lpoin) >> 3); ipoin++; @@ -1477,7 +1491,7 @@ static void test_pointer_array(FileData *fd, void **mat) *mat= imat; } - if(fd->filesdna->pointerlen==4 && fd->memsdna->pointerlen==8) { + if (fd->filesdna->pointerlen==4 && fd->memsdna->pointerlen==8) { lpoin=lmat= MEM_mallocN( len*8, "newmatar"); ipoin= *mat; @@ -1510,13 +1524,13 @@ static void IDP_DirectLinkIDPArray(IDProperty *prop, int switch_endian, FileData /* note!, idp-arrays didn't exist in 2.4x, so the pointer will be cleared * theres not really anything we can do to correct this, at least don't crash */ - if(array==NULL) { + if (array==NULL) { prop->len= 0; prop->totallen= 0; } - for(i=0; i<prop->len; i++) + for (i=0; i<prop->len; i++) IDP_DirectLinkProperty(&array[i], switch_endian, fd); } @@ -1529,14 +1543,14 @@ static void IDP_DirectLinkArray(IDProperty *prop, int switch_endian, FileData *f prop->totallen = prop->len; prop->data.pointer = newdataadr(fd, prop->data.pointer); - if(prop->subtype == IDP_GROUP) { + if (prop->subtype == IDP_GROUP) { test_pointer_array(fd, prop->data.pointer); array= prop->data.pointer; - for(i=0; i<prop->len; i++) + for (i=0; i<prop->len; i++) IDP_DirectLinkProperty(array[i], switch_endian, fd); } - else if(prop->subtype == IDP_DOUBLE) { + else if (prop->subtype == IDP_DOUBLE) { if (switch_endian) { for (i=0; i<prop->len; i++) { SWITCH_LONGINT(((double*)prop->data.pointer)[i]); @@ -1623,7 +1637,7 @@ static void direct_link_curvemapping(FileData *fd, CurveMapping *cumap) /* flag seems to be able to hang? Maybe old files... not bad to clear anyway */ cumap->flag &= ~CUMA_PREMULLED; - for(a=0; a<CM_TOT; a++) { + for (a=0; a<CM_TOT; a++) { cumap->cm[a].curve= newdataadr(fd, cumap->cm[a].curve); cumap->cm[a].table= NULL; cumap->cm[a].premultable= NULL; @@ -1637,8 +1651,8 @@ static void lib_link_brush(FileData *fd, Main *main) Brush *brush; /* only link ID pointers */ - for(brush= main->brush.first; brush; brush= brush->id.next) { - if(brush->id.flag & LIB_NEEDLINK) { + for (brush= main->brush.first; brush; brush= brush->id.next) { + if (brush->id.flag & LIB_NEEDLINK) { brush->id.flag -= LIB_NEEDLINK; brush->mtex.tex= newlibadr_us(fd, brush->id.lib, brush->mtex.tex); @@ -1653,7 +1667,7 @@ static void direct_link_brush(FileData *fd, Brush *brush) /* fallof curve */ brush->curve= newdataadr(fd, brush->curve); - if(brush->curve) + if (brush->curve) direct_link_curvemapping(fd, brush->curve); else brush_curve_preset(brush, CURVE_PRESET_SHARP); @@ -1711,10 +1725,10 @@ static void lib_link_ipo(FileData *fd, Main *main) ipo= main->ipo.first; while(ipo) { - if(ipo->id.flag & LIB_NEEDLINK) { + if (ipo->id.flag & LIB_NEEDLINK) { IpoCurve *icu; - for(icu= ipo->curve.first; icu; icu= icu->next) { - if(icu->driver) + for (icu= ipo->curve.first; icu; icu= icu->next) { + if (icu->driver) icu->driver->ob= newlibadr(fd, ipo->id.lib, icu->driver->ob); } ipo->id.flag -= LIB_NEEDLINK; @@ -1744,11 +1758,11 @@ static void lib_link_nlastrips(FileData *fd, ID *id, ListBase *striplist) bActionStrip *strip; bActionModifier *amod; - for (strip=striplist->first; strip; strip=strip->next){ + for (strip=striplist->first; strip; strip=strip->next) { strip->object = newlibadr(fd, id->lib, strip->object); strip->act = newlibadr_us(fd, id->lib, strip->act); strip->ipo = newlibadr(fd, id->lib, strip->ipo); - for(amod= strip->modifiers.first; amod; amod= amod->next) + for (amod= strip->modifiers.first; amod; amod= amod->next) amod->ob= newlibadr(fd, id->lib, amod->ob); } } @@ -1760,7 +1774,7 @@ static void direct_link_nlastrips(FileData *fd, ListBase *strips) link_list(fd, strips); - for(strip= strips->first; strip; strip= strip->next) + for (strip= strips->first; strip; strip= strip->next) link_list(fd, &strip->modifiers); } @@ -1769,7 +1783,7 @@ static void lib_link_constraint_channels(FileData *fd, ID *id, ListBase *chanbas { bConstraintChannel *chan; - for (chan=chanbase->first; chan; chan=chan->next){ + for (chan=chanbase->first; chan; chan=chan->next) { chan->ipo = newlibadr_us(fd, id->lib, chan->ipo); } } @@ -1844,9 +1858,9 @@ static void direct_link_fmodifiers(FileData *fd, ListBase *list) data->coefficients= newdataadr(fd, data->coefficients); - if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) { + if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) { unsigned int a; - for(a = 0; a < data->arraysize; a++) + for (a = 0; a < data->arraysize; a++) SWITCH_INT(data->coefficients[a]); } } @@ -2135,11 +2149,11 @@ static void lib_link_ntree(FileData *fd, ID *id, bNodeTree *ntree) { bNode *node; - if(ntree->adt) lib_link_animdata(fd, &ntree->id, ntree->adt); + if (ntree->adt) lib_link_animdata(fd, &ntree->id, ntree->adt); ntree->gpd= newlibadr_us(fd, id->lib, ntree->gpd); - for(node= ntree->nodes.first; node; node= node->next) + for (node= ntree->nodes.first; node; node= node->next) node->id= newlibadr_us(fd, id->lib, node->id); } @@ -2149,8 +2163,8 @@ static void lib_link_nodetree(FileData *fd, Main *main) bNodeTree *ntree; /* only link ID pointers */ - for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next) { - if(ntree->id.flag & LIB_NEEDLINK) { + for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next) { + if (ntree->id.flag & LIB_NEEDLINK) { ntree->id.flag -= LIB_NEEDLINK; lib_link_ntree(fd, &ntree->id, ntree); } @@ -2284,7 +2298,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) bNodeTreeType *ntreetype; /* this crashes blender on undo/redo - if(open==1) { + if (open==1) { reinit_nodesystem(); }*/ @@ -2294,7 +2308,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) if (ntreetype && ntreetype->foreach_nodetree) ntreetype->foreach_nodetree(main, NULL, lib_nodetree_init_types_cb); } - for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next) + for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next) lib_nodetree_init_types_cb(NULL, NULL, ntree); { @@ -2304,7 +2318,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) * we have set the NTREE_DO_VERSIONS flag, so at this point we can do the * actual group node updates. */ - for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next) { + for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next) { if (ntree->flag & NTREE_DO_VERSIONS_GROUP_EXPOSE) { /* this adds copies and links from all unlinked internal sockets to group inputs/outputs. */ node_group_expose_all_sockets(ntree); @@ -2320,18 +2334,18 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) } } - for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next) + for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next) ntree->flag &= ~NTREE_DO_VERSIONS_GROUP_EXPOSE; } /* verify all group user nodes */ - for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next) { + for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next) { ntreeVerifyNodes(main, &ntree->id); } /* make update calls where necessary */ { - for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next) + for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next) if (ntree->update) ntreeUpdateTree(ntree); @@ -2367,8 +2381,8 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree) direct_link_animdata(fd, ntree->adt); link_list(fd, &ntree->nodes); - for(node= ntree->nodes.first; node; node= node->next) { - if(node->type == NODE_DYNAMIC) { + for (node= ntree->nodes.first; node; node= node->next) { + if (node->type == NODE_DYNAMIC) { node->custom1= 0; node->custom1= BSET(node->custom1, NODE_DYNAMIC_LOADED); } @@ -2378,25 +2392,26 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree) link_list(fd, &node->inputs); link_list(fd, &node->outputs); - if(node->type == CMP_NODE_MOVIEDISTORTION) { + if (node->type == CMP_NODE_MOVIEDISTORTION) { node->storage= newmclipadr(fd, node->storage); - } else + } + else node->storage= newdataadr(fd, node->storage); - if(node->storage) { + if (node->storage) { /* could be handlerized at some point */ - if(ntree->type==NTREE_SHADER && (node->type==SH_NODE_CURVE_VEC || node->type==SH_NODE_CURVE_RGB)) + if (ntree->type==NTREE_SHADER && (node->type==SH_NODE_CURVE_VEC || node->type==SH_NODE_CURVE_RGB)) direct_link_curvemapping(fd, node->storage); - else if(ntree->type==NTREE_COMPOSIT) { - if( ELEM4(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT)) + else if (ntree->type==NTREE_COMPOSIT) { + if ( ELEM4(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT)) direct_link_curvemapping(fd, node->storage); - else if(ELEM3(node->type, CMP_NODE_IMAGE, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) + else if (ELEM3(node->type, CMP_NODE_IMAGE, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) ((ImageUser *)node->storage)->ok= 1; } - else if( ntree->type==NTREE_TEXTURE) { - if(node->type==TEX_NODE_CURVE_RGB || node->type==TEX_NODE_CURVE_TIME) + else if ( ntree->type==NTREE_TEXTURE) { + if (node->type==TEX_NODE_CURVE_RGB || node->type==TEX_NODE_CURVE_TIME) direct_link_curvemapping(fd, node->storage); - else if(node->type==TEX_NODE_IMAGE) + else if (node->type==TEX_NODE_IMAGE) ((ImageUser *)node->storage)->ok= 1; } } @@ -2408,22 +2423,22 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree) link_list(fd, &ntree->outputs); /* and we connect the rest */ - for(node= ntree->nodes.first; node; node= node->next) { + for (node= ntree->nodes.first; node; node= node->next) { node->parent = newdataadr(fd, node->parent); node->preview= newimaadr(fd, node->preview); node->lasty= 0; - for(sock= node->inputs.first; sock; sock= sock->next) + for (sock= node->inputs.first; sock; sock= sock->next) direct_link_node_socket(fd, sock); - for(sock= node->outputs.first; sock; sock= sock->next) + for (sock= node->outputs.first; sock; sock= sock->next) direct_link_node_socket(fd, sock); } - for(sock= ntree->inputs.first; sock; sock= sock->next) + for (sock= ntree->inputs.first; sock; sock= sock->next) direct_link_node_socket(fd, sock); - for(sock= ntree->outputs.first; sock; sock= sock->next) + for (sock= ntree->outputs.first; sock; sock= sock->next) direct_link_node_socket(fd, sock); - for(link= ntree->links.first; link; link= link->next) { + for (link= ntree->links.first; link; link= link->next) { link->fromnode= newdataadr(fd, link->fromnode); link->tonode= newdataadr(fd, link->tonode); link->fromsock= newdataadr(fd, link->fromsock); @@ -2456,7 +2471,7 @@ static void lib_link_constraints(FileData *fd, ID *id, ListBase *conlist) for (con = conlist->first; con; con=con->next) { /* patch for error introduced by changing constraints (dunno how) */ /* if con->data type changes, dna cannot resolve the pointer! (ton) */ - if(con->data==NULL) { + if (con->data==NULL) { con->type= CONSTRAINT_TYPE_NULL; } /* own ipo, all constraints have it */ @@ -2505,7 +2520,7 @@ static void direct_link_constraints(FileData *fd, ListBase *lb) case CONSTRAINT_TYPE_CHILDOF: { /* XXX version patch, in older code this flag wasn't always set, and is inherent to type */ - if(con->ownspace == CONSTRAINT_SPACE_POSE) + if (con->ownspace == CONSTRAINT_SPACE_POSE) con->flag |= CONSTRAINT_SPACEONCE; } break; @@ -2526,13 +2541,13 @@ static void lib_link_pose(FileData *fd, Object *ob, bPose *pose) /* always rebuild to match proxy or lib changes */ rebuild= ob->proxy || (ob->id.lib==NULL && arm->id.lib); - if(ob->proxy) { + if (ob->proxy) { /* sync proxy layer */ - if(pose->proxy_layer) + if (pose->proxy_layer) arm->layer = pose->proxy_layer; /* sync proxy active bone */ - if(pose->proxy_act_bone[0]) { + if (pose->proxy_act_bone[0]) { Bone *bone = get_named_bone(arm, pose->proxy_act_bone); if (bone) arm->act_bone = bone; @@ -2546,16 +2561,16 @@ static void lib_link_pose(FileData *fd, Object *ob, bPose *pose) pchan->bone= get_named_bone(arm, pchan->name); pchan->custom= newlibadr_us(fd, arm->id.lib, pchan->custom); - if(pchan->bone==NULL) + if (pchan->bone==NULL) rebuild= 1; - else if(ob->id.lib==NULL && arm->id.lib) { + else if (ob->id.lib==NULL && arm->id.lib) { /* local pose selection copied to armature, bit hackish */ pchan->bone->flag &= ~BONE_SELECTED; pchan->bone->flag |= pchan->selectflag; } } - if(rebuild) { + if (rebuild) { ob->recalc= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME; pose->flag |= POSE_RECALC; } @@ -2568,7 +2583,7 @@ static void lib_link_armature(FileData *fd, Main *main) arm= main->armature.first; while(arm) { - if(arm->id.flag & LIB_NEEDLINK) { + if (arm->id.flag & LIB_NEEDLINK) { if (arm->adt) lib_link_animdata(fd, &arm->id, arm->adt); arm->id.flag -= LIB_NEEDLINK; } @@ -2582,14 +2597,14 @@ static void direct_link_bones(FileData *fd, Bone* bone) bone->parent= newdataadr(fd, bone->parent); bone->prop= newdataadr(fd, bone->prop); - if(bone->prop) + if (bone->prop) IDP_DirectLinkProperty(bone->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); bone->flag &= ~BONE_DRAW_ACTIVE; link_list(fd, &bone->childbase); - for(child=bone->childbase.first; child; child=child->next) + for (child=bone->childbase.first; child; child=child->next) direct_link_bones(fd, child); } @@ -2622,7 +2637,7 @@ static void lib_link_camera(FileData *fd, Main *main) ca= main->camera.first; while(ca) { - if(ca->id.flag & LIB_NEEDLINK) { + if (ca->id.flag & LIB_NEEDLINK) { if (ca->adt) lib_link_animdata(fd, &ca->id, ca->adt); ca->ipo= newlibadr_us(fd, ca->id.lib, ca->ipo); // XXX depreceated - old animation system @@ -2652,12 +2667,12 @@ static void lib_link_lamp(FileData *fd, Main *main) la= main->lamp.first; while(la) { - if(la->id.flag & LIB_NEEDLINK) { + if (la->id.flag & LIB_NEEDLINK) { if (la->adt) lib_link_animdata(fd, &la->id, la->adt); - for(a=0; a<MAX_MTEX; a++) { + for (a=0; a<MAX_MTEX; a++) { mtex= la->mtex[a]; - if(mtex) { + if (mtex) { mtex->tex= newlibadr_us(fd, la->id.lib, mtex->tex); mtex->object= newlibadr(fd, la->id.lib, mtex->object); } @@ -2665,7 +2680,7 @@ static void lib_link_lamp(FileData *fd, Main *main) la->ipo= newlibadr_us(fd, la->id.lib, la->ipo); // XXX depreceated - old animation system - if(la->nodetree) + if (la->nodetree) lib_link_ntree(fd, &la->id, la->nodetree); la->id.flag -= LIB_NEEDLINK; @@ -2681,16 +2696,16 @@ static void direct_link_lamp(FileData *fd, Lamp *la) la->adt= newdataadr(fd, la->adt); direct_link_animdata(fd, la->adt); - for(a=0; a<MAX_MTEX; a++) { + for (a=0; a<MAX_MTEX; a++) { la->mtex[a]= newdataadr(fd, la->mtex[a]); } la->curfalloff= newdataadr(fd, la->curfalloff); - if(la->curfalloff) + if (la->curfalloff) direct_link_curvemapping(fd, la->curfalloff); la->nodetree= newdataadr(fd, la->nodetree); - if(la->nodetree) + if (la->nodetree) direct_link_nodetree(fd, la->nodetree); la->preview = direct_link_preview_image(fd, la->preview); @@ -2714,8 +2729,8 @@ static void lib_link_key(FileData *fd, Main *main) } } - if(key->id.flag & LIB_NEEDLINK) { - if(key->adt) lib_link_animdata(fd, &key->id, key->adt); + if (key->id.flag & LIB_NEEDLINK) { + if (key->adt) lib_link_animdata(fd, &key->id, key->adt); key->ipo= newlibadr_us(fd, key->id.lib, key->ipo); // XXX depreceated - old animation system key->from= newlibadr(fd, key->id.lib, key->from); @@ -2734,7 +2749,7 @@ static void switch_endian_keyblock(Key *key, KeyBlock *kb) elemsize= key->elemsize; data= kb->data; - for(a=0; a<kb->totelem; a++) { + for (a=0; a<kb->totelem; a++) { cp= key->elemstr; poin= data; @@ -2776,7 +2791,7 @@ static void direct_link_key(FileData *fd, Key *key) kb->data= newdataadr(fd, kb->data); - if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) + if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) switch_endian_keyblock(key, kb); kb= kb->next; @@ -2792,10 +2807,10 @@ static void lib_link_mball(FileData *fd, Main *main) mb= main->mball.first; while(mb) { - if(mb->id.flag & LIB_NEEDLINK) { + if (mb->id.flag & LIB_NEEDLINK) { if (mb->adt) lib_link_animdata(fd, &mb->id, mb->adt); - for(a=0; a<mb->totcol; a++) mb->mat[a]= newlibadr_us(fd, mb->id.lib, mb->mat[a]); + for (a=0; a<mb->totcol; a++) mb->mat[a]= newlibadr_us(fd, mb->id.lib, mb->mat[a]); mb->ipo= newlibadr_us(fd, mb->id.lib, mb->ipo); // XXX depreceated - old animation system @@ -2832,20 +2847,20 @@ static void lib_link_world(FileData *fd, Main *main) wrld= main->world.first; while(wrld) { - if(wrld->id.flag & LIB_NEEDLINK) { + if (wrld->id.flag & LIB_NEEDLINK) { if (wrld->adt) lib_link_animdata(fd, &wrld->id, wrld->adt); wrld->ipo= newlibadr_us(fd, wrld->id.lib, wrld->ipo); // XXX depreceated - old animation system - for(a=0; a<MAX_MTEX; a++) { + for (a=0; a<MAX_MTEX; a++) { mtex= wrld->mtex[a]; - if(mtex) { + if (mtex) { mtex->tex= newlibadr_us(fd, wrld->id.lib, mtex->tex); mtex->object= newlibadr(fd, wrld->id.lib, mtex->object); } } - if(wrld->nodetree) + if (wrld->nodetree) lib_link_ntree(fd, &wrld->id, wrld->nodetree); wrld->id.flag -= LIB_NEEDLINK; @@ -2861,12 +2876,12 @@ static void direct_link_world(FileData *fd, World *wrld) wrld->adt= newdataadr(fd, wrld->adt); direct_link_animdata(fd, wrld->adt); - for(a=0; a<MAX_MTEX; a++) { + for (a=0; a<MAX_MTEX; a++) { wrld->mtex[a]= newdataadr(fd, wrld->mtex[a]); } wrld->nodetree= newdataadr(fd, wrld->nodetree); - if(wrld->nodetree) + if (wrld->nodetree) direct_link_nodetree(fd, wrld->nodetree); wrld->preview = direct_link_preview_image(fd, wrld->preview); @@ -2881,7 +2896,7 @@ static void lib_link_vfont(FileData *UNUSED(fd), Main *main) vf= main->vfont.first; while(vf) { - if(vf->id.flag & LIB_NEEDLINK) { + if (vf->id.flag & LIB_NEEDLINK) { vf->id.flag -= LIB_NEEDLINK; } vf= vf->id.next; @@ -2902,7 +2917,7 @@ static void lib_link_text(FileData *UNUSED(fd), Main *main) text= main->text.first; while(text) { - if(text->id.flag & LIB_NEEDLINK) { + if (text->id.flag & LIB_NEEDLINK) { text->id.flag -= LIB_NEEDLINK; } text= text->id.next; @@ -2922,9 +2937,10 @@ static void direct_link_text(FileData *fd, Text *text) text->compiled= NULL; /* - if(text->flags & TXT_ISEXT) { + if (text->flags & TXT_ISEXT) { reopen_text(text); - } else { + } + else { */ link_list(fd, &text->lines); @@ -2959,7 +2975,7 @@ static void lib_link_image(FileData *fd, Main *main) ima= main->image.first; while (ima) { - if(ima->id.flag & LIB_NEEDLINK) { + if (ima->id.flag & LIB_NEEDLINK) { if (ima->id.properties) IDP_LibLinkProperty(ima->id.properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); ima->id.flag -= LIB_NEEDLINK; @@ -2972,7 +2988,7 @@ static void link_ibuf_list(FileData *fd, ListBase *lb) { Link *ln, *prev; - if(lb->first==NULL) return; + if (lb->first==NULL) return; lb->first= newimaadr(fd, lb->first); ln= lb->first; @@ -2989,13 +3005,13 @@ static void link_ibuf_list(FileData *fd, ListBase *lb) static void direct_link_image(FileData *fd, Image *ima) { /* for undo system, pointers could be restored */ - if(fd->imamap) + if (fd->imamap) link_ibuf_list(fd, &ima->ibufs); else ima->ibufs.first= ima->ibufs.last= NULL; /* if not restored, we keep the binded opengl index */ - if(ima->ibufs.first==NULL) { + if (ima->ibufs.first==NULL) { ima->bindcode= 0; ima->gputexture= NULL; } @@ -3005,10 +3021,10 @@ static void direct_link_image(FileData *fd, Image *ima) ima->repbind= NULL; /* undo system, try to restore render buffers */ - if(fd->imamap) { + if (fd->imamap) { int a; - for(a=0; a<IMA_MAX_RENDER_SLOT; a++) + for (a=0; a<IMA_MAX_RENDER_SLOT; a++) ima->renders[a]= newimaadr(fd, ima->renders[a]); } else { @@ -3031,10 +3047,10 @@ static void lib_link_curve(FileData *fd, Main *main) cu= main->curve.first; while(cu) { - if(cu->id.flag & LIB_NEEDLINK) { - if(cu->adt) lib_link_animdata(fd, &cu->id, cu->adt); + if (cu->id.flag & LIB_NEEDLINK) { + if (cu->adt) lib_link_animdata(fd, &cu->id, cu->adt); - for(a=0; a<cu->totcol; a++) cu->mat[a]= newlibadr_us(fd, cu->id.lib, cu->mat[a]); + for (a=0; a<cu->totcol; a++) cu->mat[a]= newlibadr_us(fd, cu->id.lib, cu->mat[a]); cu->bevobj= newlibadr(fd, cu->id.lib, cu->bevobj); cu->taperobj= newlibadr(fd, cu->id.lib, cu->taperobj); @@ -3058,13 +3074,13 @@ static void switch_endian_knots(Nurb *nu) { int len; - if(nu->knotsu) { + if (nu->knotsu) { len= KNOTSU(nu); while(len--) { SWITCH_INT(nu->knotsu[len]); } } - if(nu->knotsv) { + if (nu->knotsv) { len= KNOTSV(nu); while(len--) { SWITCH_INT(nu->knotsv[len]); @@ -3086,7 +3102,7 @@ static void direct_link_curve(FileData *fd, Curve *cu) cu->strinfo= newdataadr(fd, cu->strinfo); cu->tb= newdataadr(fd, cu->tb); - if(cu->vfont == NULL) link_list(fd, &(cu->nurb)); + if (cu->vfont == NULL) link_list(fd, &(cu->nurb)); else { cu->nurb.first=cu->nurb.last= NULL; @@ -3095,7 +3111,8 @@ static void direct_link_curve(FileData *fd, Curve *cu) memcpy(tb, cu->tb, cu->totbox*sizeof(TextBox)); MEM_freeN(cu->tb); cu->tb= tb; - } else { + } + else { cu->totbox = 1; cu->actbox = 1; cu->tb = tb; @@ -3119,7 +3136,7 @@ static void direct_link_curve(FileData *fd, Curve *cu) nu->knotsv= newdataadr(fd, nu->knotsv); if (cu->vfont == NULL) nu->charidx= nu->mat_nr; - if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) { + if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) { switch_endian_knots(nu); } @@ -3136,19 +3153,19 @@ static void lib_link_texture(FileData *fd, Main *main) tex= main->tex.first; while(tex) { - if(tex->id.flag & LIB_NEEDLINK) { - if(tex->adt) lib_link_animdata(fd, &tex->id, tex->adt); + if (tex->id.flag & LIB_NEEDLINK) { + if (tex->adt) lib_link_animdata(fd, &tex->id, tex->adt); tex->ima= newlibadr_us(fd, tex->id.lib, tex->ima); tex->ipo= newlibadr_us(fd, tex->id.lib, tex->ipo); - if(tex->env) tex->env->object= newlibadr(fd, tex->id.lib, tex->env->object); - if(tex->pd) + if (tex->env) tex->env->object= newlibadr(fd, tex->id.lib, tex->env->object); + if (tex->pd) tex->pd->object= newlibadr(fd, tex->id.lib, tex->pd->object); - if(tex->vd) tex->vd->object= newlibadr(fd, tex->id.lib, tex->vd->object); - if(tex->ot) tex->ot->object= newlibadr(fd, tex->id.lib, tex->ot->object); + if (tex->vd) tex->vd->object= newlibadr(fd, tex->id.lib, tex->vd->object); + if (tex->ot) tex->ot->object= newlibadr(fd, tex->id.lib, tex->ot->object); - if(tex->nodetree) + if (tex->nodetree) lib_link_ntree(fd, &tex->id, tex->nodetree); tex->id.flag -= LIB_NEEDLINK; @@ -3163,7 +3180,7 @@ static void direct_link_texture(FileData *fd, Tex *tex) direct_link_animdata(fd, tex->adt); tex->plugin= newdataadr(fd, tex->plugin); - if(tex->plugin) { + if (tex->plugin) { tex->plugin->handle= NULL; open_plugin_tex(tex->plugin); /* initialize data for this instance, if an initialization @@ -3174,34 +3191,35 @@ static void direct_link_texture(FileData *fd, Tex *tex) } tex->coba= newdataadr(fd, tex->coba); tex->env= newdataadr(fd, tex->env); - if(tex->env) { + if (tex->env) { tex->env->ima= NULL; memset(tex->env->cube, 0, 6*sizeof(void *)); tex->env->ok= 0; } tex->pd= newdataadr(fd, tex->pd); - if(tex->pd) { + if (tex->pd) { tex->pd->point_tree = NULL; tex->pd->coba= newdataadr(fd, tex->pd->coba); tex->pd->falloff_curve= newdataadr(fd, tex->pd->falloff_curve); - if(tex->pd->falloff_curve) { + if (tex->pd->falloff_curve) { direct_link_curvemapping(fd, tex->pd->falloff_curve); } } tex->vd= newdataadr(fd, tex->vd); - if(tex->vd) { + if (tex->vd) { tex->vd->dataset = NULL; tex->vd->ok = 0; - } else { - if(tex->type == TEX_VOXELDATA) + } + else { + if (tex->type == TEX_VOXELDATA) tex->vd= MEM_callocN(sizeof(VoxelData), "direct_link_texture VoxelData"); } tex->ot= newdataadr(fd, tex->ot); tex->nodetree= newdataadr(fd, tex->nodetree); - if(tex->nodetree) + if (tex->nodetree) direct_link_nodetree(fd, tex->nodetree); tex->preview = direct_link_preview_image(fd, tex->preview); @@ -3221,8 +3239,8 @@ static void lib_link_material(FileData *fd, Main *main) ma= main->mat.first; while(ma) { - if(ma->id.flag & LIB_NEEDLINK) { - if(ma->adt) lib_link_animdata(fd, &ma->id, ma->adt); + if (ma->id.flag & LIB_NEEDLINK) { + if (ma->adt) lib_link_animdata(fd, &ma->id, ma->adt); /*Link ID Properties -- and copy this comment EXACTLY for easy finding of library blocks that implement this.*/ @@ -3231,15 +3249,15 @@ static void lib_link_material(FileData *fd, Main *main) ma->ipo= newlibadr_us(fd, ma->id.lib, ma->ipo); ma->group= newlibadr_us(fd, ma->id.lib, ma->group); - for(a=0; a<MAX_MTEX; a++) { + for (a=0; a<MAX_MTEX; a++) { mtex= ma->mtex[a]; - if(mtex) { + if (mtex) { mtex->tex= newlibadr_us(fd, ma->id.lib, mtex->tex); mtex->object= newlibadr(fd, ma->id.lib, mtex->object); } } - if(ma->nodetree) + if (ma->nodetree) lib_link_ntree(fd, &ma->id, ma->nodetree); ma->id.flag -= LIB_NEEDLINK; @@ -3255,7 +3273,7 @@ static void direct_link_material(FileData *fd, Material *ma) ma->adt= newdataadr(fd, ma->adt); direct_link_animdata(fd, ma->adt); - for(a=0; a<MAX_MTEX; a++) { + for (a=0; a<MAX_MTEX; a++) { ma->mtex[a]= newdataadr(fd, ma->mtex[a]); } @@ -3263,7 +3281,7 @@ static void direct_link_material(FileData *fd, Material *ma) ma->ramp_spec= newdataadr(fd, ma->ramp_spec); ma->nodetree= newdataadr(fd, ma->nodetree); - if(ma->nodetree) + if (ma->nodetree) direct_link_nodetree(fd, ma->nodetree); ma->preview = direct_link_preview_image(fd, ma->preview); @@ -3284,7 +3302,7 @@ static const char *ptcache_data_struct[] = { }; static void direct_link_pointcache(FileData *fd, PointCache *cache) { - if((cache->flag & PTCACHE_DISK_CACHE)==0) { + if ((cache->flag & PTCACHE_DISK_CACHE)==0) { PTCacheMem *pm; PTCacheExtra *extra; int i; @@ -3293,23 +3311,23 @@ static void direct_link_pointcache(FileData *fd, PointCache *cache) pm = cache->mem_cache.first; - for(; pm; pm=pm->next) { - for(i=0; i<BPHYS_TOT_DATA; i++) { + for (; pm; pm=pm->next) { + for (i=0; i<BPHYS_TOT_DATA; i++) { pm->data[i] = newdataadr(fd, pm->data[i]); /* the cache saves non-struct data without DNA */ - if(pm->data[i] && ptcache_data_struct[i][0]=='\0' && (fd->flags & FD_FLAGS_SWITCH_ENDIAN)) { + if (pm->data[i] && ptcache_data_struct[i][0]=='\0' && (fd->flags & FD_FLAGS_SWITCH_ENDIAN)) { int j, tot= (BKE_ptcache_data_size (i) * pm->totpoint)/4; /* data_size returns bytes */ int *poin= pm->data[i]; - for(j= 0; j<tot; j++) + for (j= 0; j<tot; j++) SWITCH_INT(poin[j]); } } link_list(fd, &pm->extradata); - for(extra=pm->extradata.first; extra; extra=extra->next) + for (extra=pm->extradata.first; extra; extra=extra->next) extra->data = newdataadr(fd, extra->data); } } @@ -3325,12 +3343,12 @@ static void direct_link_pointcache(FileData *fd, PointCache *cache) static void direct_link_pointcache_list(FileData *fd, ListBase *ptcaches, PointCache **ocache, int force_disk) { - if(ptcaches->first) { + if (ptcaches->first) { PointCache *cache= NULL; link_list(fd, ptcaches); - for(cache=ptcaches->first; cache; cache=cache->next) { + for (cache=ptcaches->first; cache; cache=cache->next) { direct_link_pointcache(fd, cache); - if(force_disk) { + if (force_disk) { cache->flag |= PTCACHE_DISK_CACHE; cache->step = 1; } @@ -3338,11 +3356,11 @@ static void direct_link_pointcache_list(FileData *fd, ListBase *ptcaches, PointC *ocache = newdataadr(fd, *ocache); } - else if(*ocache) { + else if (*ocache) { /* old "single" caches need to be linked too */ *ocache = newdataadr(fd, *ocache); direct_link_pointcache(fd, *ocache); - if(force_disk) { + if (force_disk) { (*ocache)->flag |= PTCACHE_DISK_CACHE; (*ocache)->step = 1; } @@ -3353,7 +3371,7 @@ static void direct_link_pointcache_list(FileData *fd, ListBase *ptcaches, PointC static void lib_link_partdeflect(FileData *fd, ID *id, PartDeflect *pd) { - if(pd && pd->tex) + if (pd && pd->tex) pd->tex=newlibadr_us(fd, id->lib, pd->tex); } @@ -3366,7 +3384,7 @@ static void lib_link_particlesettings(FileData *fd, Main *main) part= main->particle.first; while(part) { - if(part->id.flag & LIB_NEEDLINK) { + if (part->id.flag & LIB_NEEDLINK) { if (part->adt) lib_link_animdata(fd, &part->id, part->adt); part->ipo= newlibadr_us(fd, part->id.lib, part->ipo); // XXX depreceated - old animation system @@ -3378,37 +3396,37 @@ static void lib_link_particlesettings(FileData *fd, Main *main) lib_link_partdeflect(fd, &part->id, part->pd); lib_link_partdeflect(fd, &part->id, part->pd2); - if(part->effector_weights) + if (part->effector_weights) part->effector_weights->group = newlibadr(fd, part->id.lib, part->effector_weights->group); - if(part->dupliweights.first && part->dup_group) { + if (part->dupliweights.first && part->dup_group) { int index_ok = 0; /* check for old files without indices (all indexes 0) */ dw = part->dupliweights.first; - if(part->dupliweights.first == part->dupliweights.last) { + if (part->dupliweights.first == part->dupliweights.last) { /* special case for only one object in the group */ index_ok = 1; } else { - for(; dw; dw=dw->next) { - if(dw->index > 0) { + for (; dw; dw=dw->next) { + if (dw->index > 0) { index_ok = 1; break; } } } - if(index_ok) { + if (index_ok) { /* if we have indexes, let's use them */ dw = part->dupliweights.first; - for(; dw; dw=dw->next) { + for (; dw; dw=dw->next) { GroupObject *go = (GroupObject *)BLI_findlink(&part->dup_group->gobject, dw->index); dw->ob = go ? go->ob : NULL; } } else { /* otherwise try to get objects from own library (won't work on library linked groups) */ - for(; dw; dw=dw->next) + for (; dw; dw=dw->next) dw->ob = newlibadr(fd, part->id.lib, dw->ob); } } @@ -3416,12 +3434,12 @@ static void lib_link_particlesettings(FileData *fd, Main *main) part->dupliweights.first = part->dupliweights.last = NULL; } - if(part->boids) { + if (part->boids) { BoidState *state = part->boids->states.first; BoidRule *rule; - for(; state; state=state->next) { + for (; state; state=state->next) { rule = state->rules.first; - for(; rule; rule=rule->next) + for (; rule; rule=rule->next) switch(rule->type) { case eBoidRuleType_Goal: case eBoidRuleType_Avoid: @@ -3440,9 +3458,9 @@ static void lib_link_particlesettings(FileData *fd, Main *main) } } - for(a=0; a<MAX_MTEX; a++) { + for (a=0; a<MAX_MTEX; a++) { mtex= part->mtex[a]; - if(mtex) { + if (mtex) { mtex->tex = newlibadr_us(fd, part->id.lib, mtex->tex); mtex->object = newlibadr(fd, part->id.lib, mtex->object); } @@ -3456,7 +3474,7 @@ static void lib_link_particlesettings(FileData *fd, Main *main) static void direct_link_partdeflect(PartDeflect *pd) { - if(pd) pd->rng=NULL; + if (pd) pd->rng=NULL; } static void direct_link_particlesettings(FileData *fd, ParticleSettings *part) @@ -3471,7 +3489,7 @@ static void direct_link_particlesettings(FileData *fd, ParticleSettings *part) direct_link_partdeflect(part->pd2); part->effector_weights = newdataadr(fd, part->effector_weights); - if(!part->effector_weights) + if (!part->effector_weights) part->effector_weights = BKE_add_effector_weights(part->eff_group); link_list(fd, &part->dupliweights); @@ -3479,17 +3497,17 @@ static void direct_link_particlesettings(FileData *fd, ParticleSettings *part) part->boids= newdataadr(fd, part->boids); part->fluid= newdataadr(fd, part->fluid); - if(part->boids) { + if (part->boids) { BoidState *state; link_list(fd, &part->boids->states); - for(state=part->boids->states.first; state; state=state->next) { + for (state=part->boids->states.first; state; state=state->next) { link_list(fd, &state->rules); link_list(fd, &state->conditions); link_list(fd, &state->actions); } } - for(a=0; a<MAX_MTEX; a++) { + for (a=0; a<MAX_MTEX; a++) { part->mtex[a]= newdataadr(fd, part->mtex[a]); } } @@ -3498,20 +3516,20 @@ static void lib_link_particlesystems(FileData *fd, Object *ob, ID *id, ListBase { ParticleSystem *psys, *psysnext; - for(psys=particles->first; psys; psys=psysnext){ + for (psys=particles->first; psys; psys=psysnext) { psysnext= psys->next; psys->part = newlibadr_us(fd, id->lib, psys->part); - if(psys->part) { + if (psys->part) { ParticleTarget *pt = psys->targets.first; - for(; pt; pt=pt->next) + for (; pt; pt=pt->next) pt->ob=newlibadr(fd, id->lib, pt->ob); psys->parent= newlibadr_us(fd, id->lib, psys->parent); psys->target_ob = newlibadr(fd, id->lib, psys->target_ob); - if(psys->clmd) { + if (psys->clmd) { /* XXX - from reading existing code this seems correct but intended usage of * pointcache should /w cloth should be added in 'ParticleSystem' - campbell */ psys->clmd->point_cache= psys->pointcache; @@ -3536,16 +3554,16 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles) ParticleData *pa; int a; - for(psys=particles->first; psys; psys=psys->next) { + for (psys=particles->first; psys; psys=psys->next) { psys->particles=newdataadr(fd,psys->particles); - if(psys->particles && psys->particles->hair){ - for(a=0,pa=psys->particles; a<psys->totpart; a++, pa++) + if (psys->particles && psys->particles->hair) { + for (a=0,pa=psys->particles; a<psys->totpart; a++, pa++) pa->hair=newdataadr(fd,pa->hair); } - if(psys->particles && psys->particles->keys){ - for(a=0,pa=psys->particles; a<psys->totpart; a++, pa++) { + if (psys->particles && psys->particles->keys) { + for (a=0,pa=psys->particles; a<psys->totpart; a++, pa++) { pa->keys= NULL; pa->totkey= 0; } @@ -3553,14 +3571,14 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles) psys->flag &= ~PSYS_KEYED; } - if(psys->particles && psys->particles->boid) { + if (psys->particles && psys->particles->boid) { pa = psys->particles; pa->boid = newdataadr(fd, pa->boid); - for(a=1,pa++; a<psys->totpart; a++, pa++) + for (a=1,pa++; a<psys->totpart; a++, pa++) pa->boid = (pa-1)->boid + 1; } - else if(psys->particles) { - for(a=0,pa=psys->particles; a<psys->totpart; a++, pa++) + else if (psys->particles) { + for (a=0,pa=psys->particles; a<psys->totpart; a++, pa++) pa->boid = NULL; } @@ -3583,7 +3601,7 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles) direct_link_pointcache_list(fd, &psys->ptcaches, &psys->pointcache, 0); - if(psys->clmd) { + if (psys->clmd) { psys->clmd = newdataadr(fd, psys->clmd); psys->clmd->clothObject = NULL; @@ -3591,8 +3609,8 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles) psys->clmd->sim_parms->effector_weights = NULL; psys->clmd->coll_parms= newdataadr(fd, psys->clmd->coll_parms); - if(psys->clmd->sim_parms) { - if(psys->clmd->sim_parms->presets > 10) + if (psys->clmd->sim_parms) { + if (psys->clmd->sim_parms->presets > 10) psys->clmd->sim_parms->presets = 0; } @@ -3619,7 +3637,7 @@ static void lib_link_mtface(FileData *fd, Mesh *me, MTFace *mtface, int totface) * to each image it used. - z0r */ for (i=0; i<totface; i++, tf++) { tf->tpage= newlibadr(fd, me->id.lib, tf->tpage); - if(tf->tpage && tf->tpage->id.us==0) + if (tf->tpage && tf->tpage->id.us==0) tf->tpage->id.us= 1; } } @@ -3627,10 +3645,10 @@ static void lib_link_mtface(FileData *fd, Mesh *me, MTFace *mtface, int totface) static void lib_link_customdata_mtface(FileData *fd, Mesh *me, CustomData *fdata, int totface) { int i; - for(i=0; i<fdata->totlayer; i++) { + for (i=0; i<fdata->totlayer; i++) { CustomDataLayer *layer = &fdata->layers[i]; - if(layer->type == CD_MTFACE) + if (layer->type == CD_MTFACE) lib_link_mtface(fd, me, layer->data, totface); } @@ -3640,16 +3658,16 @@ static void lib_link_customdata_mtpoly(FileData *fd, Mesh *me, CustomData *pdata { int i; - for(i=0; i<pdata->totlayer; i++) { + for (i=0; i<pdata->totlayer; i++) { CustomDataLayer *layer = &pdata->layers[i]; - if(layer->type == CD_MTEXPOLY) { + if (layer->type == CD_MTEXPOLY) { MTexPoly *tf= layer->data; int i; for (i=0; i<totface; i++, tf++) { tf->tpage= newlibadr(fd, me->id.lib, tf->tpage); - if(tf->tpage && tf->tpage->id.us==0) + if (tf->tpage && tf->tpage->id.us==0) tf->tpage->id.us= 1; } } @@ -3662,7 +3680,7 @@ static void lib_link_mesh(FileData *fd, Main *main) me= main->mesh.first; while(me) { - if(me->id.flag & LIB_NEEDLINK) { + if (me->id.flag & LIB_NEEDLINK) { int i; /*Link ID Properties -- and copy this comment EXACTLY for easy finding @@ -3671,8 +3689,8 @@ static void lib_link_mesh(FileData *fd, Main *main) if (me->adt) lib_link_animdata(fd, &me->id, me->adt); /* this check added for python created meshes */ - if(me->mat) { - for(i=0; i<me->totcol; i++) { + if (me->mat) { + for (i=0; i<me->totcol; i++) { me->mat[i]= newlibadr_us(fd, me->id.lib, me->mat[i]); } } @@ -3684,7 +3702,7 @@ static void lib_link_mesh(FileData *fd, Main *main) lib_link_customdata_mtface(fd, me, &me->fdata, me->totface); lib_link_customdata_mtpoly(fd, me, &me->pdata, me->totpoly); - if(me->mr && me->mr->levels.first) + if (me->mr && me->mr->levels.first) lib_link_customdata_mtface(fd, me, &me->mr->fdata, ((MultiresLevel*)me->mr->levels.first)->totface); @@ -3729,7 +3747,7 @@ static void direct_link_dverts(FileData *fd, int count, MDeformVert *mdverts) for (i= count; i > 0; i--, mdverts++) { /*convert to vgroup allocation system*/ MDeformWeight *dw; - if(mdverts->dw && (dw= newdataadr(fd, mdverts->dw))) { + if (mdverts->dw && (dw= newdataadr(fd, mdverts->dw))) { const ssize_t dw_len= mdverts->totweight * sizeof(MDeformWeight); void *dw_tmp= MEM_mallocN(dw_len, "direct_link_dverts"); memcpy(dw_tmp, dw, dw_len); @@ -3745,10 +3763,10 @@ static void direct_link_dverts(FileData *fd, int count, MDeformVert *mdverts) static void direct_link_mdisps(FileData *fd, int count, MDisps *mdisps, int external) { - if(mdisps) { + if (mdisps) { int i; - for(i = 0; i < count; ++i) { + for (i = 0; i < count; ++i) { mdisps[i].disps = newdataadr(fd, mdisps[i].disps); mdisps[i].hidden = newdataadr(fd, mdisps[i].hidden); @@ -3761,17 +3779,17 @@ static void direct_link_mdisps(FileData *fd, int count, MDisps *mdisps, int exte mdisps[i].level = (int)(logf(gridsize - 1.0f) / M_LN2) + 1; } - if( (fd->flags & FD_FLAGS_SWITCH_ENDIAN) && (mdisps[i].disps) ) { + if ( (fd->flags & FD_FLAGS_SWITCH_ENDIAN) && (mdisps[i].disps) ) { /* DNA_struct_switch_endian doesn't do endian swap for (*disps)[] */ /* this does swap for data written at write_mdisps() - readfile.c */ int x; float *tmpdisps= *mdisps[i].disps; - for(x=0;x<mdisps[i].totdisp*3;x++) { + for (x=0;x<mdisps[i].totdisp*3;x++) { SWITCH_INT(*tmpdisps); tmpdisps++; } } - if(!external && !mdisps[i].disps) + if (!external && !mdisps[i].disps) mdisps[i].totdisp = 0; } } @@ -3788,12 +3806,12 @@ static void direct_link_customdata(FileData *fd, CustomData *data, int count) while (i < data->totlayer) { CustomDataLayer *layer = &data->layers[i]; - if(layer->flag & CD_FLAG_EXTERNAL) + if (layer->flag & CD_FLAG_EXTERNAL) layer->flag &= ~CD_FLAG_IN_MEMORY; if (CustomData_verify_versions(data, i)) { layer->data = newdataadr(fd, layer->data); - if(layer->type == CD_MDISPS) + if (layer->type == CD_MDISPS) direct_link_mdisps(fd, count, layer->data, layer->flag & CD_FLAG_EXTERNAL); i++; } @@ -3871,7 +3889,7 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh) /* Multires data */ mesh->mr= newdataadr(fd, mesh->mr); - if(mesh->mr) { + if (mesh->mr) { MultiresLevel *lvl; link_list(fd, &mesh->mr->levels); @@ -3892,13 +3910,13 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh) because some saved files either do not have a verts array, or the verts array contains out-of-date data. */ - if(mesh->totvert == ((MultiresLevel*)mesh->mr->levels.last)->totvert) { - if(mesh->mr->verts) + if (mesh->totvert == ((MultiresLevel*)mesh->mr->levels.last)->totvert) { + if (mesh->mr->verts) MEM_freeN(mesh->mr->verts); mesh->mr->verts = MEM_dupallocN(mesh->mvert); } - for(; lvl; lvl= lvl->next) { + for (; lvl; lvl= lvl->next) { lvl->verts= newdataadr(fd, lvl->verts); lvl->faces= newdataadr(fd, lvl->faces); lvl->edges= newdataadr(fd, lvl->edges); @@ -3908,12 +3926,12 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh) /* if multires is present but has no valid vertex data, * there's no way to recover it; silently remove multires */ - if(mesh->mr && !mesh->mr->verts) { + if (mesh->mr && !mesh->mr->verts) { multires_free(mesh->mr); mesh->mr = NULL; } - if((fd->flags & FD_FLAGS_SWITCH_ENDIAN) && mesh->tface) { + if ((fd->flags & FD_FLAGS_SWITCH_ENDIAN) && mesh->tface) { TFace *tf= mesh->tface; int i; @@ -3934,8 +3952,8 @@ static void lib_link_latt(FileData *fd, Main *main) lt= main->latt.first; while(lt) { - if(lt->id.flag & LIB_NEEDLINK) { - if(lt->adt) lib_link_animdata(fd, <->id, lt->adt); + if (lt->id.flag & LIB_NEEDLINK) { + if (lt->adt) lib_link_animdata(fd, <->id, lt->adt); lt->ipo= newlibadr_us(fd, lt->id.lib, lt->ipo); // XXX depreceated - old animation system lt->key= newlibadr_us(fd, lt->id.lib, lt->key); @@ -3969,7 +3987,7 @@ static void lib_link_modifiers__linkModifiers(void *userData, Object *ob, *idpoin = newlibadr(fd, ob->id.lib, *idpoin); /* hardcoded bad exception; non-object modifier data gets user count (texture, displace) */ - if(*idpoin && GS((*idpoin)->name)!=ID_OB) + if (*idpoin && GS((*idpoin)->name)!=ID_OB) (*idpoin)->us++; } static void lib_link_modifiers(FileData *fd, Object *ob) @@ -3989,7 +4007,7 @@ static void lib_link_object(FileData *fd, Main *main) ob= main->object.first; while(ob) { - if(ob->id.flag & LIB_NEEDLINK) { + if (ob->id.flag & LIB_NEEDLINK) { if (ob->id.properties) IDP_LibLinkProperty(ob->id.properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); if (ob->adt) lib_link_animdata(fd, &ob->id, ob->adt); @@ -4004,9 +4022,9 @@ static void lib_link_object(FileData *fd, Main *main) ob->dup_group= newlibadr_us(fd, ob->id.lib, ob->dup_group); ob->proxy= newlibadr_us(fd, ob->id.lib, ob->proxy); - if(ob->proxy) { + if (ob->proxy) { /* paranoia check, actually a proxy_from pointer should never be written... */ - if(ob->proxy->id.lib==NULL) { + if (ob->proxy->id.lib==NULL) { ob->proxy->proxy_from= NULL; ob->proxy= NULL; @@ -4027,8 +4045,8 @@ static void lib_link_object(FileData *fd, Main *main) poin= ob->data; ob->data= newlibadr_us(fd, ob->id.lib, ob->data); - if(ob->data==NULL && poin!=NULL) { - if(ob->id.lib) + if (ob->data==NULL && poin!=NULL) { + if (ob->id.lib) printf("Can't find obdata of %s lib %s\n", ob->id.name+2, ob->id.lib->name); else printf("Object %s lost data.\n", ob->id.name+2); @@ -4036,20 +4054,20 @@ static void lib_link_object(FileData *fd, Main *main) ob->type= OB_EMPTY; warn= 1; - if(ob->pose) { + if (ob->pose) { free_pose(ob->pose); ob->pose= NULL; ob->mode &= ~OB_MODE_POSE; } } - 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]); /* When the object is local and the data is library its possible * the material list size gets out of sync. [#22663] */ - if(ob->data && ob->id.lib != ((ID *)ob->data)->lib) { + if (ob->data && ob->id.lib != ((ID *)ob->data)->lib) { short *totcol_data= give_totcolp(ob); /* Only expand so as not to loose any object materials that might be set. */ - if(totcol_data && *totcol_data > ob->totcol) { + if (totcol_data && *totcol_data > ob->totcol) { /* printf("'%s' %d -> %d\n", ob->id.name, ob->totcol, *totcol_data); */ resize_object_material(ob, *totcol_data); } @@ -4070,22 +4088,22 @@ static void lib_link_object(FileData *fd, Main *main) lib_link_nlastrips(fd, &ob->id, &ob->nlastrips); // >>> XXX depreceated - old animation system - for(paf= ob->effect.first; paf; paf= paf->next) { - if(paf->type==EFF_PARTICLE) { + for (paf= ob->effect.first; paf; paf= paf->next) { + if (paf->type==EFF_PARTICLE) { paf->group= newlibadr_us(fd, ob->id.lib, paf->group); } } sens= ob->sensors.first; while(sens) { - for(a=0; a<sens->totlinks; a++) + for (a=0; a<sens->totlinks; a++) sens->links[a]= newglobadr(fd, sens->links[a]); - if(sens->type==SENS_TOUCH) { + if (sens->type==SENS_TOUCH) { bTouchSensor *ts= sens->data; ts->ma= newlibadr(fd, ob->id.lib, ts->ma); } - else if(sens->type==SENS_MESSAGE) { + else if (sens->type==SENS_MESSAGE) { bMessageSensor *ms= sens->data; ms->fromObject= newlibadr(fd, ob->id.lib, ms->fromObject); @@ -4095,10 +4113,10 @@ static void lib_link_object(FileData *fd, Main *main) cont= ob->controllers.first; while(cont) { - for(a=0; a<cont->totlinks; a++) + for (a=0; a<cont->totlinks; a++) cont->links[a]= newglobadr(fd, cont->links[a]); - if(cont->type==CONT_PYTHON) { + if (cont->type==CONT_PYTHON) { bPythonCont *pc= cont->data; pc->text= newlibadr(fd, ob->id.lib, pc->text); } @@ -4110,34 +4128,34 @@ static void lib_link_object(FileData *fd, Main *main) act= ob->actuators.first; while(act) { - if(act->type==ACT_SOUND) { + if (act->type==ACT_SOUND) { bSoundActuator *sa= act->data; sa->sound= newlibadr_us(fd, ob->id.lib, sa->sound); } - else if(act->type==ACT_GAME) { + else if (act->type==ACT_GAME) { /* bGameActuator *ga= act->data; */ } - else if(act->type==ACT_CAMERA) { + else if (act->type==ACT_CAMERA) { bCameraActuator *ca= act->data; ca->ob= newlibadr(fd, ob->id.lib, ca->ob); } /* leave this one, it's obsolete but necessary to read for conversion */ - else if(act->type==ACT_ADD_OBJECT) { + else if (act->type==ACT_ADD_OBJECT) { bAddObjectActuator *eoa= act->data; - if(eoa) eoa->ob= newlibadr(fd, ob->id.lib, eoa->ob); + if (eoa) eoa->ob= newlibadr(fd, ob->id.lib, eoa->ob); } - else if(act->type==ACT_OBJECT) { + else if (act->type==ACT_OBJECT) { bObjectActuator *oa= act->data; - if(oa==NULL) { + if (oa==NULL) { init_actuator(act); } else { oa->reference= newlibadr(fd, ob->id.lib, oa->reference); } } - else if(act->type==ACT_EDIT_OBJECT) { + else if (act->type==ACT_EDIT_OBJECT) { bEditObjectActuator *eoa= act->data; - if(eoa==NULL) { + if (eoa==NULL) { init_actuator(act); } else { @@ -4145,44 +4163,44 @@ static void lib_link_object(FileData *fd, Main *main) eoa->me= newlibadr(fd, ob->id.lib, eoa->me); } } - else if(act->type==ACT_SCENE) { + else if (act->type==ACT_SCENE) { bSceneActuator *sa= act->data; sa->camera= newlibadr(fd, ob->id.lib, sa->camera); sa->scene= newlibadr(fd, ob->id.lib, sa->scene); } - else if(act->type==ACT_ACTION) { + else if (act->type==ACT_ACTION) { bActionActuator *aa= act->data; aa->act= newlibadr(fd, ob->id.lib, aa->act); } - else if(act->type==ACT_SHAPEACTION) { + else if (act->type==ACT_SHAPEACTION) { bActionActuator *aa= act->data; aa->act= newlibadr(fd, ob->id.lib, aa->act); } - else if(act->type==ACT_PROPERTY) { + else if (act->type==ACT_PROPERTY) { bPropertyActuator *pa= act->data; pa->ob= newlibadr(fd, ob->id.lib, pa->ob); } - else if(act->type==ACT_MESSAGE) { + else if (act->type==ACT_MESSAGE) { bMessageActuator *ma= act->data; ma->toObject= newlibadr(fd, ob->id.lib, ma->toObject); } - else if(act->type==ACT_2DFILTER){ + else if (act->type==ACT_2DFILTER) { bTwoDFilterActuator *_2dfa = act->data; _2dfa->text= newlibadr(fd, ob->id.lib, _2dfa->text); } - else if(act->type==ACT_PARENT) { + else if (act->type==ACT_PARENT) { bParentActuator *parenta = act->data; parenta->ob = newlibadr(fd, ob->id.lib, parenta->ob); } - else if(act->type==ACT_STATE) { + else if (act->type==ACT_STATE) { /* bStateActuator *statea = act->data; */ } - else if(act->type==ACT_ARMATURE) { + else if (act->type==ACT_ARMATURE) { bArmatureActuator *arma= act->data; arma->target= newlibadr(fd, ob->id.lib, arma->target); arma->subtarget= newlibadr(fd, ob->id.lib, arma->subtarget); } - else if(act->type==ACT_STEERING) { + else if (act->type==ACT_STEERING) { bSteeringActuator *steeringa = act->data; steeringa->target = newlibadr(fd, ob->id.lib, steeringa->target); steeringa->navmesh = newlibadr(fd, ob->id.lib, steeringa->navmesh); @@ -4193,24 +4211,24 @@ static void lib_link_object(FileData *fd, Main *main) { FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim); - if(fluidmd && fluidmd->fss) + if (fluidmd && fluidmd->fss) fluidmd->fss->ipo = newlibadr_us(fd, ob->id.lib, fluidmd->fss->ipo); } { SmokeModifierData *smd = (SmokeModifierData *)modifiers_findByType(ob, eModifierType_Smoke); - if(smd && smd->type == MOD_SMOKE_TYPE_DOMAIN && smd->domain) + if (smd && smd->type == MOD_SMOKE_TYPE_DOMAIN && smd->domain) { smd->domain->flags |= MOD_SMOKE_FILE_LOAD; /* flag for refreshing the simulation after loading */ } } /* texture field */ - if(ob->pd) + if (ob->pd) lib_link_partdeflect(fd, &ob->id, ob->pd); - if(ob->soft) + if (ob->soft) ob->soft->effector_weights->group = newlibadr(fd, ob->id.lib, ob->soft->effector_weights->group); lib_link_particlesystems(fd, ob, &ob->id, &ob->particlesystem); @@ -4219,7 +4237,7 @@ static void lib_link_object(FileData *fd, Main *main) ob= ob->id.next; } - if(warn) { + if (warn) { BKE_report(fd->reports, RPT_WARNING, "Warning in console"); } } @@ -4276,7 +4294,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) md->scene = NULL; /* if modifiers disappear, or for upward compatibility */ - if(NULL==modifierType_getInfo(md->type)) + if (NULL==modifierType_getInfo(md->type)) md->type= eModifierType_None; if (md->type==eModifierType_Subsurf) { @@ -4299,15 +4317,15 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) direct_link_pointcache_list(fd, &clmd->ptcaches, &clmd->point_cache, 0); - if(clmd->sim_parms) { - if(clmd->sim_parms->presets > 10) + if (clmd->sim_parms) { + if (clmd->sim_parms->presets > 10) clmd->sim_parms->presets = 0; clmd->sim_parms->reset = 0; clmd->sim_parms->effector_weights = newdataadr(fd, clmd->sim_parms->effector_weights); - if(!clmd->sim_parms->effector_weights) { + if (!clmd->sim_parms->effector_weights) { clmd->sim_parms->effector_weights = BKE_add_effector_weights(NULL); } } @@ -4316,7 +4334,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) FluidsimModifierData *fluidmd = (FluidsimModifierData*) md; fluidmd->fss= newdataadr(fd, fluidmd->fss); - if(fluidmd->fss) { + if (fluidmd->fss) { fluidmd->fss->fmd= fluidmd; fluidmd->fss->meshVelocities = NULL; } @@ -4324,7 +4342,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) else if (md->type==eModifierType_Smoke) { SmokeModifierData *smd = (SmokeModifierData*) md; - if(smd->type==MOD_SMOKE_TYPE_DOMAIN) + if (smd->type==MOD_SMOKE_TYPE_DOMAIN) { smd->flow = NULL; smd->coll = NULL; @@ -4339,16 +4357,16 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) smd->domain->tex_wt = NULL; smd->domain->effector_weights = newdataadr(fd, smd->domain->effector_weights); - if(!smd->domain->effector_weights) + if (!smd->domain->effector_weights) smd->domain->effector_weights = BKE_add_effector_weights(NULL); direct_link_pointcache_list(fd, &(smd->domain->ptcaches[0]), &(smd->domain->point_cache[0]), 1); /* Smoke uses only one cache from now on, so store pointer convert */ - if(smd->domain->ptcaches[1].first || smd->domain->point_cache[1]) { - if(smd->domain->point_cache[1]) { + if (smd->domain->ptcaches[1].first || smd->domain->point_cache[1]) { + if (smd->domain->point_cache[1]) { PointCache *cache = newdataadr(fd, smd->domain->point_cache[1]); - if(cache->flag & PTCACHE_FAKE_SMOKE) + if (cache->flag & PTCACHE_FAKE_SMOKE) ; /* Smoke was already saved in "new format" and this cache is a fake one. */ else printf("High resolution smoke cache not available due to pointcache update. Please reset the simulation.\n"); @@ -4370,7 +4388,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) smd->flow = NULL; smd->domain = NULL; smd->coll = newdataadr(fd, smd->coll); - if(smd->coll) + if (smd->coll) { smd->coll->points = NULL; smd->coll->numpoints = 0; @@ -4383,7 +4401,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) else if (md->type==eModifierType_DynamicPaint) { DynamicPaintModifierData *pmd = (DynamicPaintModifierData*) md; - if(pmd->canvas) + if (pmd->canvas) { pmd->canvas = newdataadr(fd, pmd->canvas); pmd->canvas->pmd = pmd; @@ -4399,12 +4417,12 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) surface->data = NULL; direct_link_pointcache_list(fd, &(surface->ptcaches), &(surface->pointcache), 1); - if(!(surface->effector_weights = newdataadr(fd, surface->effector_weights))) + if (!(surface->effector_weights = newdataadr(fd, surface->effector_weights))) surface->effector_weights = BKE_add_effector_weights(NULL); } } } - if(pmd->brush) + if (pmd->brush) { pmd->brush = newdataadr(fd, pmd->brush); pmd->brush->pmd = pmd; @@ -4453,20 +4471,22 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) HookModifierData *hmd = (HookModifierData*) md; hmd->indexar= newdataadr(fd, hmd->indexar); - if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) { + if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) { int a; - for(a=0; a<hmd->totindex; a++) { + for (a=0; a<hmd->totindex; a++) { SWITCH_INT(hmd->indexar[a]); } } - } else if (md->type==eModifierType_ParticleSystem) { + } + else if (md->type==eModifierType_ParticleSystem) { ParticleSystemModifierData *psmd = (ParticleSystemModifierData*) md; psmd->dm= NULL; psmd->psys= newdataadr(fd, psmd->psys); psmd->flag &= ~eParticleSystemFlag_psys_updated; psmd->flag |= eParticleSystemFlag_file_loaded; - } else if (md->type==eModifierType_Explode) { + } + else if (md->type==eModifierType_Explode) { ExplodeModifierData *psmd = (ExplodeModifierData*) md; psmd->facepa=NULL; @@ -4484,24 +4504,24 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) mmd->bindweights= newdataadr(fd, mmd->bindweights); mmd->bindcos= newdataadr(fd, mmd->bindcos); - if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) { + if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) { int a; - if(mmd->bindoffsets) - for(a=0; a<mmd->totvert+1; a++) + if (mmd->bindoffsets) + for (a=0; a<mmd->totvert+1; a++) SWITCH_INT(mmd->bindoffsets[a]); - if(mmd->bindcagecos) - for(a=0; a<mmd->totcagevert*3; a++) + if (mmd->bindcagecos) + for (a=0; a<mmd->totcagevert*3; a++) SWITCH_INT(mmd->bindcagecos[a]); - if(mmd->dynverts) - for(a=0; a<mmd->totvert; a++) + if (mmd->dynverts) + for (a=0; a<mmd->totvert; a++) SWITCH_INT(mmd->dynverts[a]); - if(mmd->bindweights) - for(a=0; a<mmd->totcagevert*mmd->totvert; a++) + if (mmd->bindweights) + for (a=0; a<mmd->totcagevert*mmd->totvert; a++) SWITCH_INT(mmd->bindweights[a]); - if(mmd->bindcos) - for(a=0; a<mmd->totcagevert*3; a++) + if (mmd->bindcos) + for (a=0; a<mmd->totcagevert*3; a++) SWITCH_INT(mmd->bindcos[a]); } } @@ -4515,14 +4535,14 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) WarpModifierData *tmd = (WarpModifierData *) md; tmd->curfalloff= newdataadr(fd, tmd->curfalloff); - if(tmd->curfalloff) + if (tmd->curfalloff) direct_link_curvemapping(fd, tmd->curfalloff); } else if (md->type==eModifierType_WeightVGEdit) { WeightVGEditModifierData *wmd = (WeightVGEditModifierData*) md; wmd->cmap_curve = newdataadr(fd, wmd->cmap_curve); - if(wmd->cmap_curve) + if (wmd->cmap_curve) direct_link_curvemapping(fd, wmd->cmap_curve); } } @@ -4541,7 +4561,7 @@ static void direct_link_object(FileData *fd, Object *ob) /* loading saved files with editmode enabled works, but for undo we like to stay in object mode during undo presses so keep editmode disabled */ - if(fd->memfile) + if (fd->memfile) ob->mode &= ~(OB_MODE_EDIT|OB_MODE_PARTICLE_EDIT); ob->disp.first=ob->disp.last= NULL; @@ -4572,10 +4592,10 @@ static void direct_link_object(FileData *fd, Object *ob) link_list(fd, &ob->effect); paf= ob->effect.first; while(paf) { - if(paf->type==EFF_PARTICLE) { + if (paf->type==EFF_PARTICLE) { paf->keys= NULL; } - if(paf->type==EFF_WAVE) { + if (paf->type==EFF_WAVE) { WaveEff *wav = (WaveEff*) paf; PartEff *next = paf->next; WaveModifierData *wmd = (WaveModifierData*) modifier_new(eModifierType_Wave); @@ -4599,7 +4619,7 @@ static void direct_link_object(FileData *fd, Object *ob) paf = next; continue; } - if(paf->type==EFF_BUILD) { + if (paf->type==EFF_BUILD) { BuildEff *baf = (BuildEff*) paf; PartEff *next = paf->next; BuildModifierData *bmd = (BuildModifierData*) modifier_new(eModifierType_Build); @@ -4623,7 +4643,7 @@ static void direct_link_object(FileData *fd, Object *ob) ob->pd= newdataadr(fd, ob->pd); direct_link_partdeflect(ob->pd); ob->soft= newdataadr(fd, ob->soft); - if(ob->soft) { + if (ob->soft) { SoftBody *sb= ob->soft; sb->bpoint= NULL; // init pointers so it gets rebuilt nicely @@ -4633,15 +4653,15 @@ static void direct_link_object(FileData *fd, Object *ob) /* still have to be loaded to be compatible with old files */ sb->keys= newdataadr(fd, sb->keys); test_pointer_array(fd, (void **)&sb->keys); - if(sb->keys) { + if (sb->keys) { int a; - for(a=0; a<sb->totkey; a++) { + for (a=0; a<sb->totkey; a++) { sb->keys[a]= newdataadr(fd, sb->keys[a]); } } sb->effector_weights = newdataadr(fd, sb->effector_weights); - if(!sb->effector_weights) + if (!sb->effector_weights) sb->effector_weights = BKE_add_effector_weights(NULL); direct_link_pointcache_list(fd, &sb->ptcaches, &sb->pointcache, 0); @@ -4656,7 +4676,7 @@ static void direct_link_object(FileData *fd, Object *ob) prop= ob->prop.first; while(prop) { prop->poin= newdataadr(fd, prop->poin); - if(prop->poin==NULL) prop->poin= &prop->data; + if (prop->poin==NULL) prop->poin= &prop->data; prop= prop->next; } @@ -4675,7 +4695,8 @@ static void direct_link_object(FileData *fd, Object *ob) if (ob->init_state) { /* if a known first state is specified, set it so that the game will start ok */ ob->state = ob->init_state; - } else if (!ob->state) { + } + else if (!ob->state) { ob->state = 1; } cont= ob->controllers.first; @@ -4701,9 +4722,9 @@ static void direct_link_object(FileData *fd, Object *ob) HookModifierData *hmd = (HookModifierData*) modifier_new(eModifierType_Hook); hook->indexar= newdataadr(fd, hook->indexar); - if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) { + if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) { int a; - for(a=0; a<hook->totindex; a++) { + for (a=0; a<hook->totindex; a++) { SWITCH_INT(hook->indexar[a]); } } @@ -4738,7 +4759,7 @@ static void direct_link_object(FileData *fd, Object *ob) /* in case this value changes in future, clamp else we get undefined behavior */ CLAMP(ob->rotmode, ROT_MODE_MIN, ROT_MODE_MAX); - if(ob->sculpt) { + if (ob->sculpt) { ob->sculpt= MEM_callocN(sizeof(SculptSession), "reload sculpt session"); } } @@ -4750,14 +4771,14 @@ static void composite_patch(bNodeTree *ntree, Scene *scene) { bNode *node; - for(node= ntree->nodes.first; node; node= node->next) - if(node->id==NULL && ELEM4(node->type, CMP_NODE_R_LAYERS, CMP_NODE_COMPOSITE, CMP_NODE_DEFOCUS, CMP_NODE_OUTPUT_FILE)) + for (node= ntree->nodes.first; node; node= node->next) + if (node->id==NULL && ELEM4(node->type, CMP_NODE_R_LAYERS, CMP_NODE_COMPOSITE, CMP_NODE_DEFOCUS, CMP_NODE_OUTPUT_FILE)) node->id= &scene->id; } static void link_paint(FileData *fd, Scene *sce, Paint *p) { - if(p) { + if (p) { p->brush= newlibadr_us(fd, sce->id.lib, p->brush); p->paint_cursor= NULL; } @@ -4773,7 +4794,7 @@ static void lib_link_scene(FileData *fd, Main *main) sce= main->scene.first; while(sce) { - if(sce->id.flag & LIB_NEEDLINK) { + if (sce->id.flag & LIB_NEEDLINK) { /*Link ID Properties -- and copy this comment EXACTLY for easy finding of library blocks that implement this.*/ if (sce->id.properties) IDP_LibLinkProperty(sce->id.properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); @@ -4793,38 +4814,38 @@ static void lib_link_scene(FileData *fd, Main *main) link_paint(fd, sce, &sce->toolsettings->uvsculpt->paint); sce->toolsettings->skgen_template = newlibadr(fd, sce->id.lib, sce->toolsettings->skgen_template); - for(base= sce->base.first; base; base= next) { + for (base= sce->base.first; base; base= next) { next= base->next; /* base->object= newlibadr_us(fd, sce->id.lib, base->object); */ base->object= newlibadr_us(fd, sce->id.lib, base->object); - if(base->object==NULL) { + if (base->object==NULL) { BKE_reportf_wrap(fd->reports, RPT_ERROR, "LIB ERROR: Object lost from scene:'%s\'\n", sce->id.name+2); BLI_remlink(&sce->base, base); - if(base==sce->basact) sce->basact= NULL; + if (base==sce->basact) sce->basact= NULL; MEM_freeN(base); } } SEQ_BEGIN(sce->ed, seq) { - if(seq->ipo) seq->ipo= newlibadr_us(fd, sce->id.lib, seq->ipo); + if (seq->ipo) seq->ipo= newlibadr_us(fd, sce->id.lib, seq->ipo); seq->scene_sound = NULL; - if(seq->scene) { + if (seq->scene) { seq->scene= newlibadr(fd, sce->id.lib, seq->scene); - if(seq->scene) { + if (seq->scene) { seq->scene_sound = sound_scene_add_scene_sound_defaults(sce, seq); } } - if(seq->clip) { + if (seq->clip) { seq->clip = newlibadr(fd, sce->id.lib, seq->clip); } - if(seq->scene_camera) seq->scene_camera= newlibadr(fd, sce->id.lib, seq->scene_camera); - if(seq->sound) { + if (seq->scene_camera) seq->scene_camera= newlibadr(fd, sce->id.lib, seq->scene_camera); + if (seq->sound) { seq->scene_sound = NULL; - if(seq->type == SEQ_HD_SOUND) + if (seq->type == SEQ_HD_SOUND) seq->type = SEQ_SOUND; else seq->sound= newlibadr(fd, sce->id.lib, seq->sound); @@ -4838,8 +4859,8 @@ static void lib_link_scene(FileData *fd, Main *main) SEQ_END #ifdef DURIAN_CAMERA_SWITCH - for(marker= sce->markers.first; marker; marker= marker->next) { - if(marker->camera) { + for (marker= sce->markers.first; marker; marker= marker->next) { + if (marker->camera) { marker->camera= newlibadr(fd, sce->id.lib, marker->camera); } } @@ -4850,12 +4871,12 @@ static void lib_link_scene(FileData *fd, Main *main) seq_update_muting(sce->ed); seq_update_sound_bounds_all(sce); - if(sce->nodetree) { + if (sce->nodetree) { lib_link_ntree(fd, &sce->id, sce->nodetree); composite_patch(sce->nodetree, sce); } - for(srl= sce->r.layers.first; srl; srl= srl->next) { + for (srl= sce->r.layers.first; srl; srl= srl->next) { srl->mat_override= newlibadr_us(fd, sce->id.lib, srl->mat_override); srl->light_override= newlibadr_us(fd, sce->id.lib, srl->light_override); } @@ -4878,8 +4899,8 @@ static void link_recurs_seq(FileData *fd, ListBase *lb) link_list(fd, lb); - for(seq=lb->first; seq; seq=seq->next) - if(seq->seqbase.first) + for (seq=lb->first; seq; seq=seq->next) + if (seq->seqbase.first) link_recurs_seq(fd, &seq->seqbase); } @@ -4919,7 +4940,7 @@ static void direct_link_scene(FileData *fd, Scene *sce) sce->basact= newdataadr(fd, sce->basact); sce->toolsettings= newdataadr(fd, sce->toolsettings); - if(sce->toolsettings) { + if (sce->toolsettings) { direct_link_paint(fd, (Paint**)&sce->toolsettings->sculpt); direct_link_paint(fd, (Paint**)&sce->toolsettings->vpaint); direct_link_paint(fd, (Paint**)&sce->toolsettings->wpaint); @@ -4929,7 +4950,7 @@ static void direct_link_scene(FileData *fd, Scene *sce) sce->toolsettings->particle.paintcursor= NULL; } - if(sce->ed) { + if (sce->ed) { ListBase *old_seqbasep= &((Editing *)sce->ed)->seqbase; ed= sce->ed= newdataadr(fd, sce->ed); @@ -4944,55 +4965,60 @@ static void direct_link_scene(FileData *fd, Scene *sce) seq->seq2= newdataadr(fd, seq->seq2); seq->seq3= newdataadr(fd, seq->seq3); /* a patch: after introduction of effects with 3 input strips */ - if(seq->seq3==NULL) seq->seq3= seq->seq2; + if (seq->seq3==NULL) seq->seq3= seq->seq2; seq->plugin= newdataadr(fd, seq->plugin); seq->effectdata= newdataadr(fd, seq->effectdata); - if(seq->type & SEQ_EFFECT) + if (seq->type & SEQ_EFFECT) seq->flag |= SEQ_EFFECT_NOT_LOADED; - if(seq->type == SEQ_SPEED) { + if (seq->type == SEQ_SPEED) { SpeedControlVars *s= seq->effectdata; s->frameMap= NULL; } seq->strip= newdataadr(fd, seq->strip); - if(seq->strip && seq->strip->done==0) { + if (seq->strip && seq->strip->done==0) { seq->strip->done= 1; - if(seq->type == SEQ_IMAGE || + if (seq->type == SEQ_IMAGE || seq->type == SEQ_MOVIE || seq->type == SEQ_RAM_SOUND || seq->type == SEQ_HD_SOUND) { seq->strip->stripdata = newdataadr( fd, seq->strip->stripdata); - } else { + } + else { seq->strip->stripdata = NULL; } if (seq->flag & SEQ_USE_CROP) { seq->strip->crop = newdataadr( fd, seq->strip->crop); - } else { + } + else { seq->strip->crop = NULL; } if (seq->flag & SEQ_USE_TRANSFORM) { seq->strip->transform = newdataadr( fd, seq->strip->transform); - } else { + } + else { seq->strip->transform = NULL; } if (seq->flag & SEQ_USE_PROXY) { seq->strip->proxy = newdataadr( fd, seq->strip->proxy); seq->strip->proxy->anim = NULL; - } else { + } + else { seq->strip->proxy = NULL; } if (seq->flag & SEQ_USE_COLOR_BALANCE) { seq->strip->color_balance = newdataadr( fd, seq->strip->color_balance); - } else { + } + else { seq->strip->color_balance = NULL; } if (seq->strip->color_balance) { @@ -5011,7 +5037,7 @@ static void direct_link_scene(FileData *fd, Scene *sce) offset= ((intptr_t)&(temp.seqbase)) - ((intptr_t)&temp); /* root pointer */ - if(ed->seqbasep == old_seqbasep) { + if (ed->seqbasep == old_seqbasep) { ed->seqbasep= &ed->seqbase; } else { @@ -5020,22 +5046,22 @@ static void direct_link_scene(FileData *fd, Scene *sce) poin -= offset; poin= newdataadr(fd, poin); - if(poin) ed->seqbasep= (ListBase *)(poin+offset); + if (poin) ed->seqbasep= (ListBase *)(poin+offset); else ed->seqbasep= &ed->seqbase; } /* stack */ link_list(fd, &(ed->metastack)); - for(ms= ed->metastack.first; ms; ms= ms->next) { + for (ms= ed->metastack.first; ms; ms= ms->next) { ms->parseq= newdataadr(fd, ms->parseq); - if(ms->oldbasep == old_seqbasep) + if (ms->oldbasep == old_seqbasep) ms->oldbasep= &ed->seqbase; else { poin= (char *)ms->oldbasep; poin -= offset; poin= newdataadr(fd, poin); - if(poin) ms->oldbasep= (ListBase *)(poin+offset); + if (poin) ms->oldbasep= (ListBase *)(poin+offset); else ms->oldbasep= &ed->seqbase; } } @@ -5067,7 +5093,7 @@ static void direct_link_scene(FileData *fd, Scene *sce) link_list(fd, &(sce->r.layers)); sce->nodetree= newdataadr(fd, sce->nodetree); - if(sce->nodetree) + if (sce->nodetree) direct_link_nodetree(fd, sce->nodetree); } @@ -5080,7 +5106,7 @@ static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm) wm->id.us= 1; link_list(fd, &(wm->windows)); - for(win= wm->windows.first; win; win= win->next) { + for (win= wm->windows.first; win; win= win->next) { win->ghostwin= NULL; win->eventstate= NULL; win->curswin= NULL; @@ -5122,9 +5148,9 @@ static void lib_link_windowmanager(FileData *fd, Main *main) wmWindowManager *wm; wmWindow *win; - for(wm= main->wm.first; wm; wm= wm->id.next) { - if(wm->id.flag & LIB_NEEDLINK) { - for(win= wm->windows.first; win; win= win->next) + for (wm= main->wm.first; wm; wm= wm->id.next) { + if (wm->id.flag & LIB_NEEDLINK) { + for (win= wm->windows.first; win; win= win->next) win->screen= newlibadr(fd, NULL, win->screen); wm->id.flag -= LIB_NEEDLINK; @@ -5194,8 +5220,8 @@ static void lib_link_screen(FileData *fd, Main *main) bScreen *sc; ScrArea *sa; - for(sc= main->screen.first; sc; sc= sc->id.next) { - if(sc->id.flag & LIB_NEEDLINK) { + for (sc= main->screen.first; sc; sc= sc->id.next) { + if (sc->id.flag & LIB_NEEDLINK) { sc->id.us= 1; sc->scene= newlibadr(fd, sc->id.lib, sc->scene); sc->animtimer= NULL; /* saved in rare cases */ @@ -5207,7 +5233,7 @@ static void lib_link_screen(FileData *fd, Main *main) sa->full= newlibadr(fd, sc->id.lib, sa->full); for (sl= sa->spacedata.first; sl; sl= sl->next) { - if(sl->spacetype==SPACE_VIEW3D) { + if (sl->spacetype==SPACE_VIEW3D) { View3D *v3d= (View3D*) sl; BGpic *bgpic = NULL; @@ -5215,21 +5241,21 @@ static void lib_link_screen(FileData *fd, Main *main) v3d->ob_centre= newlibadr(fd, sc->id.lib, v3d->ob_centre); /* should be do_versions but not easy adding into the listbase */ - if(v3d->bgpic) { + if (v3d->bgpic) { v3d->bgpic= newlibadr(fd, sc->id.lib, v3d->bgpic); BLI_addtail(&v3d->bgpicbase, bgpic); v3d->bgpic= NULL; } - for(bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) { + for (bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) { bgpic->ima= newlibadr_us(fd, sc->id.lib, bgpic->ima); bgpic->clip= newlibadr_us(fd, sc->id.lib, bgpic->clip); } - if(v3d->localvd) { + if (v3d->localvd) { v3d->localvd->camera= newlibadr(fd, sc->id.lib, v3d->localvd->camera); } } - else if(sl->spacetype==SPACE_IPO) { + else if (sl->spacetype==SPACE_IPO) { SpaceIpo *sipo= (SpaceIpo *)sl; bDopeSheet *ads= sipo->ads; @@ -5238,15 +5264,15 @@ static void lib_link_screen(FileData *fd, Main *main) ads->filter_grp= newlibadr(fd, sc->id.lib, ads->filter_grp); } } - else if(sl->spacetype==SPACE_BUTS) { + else if (sl->spacetype==SPACE_BUTS) { SpaceButs *sbuts= (SpaceButs *)sl; sbuts->pinid= newlibadr(fd, sc->id.lib, sbuts->pinid); sbuts->mainbo= sbuts->mainb; sbuts->mainbuser= sbuts->mainb; - if(main->versionfile<132) + if (main->versionfile<132) butspace_version_132(sbuts); } - else if(sl->spacetype==SPACE_FILE) { + else if (sl->spacetype==SPACE_FILE) { SpaceFile *sfile= (SpaceFile *)sl; sfile->files= NULL; sfile->op= NULL; @@ -5254,7 +5280,7 @@ static void lib_link_screen(FileData *fd, Main *main) sfile->folders_prev= NULL; sfile->folders_next= NULL; } - else if(sl->spacetype==SPACE_ACTION) { + else if (sl->spacetype==SPACE_ACTION) { SpaceAction *saction= (SpaceAction *)sl; bDopeSheet *ads= &saction->ads; @@ -5265,7 +5291,7 @@ static void lib_link_screen(FileData *fd, Main *main) saction->action = newlibadr(fd, sc->id.lib, saction->action); } - else if(sl->spacetype==SPACE_IMAGE) { + else if (sl->spacetype==SPACE_IMAGE) { SpaceImage *sima= (SpaceImage *)sl; sima->image= newlibadr_us(fd, sc->id.lib, sima->image); @@ -5275,7 +5301,7 @@ static void lib_link_screen(FileData *fd, Main *main) */ sima->gpd= newlibadr_us(fd, sc->id.lib, sima->gpd); } - else if(sl->spacetype==SPACE_NLA){ + else if (sl->spacetype==SPACE_NLA) { SpaceNla *snla= (SpaceNla *)sl; bDopeSheet *ads= snla->ads; @@ -5284,14 +5310,14 @@ static void lib_link_screen(FileData *fd, Main *main) ads->filter_grp= newlibadr(fd, sc->id.lib, ads->filter_grp); } } - else if(sl->spacetype==SPACE_TEXT) { + else if (sl->spacetype==SPACE_TEXT) { SpaceText *st= (SpaceText *)sl; st->text= newlibadr(fd, sc->id.lib, st->text); st->drawcache= NULL; } - else if(sl->spacetype==SPACE_SCRIPT) { + else if (sl->spacetype==SPACE_SCRIPT) { SpaceScript *scpt= (SpaceScript *)sl; /*scpt->script = NULL; - 2.45 set to null, better re-run the script */ @@ -5302,7 +5328,7 @@ static void lib_link_screen(FileData *fd, Main *main) } } } - else if(sl->spacetype==SPACE_OUTLINER) { + else if (sl->spacetype==SPACE_OUTLINER) { SpaceOops *so= (SpaceOops *)sl; TreeStoreElem *tselem; int a; @@ -5310,14 +5336,14 @@ static void lib_link_screen(FileData *fd, Main *main) so->tree.first= so->tree.last= NULL; so->search_tse.id= newlibadr(fd, NULL, so->search_tse.id); - if(so->treestore) { + if (so->treestore) { tselem= so->treestore->data; - for(a=0; a<so->treestore->usedelem; a++, tselem++) { + for (a=0; a<so->treestore->usedelem; a++, tselem++) { tselem->id= newlibadr(fd, NULL, tselem->id); } } } - else if(sl->spacetype==SPACE_NODE) { + else if (sl->spacetype==SPACE_NODE) { SpaceNode *snode= (SpaceNode *)sl; snode->id= newlibadr(fd, sc->id.lib, snode->id); @@ -5326,16 +5352,16 @@ static void lib_link_screen(FileData *fd, Main *main) if (ELEM3(snode->treetype, NTREE_COMPOSIT, NTREE_SHADER, NTREE_TEXTURE)) { /* internal data, a bit patchy */ snode->nodetree= NULL; - if(snode->id) { - if(GS(snode->id->name)==ID_MA) + if (snode->id) { + if (GS(snode->id->name)==ID_MA) snode->nodetree= ((Material *)snode->id)->nodetree; - else if(GS(snode->id->name)==ID_WO) + else if (GS(snode->id->name)==ID_WO) snode->nodetree= ((World *)snode->id)->nodetree; - else if(GS(snode->id->name)==ID_LA) + else if (GS(snode->id->name)==ID_LA) snode->nodetree= ((Lamp *)snode->id)->nodetree; - else if(GS(snode->id->name)==ID_SCE) + else if (GS(snode->id->name)==ID_SCE) snode->nodetree= ((Scene *)snode->id)->nodetree; - else if(GS(snode->id->name)==ID_TE) + else if (GS(snode->id->name)==ID_TE) snode->nodetree= ((Tex *)snode->id)->nodetree; } } @@ -5345,7 +5371,7 @@ static void lib_link_screen(FileData *fd, Main *main) snode->linkdrag.first = snode->linkdrag.last = NULL; } - else if(sl->spacetype==SPACE_CLIP) { + else if (sl->spacetype==SPACE_CLIP) { SpaceClip *sclip= (SpaceClip *)sl; sclip->clip= newlibadr_us(fd, sc->id.lib, sclip->clip); @@ -5365,17 +5391,17 @@ static void lib_link_screen(FileData *fd, Main *main) static void *restore_pointer_by_name(Main *mainp, ID *id, int user) { - if(id) { + if (id) { ListBase *lb= which_libbase(mainp, GS(id->name)); - if(lb) { // there's still risk of checking corrupt mem (freed Ids in oops) + if (lb) { // there's still risk of checking corrupt mem (freed Ids in oops) ID *idn= lb->first; char *name= id->name+2; while(idn) { - if(idn->name[2]==name[0] && strcmp(idn->name+2, name)==0) { - if(idn->lib==id->lib) { - if(user && idn->us==0) idn->us++; + if (idn->name[2]==name[0] && strcmp(idn->name+2, name)==0) { + if (idn->lib==id->lib) { + if (user && idn->us==0) idn->us++; break; } } @@ -5391,15 +5417,15 @@ static int lib_link_seq_clipboard_cb(Sequence *seq, void *arg_pt) { Main *newmain = (Main *)arg_pt; - if(seq->sound) { + if (seq->sound) { seq->sound = restore_pointer_by_name(newmain, (ID *)seq->sound, 0); seq->sound->id.us++; } - if(seq->scene) + if (seq->scene) seq->scene = restore_pointer_by_name(newmain, (ID *)seq->scene, 1); - if(seq->scene_camera) + if (seq->scene_camera) seq->scene_camera = restore_pointer_by_name(newmain, (ID *)seq->scene_camera, 1); return 1; @@ -5422,11 +5448,11 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene) ScrArea *sa; /* first windowmanager */ - for(wm= newmain->wm.first; wm; wm= wm->id.next) { - for(win= wm->windows.first; win; win= win->next) { + for (wm= newmain->wm.first; wm; wm= wm->id.next) { + for (win= wm->windows.first; win; win= win->next) { win->screen= restore_pointer_by_name(newmain, (ID *)win->screen, 1); - if(win->screen==NULL) + if (win->screen==NULL) win->screen= curscreen; win->screen->winid= win->winid; @@ -5434,11 +5460,11 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene) } - for(sc= newmain->screen.first; sc; sc= sc->id.next) { + for (sc= newmain->screen.first; sc; sc= sc->id.next) { Scene *oldscene= sc->scene; sc->scene= restore_pointer_by_name(newmain, (ID *)sc->scene, 1); - if(sc->scene==NULL) + if (sc->scene==NULL) sc->scene= curscene; /* keep cursor location through undo */ @@ -5449,34 +5475,34 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene) SpaceLink *sl; for (sl= sa->spacedata.first; sl; sl= sl->next) { - if(sl->spacetype==SPACE_VIEW3D) { + if (sl->spacetype==SPACE_VIEW3D) { View3D *v3d= (View3D*) sl; BGpic *bgpic; ARegion *ar; - if(v3d->scenelock) + if (v3d->scenelock) v3d->camera= NULL; /* always get from scene */ else v3d->camera= restore_pointer_by_name(newmain, (ID *)v3d->camera, 1); - if(v3d->camera==NULL) + if (v3d->camera==NULL) v3d->camera= sc->scene->camera; v3d->ob_centre= restore_pointer_by_name(newmain, (ID *)v3d->ob_centre, 1); - for(bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) { + for (bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) { bgpic->ima= restore_pointer_by_name(newmain, (ID *)bgpic->ima, 1); bgpic->clip= restore_pointer_by_name(newmain, (ID *)bgpic->clip, 1); } - if(v3d->localvd) { + if (v3d->localvd) { /*Base *base;*/ v3d->localvd->camera= sc->scene->camera; /* localview can become invalid during undo/redo steps, so we exit it when no could be found */ /* XXX regionlocalview ? - for(base= sc->scene->base.first; base; base= base->next) { - if(base->lay & v3d->lay) break; + for (base= sc->scene->base.first; base; base= base->next) { + if (base->lay & v3d->lay) break; } - if(base==NULL) { + if (base==NULL) { v3d->lay= v3d->localvd->lay; v3d->layact= v3d->localvd->layact; MEM_freeN(v3d->localvd); @@ -5484,22 +5510,22 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene) } */ } - else if(v3d->scenelock) v3d->lay= sc->scene->lay; + else if (v3d->scenelock) v3d->lay= sc->scene->lay; /* not very nice, but could help */ - if((v3d->layact & v3d->lay)==0) v3d->layact= v3d->lay; + if ((v3d->layact & v3d->lay)==0) v3d->layact= v3d->lay; /* free render engines for now */ - for(ar= sa->regionbase.first; ar; ar= ar->next) { + for (ar= sa->regionbase.first; ar; ar= ar->next) { RegionView3D *rv3d= ar->regiondata; - if(rv3d && rv3d->render_engine) { + if (rv3d && rv3d->render_engine) { RE_engine_free(rv3d->render_engine); rv3d->render_engine= NULL; } } } - else if(sl->spacetype==SPACE_IPO) { + else if (sl->spacetype==SPACE_IPO) { SpaceIpo *sipo= (SpaceIpo *)sl; bDopeSheet *ads= sipo->ads; @@ -5510,17 +5536,17 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene) ads->filter_grp= restore_pointer_by_name(newmain, (ID *)ads->filter_grp, 0); } } - else if(sl->spacetype==SPACE_BUTS) { + else if (sl->spacetype==SPACE_BUTS) { SpaceButs *sbuts= (SpaceButs *)sl; sbuts->pinid = restore_pointer_by_name(newmain, sbuts->pinid, 0); //XXX if (sbuts->ri) sbuts->ri->curtile = 0; } - else if(sl->spacetype==SPACE_FILE) { + else if (sl->spacetype==SPACE_FILE) { SpaceFile *sfile= (SpaceFile *)sl; sfile->op= NULL; } - else if(sl->spacetype==SPACE_ACTION) { + else if (sl->spacetype==SPACE_ACTION) { SpaceAction *saction= (SpaceAction *)sl; saction->action = restore_pointer_by_name(newmain, (ID *)saction->action, 1); @@ -5529,7 +5555,7 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene) if (saction->ads.filter_grp) saction->ads.filter_grp= restore_pointer_by_name(newmain, (ID *)saction->ads.filter_grp, 0); } - else if(sl->spacetype==SPACE_IMAGE) { + else if (sl->spacetype==SPACE_IMAGE) { SpaceImage *sima= (SpaceImage *)sl; sima->image= restore_pointer_by_name(newmain, (ID *)sima->image, 1); @@ -5545,7 +5571,7 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene) */ sima->gpd= restore_pointer_by_name(newmain, (ID *)sima->gpd, 1); } - else if(sl->spacetype==SPACE_NLA){ + else if (sl->spacetype==SPACE_NLA) { SpaceNla *snla= (SpaceNla *)sl; bDopeSheet *ads= snla->ads; @@ -5556,13 +5582,13 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene) ads->filter_grp= restore_pointer_by_name(newmain, (ID *)ads->filter_grp, 0); } } - else if(sl->spacetype==SPACE_TEXT) { + else if (sl->spacetype==SPACE_TEXT) { SpaceText *st= (SpaceText *)sl; st->text= restore_pointer_by_name(newmain, (ID *)st->text, 1); - if(st->text==NULL) st->text= newmain->text.first; + if (st->text==NULL) st->text= newmain->text.first; } - else if(sl->spacetype==SPACE_SCRIPT) { + else if (sl->spacetype==SPACE_SCRIPT) { SpaceScript *scpt= (SpaceScript *)sl; scpt->script= restore_pointer_by_name(newmain, (ID *)scpt->script, 1); @@ -5572,21 +5598,21 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene) SCRIPT_SET_NULL(scpt->script) } } - else if(sl->spacetype==SPACE_OUTLINER) { + else if (sl->spacetype==SPACE_OUTLINER) { SpaceOops *so= (SpaceOops *)sl; int a; so->search_tse.id= restore_pointer_by_name(newmain, so->search_tse.id, 0); - if(so->treestore) { + if (so->treestore) { TreeStore *ts= so->treestore; TreeStoreElem *tselem=ts->data; - for(a=0; a<ts->usedelem; a++, tselem++) { + for (a=0; a<ts->usedelem; a++, tselem++) { tselem->id= restore_pointer_by_name(newmain, tselem->id, 0); } } } - else if(sl->spacetype==SPACE_NODE) { + else if (sl->spacetype==SPACE_NODE) { SpaceNode *snode= (SpaceNode *)sl; snode->id= restore_pointer_by_name(newmain, snode->id, 1); @@ -5594,12 +5620,12 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene) if (ELEM3(snode->treetype, NTREE_COMPOSIT, NTREE_SHADER, NTREE_TEXTURE)) { snode->nodetree= NULL; - if(snode->id) { - if(GS(snode->id->name)==ID_MA) + if (snode->id) { + if (GS(snode->id->name)==ID_MA) snode->nodetree= ((Material *)snode->id)->nodetree; - else if(GS(snode->id->name)==ID_SCE) + else if (GS(snode->id->name)==ID_SCE) snode->nodetree= ((Scene *)snode->id)->nodetree; - else if(GS(snode->id->name)==ID_TE) + else if (GS(snode->id->name)==ID_TE) snode->nodetree= ((Tex *)snode->id)->nodetree; } } @@ -5607,7 +5633,7 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene) snode->nodetree= restore_pointer_by_name(newmain, &snode->nodetree->id, 1); } } - else if(sl->spacetype==SPACE_CLIP) { + else if (sl->spacetype==SPACE_CLIP) { SpaceClip *sclip= (SpaceClip *)sl; sclip->clip= restore_pointer_by_name(newmain, (ID *)sclip->clip, 1); @@ -5629,7 +5655,7 @@ static void direct_link_region(FileData *fd, ARegion *ar, int spacetype) link_list(fd, &(ar->panels)); - for(pa= ar->panels.first; pa; pa=pa->next) { + for (pa= ar->panels.first; pa; pa=pa->next) { pa->paneltab= newdataadr(fd, pa->paneltab); pa->runtime_flag= 0; pa->activedata= NULL; @@ -5637,8 +5663,8 @@ static void direct_link_region(FileData *fd, ARegion *ar, int spacetype) } ar->regiondata= newdataadr(fd, ar->regiondata); - if(ar->regiondata) { - if(spacetype==SPACE_VIEW3D) { + if (ar->regiondata) { + if (spacetype==SPACE_VIEW3D) { RegionView3D *rv3d= ar->regiondata; rv3d->localvd= newdataadr(fd, rv3d->localvd); @@ -5671,8 +5697,8 @@ static void view3d_split_250(View3D *v3d, ListBase *regions) { ARegion *ar; - for(ar= regions->first; ar; ar= ar->next) { - if(ar->regiontype==RGN_TYPE_WINDOW && ar->regiondata==NULL) { + for (ar= regions->first; ar; ar= ar->next) { + if (ar->regiontype==RGN_TYPE_WINDOW && ar->regiondata==NULL) { RegionView3D *rv3d; rv3d= ar->regiondata= MEM_callocN(sizeof(RegionView3D), "region v3d patch"); @@ -5685,7 +5711,7 @@ static void view3d_split_250(View3D *v3d, ListBase *regions) } /* this was not initialized correct always */ - if(v3d->twtype == 0) + if (v3d->twtype == 0) v3d->twtype= V3D_MANIP_TRANSLATE; } @@ -5707,31 +5733,31 @@ static void direct_link_screen(FileData *fd, bScreen *sc) /* hacky patch... but people have been saving files with the verse-blender, causing the handler to keep running for ever, with no means to disable it */ - for(a=0; a<SCREEN_MAXHANDLER; a+=2) { - if( sc->handler[a]==SCREEN_HANDLER_VERSE) { + for (a=0; a<SCREEN_MAXHANDLER; a+=2) { + if ( sc->handler[a]==SCREEN_HANDLER_VERSE) { sc->handler[a]= 0; break; } } /* edges */ - for(se= sc->edgebase.first; se; se= se->next) { + for (se= sc->edgebase.first; se; se= se->next) { se->v1= newdataadr(fd, se->v1); se->v2= newdataadr(fd, se->v2); - if( (intptr_t)se->v1 > (intptr_t)se->v2) { + if ( (intptr_t)se->v1 > (intptr_t)se->v2) { sv= se->v1; se->v1= se->v2; se->v2= sv; } - if(se->v1==NULL) { + if (se->v1==NULL) { printf("error reading screen... file corrupt\n"); se->v1= se->v2; } } /* areas */ - for(sa= sc->areabase.first; sa; sa= sa->next) { + for (sa= sc->areabase.first; sa; sa= sa->next) { SpaceLink *sl; ARegion *ar; @@ -5741,24 +5767,24 @@ static void direct_link_screen(FileData *fd, bScreen *sc) sa->handlers.first= sa->handlers.last= NULL; sa->type= NULL; /* spacetype callbacks */ - for(ar= sa->regionbase.first; ar; ar= ar->next) + for (ar= sa->regionbase.first; ar; ar= ar->next) direct_link_region(fd, ar, sa->spacetype); /* accident can happen when read/save new file with older version */ /* 2.50: we now always add spacedata for info */ - if(sa->spacedata.first==NULL) { + if (sa->spacedata.first==NULL) { SpaceInfo *sinfo= MEM_callocN(sizeof(SpaceInfo), "spaceinfo"); sa->spacetype= sinfo->spacetype= SPACE_INFO; BLI_addtail(&sa->spacedata, sinfo); } /* add local view3d too */ - else if(sa->spacetype==SPACE_VIEW3D) + else if (sa->spacetype==SPACE_VIEW3D) view3d_split_250(sa->spacedata.first, &sa->regionbase); for (sl= sa->spacedata.first; sl; sl= sl->next) { link_list(fd, &(sl->regionbase)); - for(ar= sl->regionbase.first; ar; ar= ar->next) + for (ar= sl->regionbase.first; ar; ar= ar->next) direct_link_region(fd, ar, sl->spacetype); if (sl->spacetype==SPACE_VIEW3D) { @@ -5770,16 +5796,16 @@ static void direct_link_screen(FileData *fd, bScreen *sc) link_list(fd, &(v3d->bgpicbase)); /* should be do_versions except this doesnt fit well there */ - if(v3d->bgpic) { + if (v3d->bgpic) { bgpic= newdataadr(fd, v3d->bgpic); BLI_addtail(&v3d->bgpicbase, bgpic); v3d->bgpic= NULL; } - for(bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) + for (bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) bgpic->iuser.ok= 1; - if(v3d->gpd) { + if (v3d->gpd) { v3d->gpd= newdataadr(fd, v3d->gpd); direct_link_gpencil(fd, v3d->gpd); } @@ -5790,7 +5816,7 @@ static void direct_link_screen(FileData *fd, bScreen *sc) v3d->properties_storage= NULL; /* render can be quite heavy, set to wire on load */ - if(v3d->drawtype == OB_RENDER) + if (v3d->drawtype == OB_RENDER) v3d->drawtype = OB_WIRE; view3d_split_250(v3d, &sl->regionbase); @@ -5810,18 +5836,18 @@ static void direct_link_screen(FileData *fd, bScreen *sc) SpaceOops *soops= (SpaceOops*) sl; soops->treestore= newdataadr(fd, soops->treestore); - if(soops->treestore) { + if (soops->treestore) { soops->treestore->data= newdataadr(fd, soops->treestore->data); /* we only saved what was used */ soops->treestore->totelem= soops->treestore->usedelem; soops->storeflag |= SO_TREESTORE_CLEANUP; // at first draw } } - else if(sl->spacetype==SPACE_IMAGE) { + else if (sl->spacetype==SPACE_IMAGE) { SpaceImage *sima= (SpaceImage *)sl; sima->cumap= newdataadr(fd, sima->cumap); - if(sima->cumap) + if (sima->cumap) direct_link_curvemapping(fd, sima->cumap); sima->iuser.scene= NULL; @@ -5841,39 +5867,39 @@ static void direct_link_screen(FileData *fd, bScreen *sc) direct_link_gpencil(fd, sima->gpd); #endif } - else if(sl->spacetype==SPACE_NODE) { + else if (sl->spacetype==SPACE_NODE) { SpaceNode *snode= (SpaceNode *)sl; - if(snode->gpd) { + if (snode->gpd) { snode->gpd= newdataadr(fd, snode->gpd); direct_link_gpencil(fd, snode->gpd); } } - else if(sl->spacetype==SPACE_TIME) { + else if (sl->spacetype==SPACE_TIME) { SpaceTime *stime= (SpaceTime *)sl; stime->caches.first= stime->caches.last= NULL; } - else if(sl->spacetype==SPACE_LOGIC) { + else if (sl->spacetype==SPACE_LOGIC) { SpaceLogic *slogic= (SpaceLogic *)sl; - if(slogic->gpd) { + if (slogic->gpd) { slogic->gpd= newdataadr(fd, slogic->gpd); direct_link_gpencil(fd, slogic->gpd); } } - else if(sl->spacetype==SPACE_SEQ) { + else if (sl->spacetype==SPACE_SEQ) { SpaceSeq *sseq= (SpaceSeq *)sl; - if(sseq->gpd) { + if (sseq->gpd) { sseq->gpd= newdataadr(fd, sseq->gpd); direct_link_gpencil(fd, sseq->gpd); } } - else if(sl->spacetype==SPACE_BUTS) { + else if (sl->spacetype==SPACE_BUTS) { SpaceButs *sbuts= (SpaceButs *)sl; sbuts->path= NULL; sbuts->texuser= NULL; } - else if(sl->spacetype==SPACE_CONSOLE) { + else if (sl->spacetype==SPACE_CONSOLE) { SpaceConsole *sconsole= (SpaceConsole *)sl; ConsoleLine *cl, *cl_next; @@ -5886,7 +5912,7 @@ static void direct_link_screen(FileData *fd, bScreen *sc) /*comma expressions, (e.g. expr1, expr2, expr3) evalutate each expression, from left to right. the right-most expression sets the result of the comma expression as a whole*/ - for(cl= sconsole->history.first; cl; cl= cl_next) { + for (cl= sconsole->history.first; cl; cl= cl_next) { cl_next= cl->next; cl->line= newdataadr(fd, cl->line); if (cl->line) { @@ -5899,7 +5925,7 @@ static void direct_link_screen(FileData *fd, bScreen *sc) } } } - else if(sl->spacetype==SPACE_FILE) { + else if (sl->spacetype==SPACE_FILE) { SpaceFile *sfile= (SpaceFile *)sl; /* this sort of info is probably irrelevant for reloading... @@ -5929,9 +5955,9 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main) { Main *newmain; - for(newmain= fd->mainlist.first; newmain; newmain= newmain->next) { - if(newmain->curlib) { - if(BLI_path_cmp(newmain->curlib->filepath, lib->filepath) == 0) { + for (newmain= fd->mainlist.first; newmain; newmain= newmain->next) { + if (newmain->curlib) { + if (BLI_path_cmp(newmain->curlib->filepath, lib->filepath) == 0) { BKE_reportf_wrap(fd->reports, RPT_WARNING, "Library '%s', '%s' had multiple instances, save and reload!", lib->name, lib->filepath); @@ -5965,7 +5991,7 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main) static void lib_link_library(FileData *UNUSED(fd), Main *main) { Library *lib; - for(lib= main->library.first; lib; lib= lib->id.next) { + for (lib= main->library.first; lib; lib= lib->id.next) { lib->id.us= 1; } } @@ -5976,7 +6002,7 @@ static void fix_relpaths_library(const char *basepath, Main *main) Library *lib; /* BLO_read_from_memory uses a blank filename */ if (basepath==NULL || basepath[0] == '\0') { - for(lib= main->library.first; lib; lib= lib->id.next) { + for (lib= main->library.first; lib; lib= lib->id.next) { /* when loading a linked lib into a file which has not been saved, * there is nothing we can be relative to, so instead we need to make * it absolute. This can happen when appending an object with a relative @@ -5988,7 +6014,7 @@ static void fix_relpaths_library(const char *basepath, Main *main) } } else { - for(lib= main->library.first; lib; lib= lib->id.next) { + for (lib= main->library.first; lib; lib= lib->id.next) { /* Libraries store both relative and abs paths, recreate relative paths, * relative to the blend file since indirectly linked libs will be relative to their direct linked library */ if (strncmp(lib->name, "//", 2)==0) { /* if this is relative to begin with? */ @@ -6007,7 +6033,7 @@ static void lib_link_speaker(FileData *fd, Main *main) spk= main->speaker.first; while(spk) { - if(spk->id.flag & LIB_NEEDLINK) { + if (spk->id.flag & LIB_NEEDLINK) { if (spk->adt) lib_link_animdata(fd, &spk->id, spk->adt); spk->sound= newlibadr(fd, spk->id.lib, spk->sound); @@ -6039,7 +6065,7 @@ static void direct_link_sound(FileData *fd, bSound *sound) sound->waveform = NULL; // versioning stuff, if there was a cache, then we enable caching: - if(sound->cache) + if (sound->cache) { sound->flags |= SOUND_FLAGS_CACHING; sound->cache = NULL; @@ -6055,7 +6081,7 @@ static void lib_link_sound(FileData *fd, Main *main) sound= main->sound.first; while(sound) { - if(sound->id.flag & LIB_NEEDLINK) { + if (sound->id.flag & LIB_NEEDLINK) { sound->id.flag -= LIB_NEEDLINK; sound->ipo= newlibadr_us(fd, sound->id.lib, sound->ipo); // XXX depreceated - old animation system @@ -6078,7 +6104,7 @@ static void lib_link_group(FileData *fd, Main *main) int add_us; while(group) { - if(group->id.flag & LIB_NEEDLINK) { + if (group->id.flag & LIB_NEEDLINK) { group->id.flag -= LIB_NEEDLINK; add_us= 0; @@ -6086,16 +6112,16 @@ static void lib_link_group(FileData *fd, Main *main) go= group->gobject.first; while(go) { go->ob= newlibadr(fd, group->id.lib, go->ob); - if(go->ob) { + if (go->ob) { go->ob->flag |= OB_FROMGROUP; /* if group has an object, it increments user... */ add_us= 1; - if(go->ob->id.us==0) + if (go->ob->id.us==0) go->ob->id.us= 1; } go= go->next; } - if(add_us) group->id.us++; + if (add_us) group->id.us++; rem_from_group(group, NULL, NULL, NULL); /* removes NULL entries */ } group= group->id.next; @@ -6130,10 +6156,10 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip) clip->adt= newdataadr(fd, clip->adt); - if(fd->movieclipmap) clip->cache= newmclipadr(fd, clip->cache); + if (fd->movieclipmap) clip->cache= newmclipadr(fd, clip->cache); else clip->cache= NULL; - if(fd->movieclipmap) clip->tracking.camera.intrinsics= newmclipadr(fd, clip->tracking.camera.intrinsics); + if (fd->movieclipmap) clip->tracking.camera.intrinsics= newmclipadr(fd, clip->tracking.camera.intrinsics); else clip->tracking.camera.intrinsics= NULL; direct_link_movieTracks(fd, &tracking->tracks); @@ -6166,7 +6192,7 @@ static void lib_link_movieclip(FileData *fd, Main *main) clip= main->movieclip.first; while(clip) { - if(clip->id.flag & LIB_NEEDLINK) { + if (clip->id.flag & LIB_NEEDLINK) { if (clip->adt) lib_link_animdata(fd, &clip->id, clip->adt); @@ -6265,7 +6291,7 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID oldnewmap_insert(fd->libmap, bhead->old, id, bhead->code); /* for ID_ID check */ /* do after read_struct, for dna reconstruct */ - if(bhead->code==ID_ID) { + if (bhead->code==ID_ID) { lb= which_libbase(main, GS(id->name)); } else { @@ -6277,13 +6303,13 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID /* clear first 8 bits */ id->flag= (id->flag & 0xFF00) | flag | LIB_NEEDLINK; id->lib= main->curlib; - if(id->flag & LIB_FAKEUSER) id->us= 1; + if (id->flag & LIB_FAKEUSER) id->us= 1; else id->us= 0; id->icon_id = 0; id->flag &= ~(LIB_ID_RECALC|LIB_ID_RECALC_DATA); /* 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); } @@ -6419,7 +6445,7 @@ static BHead *read_global(BlendFileData *bfd, FileData *fd, BHead *bhead) bfd->globalf= fg->globalf; BLI_strncpy(bfd->filename, fg->filename, sizeof(bfd->filename)); - if(G.fileflags & G_FILE_RECOVER) + if (G.fileflags & G_FILE_RECOVER) BLI_strncpy(fd->relabase, fg->filename, sizeof(fd->relabase)); bfd->curscreen= fg->curscreen; @@ -6440,8 +6466,8 @@ static void link_global(FileData *fd, BlendFileData *bfd) bfd->curscreen= newlibadr(fd, NULL, bfd->curscreen); bfd->curscene= newlibadr(fd, NULL, bfd->curscene); // this happens in files older than 2.35 - if(bfd->curscene==NULL) { - if(bfd->curscreen) bfd->curscene= bfd->curscreen->scene; + if (bfd->curscene==NULL) { + if (bfd->curscreen) bfd->curscene= bfd->curscreen->scene; } } @@ -6451,12 +6477,12 @@ static void vcol_to_fcol(Mesh *me) unsigned int *mcol, *mcoln, *mcolmain; int a; - if(me->totface==0 || me->mcol==NULL) return; + if (me->totface==0 || me->mcol==NULL) return; mcoln= mcolmain= MEM_mallocN(4*sizeof(int)*me->totface, "mcoln"); mcol = (unsigned int *)me->mcol; mface= me->mface; - for(a=me->totface; a>0; a--, mface++) { + for (a=me->totface; a>0; a--, mface++) { mcoln[0]= mcol[mface->v1]; mcoln[1]= mcol[mface->v2]; mcoln[2]= mcol[mface->v3]; @@ -6500,7 +6526,7 @@ static void do_version_bone_head_tail_237(Bone *bone) mul_v3_fl(vec, bone->length); add_v3_v3v3(bone->arm_tail, bone->arm_head, vec); - for(child= bone->childbase.first; child; child= child->next) + for (child= bone->childbase.first; child; child= child->next) do_version_bone_head_tail_237(child); } @@ -6508,13 +6534,13 @@ static void bone_version_238(ListBase *lb) { Bone *bone; - for(bone= lb->first; bone; bone= bone->next) { - if(bone->rad_tail==0.0f && bone->rad_head==0.0f) { + for (bone= lb->first; bone; bone= bone->next) { + if (bone->rad_tail==0.0f && bone->rad_head==0.0f) { bone->rad_head= 0.25f*bone->length; bone->rad_tail= 0.1f*bone->length; bone->dist-= bone->rad_head; - if(bone->dist<=0.0f) bone->dist= 0.0f; + if (bone->dist<=0.0f) bone->dist= 0.0f; } bone_version_238(&bone->childbase); } @@ -6524,8 +6550,8 @@ static void bone_version_239(ListBase *lb) { Bone *bone; - for(bone= lb->first; bone; bone= bone->next) { - if(bone->layer==0) + for (bone= lb->first; bone; bone= bone->next) { + if (bone->layer==0) bone->layer= 1; bone_version_239(&bone->childbase); } @@ -6535,10 +6561,10 @@ static void ntree_version_241(bNodeTree *ntree) { bNode *node; - if(ntree->type==NTREE_COMPOSIT) { - for(node= ntree->nodes.first; node; node= node->next) { - if(node->type==CMP_NODE_BLUR) { - if(node->storage==NULL) { + if (ntree->type==NTREE_COMPOSIT) { + for (node= ntree->nodes.first; node; node= node->next) { + if (node->type==CMP_NODE_BLUR) { + if (node->storage==NULL) { NodeBlurData *nbd= MEM_callocN(sizeof(NodeBlurData), "node blur patch"); nbd->sizex= node->custom1; nbd->sizey= node->custom2; @@ -6546,8 +6572,8 @@ static void ntree_version_241(bNodeTree *ntree) node->storage= nbd; } } - else if(node->type==CMP_NODE_VECBLUR) { - if(node->storage==NULL) { + else if (node->type==CMP_NODE_VECBLUR) { + if (node->storage==NULL) { NodeBlurData *nbd= MEM_callocN(sizeof(NodeBlurData), "node blur patch"); nbd->samples= node->custom1; nbd->maxspeed= node->custom2; @@ -6563,19 +6589,19 @@ static void ntree_version_242(bNodeTree *ntree) { bNode *node; - if(ntree->type==NTREE_COMPOSIT) { - for(node= ntree->nodes.first; node; node= node->next) { - if(node->type==CMP_NODE_HUE_SAT) { - if(node->storage) { + if (ntree->type==NTREE_COMPOSIT) { + for (node= ntree->nodes.first; node; node= node->next) { + if (node->type==CMP_NODE_HUE_SAT) { + if (node->storage) { NodeHueSat *nhs= node->storage; - if(nhs->val==0.0f) nhs->val= 1.0f; + if (nhs->val==0.0f) nhs->val= 1.0f; } } } } - else if(ntree->type==NTREE_SHADER) { - for(node= ntree->nodes.first; node; node= node->next) - if(node->type == SH_NODE_GEOMETRY && node->storage == NULL) + else if (ntree->type==NTREE_SHADER) { + for (node= ntree->nodes.first; node; node= node->next) + if (node->type == SH_NODE_GEOMETRY && node->storage == NULL) node->storage= MEM_callocN(sizeof(NodeGeometry), "NodeGeometry"); } @@ -6591,9 +6617,9 @@ static void sort_shape_fix(Main *main) while(sorted==0) { sorted= 1; - for(key= main->key.first; key; key= key->id.next) { - for(kb= key->block.first; kb; kb= kb->next) { - if(kb->next && kb->adrcode>kb->next->adrcode) { + for (key= main->key.first; key; key= key->id.next) { + for (kb= key->block.first; kb; kb= kb->next) { + if (kb->next && kb->adrcode>kb->next->adrcode) { KeyBlock *next= kb->next; BLI_remlink(&key->block, kb); BLI_insertlink(&key->block, next, kb); @@ -6602,7 +6628,7 @@ static void sort_shape_fix(Main *main) } } } - if(sorted==0) printf("warning, shape keys were sorted incorrect, fixed it!\n"); + if (sorted==0) printf("warning, shape keys were sorted incorrect, fixed it!\n"); } } @@ -6704,11 +6730,11 @@ static void do_version_ntree_242_2(bNodeTree *ntree) { bNode *node; - if(ntree->type==NTREE_COMPOSIT) { - for(node= ntree->nodes.first; node; node= node->next) { - if(ELEM3(node->type, CMP_NODE_IMAGE, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) { + if (ntree->type==NTREE_COMPOSIT) { + for (node= ntree->nodes.first; node; node= node->next) { + if (ELEM3(node->type, CMP_NODE_IMAGE, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) { /* only image had storage */ - if(node->storage) { + if (node->storage) { NodeImageAnim *nia= node->storage; ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "ima user node"); @@ -6741,27 +6767,27 @@ static void ntree_version_245(FileData *fd, Library *lib, bNodeTree *ntree) Image *image; ImageUser *iuser; - if(ntree->type==NTREE_COMPOSIT) { - for(node= ntree->nodes.first; node; node= node->next) { - if(node->type == CMP_NODE_ALPHAOVER) { - if(!node->storage) { + if (ntree->type==NTREE_COMPOSIT) { + for (node= ntree->nodes.first; node; node= node->next) { + if (node->type == CMP_NODE_ALPHAOVER) { + if (!node->storage) { ntf= MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats"); node->storage= ntf; - if(node->custom1) + if (node->custom1) ntf->x= 1.0f; } } /* fix for temporary flag changes during 245 cycle */ nodeid= newlibadr(fd, lib, node->id); - if(node->storage && nodeid && GS(nodeid->name) == ID_IM) { + if (node->storage && nodeid && GS(nodeid->name) == ID_IM) { image= (Image*)nodeid; iuser= node->storage; - if(iuser->flag & IMA_OLD_PREMUL) { + if (iuser->flag & IMA_OLD_PREMUL) { iuser->flag &= ~IMA_OLD_PREMUL; iuser->flag |= IMA_DO_PREMUL; } - if(iuser->flag & IMA_DO_PREMUL) { + if (iuser->flag & IMA_DO_PREMUL) { image->flag &= ~IMA_OLD_PREMUL; image->flag |= IMA_DO_PREMUL; } @@ -6804,27 +6830,27 @@ static void alphasort_version_246(FileData *fd, Library *lib, Mesh *me) int a, b, texalpha; /* verify we have a tface layer */ - for(b=0; b<me->fdata.totlayer; b++) - if(me->fdata.layers[b].type == CD_MTFACE) + for (b=0; b<me->fdata.totlayer; b++) + if (me->fdata.layers[b].type == CD_MTFACE) break; - if(b == me->fdata.totlayer) + if (b == me->fdata.totlayer) return; /* if we do, set alpha sort if the game engine did it before */ - for(a=0, mf=me->mface; a<me->totface; a++, mf++) { - if(mf->mat_nr < me->totcol) { + for (a=0, mf=me->mface; a<me->totface; a++, mf++) { + if (mf->mat_nr < me->totcol) { ma= newlibadr(fd, lib, me->mat[mf->mat_nr]); texalpha = 0; /* we can't read from this if it comes from a library, * because direct_link might not have happened on it, * so ma->mtex is not pointing to valid memory yet */ - if(ma && ma->id.lib) + if (ma && ma->id.lib) ma= NULL; - for(b=0; ma && b<MAX_MTEX; b++) - if(ma->mtex && ma->mtex[b] && ma->mtex[b]->mapto & MAP_ALPHA) + for (b=0; ma && b<MAX_MTEX; b++) + if (ma->mtex && ma->mtex[b] && ma->mtex[b]->mapto & MAP_ALPHA) texalpha = 1; } else { @@ -6832,13 +6858,13 @@ static void alphasort_version_246(FileData *fd, Library *lib, Mesh *me) texalpha = 0; } - for(b=0; b<me->fdata.totlayer; b++) { - if(me->fdata.layers[b].type == CD_MTFACE) { + for (b=0; b<me->fdata.totlayer; b++) { + if (me->fdata.layers[b].type == CD_MTFACE) { tf = ((MTFace*)me->fdata.layers[b].data) + a; tf->mode &= ~TF_ALPHASORT; - if(ma && (ma->mode & MA_ZTRANSP)) - if(ELEM(tf->transp, TF_ALPHA, TF_ADD) || (texalpha && (tf->transp != TF_CLIP))) + if (ma && (ma->mode & MA_ZTRANSP)) + if (ELEM(tf->transp, TF_ALPHA, TF_ADD) || (texalpha && (tf->transp != TF_CLIP))) tf->mode |= TF_ALPHASORT; } } @@ -6852,7 +6878,7 @@ static void area_add_header_region(ScrArea *sa, ListBase *lb) BLI_addtail(lb, ar); ar->regiontype= RGN_TYPE_HEADER; - if(sa->headertype==HEADERDOWN) + if (sa->headertype==HEADERDOWN) ar->alignment= RGN_ALIGN_BOTTOM; else ar->alignment= RGN_ALIGN_TOP; @@ -6895,7 +6921,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb) ARegion *ar; ARegion *ar_main; - if(sl) { + if (sl) { /* first channels for ipo action nla... */ switch(sl->spacetype) { case SPACE_IPO: @@ -7016,7 +7042,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb) ar->regiontype= RGN_TYPE_WINDOW; - if(sl) { + if (sl) { /* if active spacetype has view2d data, copy that over to main region */ /* and we split view3d */ switch(sl->spacetype) { @@ -7177,23 +7203,23 @@ static void do_versions_windowmanager_2_50(bScreen *screen) SpaceLink *sl; /* add regions */ - for(sa= screen->areabase.first; sa; sa= sa->next) { + for (sa= screen->areabase.first; sa; sa= sa->next) { /* we keep headertype variable to convert old files only */ - if(sa->headertype) + if (sa->headertype) area_add_header_region(sa, &sa->regionbase); area_add_window_regions(sa, sa->spacedata.first, &sa->regionbase); /* space imageselect is deprecated */ - for(sl= sa->spacedata.first; sl; sl= sl->next) { - if(sl->spacetype==SPACE_IMASEL) + for (sl= sa->spacedata.first; sl; sl= sl->next) { + if (sl->spacetype==SPACE_IMASEL) sl->spacetype= SPACE_EMPTY; /* spacedata then matches */ } /* space sound is deprecated */ - for(sl= sa->spacedata.first; sl; sl= sl->next) { - if(sl->spacetype==SPACE_SOUND) + for (sl= sa->spacedata.first; sl; sl= sl->next) { + if (sl->spacetype==SPACE_SOUND) sl->spacetype= SPACE_EMPTY; /* spacedata then matches */ } @@ -7201,10 +7227,10 @@ static void do_versions_windowmanager_2_50(bScreen *screen) sa->butspacetype= sa->spacetype; /* pushed back spaces also need regions! */ - if(sa->spacedata.first) { + if (sa->spacedata.first) { sl= sa->spacedata.first; - for(sl= sl->next; sl; sl= sl->next) { - if(sa->headertype) + for (sl= sl->next; sl; sl= sl->next) { + if (sa->headertype) area_add_header_region(sa, &sl->regionbase); area_add_window_regions(sa, sl, &sl->regionbase); } @@ -7223,7 +7249,7 @@ static void versions_gpencil_add_main(ListBase *lb, ID *id, const char *name) new_id(lb, id, name); /* alphabetic insterion: is in new_id */ - if(G.f & G_DEBUG) + if (G.f & G_DEBUG) printf("Converted GPencil to ID: %s\n", id->name+2); } @@ -7233,25 +7259,25 @@ static void do_versions_gpencil_2_50(Main *main, bScreen *screen) SpaceLink *sl; /* add regions */ - for(sa= screen->areabase.first; sa; sa= sa->next) { - for(sl= sa->spacedata.first; sl; sl= sl->next) { + for (sa= screen->areabase.first; sa; sa= sa->next) { + for (sl= sa->spacedata.first; sl; sl= sl->next) { if (sl->spacetype==SPACE_VIEW3D) { View3D *v3d= (View3D*) sl; - if(v3d->gpd) { + if (v3d->gpd) { versions_gpencil_add_main(&main->gpencil, (ID *)v3d->gpd, "GPencil View3D"); v3d->gpd= NULL; } } else if (sl->spacetype==SPACE_NODE) { SpaceNode *snode= (SpaceNode *)sl; - if(snode->gpd) { + if (snode->gpd) { versions_gpencil_add_main(&main->gpencil, (ID *)snode->gpd, "GPencil Node"); snode->gpd= NULL; } } else if (sl->spacetype==SPACE_SEQ) { SpaceSeq *sseq= (SpaceSeq *)sl; - if(sseq->gpd) { + if (sseq->gpd) { versions_gpencil_add_main(&main->gpencil, (ID *)sseq->gpd, "GPencil Node"); sseq->gpd= NULL; } @@ -7259,7 +7285,7 @@ static void do_versions_gpencil_2_50(Main *main, bScreen *screen) else if (sl->spacetype==SPACE_IMAGE) { SpaceImage *sima= (SpaceImage *)sl; #if 0 /* see comment on r28002 */ - if(sima->gpd) { + if (sima->gpd) { versions_gpencil_add_main(&main->gpencil, (ID *)sima->gpd, "GPencil Image"); sima->gpd= NULL; } @@ -7278,7 +7304,7 @@ static PartEff *do_version_give_parteff_245(Object *ob) paf= ob->effect.first; while(paf) { - if(paf->type==EFF_PARTICLE) return paf; + if (paf->type==EFF_PARTICLE) return paf; paf= paf->next; } return NULL; @@ -7287,9 +7313,9 @@ static void do_version_free_effect_245(Effect *eff) { PartEff *paf; - if(eff->type==EFF_PARTICLE) { + if (eff->type==EFF_PARTICLE) { paf= (PartEff *)eff; - if(paf->keys) MEM_freeN(paf->keys); + if (paf->keys) MEM_freeN(paf->keys); } MEM_freeN(eff); } @@ -7311,20 +7337,20 @@ static void do_version_mtex_factor_2_50(MTex **mtex_array, short idtype) float varfac, colfac; int a, neg; - if(!mtex_array) + if (!mtex_array) return; - for(a=0; a<MAX_MTEX; a++) { - if(mtex_array[a]) { + for (a=0; a<MAX_MTEX; a++) { + if (mtex_array[a]) { mtex= mtex_array[a]; neg= mtex->maptoneg; varfac= mtex->varfac; colfac= mtex->colfac; - if(neg & MAP_DISP) mtex->dispfac= -mtex->dispfac; - if(neg & MAP_NORM) mtex->norfac= -mtex->norfac; - if(neg & MAP_WARP) mtex->warpfac= -mtex->warpfac; + if (neg & MAP_DISP) mtex->dispfac= -mtex->dispfac; + if (neg & MAP_NORM) mtex->norfac= -mtex->norfac; + if (neg & MAP_WARP) mtex->warpfac= -mtex->warpfac; mtex->colspecfac= (neg & MAP_COLSPEC)? -colfac: colfac; mtex->mirrfac= (neg & MAP_COLMIR)? -colfac: colfac; @@ -7359,11 +7385,11 @@ static void do_version_mtex_factor_2_50(MTex **mtex_array, short idtype) mtex->zendownfac= (neg & WOMAP_ZENDOWN)? -colfac: colfac; mtex->blendfac= (neg & WOMAP_BLEND)? -varfac: varfac; - if(idtype == ID_MA) + if (idtype == ID_MA) mtex->colfac= (neg & MAP_COL)? -colfac: colfac; - else if(idtype == ID_LA) + else if (idtype == ID_LA) mtex->colfac= (neg & LAMAP_COL)? -colfac: colfac; - else if(idtype == ID_WO) + else if (idtype == ID_WO) mtex->colfac= (neg & WOMAP_HORIZ)? -colfac: colfac; } } @@ -7375,12 +7401,12 @@ static void do_version_mdef_250(Main *main) ModifierData *md; MeshDeformModifierData *mmd; - for(ob= main->object.first; ob; ob=ob->id.next) { - for(md=ob->modifiers.first; md; md=md->next) { - if(md->type == eModifierType_MeshDeform) { + for (ob= main->object.first; ob; ob=ob->id.next) { + for (md=ob->modifiers.first; md; md=md->next) { + if (md->type == eModifierType_MeshDeform) { mmd= (MeshDeformModifierData*)md; - if(mmd->bindcos) { + if (mmd->bindcos) { /* make bindcos NULL in order to trick older versions into thinking that the mesh was not bound yet */ mmd->bindcagecos= mmd->bindcos; @@ -7398,17 +7424,17 @@ static void do_version_constraints_radians_degrees_250(ListBase *lb) bConstraint *con; for (con=lb->first; con; con=con->next) { - if(con->type==CONSTRAINT_TYPE_RIGIDBODYJOINT) { + if (con->type==CONSTRAINT_TYPE_RIGIDBODYJOINT) { bRigidBodyJointConstraint *data = con->data; data->axX *= (float)(M_PI/180.0); data->axY *= (float)(M_PI/180.0); data->axZ *= (float)(M_PI/180.0); } - else if(con->type==CONSTRAINT_TYPE_KINEMATIC) { + else if (con->type==CONSTRAINT_TYPE_KINEMATIC) { bKinematicConstraint *data = con->data; data->poleangle *= (float)(M_PI/180.0); } - else if(con->type==CONSTRAINT_TYPE_ROTLIMIT) { + else if (con->type==CONSTRAINT_TYPE_ROTLIMIT) { bRotLimitConstraint *data = con->data; data->xmin *= (float)(M_PI/180.0); @@ -7464,7 +7490,7 @@ static void do_version_bone_roll_256(Bone *bone) copy_m3_m4(submat, bone->arm_mat); mat3_to_vec_roll(submat, NULL, &bone->arm_roll); - for(child = bone->childbase.first; child; child = child->next) + for (child = bone->childbase.first; child; child = child->next) do_version_bone_roll_256(child); } @@ -7489,7 +7515,7 @@ void convert_tface_mt(FileData *fd, Main *main) gmain = G.main; G.main = main; - if(!(do_version_tface(main, 1))) { + if (!(do_version_tface(main, 1))) { BKE_report(fd->reports, RPT_WARNING, "Texface conversion problem. Error in console"); } @@ -7515,8 +7541,8 @@ static void do_version_ntree_tex_mapping_260(void *UNUSED(data), ID *UNUSED(id), { bNode *node; - for(node=ntree->nodes.first; node; node=node->next) { - if(node->type == SH_NODE_MAPPING) { + for (node=ntree->nodes.first; node; node=node->next) { + if (node->type == SH_NODE_MAPPING) { TexMapping *tex_mapping; tex_mapping= node->storage; @@ -7671,15 +7697,15 @@ static void do_versions_nodetree_socket_auto_hidden_flags_2_62(bNodeTree *ntree) if (sock->link==NULL) sock->flag |= SOCK_AUTO_HIDDEN; } - for(sock=node->outputs.first; sock; sock= sock->next) { - if(nodeCountSocketLinks(ntree, sock)==0) + for (sock=node->outputs.first; sock; sock= sock->next) { + if (nodeCountSocketLinks(ntree, sock)==0) sock->flag |= SOCK_AUTO_HIDDEN; } } else { - for(sock=node->inputs.first; sock; sock= sock->next) + for (sock=node->inputs.first; sock; sock= sock->next) sock->flag &= ~SOCK_AUTO_HIDDEN; - for(sock=node->outputs.first; sock; sock= sock->next) + for (sock=node->outputs.first; sock; sock= sock->next) sock->flag &= ~SOCK_AUTO_HIDDEN; } } @@ -7764,12 +7790,12 @@ static void do_versions_mesh_mloopcol_swap_2_62_1(Mesh *me) int a; int i; - for(a = 0; a < me->ldata.totlayer; a++) { + for (a = 0; a < me->ldata.totlayer; a++) { layer = &me->ldata.layers[a]; - if(layer->type == CD_MLOOPCOL) { + if (layer->type == CD_MLOOPCOL) { mloopcol = (MLoopCol *)layer->data; - for(i = 0; i < me->totloop; i++, mloopcol++) { + for (i = 0; i < me->totloop; i++, mloopcol++) { SWAP(char, mloopcol->r, mloopcol->b); } } @@ -7780,17 +7806,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main) { /* WATCH IT!!!: pointers from libdata have not been converted */ - if(G.f & G_DEBUG) + if (G.f & G_DEBUG) printf("read file %s\n Version %d sub %d svn r%d\n", fd->relabase, main->versionfile, main->subversionfile, main->revision); - if(main->versionfile == 100) { + if (main->versionfile == 100) { /* tex->extend and tex->imageflag have changed: */ Tex *tex = main->tex.first; while(tex) { - if(tex->id.flag & LIB_NEEDLINK) { + if (tex->id.flag & LIB_NEEDLINK) { - if(tex->extend==0) { - if(tex->xrepeat || tex->yrepeat) tex->extend= TEX_REPEAT; + if (tex->extend==0) { + if (tex->xrepeat || tex->yrepeat) tex->extend= TEX_REPEAT; else { tex->extend= TEX_EXTEND; tex->xrepeat= tex->yrepeat= 1; @@ -7801,7 +7827,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) tex= tex->id.next; } } - if(main->versionfile <= 101) { + if (main->versionfile <= 101) { /* frame mapping */ Scene *sce = main->scene.first; while(sce) { @@ -7811,7 +7837,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) sce= sce->id.next; } } - if(main->versionfile <= 102) { + if (main->versionfile <= 102) { /* init halo's at 1.0 */ Material *ma = main->mat.first; while(ma) { @@ -7819,32 +7845,32 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ma= ma->id.next; } } - if(main->versionfile <= 103) { + if (main->versionfile <= 103) { /* new variable in object: colbits */ Object *ob = main->object.first; int a; while(ob) { ob->colbits= 0; - if(ob->totcol) { - for(a=0; a<ob->totcol; a++) { - if(ob->mat[a]) ob->colbits |= (1<<a); + if (ob->totcol) { + for (a=0; a<ob->totcol; a++) { + if (ob->mat[a]) ob->colbits |= (1<<a); } } ob= ob->id.next; } } - if(main->versionfile <= 104) { + if (main->versionfile <= 104) { /* timeoffs moved */ Object *ob = main->object.first; while(ob) { - if(ob->transflag & 1) { + if (ob->transflag & 1) { ob->transflag -= 1; //ob->ipoflag |= OB_OFFS_OB; } ob= ob->id.next; } } - if(main->versionfile <= 105) { + if (main->versionfile <= 105) { Object *ob = main->object.first; while(ob) { ob->dupon= 1; ob->dupoff= 0; @@ -7852,16 +7878,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ob= ob->id.next; } } - if(main->versionfile <= 106) { + if (main->versionfile <= 106) { /* mcol changed */ Mesh *me = main->mesh.first; while(me) { - if(me->mcol) vcol_to_fcol(me); + if (me->mcol) vcol_to_fcol(me); me= me->id.next; } } - if(main->versionfile <= 107) { + if (main->versionfile <= 107) { Object *ob; Scene *sce = main->scene.first; while(sce) { @@ -7871,12 +7897,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ob= main->object.first; while(ob) { //ob->ipoflag |= OB_OFFS_PARENT; - if(ob->dt==0) ob->dt= OB_SOLID; + if (ob->dt==0) ob->dt= OB_SOLID; ob= ob->id.next; } } - if(main->versionfile <= 109) { + if (main->versionfile <= 109) { /* new variable: gridlines */ bScreen *sc = main->screen.first; while(sc) { @@ -7896,17 +7922,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main) sc= sc->id.next; } } - if(main->versionfile <= 113) { + if (main->versionfile <= 113) { Material *ma = main->mat.first; while(ma) { - if(ma->flaresize==0.0f) ma->flaresize= 1.0f; + if (ma->flaresize==0.0f) ma->flaresize= 1.0f; ma->subsize= 1.0f; ma->flareboost= 1.0f; ma= ma->id.next; } } - if(main->versionfile <= 134) { + if (main->versionfile <= 134) { Tex *tex = main->tex.first; while (tex) { if ((tex->rfac == 0.0f) && @@ -7920,7 +7946,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) tex = tex->id.next; } } - if(main->versionfile <= 140) { + if (main->versionfile <= 140) { /* r-g-b-fac in texture */ Tex *tex = main->tex.first; while (tex) { @@ -7935,54 +7961,54 @@ static void do_versions(FileData *fd, Library *lib, Main *main) tex = tex->id.next; } } - if(main->versionfile <= 153) { + if (main->versionfile <= 153) { Scene *sce = main->scene.first; while(sce) { - if(sce->r.blurfac==0.0f) sce->r.blurfac= 1.0f; + if (sce->r.blurfac==0.0f) sce->r.blurfac= 1.0f; sce= sce->id.next; } } - if(main->versionfile <= 163) { + if (main->versionfile <= 163) { Scene *sce = main->scene.first; while(sce) { - if(sce->r.frs_sec==0) sce->r.frs_sec= 25; + if (sce->r.frs_sec==0) sce->r.frs_sec= 25; sce= sce->id.next; } } - if(main->versionfile <= 164) { + if (main->versionfile <= 164) { Mesh *me= main->mesh.first; while(me) { me->smoothresh= 30; me= me->id.next; } } - if(main->versionfile <= 165) { + if (main->versionfile <= 165) { Mesh *me= main->mesh.first; TFace *tface; int nr; char *cp; while(me) { - if(me->tface) { + if (me->tface) { nr= me->totface; tface= me->tface; while(nr--) { cp= (char *)&tface->col[0]; - if(cp[1]>126) cp[1]= 255; else cp[1]*=2; - if(cp[2]>126) cp[2]= 255; else cp[2]*=2; - if(cp[3]>126) cp[3]= 255; else cp[3]*=2; + if (cp[1]>126) cp[1]= 255; else cp[1]*=2; + if (cp[2]>126) cp[2]= 255; else cp[2]*=2; + if (cp[3]>126) cp[3]= 255; else cp[3]*=2; cp= (char *)&tface->col[1]; - if(cp[1]>126) cp[1]= 255; else cp[1]*=2; - if(cp[2]>126) cp[2]= 255; else cp[2]*=2; - if(cp[3]>126) cp[3]= 255; else cp[3]*=2; + if (cp[1]>126) cp[1]= 255; else cp[1]*=2; + if (cp[2]>126) cp[2]= 255; else cp[2]*=2; + if (cp[3]>126) cp[3]= 255; else cp[3]*=2; cp= (char *)&tface->col[2]; - if(cp[1]>126) cp[1]= 255; else cp[1]*=2; - if(cp[2]>126) cp[2]= 255; else cp[2]*=2; - if(cp[3]>126) cp[3]= 255; else cp[3]*=2; + if (cp[1]>126) cp[1]= 255; else cp[1]*=2; + if (cp[2]>126) cp[2]= 255; else cp[2]*=2; + if (cp[3]>126) cp[3]= 255; else cp[3]*=2; cp= (char *)&tface->col[3]; - if(cp[1]>126) cp[1]= 255; else cp[1]*=2; - if(cp[2]>126) cp[2]= 255; else cp[2]*=2; - if(cp[3]>126) cp[3]= 255; else cp[3]*=2; + if (cp[1]>126) cp[1]= 255; else cp[1]*=2; + if (cp[2]>126) cp[2]= 255; else cp[2]*=2; + if (cp[3]>126) cp[3]= 255; else cp[3]*=2; tface++; } @@ -7991,22 +8017,22 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if(main->versionfile <= 169) { + if (main->versionfile <= 169) { Mesh *me= main->mesh.first; while(me) { - if(me->subdiv==0) me->subdiv= 1; + if (me->subdiv==0) me->subdiv= 1; me= me->id.next; } } - if(main->versionfile <= 169) { + if (main->versionfile <= 169) { bScreen *sc= main->screen.first; while(sc) { ScrArea *sa= sc->areabase.first; while(sa) { SpaceLink *sl= sa->spacedata.first; while(sl) { - if(sl->spacetype==SPACE_IPO) { + if (sl->spacetype==SPACE_IPO) { SpaceIpo *sipo= (SpaceIpo*) sl; sipo->v2d.max[0]= 15000.0; } @@ -8018,7 +8044,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if(main->versionfile <= 170) { + if (main->versionfile <= 170) { Object *ob = main->object.first; PartEff *paf; while (ob) { @@ -8032,14 +8058,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if(main->versionfile <= 171) { + if (main->versionfile <= 171) { bScreen *sc= main->screen.first; while(sc) { ScrArea *sa= sc->areabase.first; while(sa) { SpaceLink *sl= sa->spacedata.first; while(sl) { - if(sl->spacetype==SPACE_TEXT) { + if (sl->spacetype==SPACE_TEXT) { SpaceText *st= (SpaceText*) sl; st->lheight= 12; } @@ -8051,14 +8077,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if(main->versionfile <= 173) { + if (main->versionfile <= 173) { int a, b; Mesh *me= main->mesh.first; while(me) { - if(me->tface) { + if (me->tface) { TFace *tface= me->tface; - for(a=0; a<me->totface; a++, tface++) { - for(b=0; b<4; b++) { + for (a=0; a<me->totface; a++, tface++) { + for (b=0; b<4; b++) { tface->uv[b][0]/= 32767.0f; tface->uv[b][1]/= 32767.0f; } @@ -8068,7 +8094,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if(main->versionfile <= 191) { + if (main->versionfile <= 191) { Object *ob= main->object.first; Material *ma = main->mat.first; @@ -8086,7 +8112,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if(main->versionfile <= 193) { + if (main->versionfile <= 193) { Object *ob= main->object.first; while(ob) { ob->inertia= 1.0f; @@ -8095,14 +8121,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if(main->versionfile <= 196) { + if (main->versionfile <= 196) { Mesh *me= main->mesh.first; int a, b; while(me) { - if(me->tface) { + if (me->tface) { TFace *tface= me->tface; - for(a=0; a<me->totface; a++, tface++) { - for(b=0; b<4; b++) { + for (a=0; a<me->totface; a++, tface++) { + for (b=0; b<4; b++) { tface->mode |= TF_DYNAMIC; tface->mode &= ~TF_INVISIBLE; } @@ -8112,7 +8138,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if(main->versionfile <= 200) { + if (main->versionfile <= 200) { Object *ob= main->object.first; while(ob) { ob->scaflag = ob->gameflag & (OB_DO_FH|OB_ROT_FH|OB_ANISOTROPIC_FRICTION|OB_GHOST|OB_RIGID_BODY|OB_BOUNDS); @@ -8122,7 +8148,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if(main->versionfile <= 201) { + if (main->versionfile <= 201) { /* add-object + end-object are joined to edit-object actuator */ Object *ob = main->object.first; bProperty *prop; @@ -8133,14 +8159,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main) while (ob) { act = ob->actuators.first; while (act) { - if(act->type==ACT_IPO) { + if (act->type==ACT_IPO) { ia= act->data; prop= get_ob_property(ob, ia->name); - if(prop) { + if (prop) { ia->type= ACT_IPO_FROM_PROP; } } - else if(act->type==ACT_ADD_OBJECT) { + else if (act->type==ACT_ADD_OBJECT) { aoa= act->data; eoa= MEM_callocN(sizeof(bEditObjectActuator), "edit ob act"); eoa->type= ACT_EDOB_ADD_OBJECT; @@ -8150,7 +8176,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) act->data= eoa; act->type= act->otype= ACT_EDIT_OBJECT; } - else if(act->type==ACT_END_OBJECT) { + else if (act->type==ACT_END_OBJECT) { eoa= MEM_callocN(sizeof(bEditObjectActuator), "edit ob act"); eoa->type= ACT_EDOB_END_OBJECT; act->data= eoa; @@ -8162,7 +8188,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if(main->versionfile <= 202) { + if (main->versionfile <= 202) { /* add-object and end-object are joined to edit-object * actuator */ Object *ob= main->object.first; @@ -8171,7 +8197,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) while(ob) { act= ob->actuators.first; while(act) { - if(act->type==ACT_OBJECT) { + if (act->type==ACT_OBJECT) { oa= act->data; oa->flag &= ~(ACT_TORQUE_LOCAL|ACT_DROT_LOCAL); /* this actuator didn't do local/glob rot before */ } @@ -8181,7 +8207,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if(main->versionfile <= 204) { + if (main->versionfile <= 204) { /* patches for new physics */ Object *ob= main->object.first; bActuator *act; @@ -8194,7 +8220,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) * rotation factor of 50 is not workable */ act= ob->actuators.first; while(act) { - if(act->type==ACT_OBJECT) { + if (act->type==ACT_OBJECT) { oa= act->data; oa->forceloc[0]*= 25.0f; @@ -8219,7 +8245,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if(main->versionfile <= 205) { + if (main->versionfile <= 205) { /* patches for new physics */ Object *ob= main->object.first; bActuator *act; @@ -8237,7 +8263,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) act= ob->actuators.first; while(act) { - if(act->type==ACT_EDIT_OBJECT) { + if (act->type==ACT_EDIT_OBJECT) { /* Zero initial velocity for newly * added objects */ oa= act->data; @@ -8252,16 +8278,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main) sens= ob->sensors.first; while (sens) { /* Extra fields for radar sensors. */ - if(sens->type == SENS_RADAR) { + if (sens->type == SENS_RADAR) { bRadarSensor *s = sens->data; s->range = 10000.0; } /* Pulsing: defaults for new sensors. */ - if(sens->type != SENS_ALWAYS) { + if (sens->type != SENS_ALWAYS) { sens->pulse = 0; sens->freq = 0; - } else { + } + else { sens->pulse = 1; } @@ -8271,11 +8298,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* Collision and ray: default = trigger * on property. The material field can * remain empty. */ - if(sens->type == SENS_COLLISION) { + if (sens->type == SENS_COLLISION) { cs = (bCollisionSensor*) sens->data; cs->mode = 0; } - if(sens->type == SENS_RAY) { + if (sens->type == SENS_RAY) { rs = (bRaySensor*) sens->data; rs->mode = 0; } @@ -8286,7 +8313,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* have to check the exact multiplier */ } - if(main->versionfile <= 211) { + if (main->versionfile <= 211) { /* Render setting: per scene, the applicable gamma value * can be set. Default is 1.0, which means no * correction. */ @@ -8328,7 +8355,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if(main->versionfile <= 212) { + if (main->versionfile <= 212) { bSound* sound; bProperty *prop; @@ -8376,7 +8403,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) me->flag|= ME_SUBSURF; me->subdiv= 1; - } else { + } + else { if (me->subdiv<2) me->subdiv= 1; else @@ -8385,7 +8413,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if(main->versionfile <= 220) { + if (main->versionfile <= 220) { Object *ob; Mesh *me; @@ -8434,7 +8462,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } } - if(main->versionfile <= 221) { + if (main->versionfile <= 221) { Scene *sce= main->scene.first; // new variables for std-alone player and runtime @@ -8448,7 +8476,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if(main->versionfile <= 222) { + if (main->versionfile <= 222) { Scene *sce= main->scene.first; // new variables for std-alone player and runtime @@ -8461,7 +8489,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } - if(main->versionfile <= 223) { + if (main->versionfile <= 223) { VFont *vf; Image *ima; Object *ob; @@ -8473,7 +8501,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } /* Old textures animate at 25 FPS */ - for (ima = main->image.first; ima; ima=ima->id.next){ + for (ima = main->image.first; ima; ima=ima->id.next) { ima->animspeed = 25; } @@ -8492,7 +8520,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } } - if(main->versionfile <= 224) { + if (main->versionfile <= 224) { bSound* sound; Scene *sce; Mesh *me; @@ -8507,7 +8535,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } /* Make sure that old subsurf meshes don't have zero subdivision level for rendering */ - for (me=main->mesh.first; me; me=me->id.next){ + for (me=main->mesh.first; me; me=me->id.next) { if ((me->flag & ME_SUBSURF) && (me->subdivr==0)) me->subdivr=me->subdiv; } @@ -8535,7 +8563,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } - if(main->versionfile <= 225) { + if (main->versionfile <= 225) { World *wo; /* Use Sumo for old games */ for (wo = main->world.first; wo; wo= wo->id.next) { @@ -8543,7 +8571,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if(main->versionfile <= 227) { + if (main->versionfile <= 227) { Scene *sce; Material *ma; bScreen *sc; @@ -8561,10 +8589,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* check for already existing TrackTo constraint set their track and up flag correctly */ - if (list){ + if (list) { bConstraint *curcon; - for (curcon = list->first; curcon; curcon=curcon->next){ - if (curcon->type == CONSTRAINT_TYPE_TRACKTO){ + for (curcon = list->first; curcon; curcon=curcon->next) { + if (curcon->type == CONSTRAINT_TYPE_TRACKTO) { bTrackToConstraint *data = curcon->data; data->reserved1 = ob->trackflag; data->reserved2 = ob->upflag; @@ -8573,14 +8601,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } if (ob->type == OB_ARMATURE) { - if (ob->pose){ + if (ob->pose) { bConstraint *curcon; bPoseChannel *pchan; for (pchan = ob->pose->chanbase.first; - pchan; pchan=pchan->next){ + pchan; pchan=pchan->next) { for (curcon = pchan->constraints.first; - curcon; curcon=curcon->next){ - if (curcon->type == CONSTRAINT_TYPE_TRACKTO){ + curcon; curcon=curcon->next) { + if (curcon->type == CONSTRAINT_TYPE_TRACKTO) { bTrackToConstraint *data = curcon->data; data->reserved1 = ob->trackflag; data->reserved2 = ob->upflag; @@ -8631,7 +8659,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } } - if(main->versionfile <= 228) { + if (main->versionfile <= 228) { Scene *sce; bScreen *sc; Object *ob; @@ -8648,10 +8676,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* check for already existing TrackTo constraint set their track and up flag correctly */ - if (list){ + if (list) { bConstraint *curcon; - for (curcon = list->first; curcon; curcon=curcon->next){ - if (curcon->type == CONSTRAINT_TYPE_TRACKTO){ + for (curcon = list->first; curcon; curcon=curcon->next) { + if (curcon->type == CONSTRAINT_TYPE_TRACKTO) { bTrackToConstraint *data = curcon->data; data->reserved1 = ob->trackflag; data->reserved2 = ob->upflag; @@ -8660,14 +8688,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } if (ob->type == OB_ARMATURE) { - if (ob->pose){ + if (ob->pose) { bConstraint *curcon; bPoseChannel *pchan; for (pchan = ob->pose->chanbase.first; - pchan; pchan=pchan->next){ + pchan; pchan=pchan->next) { for (curcon = pchan->constraints.first; - curcon; curcon=curcon->next){ - if (curcon->type == CONSTRAINT_TYPE_TRACKTO){ + curcon; curcon=curcon->next) { + if (curcon->type == CONSTRAINT_TYPE_TRACKTO) { bTrackToConstraint *data = curcon->data; data->reserved1 = ob->trackflag; data->reserved2 = ob->upflag; @@ -8698,46 +8726,46 @@ static void do_versions(FileData *fd, Library *lib, Main *main) sbuts->v2d.maxzoom= 1.2f; sbuts->align= 1; /* horizontal default */ - if(sbuts->mainb==BUTS_LAMP) { + if (sbuts->mainb==BUTS_LAMP) { sbuts->mainb= CONTEXT_SHADING; //sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP; } - else if(sbuts->mainb==BUTS_MAT) { + else if (sbuts->mainb==BUTS_MAT) { sbuts->mainb= CONTEXT_SHADING; //sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT; } - else if(sbuts->mainb==BUTS_TEX) { + else if (sbuts->mainb==BUTS_TEX) { sbuts->mainb= CONTEXT_SHADING; //sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_TEX; } - else if(sbuts->mainb==BUTS_ANIM) { + else if (sbuts->mainb==BUTS_ANIM) { sbuts->mainb= CONTEXT_OBJECT; } - else if(sbuts->mainb==BUTS_WORLD) { + else if (sbuts->mainb==BUTS_WORLD) { sbuts->mainb= CONTEXT_SCENE; //sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_WORLD; } - else if(sbuts->mainb==BUTS_RENDER) { + else if (sbuts->mainb==BUTS_RENDER) { sbuts->mainb= CONTEXT_SCENE; //sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_RENDER; } - else if(sbuts->mainb==BUTS_GAME) { + else if (sbuts->mainb==BUTS_GAME) { sbuts->mainb= CONTEXT_LOGIC; } - else if(sbuts->mainb==BUTS_FPAINT) { + else if (sbuts->mainb==BUTS_FPAINT) { sbuts->mainb= CONTEXT_EDITING; } - else if(sbuts->mainb==BUTS_RADIO) { + else if (sbuts->mainb==BUTS_RADIO) { sbuts->mainb= CONTEXT_SHADING; //sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_RAD; } - else if(sbuts->mainb==BUTS_CONSTRAINT) { + else if (sbuts->mainb==BUTS_CONSTRAINT) { sbuts->mainb= CONTEXT_OBJECT; } - else if(sbuts->mainb==BUTS_SCRIPT) { + else if (sbuts->mainb==BUTS_SCRIPT) { sbuts->mainb= CONTEXT_OBJECT; } - else if(sbuts->mainb==BUTS_EDIT) { + else if (sbuts->mainb==BUTS_EDIT) { sbuts->mainb= CONTEXT_EDITING; } else sbuts->mainb= CONTEXT_SCENE; @@ -8751,7 +8779,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) nevertheless, we might need to think over a fitness (initialize) check apart from the do_versions() */ - if(main->versionfile <= 230) { + if (main->versionfile <= 230) { bScreen *sc; // new variable blockscale, for panels in any area @@ -8762,9 +8790,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main) SpaceLink *sl; for (sl= sa->spacedata.first; sl; sl= sl->next) { - if(sl->blockscale==0.0f) sl->blockscale= 0.7f; + if (sl->blockscale==0.0f) sl->blockscale= 0.7f; /* added: 5x better zoom in for action */ - if(sl->spacetype==SPACE_ACTION) { + if (sl->spacetype==SPACE_ACTION) { SpaceAction *sac= (SpaceAction *)sl; sac->v2d.maxzoom= 50; } @@ -8772,7 +8800,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } } - if(main->versionfile <= 231) { + if (main->versionfile <= 231) { /* new bit flags for showing/hiding grid floor and axes */ bScreen *sc = main->screen.first; while(sc) { @@ -8797,7 +8825,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) sc= sc->id.next; } } - if(main->versionfile <= 231) { + if (main->versionfile <= 231) { Material *ma= main->mat.first; bScreen *sc = main->screen.first; Scene *sce; @@ -8806,8 +8834,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* introduction of raytrace */ while(ma) { - if(ma->fresnel_tra_i==0.0f) ma->fresnel_tra_i= 1.25f; - if(ma->fresnel_mir_i==0.0f) ma->fresnel_mir_i= 1.25f; + if (ma->fresnel_tra_i==0.0f) ma->fresnel_tra_i= 1.25f; + if (ma->fresnel_mir_i==0.0f) ma->fresnel_mir_i= 1.25f; ma->ang= 1.0; ma->ray_depth= 2; @@ -8819,23 +8847,23 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } sce= main->scene.first; while(sce) { - if(sce->r.gauss==0.0f) sce->r.gauss= 1.0f; + if (sce->r.gauss==0.0f) sce->r.gauss= 1.0f; sce= sce->id.next; } la= main->lamp.first; while(la) { - if(la->k==0.0f) la->k= 1.0; - if(la->ray_samp==0) la->ray_samp= 1; - if(la->ray_sampy==0) la->ray_sampy= 1; - if(la->ray_sampz==0) la->ray_sampz= 1; - if(la->area_size==0.0f) la->area_size= 1.0f; - if(la->area_sizey==0.0f) la->area_sizey= 1.0f; - if(la->area_sizez==0.0f) la->area_sizez= 1.0f; + if (la->k==0.0f) la->k= 1.0; + if (la->ray_samp==0) la->ray_samp= 1; + if (la->ray_sampy==0) la->ray_sampy= 1; + if (la->ray_sampz==0) la->ray_sampz= 1; + if (la->area_size==0.0f) la->area_size= 1.0f; + if (la->area_sizey==0.0f) la->area_sizey= 1.0f; + if (la->area_sizez==0.0f) la->area_sizez= 1.0f; la= la->id.next; } wrld= main->world.first; while(wrld) { - if(wrld->range==0.0f) { + if (wrld->range==0.0f) { wrld->range= 1.0f/wrld->exposure; } wrld= wrld->id.next; @@ -8865,18 +8893,18 @@ static void do_versions(FileData *fd, Library *lib, Main *main) sc= sc->id.next; } } - if(main->versionfile <= 232) { + if (main->versionfile <= 232) { Tex *tex= main->tex.first; World *wrld= main->world.first; bScreen *sc; Scene *sce; while(tex) { - if((tex->flag & (TEX_CHECKER_ODD+TEX_CHECKER_EVEN))==0) { + if ((tex->flag & (TEX_CHECKER_ODD+TEX_CHECKER_EVEN))==0) { tex->flag |= TEX_CHECKER_ODD; } /* copied from kernel texture.c */ - if(tex->ns_outscale==0.0f) { + if (tex->ns_outscale==0.0f) { /* musgrave */ tex->mg_H = 1.0f; tex->mg_lacunarity = 2.0f; @@ -8894,12 +8922,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } while(wrld) { - if(wrld->aodist==0.0f) { + if (wrld->aodist==0.0f) { wrld->aodist= 10.0f; wrld->aobias= 0.05f; } - if(wrld->aosamp==0) wrld->aosamp= 5; - if(wrld->aoenergy==0.0f) wrld->aoenergy= 1.0f; + if (wrld->aosamp==0) wrld->aosamp= 5; + if (wrld->aoenergy==0.0f) wrld->aoenergy= 1.0f; wrld= wrld->id.next; } @@ -8911,10 +8939,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (sa= sc->areabase.first; sa; sa= sa->next) { SpaceLink *sl; for (sl= sa->spacedata.first; sl; sl= sl->next) { - if(sl->blockscale==0.0f) sl->blockscale= 0.7f; + if (sl->blockscale==0.0f) sl->blockscale= 0.7f; /* added: 5x better zoom in for nla */ - if(sl->spacetype==SPACE_NLA) { + if (sl->spacetype==SPACE_NLA) { SpaceNla *snla= (SpaceNla *)sl; snla->v2d.maxzoom= 50; } @@ -8923,27 +8951,27 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } sce= main->scene.first; while(sce) { - if(sce->r.ocres==0) sce->r.ocres= 64; + if (sce->r.ocres==0) sce->r.ocres= 64; sce= sce->id.next; } } - if(main->versionfile <= 233) { + if (main->versionfile <= 233) { bScreen *sc; Material *ma= main->mat.first; /* Object *ob= main->object.first; */ while(ma) { - if(ma->rampfac_col==0.0f) ma->rampfac_col= 1.0; - if(ma->rampfac_spec==0.0f) ma->rampfac_spec= 1.0; - if(ma->pr_lamp==0) ma->pr_lamp= 3; + if (ma->rampfac_col==0.0f) ma->rampfac_col= 1.0; + if (ma->rampfac_spec==0.0f) ma->rampfac_spec= 1.0; + if (ma->pr_lamp==0) ma->pr_lamp= 3; ma= ma->id.next; } /* this should have been done loooong before! */ #if 0 /* deprecated in 2.5+ */ while(ob) { - if(ob->ipowin==0) ob->ipowin= ID_OB; + if (ob->ipowin==0) ob->ipowin= ID_OB; ob= ob->id.next; } #endif @@ -8952,7 +8980,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (sa= sc->areabase.first; sa; sa= sa->next) { SpaceLink *sl; for (sl= sa->spacedata.first; sl; sl= sl->next) { - if(sl->spacetype==SPACE_VIEW3D) { + if (sl->spacetype==SPACE_VIEW3D) { View3D *v3d= (View3D *)sl; v3d->flag |= V3D_SELECT_OUTLINE; } @@ -8964,13 +8992,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main) - if(main->versionfile <= 234) { + if (main->versionfile <= 234) { World *wo; bScreen *sc; // force sumo engine to be active for (wo = main->world.first; wo; wo= wo->id.next) { - if(wo->physicsEngine==0) wo->physicsEngine = 2; + if (wo->physicsEngine==0) wo->physicsEngine = 2; } for (sc= main->screen.first; sc; sc= sc->id.next) { @@ -8978,33 +9006,33 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (sa= sc->areabase.first; sa; sa= sa->next) { SpaceLink *sl; for (sl= sa->spacedata.first; sl; sl= sl->next) { - if(sl->spacetype==SPACE_VIEW3D) { + if (sl->spacetype==SPACE_VIEW3D) { View3D *v3d= (View3D *)sl; v3d->flag |= V3D_ZBUF_SELECT; } - else if(sl->spacetype==SPACE_TEXT) { + else if (sl->spacetype==SPACE_TEXT) { SpaceText *st= (SpaceText *)sl; - if(st->tabnumber==0) st->tabnumber= 2; + if (st->tabnumber==0) st->tabnumber= 2; } } } } } - if(main->versionfile <= 235) { + if (main->versionfile <= 235) { Tex *tex= main->tex.first; Scene *sce= main->scene.first; Sequence *seq; Editing *ed; while(tex) { - if(tex->nabla==0.0f) tex->nabla= 0.025f; + if (tex->nabla==0.0f) tex->nabla= 0.025f; tex= tex->id.next; } while(sce) { ed= sce->ed; - if(ed) { + if (ed) { SEQ_BEGIN(sce->ed, seq) { - if(seq->type==SEQ_IMAGE || seq->type==SEQ_MOVIE) + if (seq->type==SEQ_IMAGE || seq->type==SEQ_MOVIE) seq->flag |= SEQ_MAKE_PREMUL; } SEQ_END @@ -9013,16 +9041,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main) sce= sce->id.next; } } - if(main->versionfile <= 236) { + if (main->versionfile <= 236) { Object *ob; Camera *cam= main->camera.first; Material *ma; bScreen *sc; while(cam) { - if(cam->ortho_scale==0.0f) { + if (cam->ortho_scale==0.0f) { cam->ortho_scale= 256.0f/cam->lens; - if(cam->type==CAM_ORTHO) printf("NOTE: ortho render has changed, tweak new Camera 'scale' value.\n"); + if (cam->type==CAM_ORTHO) printf("NOTE: ortho render has changed, tweak new Camera 'scale' value.\n"); } cam= cam->id.next; } @@ -9034,34 +9062,34 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (sa= sc->areabase.first; sa; sa= sa->next) { SpaceLink *sl; for (sl= sa->spacedata.first; sl; sl= sl->next) { - if(sl->spacetype==SPACE_VIEW3D) { + if (sl->spacetype==SPACE_VIEW3D) { View3D *v3d= (View3D *)sl; - if(v3d->twtype==0) v3d->twtype= V3D_MANIP_TRANSLATE; + if (v3d->twtype==0) v3d->twtype= V3D_MANIP_TRANSLATE; } } } } // init new shader vars for (ma= main->mat.first; ma; ma= ma->id.next) { - if(ma->darkness==0.0f) { + if (ma->darkness==0.0f) { ma->rms=0.1f; ma->darkness=1.0f; } } /* softbody init new vars */ - for(ob= main->object.first; ob; ob= ob->id.next) { - if(ob->soft) { - if(ob->soft->defgoal==0.0f) ob->soft->defgoal= 0.7f; - if(ob->soft->physics_speed==0.0f) ob->soft->physics_speed= 1.0f; + for (ob= main->object.first; ob; ob= ob->id.next) { + if (ob->soft) { + if (ob->soft->defgoal==0.0f) ob->soft->defgoal= 0.7f; + if (ob->soft->physics_speed==0.0f) ob->soft->physics_speed= 1.0f; - if(ob->soft->interval==0) { + if (ob->soft->interval==0) { ob->soft->interval= 2; ob->soft->sfra= 1; ob->soft->efra= 100; } } - if(ob->soft && ob->soft->vertgroup==0) { + if (ob->soft && ob->soft->vertgroup==0) { bDeformGroup *locGroup = defgroup_find_name(ob, "SOFTGOAL"); if (locGroup) { /* retrieve index for that group */ @@ -9070,38 +9098,39 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } } - if(main->versionfile <= 237) { + if (main->versionfile <= 237) { bArmature *arm; bConstraint *con; Object *ob; Bone *bone; // armature recode checks - for(arm= main->armature.first; arm; arm= arm->id.next) { + for (arm= main->armature.first; arm; arm= arm->id.next) { where_is_armature(arm); - for(bone= arm->bonebase.first; bone; bone= bone->next) + for (bone= arm->bonebase.first; bone; bone= bone->next) do_version_bone_head_tail_237(bone); } - for(ob= main->object.first; ob; ob= ob->id.next) { - if(ob->parent) { + for (ob= main->object.first; ob; ob= ob->id.next) { + if (ob->parent) { Object *parent= newlibadr(fd, lib, ob->parent); if (parent && parent->type==OB_LATTICE) ob->partype = PARSKEL; } // btw. armature_rebuild_pose is further only called on leave editmode - if(ob->type==OB_ARMATURE) { - if(ob->pose) + if (ob->type==OB_ARMATURE) { + if (ob->pose) ob->pose->flag |= POSE_RECALC; ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME; // cannot call stuff now (pointers!), done in setup_app_data /* new generic xray option */ arm= newlibadr(fd, lib, ob->data); - if(arm->flag & ARM_DRAWXRAY) { + if (arm->flag & ARM_DRAWXRAY) { ob->dtx |= OB_DRAWXRAY; } - } else if (ob->type==OB_MESH) { + } + else if (ob->type==OB_MESH) { Mesh *me = newlibadr(fd, lib, ob->data); if ((me->flag&ME_SUBSURF)) { @@ -9126,20 +9155,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } // follow path constraint needs to set the 'path' option in curves... - for(con=ob->constraints.first; con; con= con->next) { - if(con->type==CONSTRAINT_TYPE_FOLLOWPATH) { + for (con=ob->constraints.first; con; con= con->next) { + if (con->type==CONSTRAINT_TYPE_FOLLOWPATH) { bFollowPathConstraint *data = con->data; Object *obc= newlibadr(fd, lib, data->tar); - if(obc && obc->type==OB_CURVE) { + if (obc && obc->type==OB_CURVE) { Curve *cu= newlibadr(fd, lib, obc->data); - if(cu) cu->flag |= CU_PATH; + if (cu) cu->flag |= CU_PATH; } } } } } - if(main->versionfile <= 238) { + if (main->versionfile <= 238) { Lattice *lt; Object *ob; bArmature *arm; @@ -9147,8 +9176,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Key *key; Scene *sce= main->scene.first; - while(sce){ - if(sce->toolsettings == NULL){ + while(sce) { + if (sce->toolsettings == NULL) { sce->toolsettings = MEM_callocN(sizeof(struct ToolSettings),"Tool Settings Struct"); sce->toolsettings->cornertype=0; sce->toolsettings->degr = 90; @@ -9172,7 +9201,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - for(ob=main->object.first; ob; ob= ob->id.next) { + for (ob=main->object.first; ob; ob= ob->id.next) { ModifierData *md; PartEff *paf; @@ -9193,23 +9222,24 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } BLI_insertlinkbefore(&ob->modifiers, md, modifier_new(eModifierType_Softbody)); - } else { + } + else { BLI_addhead(&ob->modifiers, modifier_new(eModifierType_Softbody)); } ob->softflag &= ~OB_SB_ENABLE; } - if(ob->pose) { + if (ob->pose) { bPoseChannel *pchan; bConstraint *con; - for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { + for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { // note, pchan->bone is also lib-link stuff if (pchan->limitmin[0] == 0.0f && pchan->limitmax[0] == 0.0f) { pchan->limitmin[0]= pchan->limitmin[1]= pchan->limitmin[2]= -180.0f; pchan->limitmax[0]= pchan->limitmax[1]= pchan->limitmax[2]= 180.0f; - for(con= pchan->constraints.first; con; con= con->next) { - if(con->type == CONSTRAINT_TYPE_KINEMATIC) { + for (con= pchan->constraints.first; con; con= con->next) { + if (con->type == CONSTRAINT_TYPE_KINEMATIC) { bKinematicConstraint *data = (bKinematicConstraint*)con->data; data->weight = 1.0f; data->orientweight = 1.0f; @@ -9228,40 +9258,41 @@ static void do_versions(FileData *fd, Library *lib, Main *main) paf = do_version_give_parteff_245(ob); if (paf) { - if(paf->disp == 0) + if (paf->disp == 0) paf->disp = 100; - if(paf->speedtex == 0) + if (paf->speedtex == 0) paf->speedtex = 8; - if(paf->omat == 0) + if (paf->omat == 0) paf->omat = 1; } } - for(arm=main->armature.first; arm; arm= arm->id.next) { + for (arm=main->armature.first; arm; arm= arm->id.next) { bone_version_238(&arm->bonebase); arm->deformflag |= ARM_DEF_VGROUP; } - for(me=main->mesh.first; me; me= me->id.next) { + for (me=main->mesh.first; me; me= me->id.next) { if (!me->medge) { make_edges(me, 1); /* 1 = use mface->edcode */ - } else { + } + else { mesh_strip_loose_faces(me); } } - for(key= main->key.first; key; key= key->id.next) { + for (key= main->key.first; key; key= key->id.next) { KeyBlock *kb; int index= 1; /* trick to find out if we already introduced adrcode */ - for(kb= key->block.first; kb; kb= kb->next) - if(kb->adrcode) break; + for (kb= key->block.first; kb; kb= kb->next) + if (kb->adrcode) break; - if(kb==NULL) { - for(kb= key->block.first; kb; kb= kb->next) { - if(kb==key->refkey) { - if(kb->name[0]==0) + if (kb==NULL) { + for (kb= key->block.first; kb; kb= kb->next) { + if (kb==key->refkey) { + if (kb->name[0]==0) strcpy(kb->name, "Basis"); } else { @@ -9274,7 +9305,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } } - if(main->versionfile <= 239) { + if (main->versionfile <= 239) { bArmature *arm; Object *ob; Scene *sce= main->scene.first; @@ -9283,13 +9314,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main) int set_passepartout= 0; /* deformflag is local in modifier now */ - for(ob=main->object.first; ob; ob= ob->id.next) { + for (ob=main->object.first; ob; ob= ob->id.next) { ModifierData *md; for (md=ob->modifiers.first; md; md=md->next) { if (md->type==eModifierType_Armature) { ArmatureModifierData *amd = (ArmatureModifierData*) md; - if(amd->object && amd->deformflag==0) { + if (amd->object && amd->deformflag==0) { Object *oba= newlibadr(fd, lib, amd->object); arm= newlibadr(fd, lib, oba->data); amd->deformflag= arm->deformflag; @@ -9299,29 +9330,29 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } /* updating stepsize for ghost drawing */ - for(arm= main->armature.first; arm; arm= arm->id.next) { + for (arm= main->armature.first; arm; arm= arm->id.next) { if (arm->ghostsize==0) arm->ghostsize=1; bone_version_239(&arm->bonebase); - if(arm->layer==0) arm->layer= 1; + if (arm->layer==0) arm->layer= 1; } - for(;sce;sce= sce->id.next) { + for (;sce;sce= sce->id.next) { /* make 'innervert' the default subdivide type, for backwards compat */ sce->toolsettings->cornertype=1; - if(sce->r.scemode & R_PASSEPARTOUT) { + if (sce->r.scemode & R_PASSEPARTOUT) { set_passepartout= 1; sce->r.scemode &= ~R_PASSEPARTOUT; } /* gauss is filter variable now */ - if(sce->r.mode & R_GAUSS) { + if (sce->r.mode & R_GAUSS) { sce->r.filtertype= R_FILTER_GAUSS; sce->r.mode &= ~R_GAUSS; } } - for(;cam; cam= cam->id.next) { - if(set_passepartout) + for (;cam; cam= cam->id.next) { + if (set_passepartout) cam->flag |= CAM_SHOWPASSEPARTOUT; /* make sure old cameras have title safe on */ @@ -9332,16 +9363,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (!(cam->passepartalpha)) cam->passepartalpha = 0.2f; } - for(; ma; ma= ma->id.next) { - if(ma->strand_sta==0.0f) { + for (; ma; ma= ma->id.next) { + if (ma->strand_sta==0.0f) { ma->strand_sta= ma->strand_end= 1.0f; ma->mode |= MA_TANGENT_STR; } - if(ma->mode & MA_TRACEBLE) ma->mode |= MA_SHADBUF; + if (ma->mode & MA_TRACEBLE) ma->mode |= MA_SHADBUF; } } - if(main->versionfile <= 241) { + if (main->versionfile <= 241) { Object *ob; Tex *tex; Scene *sce; @@ -9354,37 +9385,37 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (wo = main->world.first; wo; wo= wo->id.next) { /* Migrate to Bullet for games, except for the NaN versions */ /* People can still explicitly choose for Sumo (after 2.42 is out) */ - if(main->versionfile > 225) + if (main->versionfile > 225) wo->physicsEngine = WOPHY_BULLET; - if(WO_AODIST == wo->aomode) + if (WO_AODIST == wo->aomode) wo->aocolor= WO_AOPLAIN; } /* updating layers still */ - for(arm= main->armature.first; arm; arm= arm->id.next) { + for (arm= main->armature.first; arm; arm= arm->id.next) { bone_version_239(&arm->bonebase); - if(arm->layer==0) arm->layer= 1; + if (arm->layer==0) arm->layer= 1; } - for(sce= main->scene.first; sce; sce= sce->id.next) { - if(sce->audio.mixrate==0) sce->audio.mixrate= 44100; + for (sce= main->scene.first; sce; sce= sce->id.next) { + if (sce->audio.mixrate==0) sce->audio.mixrate= 44100; - if(sce->r.xparts<2) sce->r.xparts= 4; - if(sce->r.yparts<2) sce->r.yparts= 4; + if (sce->r.xparts<2) sce->r.xparts= 4; + if (sce->r.yparts<2) sce->r.yparts= 4; /* adds default layer */ - if(sce->r.layers.first==NULL) + if (sce->r.layers.first==NULL) scene_add_render_layer(sce, NULL); else { SceneRenderLayer *srl; /* new layer flag for sky, was default for solid */ - for(srl= sce->r.layers.first; srl; srl= srl->next) { - if(srl->layflag & SCE_LAY_SOLID) + for (srl= sce->r.layers.first; srl; srl= srl->next) { + if (srl->layflag & SCE_LAY_SOLID) srl->layflag |= SCE_LAY_SKY; srl->passflag &= (SCE_PASS_COMBINED|SCE_PASS_Z|SCE_PASS_NORMAL|SCE_PASS_VECTOR); } } /* node version changes */ - if(sce->nodetree) + if (sce->nodetree) ntree_version_241(sce->nodetree); /* uv calculation options moved to toolsettings */ @@ -9397,13 +9428,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main) sce->toolsettings->unwrapper = 1; } - if(sce->r.mode & R_PANORAMA) { + if (sce->r.mode & R_PANORAMA) { /* all these checks to ensure saved files with svn version keep working... */ - if(sce->r.xsch < sce->r.ysch) { + if (sce->r.xsch < sce->r.ysch) { Object *obc= newlibadr(fd, lib, sce->camera); - if(obc && obc->type==OB_CAMERA) { + if (obc && obc->type==OB_CAMERA) { Camera *cam= newlibadr(fd, lib, obc->data); - if(cam->lens>=10.0f) { + if (cam->lens>=10.0f) { sce->r.xsch*= sce->r.xparts; cam->lens*= (float)sce->r.ysch/(float)sce->r.xsch; } @@ -9412,53 +9443,53 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next) + for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next) ntree_version_241(ntree); - for(la= main->lamp.first; la; la= la->id.next) - if(la->buffers==0) + for (la= main->lamp.first; la; la= la->id.next) + if (la->buffers==0) la->buffers= 1; - for(tex= main->tex.first; tex; tex= tex->id.next) { - if(tex->env && tex->env->viewscale==0.0f) + for (tex= main->tex.first; tex; tex= tex->id.next) { + if (tex->env && tex->env->viewscale==0.0f) tex->env->viewscale= 1.0f; // tex->imaflag |= TEX_GAUSS_MIP; } /* for empty drawsize and drawtype */ - for(ob=main->object.first; ob; ob= ob->id.next) { - if(ob->empty_drawsize==0.0f) { + for (ob=main->object.first; ob; ob= ob->id.next) { + if (ob->empty_drawsize==0.0f) { ob->empty_drawtype = OB_ARROWS; ob->empty_drawsize = 1.0; } } - for(ma= main->mat.first; ma; ma= ma->id.next) { + for (ma= main->mat.first; ma; ma= ma->id.next) { /* stucci returns intensity from now on */ int a; - for(a=0; a<MAX_MTEX; a++) { - if(ma->mtex[a] && ma->mtex[a]->tex) { + for (a=0; a<MAX_MTEX; a++) { + if (ma->mtex[a] && ma->mtex[a]->tex) { tex= newlibadr(fd, lib, ma->mtex[a]->tex); - if(tex && tex->type==TEX_STUCCI) + if (tex && tex->type==TEX_STUCCI) ma->mtex[a]->mapto &= ~(MAP_COL|MAP_SPEC|MAP_REF); } } /* transmissivity defaults */ - if(ma->tx_falloff==0.0f) ma->tx_falloff= 1.0f; + if (ma->tx_falloff==0.0f) ma->tx_falloff= 1.0f; } /* during 2.41 images with this name were used for viewer node output, lets fix that */ - if(main->versionfile == 241) { + if (main->versionfile == 241) { Image *ima; - for(ima= main->image.first; ima; ima= ima->id.next) - if(strcmp(ima->name, "Compositor")==0) { + for (ima= main->image.first; ima; ima= ima->id.next) + if (strcmp(ima->name, "Compositor")==0) { strcpy(ima->id.name+2, "Viewer Node"); strcpy(ima->name, "Viewer Node"); } } } - if(main->versionfile <= 242) { + if (main->versionfile <= 242) { Scene *sce; bScreen *sc; Object *ob; @@ -9472,14 +9503,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main) bNodeTree *ntree; int a; - for(sc= main->screen.first; sc; sc= sc->id.next) { + for (sc= main->screen.first; sc; sc= sc->id.next) { ScrArea *sa; sa= sc->areabase.first; while(sa) { SpaceLink *sl; for (sl= sa->spacedata.first; sl; sl= sl->next) { - if(sl->spacetype==SPACE_VIEW3D) { + if (sl->spacetype==SPACE_VIEW3D) { View3D *v3d= (View3D*) sl; if (v3d->gridsubdiv == 0) v3d->gridsubdiv = 10; @@ -9489,7 +9520,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - for(sce= main->scene.first; sce; sce= sce->id.next) { + for (sce= main->scene.first; sce; sce= sce->id.next) { if (sce->toolsettings->select_thresh == 0.0f) sce->toolsettings->select_thresh= 0.01f; if (sce->toolsettings->clean_thresh == 0.0f) @@ -9501,32 +9532,32 @@ static void do_versions(FileData *fd, Library *lib, Main *main) else sce->r.threads= 1; } - if(sce->nodetree) + if (sce->nodetree) ntree_version_242(sce->nodetree); } - for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next) + for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next) ntree_version_242(ntree); /* add default radius values to old curve points */ - for(cu= main->curve.first; cu; cu= cu->id.next) { - for(nu= cu->nurb.first; nu; nu= nu->next) { + for (cu= main->curve.first; cu; cu= cu->id.next) { + for (nu= cu->nurb.first; nu; nu= nu->next) { if (nu) { - if(nu->bezt) { - for(bezt=nu->bezt, a=0; a<nu->pntsu; a++, bezt++) { + if (nu->bezt) { + for (bezt=nu->bezt, a=0; a<nu->pntsu; a++, bezt++) { if (!bezt->radius) bezt->radius= 1.0; } } - else if(nu->bp) { - for(bp=nu->bp, a=0; a<nu->pntsu*nu->pntsv; a++, bp++) { - if(!bp->radius) bp->radius= 1.0; + else if (nu->bp) { + for (bp=nu->bp, a=0; a<nu->pntsu*nu->pntsv; a++, bp++) { + if (!bp->radius) bp->radius= 1.0; } } } } } - for(ob = main->object.first; ob; ob= ob->id.next) { + for (ob = main->object.first; ob; ob= ob->id.next) { ModifierData *md; ListBase *list; list = &ob->constraints; @@ -9534,9 +9565,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* check for already existing MinMax (floor) constraint and update the sticky flagging */ - if (list){ + if (list) { bConstraint *curcon; - for (curcon = list->first; curcon; curcon=curcon->next){ + for (curcon = list->first; curcon; curcon=curcon->next) { switch (curcon->type) { case CONSTRAINT_TYPE_MINMAX: { @@ -9552,7 +9583,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) bRotateLikeConstraint *data = curcon->data; /* version patch from buttons_object.c */ - if(data->flag==0) + if (data->flag==0) data->flag = ROTLIKE_X|ROTLIKE_Y|ROTLIKE_Z; } break; @@ -9561,11 +9592,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } if (ob->type == OB_ARMATURE) { - if (ob->pose){ + if (ob->pose) { bConstraint *curcon; bPoseChannel *pchan; - for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next){ - for (curcon = pchan->constraints.first; curcon; curcon=curcon->next){ + for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next) { + for (curcon = pchan->constraints.first; curcon; curcon=curcon->next) { switch (curcon->type) { case CONSTRAINT_TYPE_MINMAX: { @@ -9590,7 +9621,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) bRotateLikeConstraint *data = curcon->data; /* version patch from buttons_object.c */ - if(data->flag==0) + if (data->flag==0) data->flag = ROTLIKE_X|ROTLIKE_Y|ROTLIKE_Z; } break; @@ -9611,54 +9642,54 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } - for(ma = main->mat.first; ma; ma= ma->id.next) { - if(ma->shad_alpha==0.0f) + for (ma = main->mat.first; ma; ma= ma->id.next) { + if (ma->shad_alpha==0.0f) ma->shad_alpha= 1.0f; - if(ma->nodetree) + if (ma->nodetree) ntree_version_242(ma->nodetree); } - for(me=main->mesh.first; me; me=me->id.next) + for (me=main->mesh.first; me; me=me->id.next) customdata_version_242(me); - for(group= main->group.first; group; group= group->id.next) - if(group->layer==0) + for (group= main->group.first; group; group= group->id.next) + if (group->layer==0) group->layer= (1<<20)-1; /* History fix (python?), shape key adrcode numbers have to be sorted */ sort_shape_fix(main); /* now, subversion control! */ - if(main->subversionfile < 3) { + if (main->subversionfile < 3) { Image *ima; Tex *tex; /* Image refactor initialize */ - for(ima= main->image.first; ima; ima= ima->id.next) { + for (ima= main->image.first; ima; ima= ima->id.next) { ima->source= IMA_SRC_FILE; ima->type= IMA_TYPE_IMAGE; ima->gen_x= 256; ima->gen_y= 256; ima->gen_type= 1; - if(0==strncmp(ima->id.name+2, "Viewer Node", sizeof(ima->id.name)-2)) { + if (0==strncmp(ima->id.name+2, "Viewer Node", sizeof(ima->id.name)-2)) { ima->source= IMA_SRC_VIEWER; ima->type= IMA_TYPE_COMPOSITE; } - if(0==strncmp(ima->id.name+2, "Render Result", sizeof(ima->id.name)-2)) { + if (0==strncmp(ima->id.name+2, "Render Result", sizeof(ima->id.name)-2)) { ima->source= IMA_SRC_VIEWER; ima->type= IMA_TYPE_R_RESULT; } } - for(tex= main->tex.first; tex; tex= tex->id.next) { - if(tex->type==TEX_IMAGE && tex->ima) { + for (tex= main->tex.first; tex; tex= tex->id.next) { + if (tex->type==TEX_IMAGE && tex->ima) { ima= newlibadr(fd, lib, tex->ima); - if(tex->imaflag & TEX_ANIM5_) + if (tex->imaflag & TEX_ANIM5_) ima->source= IMA_SRC_MOVIE; - if(tex->imaflag & TEX_FIELDS_) + if (tex->imaflag & TEX_FIELDS_) ima->flag |= IMA_FIELDS; - if(tex->imaflag & TEX_STD_FIELD_) + if (tex->imaflag & TEX_STD_FIELD_) ima->flag |= IMA_STD_FIELD; } tex->iuser.frames= tex->frames; @@ -9667,27 +9698,27 @@ static void do_versions(FileData *fd, Library *lib, Main *main) tex->iuser.sfra= tex->sfra; tex->iuser.cycl= (tex->imaflag & TEX_ANIMCYCLIC_)!=0; } - for(sce= main->scene.first; sce; sce= sce->id.next) { - if(sce->nodetree) + for (sce= main->scene.first; sce; sce= sce->id.next) { + if (sce->nodetree) do_version_ntree_242_2(sce->nodetree); } - for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next) + for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next) do_version_ntree_242_2(ntree); - for(ma = main->mat.first; ma; ma= ma->id.next) - if(ma->nodetree) + for (ma = main->mat.first; ma; ma= ma->id.next) + if (ma->nodetree) do_version_ntree_242_2(ma->nodetree); - for(sc= main->screen.first; sc; sc= sc->id.next) { + for (sc= main->screen.first; sc; sc= sc->id.next) { ScrArea *sa; - for(sa= sc->areabase.first; sa; sa= sa->next) { + for (sa= sc->areabase.first; sa; sa= sa->next) { SpaceLink *sl; for (sl= sa->spacedata.first; sl; sl= sl->next) { - if(sl->spacetype==SPACE_IMAGE) + if (sl->spacetype==SPACE_IMAGE) ((SpaceImage *)sl)->iuser.fie_ima= 2; - else if(sl->spacetype==SPACE_VIEW3D) { + else if (sl->spacetype==SPACE_VIEW3D) { View3D *v3d= (View3D *)sl; BGpic *bgpic; - for(bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) + for (bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) bgpic->iuser.fie_ima= 2; } } @@ -9695,8 +9726,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if(main->subversionfile < 4) { - for(sce= main->scene.first; sce; sce= sce->id.next) { + if (main->subversionfile < 4) { + for (sce= main->scene.first; sce; sce= sce->id.next) { sce->r.bake_mode= 1; /* prevent to include render stuff here */ sce->r.bake_filter= 2; sce->r.bake_osa= 5; @@ -9704,20 +9735,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if(main->subversionfile < 5) { - for(sce= main->scene.first; sce; sce= sce->id.next) { + if (main->subversionfile < 5) { + for (sce= main->scene.first; sce; sce= sce->id.next) { /* improved triangle to quad conversion settings */ - if(sce->toolsettings->jointrilimit==0.0f) + if (sce->toolsettings->jointrilimit==0.0f) sce->toolsettings->jointrilimit= 0.8f; } } } - if(main->versionfile <= 243) { + if (main->versionfile <= 243) { Object *ob= main->object.first; Material *ma; - for(ma=main->mat.first; ma; ma= ma->id.next) { - if(ma->sss_scale==0.0f) { + for (ma=main->mat.first; ma; ma= ma->id.next) { + if (ma->sss_scale==0.0f) { ma->sss_radius[0]= 1.0f; ma->sss_radius[1]= 1.0f; ma->sss_radius[2]= 1.0f; @@ -9730,28 +9761,28 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ma->sss_colfac= 1.0f; ma->sss_texfac= 0.0f; } - if(ma->sss_front==0 && ma->sss_back==0) { + if (ma->sss_front==0 && ma->sss_back==0) { ma->sss_front= 1.0f; ma->sss_back= 1.0f; } - if(ma->sss_col[0]==0 && ma->sss_col[1]==0 && ma->sss_col[2]==0) { + if (ma->sss_col[0]==0 && ma->sss_col[1]==0 && ma->sss_col[2]==0) { ma->sss_col[0]= ma->r; ma->sss_col[1]= ma->g; ma->sss_col[2]= ma->b; } } - for(; ob; ob= ob->id.next) { + for (; ob; ob= ob->id.next) { bDeformGroup *curdef; - for(curdef= ob->defbase.first; curdef; curdef=curdef->next) { + for (curdef= ob->defbase.first; curdef; curdef=curdef->next) { /* replace an empty-string name with unique name */ if (curdef->name[0] == '\0') { defgroup_unique_name(curdef, ob); } } - if(main->versionfile < 243 || main->subversionfile < 1) { + if (main->versionfile < 243 || main->subversionfile < 1) { ModifierData *md; /* translate old mirror modifier axis values to new flags */ @@ -9779,33 +9810,33 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } /* render layer added, this is not the active layer */ - if(main->versionfile <= 243 || main->subversionfile < 2) { + if (main->versionfile <= 243 || main->subversionfile < 2) { Mesh *me; - for(me=main->mesh.first; me; me=me->id.next) + for (me=main->mesh.first; me; me=me->id.next) customdata_version_243(me); } } - if(main->versionfile <= 244) { + if (main->versionfile <= 244) { Scene *sce; bScreen *sc; Lamp *la; World *wrld; - if(main->versionfile != 244 || main->subversionfile < 2) { - for(sce= main->scene.first; sce; sce= sce->id.next) + if (main->versionfile != 244 || main->subversionfile < 2) { + for (sce= main->scene.first; sce; sce= sce->id.next) sce->r.mode |= R_SSS; /* correct older action editors - incorrect scrolling */ - for(sc= main->screen.first; sc; sc= sc->id.next) { + for (sc= main->screen.first; sc; sc= sc->id.next) { ScrArea *sa; sa= sc->areabase.first; while(sa) { SpaceLink *sl; for (sl= sa->spacedata.first; sl; sl= sl->next) { - if(sl->spacetype==SPACE_ACTION) { + if (sl->spacetype==SPACE_ACTION) { SpaceAction *saction= (SpaceAction*) sl; saction->v2d.tot.ymin = -1000.0; @@ -9823,7 +9854,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* constraints recode version patch used to be here. Moved to 245 now... */ - for(wrld=main->world.first; wrld; wrld= wrld->id.next) { + for (wrld=main->world.first; wrld; wrld= wrld->id.next) { if (wrld->mode & WO_AMB_OCC) wrld->ao_samp_method = WO_AOSAMP_CONSTANT; else @@ -9832,7 +9863,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) wrld->ao_adapt_thresh = 0.005f; } - for(la=main->lamp.first; la; la= la->id.next) { + for (la=main->lamp.first; la; la= la->id.next) { if (la->type == LA_AREA) la->ray_samp_method = LA_SAMP_CONSTANT; else @@ -9842,7 +9873,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } } - if(main->versionfile <= 245) { + if (main->versionfile <= 245) { Scene *sce; Object *ob; Image *ima; @@ -9930,19 +9961,19 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile != 245) { /* repair preview from 242 - 244*/ - for(ima= main->image.first; ima; ima= ima->id.next) { + for (ima= main->image.first; ima; ima= ima->id.next) { ima->preview = NULL; } } /* add point caches */ - for(ob=main->object.first; ob; ob=ob->id.next) { - if(ob->soft && !ob->soft->pointcache) + for (ob=main->object.first; ob; ob=ob->id.next) { + if (ob->soft && !ob->soft->pointcache) ob->soft->pointcache= BKE_ptcache_add(&ob->soft->ptcaches); - for(psys=ob->particlesystem.first; psys; psys=psys->next) { - if(psys->pointcache) { - if(psys->pointcache->flag & PTCACHE_BAKED && (psys->pointcache->flag & PTCACHE_DISK_CACHE)==0) { + for (psys=ob->particlesystem.first; psys; psys=psys->next) { + if (psys->pointcache) { + if (psys->pointcache->flag & PTCACHE_BAKED && (psys->pointcache->flag & PTCACHE_DISK_CACHE)==0) { printf("Old memory cache isn't supported for particles, so re-bake the simulation!\n"); psys->pointcache->flag &= ~PTCACHE_BAKED; } @@ -9951,10 +9982,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main) psys->pointcache= BKE_ptcache_add(&psys->ptcaches); } - for(md=ob->modifiers.first; md; md=md->next) { - if(md->type==eModifierType_Cloth) { + for (md=ob->modifiers.first; md; md=md->next) { + if (md->type==eModifierType_Cloth) { ClothModifierData *clmd = (ClothModifierData*) md; - if(!clmd->point_cache) + if (!clmd->point_cache) clmd->point_cache= BKE_ptcache_add(&clmd->ptcaches); } } @@ -9962,14 +9993,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* Copy over old per-level multires vertex data into a single vertex array in struct Multires */ - for(me = main->mesh.first; me; me=me->id.next) { - if(me->mr && !me->mr->verts) { + for (me = main->mesh.first; me; me=me->id.next) { + if (me->mr && !me->mr->verts) { MultiresLevel *lvl = me->mr->levels.last; - if(lvl) { + if (lvl) { me->mr->verts = lvl->verts; lvl->verts = NULL; /* Don't need the other vert arrays */ - for(lvl = lvl->prev; lvl; lvl = lvl->prev) { + for (lvl = lvl->prev; lvl; lvl = lvl->prev) { MEM_freeN(lvl->verts); lvl->verts = NULL; } @@ -9978,7 +10009,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } if (main->versionfile != 245 || main->subversionfile < 1) { - for(la=main->lamp.first; la; la= la->id.next) { + for (la=main->lamp.first; la; la= la->id.next) { if (la->mode & LA_QUAD) la->falloff_type = LA_FALLOFF_SLIDERS; else la->falloff_type = LA_FALLOFF_INVLINEAR; @@ -9989,8 +10020,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - for(ma=main->mat.first; ma; ma= ma->id.next) { - if(ma->samp_gloss_mir == 0) { + for (ma=main->mat.first; ma; ma= ma->id.next) { + if (ma->samp_gloss_mir == 0) { ma->gloss_mir = ma->gloss_tra= 1.0f; ma->aniso_gloss_mir = 1.0f; ma->samp_gloss_mir = ma->samp_gloss_tra= 18; @@ -9999,15 +10030,15 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ma->fadeto_mir = MA_RAYMIR_FADETOSKY; } - if(ma->strand_min == 0.0f) + if (ma->strand_min == 0.0f) ma->strand_min= 1.0f; } - for(part=main->particle.first; part; part=part->id.next) { - if(part->ren_child_nbr==0) + for (part=main->particle.first; part; part=part->id.next) { + if (part->ren_child_nbr==0) part->ren_child_nbr= part->child_nbr; - if(part->simplify_refsize==0) { + if (part->simplify_refsize==0) { part->simplify_refsize= 1920; part->simplify_rate= 1.0f; part->simplify_transition= 0.1f; @@ -10015,49 +10046,49 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - for(wrld=main->world.first; wrld; wrld= wrld->id.next) { - if(wrld->ao_approx_error == 0.0f) + for (wrld=main->world.first; wrld; wrld= wrld->id.next) { + if (wrld->ao_approx_error == 0.0f) wrld->ao_approx_error= 0.25f; } - for(sce= main->scene.first; sce; sce= sce->id.next) { - if(sce->nodetree) + for (sce= main->scene.first; sce; sce= sce->id.next) { + if (sce->nodetree) ntree_version_245(fd, lib, sce->nodetree); - if(sce->r.simplify_shadowsamples == 0) { + if (sce->r.simplify_shadowsamples == 0) { sce->r.simplify_subsurf= 6; sce->r.simplify_particles= 1.0f; sce->r.simplify_shadowsamples= 16; sce->r.simplify_aosss= 1.0f; } - if(sce->r.cineongamma == 0) { + if (sce->r.cineongamma == 0) { sce->r.cineonblack= 95; sce->r.cineonwhite= 685; sce->r.cineongamma= 1.7f; } } - for(ntree=main->nodetree.first; ntree; ntree= ntree->id.next) + for (ntree=main->nodetree.first; ntree; ntree= ntree->id.next) ntree_version_245(fd, lib, ntree); /* fix for temporary flag changes during 245 cycle */ - for(ima= main->image.first; ima; ima= ima->id.next) { - if(ima->flag & IMA_OLD_PREMUL) { + for (ima= main->image.first; ima; ima= ima->id.next) { + if (ima->flag & IMA_OLD_PREMUL) { ima->flag &= ~IMA_OLD_PREMUL; ima->flag |= IMA_DO_PREMUL; } } - for(tex=main->tex.first; tex; tex=tex->id.next) { - if(tex->iuser.flag & IMA_OLD_PREMUL) { + for (tex=main->tex.first; tex; tex=tex->id.next) { + if (tex->iuser.flag & IMA_OLD_PREMUL) { tex->iuser.flag &= ~IMA_OLD_PREMUL; tex->iuser.flag |= IMA_DO_PREMUL; } ima= newlibadr(fd, lib, tex->ima); - if(ima && (tex->iuser.flag & IMA_DO_PREMUL)) { + if (ima && (tex->iuser.flag & IMA_DO_PREMUL)) { ima->flag &= ~IMA_OLD_PREMUL; ima->flag |= IMA_DO_PREMUL; } @@ -10068,7 +10099,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) * */ { Scene *sce; - for(sce=main->scene.first; sce; sce = sce->id.next) + for (sce=main->scene.first; sce; sce = sce->id.next) { if (sce->toolsettings->skgen_subdivisions[0] == sce->toolsettings->skgen_subdivisions[1] || sce->toolsettings->skgen_subdivisions[0] == sce->toolsettings->skgen_subdivisions[2] || @@ -10086,7 +10117,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Image *ima; /* initialize 1:1 Aspect */ - for(ima= main->image.first; ima; ima= ima->id.next) { + for (ima= main->image.first; ima; ima= ima->id.next) { ima->aspx = ima->aspy = 1.0f; } @@ -10097,12 +10128,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ModifierData *md; Object *ob; - for(arm= main->armature.first; arm; arm= arm->id.next) + for (arm= main->armature.first; arm; arm= arm->id.next) arm->deformflag |= ARM_DEF_B_BONE_REST; - for(ob = main->object.first; ob; ob= ob->id.next) { - for(md=ob->modifiers.first; md; md=md->next) { - if(md->type==eModifierType_Armature) + for (ob = main->object.first; ob; ob= ob->id.next) { + for (md=ob->modifiers.first; md; md=md->next) { + if (md->type==eModifierType_Armature) ((ArmatureModifierData*)md)->deformflag |= ARM_DEF_B_BONE_REST; } } @@ -10111,7 +10142,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 5)) { /* foreground color needs to be something other then black */ Scene *sce; - for(sce= main->scene.first; sce; sce=sce->id.next) { + for (sce= main->scene.first; sce; sce=sce->id.next) { sce->r.fg_stamp[0] = sce->r.fg_stamp[1] = sce->r.fg_stamp[2] = 0.8f; sce->r.fg_stamp[3] = 1.0f; /* don't use text alpha yet */ sce->r.bg_stamp[3] = 0.25f; /* make sure the background has full alpha */ @@ -10122,7 +10153,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 6)) { Scene *sce; /* fix frs_sec_base */ - for(sce= main->scene.first; sce; sce= sce->id.next) { + for (sce= main->scene.first; sce; sce= sce->id.next) { if (sce->r.frs_sec_base == 0) { sce->r.frs_sec_base = 1; } @@ -10196,12 +10227,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if(ob->soft && ob->soft->keys) { + if (ob->soft && ob->soft->keys) { SoftBody *sb = ob->soft; int k; - for(k=0; k<sb->totkey; k++) { - if(sb->keys[k]) + for (k=0; k<sb->totkey; k++) { + if (sb->keys[k]) MEM_freeN(sb->keys[k]); } @@ -10218,13 +10249,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Object *ob; PartEff *paf=NULL; - for(ob = main->object.first; ob; ob= ob->id.next) { - if(ob->soft && ob->soft->keys) { + for (ob = main->object.first; ob; ob= ob->id.next) { + if (ob->soft && ob->soft->keys) { SoftBody *sb = ob->soft; int k; - for(k=0; k<sb->totkey; k++) { - if(sb->keys[k]) + for (k=0; k<sb->totkey; k++) { + if (sb->keys[k]) MEM_freeN(sb->keys[k]); } @@ -10235,7 +10266,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } /* convert old particles to new system */ - if((paf = do_version_give_parteff_245(ob))) { + if ((paf = do_version_give_parteff_245(ob))) { ParticleSystem *psys; ModifierData *md; ParticleSystemModifierData *psmd; @@ -10290,8 +10321,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) copy_v3_v3(part->acc, paf->force); /* flags */ - if(paf->stype & PAF_VECT) { - if(paf->flag & PAF_STATIC) { + if (paf->stype & PAF_VECT) { + if (paf->flag & PAF_STATIC) { /* new hair lifetime is always 100.0f */ float fac = paf->lifetime / 100.0f; @@ -10324,11 +10355,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main) psys->vgroup[PSYS_VG_LENGTH] = paf->vertgroup_v; /* dupliobjects */ - if(ob->transflag & OB_DUPLIVERTS) { + if (ob->transflag & OB_DUPLIVERTS) { Object *dup = main->object.first; - for(; dup; dup= dup->id.next) { - if(ob == newlibadr(fd, lib, dup->parent)) { + for (; dup; dup= dup->id.next) { + if (ob == newlibadr(fd, lib, dup->parent)) { part->dup_ob = dup; ob->transflag |= OB_DUPLIPARTS; ob->transflag &= ~OB_DUPLIVERTS; @@ -10344,7 +10375,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) { FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim); - if(fluidmd && fluidmd->fss && fluidmd->fss->type == OB_FLUIDSIM_PARTICLE) + if (fluidmd && fluidmd->fss && fluidmd->fss->type == OB_FLUIDSIM_PARTICLE) part->type = PART_FLUID; } @@ -10354,18 +10385,18 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - for(sce= main->scene.first; sce; sce=sce->id.next) { + for (sce= main->scene.first; sce; sce=sce->id.next) { ParticleEditSettings *pset= &sce->toolsettings->particle; int a; - if(pset->brush[0].size == 0) { + if (pset->brush[0].size == 0) { pset->flag= PE_KEEP_LENGTHS|PE_LOCK_FIRST|PE_DEFLECT_EMITTER; pset->emitterdist= 0.25f; pset->totrekey= 5; pset->totaddkey= 5; pset->brushtype= PE_BRUSH_NONE; - for(a=0; a<PE_TOT_BRUSH; a++) { + for (a=0; a<PE_TOT_BRUSH; a++) { pset->brush[a].strength= 50; pset->brush[a].size= 50; pset->brush[a].step= 10; @@ -10379,10 +10410,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Material *ma; int a; - for(ma=main->mat.first; ma; ma= ma->id.next) - if(ma->mode & MA_NORMAP_TANG) - for(a=0; a<MAX_MTEX; a++) - if(ma->mtex[a] && ma->mtex[a]->tex) + for (ma=main->mat.first; ma; ma= ma->id.next) + if (ma->mode & MA_NORMAP_TANG) + for (a=0; a<MAX_MTEX; a++) + if (ma->mtex[a] && ma->mtex[a]->tex) ma->mtex[a]->normapspace = MTEX_NSPACE_TANGENT; } @@ -10390,7 +10421,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Object *ob; /* dupliface scale */ - for(ob= main->object.first; ob; ob= ob->id.next) + for (ob= main->object.first; ob; ob= ob->id.next) ob->dupfacesca = 1.0f; } @@ -10415,7 +10446,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) strip->scale = length / (repeat * actlength); if (strip->scale == 0.0f) strip->scale= 1.0f; } - if(ob->soft){ + if (ob->soft) { ob->soft->inpush = ob->soft->inspring; ob->soft->shearstiff = 1.0f; } @@ -10426,7 +10457,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Scene *sce; Sequence *seq; - for(sce=main->scene.first; sce; sce=sce->id.next) { + for (sce=main->scene.first; sce; sce=sce->id.next) { SEQ_BEGIN(sce->ed, seq) { if (seq->blend_mode == 0) seq->blend_opacity = 100.0f; @@ -10466,13 +10497,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } /* sun/sky */ - if(main->versionfile < 246) { + if (main->versionfile < 246) { Object *ob; bActuator *act; /* dRot actuator change direction in 2.46 */ - for(ob = main->object.first; ob; ob= ob->id.next) { - for(act= ob->actuators.first; act; act= act->next) { + for (ob = main->object.first; ob; ob= ob->id.next) { + for (act= ob->actuators.first; act; act= act->next) { if (act->type == ACT_OBJECT) { bObjectActuator *ba= act->data; @@ -10485,12 +10516,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } // convert fluids to modifier - if(main->versionfile < 246 || (main->versionfile == 246 && main->subversionfile < 1)) + if (main->versionfile < 246 || (main->versionfile == 246 && main->subversionfile < 1)) { Object *ob; - for(ob = main->object.first; ob; ob= ob->id.next) { - if(ob->fluidsimSettings) + for (ob = main->object.first; ob; ob= ob->id.next) { + if (ob->fluidsimSettings) { FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifier_new(eModifierType_Fluidsim); BLI_addhead(&ob->modifiers, (ModifierData *)fluidmd); @@ -10508,32 +10539,32 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } - if(main->versionfile < 246 || (main->versionfile == 246 && main->subversionfile < 1)) { + if (main->versionfile < 246 || (main->versionfile == 246 && main->subversionfile < 1)) { Mesh *me; - for(me=main->mesh.first; me; me= me->id.next) + for (me=main->mesh.first; me; me= me->id.next) alphasort_version_246(fd, lib, me); } - if(main->versionfile < 246 || (main->versionfile == 246 && main->subversionfile < 1)){ + if (main->versionfile < 246 || (main->versionfile == 246 && main->subversionfile < 1)) { Object *ob; - for(ob = main->object.first; ob; ob= ob->id.next) { - if(ob->pd && (ob->pd->forcefield == PFIELD_WIND)) + for (ob = main->object.first; ob; ob= ob->id.next) { + if (ob->pd && (ob->pd->forcefield == PFIELD_WIND)) ob->pd->f_noise = 0.0f; } } - if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 2)){ + if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 2)) { Object *ob; - for(ob = main->object.first; ob; ob= ob->id.next) { + for (ob = main->object.first; ob; ob= ob->id.next) { ob->gameflag |= OB_COLLISION; ob->margin = 0.06f; } } - if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 3)){ + if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 3)) { Object *ob; - for(ob = main->object.first; ob; ob= ob->id.next) { + for (ob = main->object.first; ob; ob= ob->id.next) { // Starting from subversion 3, ACTOR is a separate feature. // Before it was conditioning all the other dynamic flags if (!(ob->gameflag & OB_ACTOR)) @@ -10544,7 +10575,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 5)) { Lamp *la= main->lamp.first; - for(; la; la= la->id.next) { + for (; la; la= la->id.next) { la->skyblendtype= MA_RAMP_ADD; la->skyblendfac= 1.0f; } @@ -10555,8 +10586,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Curve *cu; Nurb *nu; - for(cu= main->curve.first; cu; cu= cu->id.next) { - for(nu= cu->nurb.first; nu; nu= nu->next) { + for (cu= main->curve.first; cu; cu= cu->id.next) { + for (nu= cu->nurb.first; nu; nu= nu->next) { if (nu) { nu->radius_interp = 3; @@ -10577,8 +10608,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) bActuator *act; Object *ob; - for(ob = main->object.first; ob; ob= ob->id.next) { - for(act= ob->actuators.first; act; act= act->next) { + for (ob = main->object.first; ob; ob= ob->id.next) { + for (act= ob->actuators.first; act; act= act->next) { if (act->type == ACT_CONSTRAINT) { bConstraintActuator *coa = act->data; if (coa->type == ACT_CONST_TYPE_DIST) { @@ -10591,7 +10622,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 9)) { Lamp *la= main->lamp.first; - for(; la; la= la->id.next) { + for (; la; la= la->id.next) { la->sky_exposure= 1.0f; } } @@ -10601,8 +10632,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) bActuator *act; Object *ob; - for(ob = main->object.first; ob; ob= ob->id.next) { - for(act= ob->actuators.first; act; act= act->next) { + for (ob = main->object.first; ob; ob= ob->id.next) { + for (act= ob->actuators.first; act; act= act->next) { if (act->type == ACT_MESSAGE) { bMessageActuator *msgAct = (bMessageActuator *) act->data; if (BLI_strnlen(msgAct->toPropName, 3) > 2) { @@ -10620,8 +10651,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile < 248) { Lamp *la; - for(la=main->lamp.first; la; la= la->id.next) { - if(la->atm_turbidity == 0.0f) { + for (la=main->lamp.first; la; la= la->id.next) { + if (la->atm_turbidity == 0.0f) { la->sun_effect_type = 0; la->horizon_brightness = 1.0f; la->spread = 1.0f; @@ -10713,7 +10744,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Object *ob; /* Adjustments needed after Bullets update */ - for(ob = main->object.first; ob; ob= ob->id.next) { + for (ob = main->object.first; ob; ob= ob->id.next) { ob->damping *= 0.635f; ob->rdamping = 0.1f + (0.8f * ob->rdamping); } @@ -10732,7 +10763,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) sce->r.dometilt = 0; } /* DBVT culling by default */ - for(wrld=main->world.first; wrld; wrld= wrld->id.next) { + for (wrld=main->world.first; wrld; wrld= wrld->id.next) { wrld->mode |= WO_DBVT_CULLING; wrld->occlusionRes = 128; } @@ -10741,22 +10772,22 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile < 248 || (main->versionfile == 248 && main->subversionfile < 5)) { Object *ob; World *wrld; - for(ob = main->object.first; ob; ob= ob->id.next) { + for (ob = main->object.first; ob; ob= ob->id.next) { ob->m_contactProcessingThreshold = 1.; //pad3 is used for m_contactProcessingThreshold - if(ob->parent) { + if (ob->parent) { /* check if top parent has compound shape set and if yes, set this object to compound shaper as well (was the behavior before, now it's optional) */ Object *parent= newlibadr(fd, lib, ob->parent); while (parent && parent != ob && parent->parent != NULL) { parent = newlibadr(fd, lib, parent->parent); } - if(parent) { + if (parent) { if (parent->gameflag & OB_CHILD) ob->gameflag |= OB_CHILD; } } } - for(wrld=main->world.first; wrld; wrld= wrld->id.next) { + for (wrld=main->world.first; wrld; wrld= wrld->id.next) { wrld->ticrate = 60; wrld->maxlogicstep = 5; wrld->physubstep = 1; @@ -10767,8 +10798,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) // correct introduce of seed for wind force if (main->versionfile < 249 && main->subversionfile < 1) { Object *ob; - for(ob = main->object.first; ob; ob= ob->id.next) { - if(ob->pd) + for (ob = main->object.first; ob; ob= ob->id.next) { + if (ob->pd) ob->pd->seed = ((unsigned int)(ceil(PIL_check_seconds_timer()))+1) % 128; } @@ -10781,9 +10812,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main) while(sce) { ed= sce->ed; - if(ed) { + if (ed) { SEQP_BEGIN(ed, seq) { - if (seq->strip && seq->strip->proxy){ + if (seq->strip && seq->strip->proxy) { seq->strip->proxy->quality =90; } } @@ -10815,20 +10846,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main) bActuator *act; int a; - for(sound = main->sound.first; sound; sound = sound->id.next) + for (sound = main->sound.first; sound; sound = sound->id.next) { - if(sound->newpackedfile) + if (sound->newpackedfile) { sound->packedfile = sound->newpackedfile; sound->newpackedfile = NULL; } } - for(ob = main->object.first; ob; ob= ob->id.next) { - for(act= ob->actuators.first; act; act= act->next) { + for (ob = main->object.first; ob; ob= ob->id.next) { + for (act= ob->actuators.first; act; act= act->next) { if (act->type == ACT_SOUND) { bSoundActuator *sAct = (bSoundActuator*) act->data; - if(sAct->sound) + if (sAct->sound) { sound = newlibadr(fd, lib, sAct->sound); sAct->flag = sound->flags & SOUND_FLAGS_3D ? ACT_SND_3D_SOUND : 0; @@ -10852,12 +10883,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - for(scene = main->scene.first; scene; scene = scene->id.next) + for (scene = main->scene.first; scene; scene = scene->id.next) { - if(scene->ed && scene->ed->seqbasep) + if (scene->ed && scene->ed->seqbasep) { SEQ_BEGIN(scene->ed, seq) { - if(seq->type == SEQ_HD_SOUND) + if (seq->type == SEQ_HD_SOUND) { char str[FILE_MAX]; BLI_join_dirfile(str, sizeof(str), seq->strip->dir, seq->strip->stripdata->name); @@ -10867,7 +10898,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* don't know, if anybody used that this way, but just in case, upgrade to new way... */ - if((seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) && + if ((seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) && !(seq->flag & SEQ_USE_PROXY_CUSTOM_DIR)) { @@ -10880,7 +10911,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - for(screen= main->screen.first; screen; screen= screen->id.next) { + for (screen= main->screen.first; screen; screen= screen->id.next) { do_versions_windowmanager_2_50(screen); do_versions_gpencil_2_50(main, screen); } @@ -10888,30 +10919,30 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* shader, composite and texture node trees have id.name empty, put something in * to have them show in RNA viewer and accessible otherwise. */ - for(ma= main->mat.first; ma; ma= ma->id.next) { - if(ma->nodetree && ma->nodetree->id.name[0] == '\0') + for (ma= main->mat.first; ma; ma= ma->id.next) { + if (ma->nodetree && ma->nodetree->id.name[0] == '\0') strcpy(ma->nodetree->id.name, "NTShader Nodetree"); /* which_output 0 is now "not specified" */ - for(a=0; a<MAX_MTEX; a++) { - if(ma->mtex[a]) { + for (a=0; a<MAX_MTEX; a++) { + if (ma->mtex[a]) { tx= newlibadr(fd, lib, ma->mtex[a]->tex); - if(tx && tx->use_nodes) + if (tx && tx->use_nodes) ma->mtex[a]->which_output++; } } } /* and composite trees */ - for(sce= main->scene.first; sce; sce= sce->id.next) { - if(sce->nodetree && sce->nodetree->id.name[0] == '\0') + for (sce= main->scene.first; sce; sce= sce->id.next) { + if (sce->nodetree && sce->nodetree->id.name[0] == '\0') strcpy(sce->nodetree->id.name, "NTCompositing Nodetree"); /* move to cameras */ - if(sce->r.mode & R_PANORAMA) { - for(base=sce->base.first; base; base=base->next) { + if (sce->r.mode & R_PANORAMA) { + for (base=sce->base.first; base; base=base->next) { ob= newlibadr(fd, lib, base->object); - if(ob->type == OB_CAMERA && !ob->id.lib) { + if (ob->type == OB_CAMERA && !ob->id.lib) { cam= newlibadr(fd, lib, ob->data); cam->flag |= CAM_PANORAMA; } @@ -10921,33 +10952,33 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } /* and texture trees */ - for(tx= main->tex.first; tx; tx= tx->id.next) { + for (tx= main->tex.first; tx; tx= tx->id.next) { bNode *node; - if(tx->nodetree) { - if(tx->nodetree->id.name[0] == '\0') + if (tx->nodetree) { + if (tx->nodetree->id.name[0] == '\0') strcpy(tx->nodetree->id.name, "NTTexture Nodetree"); /* which_output 0 is now "not specified" */ - for(node=tx->nodetree->nodes.first; node; node=node->next) - if(node->type == TEX_NODE_OUTPUT) + for (node=tx->nodetree->nodes.first; node; node=node->next) + if (node->type == TEX_NODE_OUTPUT) node->custom1++; } } /* copy standard draw flag to meshes(used to be global, is not available here) */ - for(me= main->mesh.first; me; me= me->id.next) { + for (me= main->mesh.first; me; me= me->id.next) { me->drawflag= ME_DRAWEDGES|ME_DRAWFACES|ME_DRAWCREASES; } /* particle draw and render types */ - for(part= main->particle.first; part; part= part->id.next) { - if(part->draw_as) { - if(part->draw_as == PART_DRAW_DOT) { + for (part= main->particle.first; part; part= part->id.next) { + if (part->draw_as) { + if (part->draw_as == PART_DRAW_DOT) { part->ren_as = PART_DRAW_HALO; part->draw_as = PART_DRAW_REND; } - else if(part->draw_as <= PART_DRAW_AXIS) { + else if (part->draw_as <= PART_DRAW_AXIS) { part->ren_as = PART_DRAW_HALO; } else { @@ -10959,7 +10990,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) part->clength = 1.0f; } /* set old pointcaches to have disk cache flag */ - for(ob = main->object.first; ob; ob= ob->id.next) { + for (ob = main->object.first; ob; ob= ob->id.next) { //BKE_ptcache_ids_from_object(&pidlist, ob); @@ -10970,10 +11001,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } /* type was a mixed flag & enum. move the 2d flag elsewhere */ - for(cu = main->curve.first; cu; cu= cu->id.next) { + for (cu = main->curve.first; cu; cu= cu->id.next) { Nurb *nu; - for(nu= cu->nurb.first; nu; nu= nu->next) { + for (nu= cu->nurb.first; nu; nu= nu->next) { nu->flag |= (nu->type & CU_2D); nu->type &= CU_TYPE; } @@ -10989,57 +11020,57 @@ static void do_versions(FileData *fd, Library *lib, Main *main) //PTCacheID *pid; //ListBase pidlist; - for(ob = main->object.first; ob; ob = ob->id.next) { + for (ob = main->object.first; ob; ob = ob->id.next) { //BKE_ptcache_ids_from_object(&pidlist, ob); //for(pid=pidlist.first; pid; pid=pid->next) { - // if(pid->ptcaches->first == NULL) + // if (pid->ptcaches->first == NULL) // pid->ptcaches->first = pid->ptcaches->last = pid->cache; //} //BLI_freelistN(&pidlist); - if(ob->type == OB_MESH) { + if (ob->type == OB_MESH) { Mesh *me = newlibadr(fd, lib, ob->data); void *olddata = ob->data; ob->data = me; /* XXX - library meshes crash on loading most yoFrankie levels, * the multires pointer gets invalid - Campbell */ - if(me && me->id.lib==NULL && me->mr && me->mr->level_count > 1) { + if (me && me->id.lib==NULL && me->mr && me->mr->level_count > 1) { multires_load_old(ob, me); } ob->data = olddata; } - if(ob->totcol && ob->matbits == NULL) { + if (ob->totcol && ob->matbits == NULL) { int a; ob->matbits= MEM_callocN(sizeof(char)*ob->totcol, "ob->matbits"); - for(a=0; a<ob->totcol; a++) + for (a=0; a<ob->totcol; a++) ob->matbits[a]= ob->colbits & (1<<a); } } /* texture filter */ - for(tex = main->tex.first; tex; tex = tex->id.next) { - if(tex->afmax == 0) + for (tex = main->tex.first; tex; tex = tex->id.next) { + if (tex->afmax == 0) tex->afmax= 8; } - for(ma = main->mat.first; ma; ma = ma->id.next) { + for (ma = main->mat.first; ma; ma = ma->id.next) { int a; - if(ma->mode & MA_WIRE) { + if (ma->mode & MA_WIRE) { ma->material_type= MA_TYPE_WIRE; ma->mode &= ~MA_WIRE; } - if(ma->mode & MA_HALO) { + if (ma->mode & MA_HALO) { ma->material_type= MA_TYPE_HALO; ma->mode &= ~MA_HALO; } - if(ma->mode & (MA_ZTRANSP|MA_RAYTRANSP)) { + if (ma->mode & (MA_ZTRANSP|MA_RAYTRANSP)) { ma->mode |= MA_TRANSP; } else { @@ -11048,15 +11079,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } /* set new bump for unused slots */ - for(a=0; a<MAX_MTEX; a++) { - if(ma->mtex[a]) { + for (a=0; a<MAX_MTEX; a++) { + if (ma->mtex[a]) { tex= ma->mtex[a]->tex; - if(!tex) { + if (!tex) { ma->mtex[a]->texflag |= MTEX_3TAP_BUMP; ma->mtex[a]->texflag |= MTEX_BUMP_OBJECTSPACE; - } else { + } + else { tex= (Tex*)newlibadr(fd, ma->id.lib, tex); - if(tex && tex->type == 0) { /* invalid type */ + if (tex && tex->type == 0) { /* invalid type */ ma->mtex[a]->texflag |= MTEX_3TAP_BUMP; ma->mtex[a]->texflag |= MTEX_BUMP_OBJECTSPACE; } @@ -11080,9 +11112,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - for(sce = main->scene.first; sce; sce = sce->id.next) { + for (sce = main->scene.first; sce; sce = sce->id.next) { ts= sce->toolsettings; - if(ts->normalsize == 0.0f || !ts->uv_selectmode || ts->vgroup_weight == 0.0f) { + if (ts->normalsize == 0.0f || !ts->uv_selectmode || ts->vgroup_weight == 0.0f) { ts->normalsize= 0.1f; ts->selectmode= SCE_SELECT_VERTEX; @@ -11117,11 +11149,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main) //Stereo sce->gm.stereomode = sce->r.stereomode; /* reassigning stereomode NO_STEREO and DOME to a separeted flag*/ - if (sce->gm.stereomode == 1){ //1 = STEREO_NOSTEREO + if (sce->gm.stereomode == 1) { //1 = STEREO_NOSTEREO sce->gm.stereoflag = STEREO_NOSTEREO; sce->gm.stereomode = STEREO_ANAGLYPH; } - else if(sce->gm.stereomode == 8){ //8 = STEREO_DOME + else if (sce->gm.stereomode == 8) { //8 = STEREO_DOME sce->gm.stereoflag = STEREO_DOME; sce->gm.stereomode = STEREO_ANAGLYPH; } @@ -11151,31 +11183,31 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Scene *sce; Object *ob; - for(sce = main->scene.first; sce; sce = sce->id.next) { - if(fd->fileflags & G_FILE_ENABLE_ALL_FRAMES) + for (sce = main->scene.first; sce; sce = sce->id.next) { + if (fd->fileflags & G_FILE_ENABLE_ALL_FRAMES) sce->gm.flag |= GAME_ENABLE_ALL_FRAMES; - if(fd->fileflags & G_FILE_SHOW_DEBUG_PROPS) + if (fd->fileflags & G_FILE_SHOW_DEBUG_PROPS) sce->gm.flag |= GAME_SHOW_DEBUG_PROPS; - if(fd->fileflags & G_FILE_SHOW_FRAMERATE) + if (fd->fileflags & G_FILE_SHOW_FRAMERATE) sce->gm.flag |= GAME_SHOW_FRAMERATE; - if(fd->fileflags & G_FILE_SHOW_PHYSICS) + if (fd->fileflags & G_FILE_SHOW_PHYSICS) sce->gm.flag |= GAME_SHOW_PHYSICS; - if(fd->fileflags & G_FILE_GLSL_NO_SHADOWS) + if (fd->fileflags & G_FILE_GLSL_NO_SHADOWS) sce->gm.flag |= GAME_GLSL_NO_SHADOWS; - if(fd->fileflags & G_FILE_GLSL_NO_SHADERS) + if (fd->fileflags & G_FILE_GLSL_NO_SHADERS) sce->gm.flag |= GAME_GLSL_NO_SHADERS; - if(fd->fileflags & G_FILE_GLSL_NO_RAMPS) + if (fd->fileflags & G_FILE_GLSL_NO_RAMPS) sce->gm.flag |= GAME_GLSL_NO_RAMPS; - if(fd->fileflags & G_FILE_GLSL_NO_NODES) + if (fd->fileflags & G_FILE_GLSL_NO_NODES) sce->gm.flag |= GAME_GLSL_NO_NODES; - if(fd->fileflags & G_FILE_GLSL_NO_EXTRA_TEX) + if (fd->fileflags & G_FILE_GLSL_NO_EXTRA_TEX) sce->gm.flag |= GAME_GLSL_NO_EXTRA_TEX; - if(fd->fileflags & G_FILE_IGNORE_DEPRECATION_WARNINGS) + if (fd->fileflags & G_FILE_IGNORE_DEPRECATION_WARNINGS) sce->gm.flag |= GAME_IGNORE_DEPRECATION_WARNINGS; - if(fd->fileflags & G_FILE_GAME_MAT_GLSL) + if (fd->fileflags & G_FILE_GAME_MAT_GLSL) sce->gm.matmode= GAME_MAT_GLSL; - else if(fd->fileflags & G_FILE_GAME_MAT) + else if (fd->fileflags & G_FILE_GAME_MAT) sce->gm.matmode= GAME_MAT_MULTITEX; else sce->gm.matmode= GAME_MAT_TEXFACE; @@ -11183,8 +11215,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) sce->gm.flag |= GAME_DISPLAY_LISTS; } - for(ob = main->object.first; ob; ob = ob->id.next) { - if(ob->flag & 8192) // OB_POSEMODE = 8192 + for (ob = main->object.first; ob; ob = ob->id.next) { + if (ob->flag & 8192) // OB_POSEMODE = 8192 ob->mode |= OB_MODE_POSE; } } @@ -11199,11 +11231,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ParticleSettings *part; int do_gravity = 0; - for(sce = main->scene.first; sce; sce = sce->id.next) - if(sce->unit.scale_length == 0.0f) + for (sce = main->scene.first; sce; sce = sce->id.next) + if (sce->unit.scale_length == 0.0f) sce->unit.scale_length= 1.0f; - for(ob = main->object.first; ob; ob = ob->id.next) { + for (ob = main->object.first; ob; ob = ob->id.next) { /* fluid-sim stuff */ FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim); if (fluidmd) fluidmd->fss->fmd = fluidmd; @@ -11212,8 +11244,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ob->rotmode= ROT_MODE_EUL; } - for(ma = main->mat.first; ma; ma=ma->id.next) { - if(ma->vol.reflection == 0.f) { + for (ma = main->mat.first; ma; ma=ma->id.next) { + if (ma->vol.reflection == 0.f) { ma->vol.reflection = 1.f; ma->vol.transmission_col[0] = ma->vol.transmission_col[1] = ma->vol.transmission_col[2] = 1.0f; ma->vol.reflection_col[0] = ma->vol.reflection_col[1] = ma->vol.reflection_col[2] = 1.0f; @@ -11222,20 +11254,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main) do_version_mtex_factor_2_50(ma->mtex, ID_MA); } - for(la = main->lamp.first; la; la=la->id.next) + for (la = main->lamp.first; la; la=la->id.next) do_version_mtex_factor_2_50(la->mtex, ID_LA); - for(wo = main->world.first; wo; wo=wo->id.next) + for (wo = main->world.first; wo; wo=wo->id.next) do_version_mtex_factor_2_50(wo->mtex, ID_WO); - for(tex = main->tex.first; tex; tex=tex->id.next) - if(tex->vd) - if(tex->vd->extend == 0) + for (tex = main->tex.first; tex; tex=tex->id.next) + if (tex->vd) + if (tex->vd->extend == 0) tex->vd->extend = TEX_CLIP; - for(sce= main->scene.first; sce; sce= sce->id.next) + for (sce= main->scene.first; sce; sce= sce->id.next) { - if(sce->audio.main == 0.0f) + if (sce->audio.main == 0.0f) sce->audio.main = 1.0f; sce->r.ffcodecdata.audio_mixrate = sce->audio.mixrate; @@ -11246,8 +11278,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } /* Add default gravity to scenes */ - for(sce= main->scene.first; sce; sce= sce->id.next) { - if((sce->physics_settings.flag & PHYS_GLOBAL_GRAVITY) == 0 + for (sce= main->scene.first; sce; sce= sce->id.next) { + if ((sce->physics_settings.flag & PHYS_GLOBAL_GRAVITY) == 0 && len_v3(sce->physics_settings.gravity) == 0.0f) { sce->physics_settings.gravity[0] = sce->physics_settings.gravity[1] = 0.0f; @@ -11258,31 +11290,31 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } /* Assign proper global gravity weights for dynamics (only z-coordinate is taken into account) */ - if(do_gravity) for(part= main->particle.first; part; part= part->id.next) + if (do_gravity) for(part= main->particle.first; part; part= part->id.next) part->effector_weights->global_gravity = part->acc[2]/-9.81f; - for(ob = main->object.first; ob; ob = ob->id.next) { + for (ob = main->object.first; ob; ob = ob->id.next) { ModifierData *md; - if(do_gravity) { - for(md= ob->modifiers.first; md; md= md->next) { + if (do_gravity) { + for (md= ob->modifiers.first; md; md= md->next) { ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth); - if(clmd) + if (clmd) clmd->sim_parms->effector_weights->global_gravity = clmd->sim_parms->gravity[2]/-9.81f; } - if(ob->soft) + if (ob->soft) ob->soft->effector_weights->global_gravity = ob->soft->grav/9.81f; } /* Normal wind shape is plane */ - if(ob->pd) { - if(ob->pd->forcefield == PFIELD_WIND) + if (ob->pd) { + if (ob->pd->forcefield == PFIELD_WIND) ob->pd->shape = PFIELD_SHAPE_PLANE; - if(ob->pd->flag & PFIELD_PLANAR) + if (ob->pd->flag & PFIELD_PLANAR) ob->pd->shape = PFIELD_SHAPE_PLANE; - else if(ob->pd->flag & PFIELD_SURFACE) + else if (ob->pd->flag & PFIELD_SURFACE) ob->pd->shape = PFIELD_SHAPE_SURFACE; ob->pd->flag |= PFIELD_DO_LOCATION; @@ -11311,7 +11343,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - for(la = main->lamp.first; la; la=la->id.next) + for (la = main->lamp.first; la; la=la->id.next) la->compressthresh= 0.05f; } @@ -11328,45 +11360,45 @@ static void do_versions(FileData *fd, Library *lib, Main *main) to the derivedmesh/displist, so here we ensure that the basis shape key is always set in the mesh coordinates. */ - for(me= main->mesh.first; me; me= me->id.next) { - if((key = newlibadr(fd, lib, me->key)) && key->refkey) { + for (me= main->mesh.first; me; me= me->id.next) { + if ((key = newlibadr(fd, lib, me->key)) && key->refkey) { data= key->refkey->data; tot= MIN2(me->totvert, key->refkey->totelem); - for(a=0; a<tot; a++, data+=3) + for (a=0; a<tot; a++, data+=3) copy_v3_v3(me->mvert[a].co, data); } } - for(lt= main->latt.first; lt; lt= lt->id.next) { - if((key = newlibadr(fd, lib, lt->key)) && key->refkey) { + for (lt= main->latt.first; lt; lt= lt->id.next) { + if ((key = newlibadr(fd, lib, lt->key)) && key->refkey) { data= key->refkey->data; tot= MIN2(lt->pntsu*lt->pntsv*lt->pntsw, key->refkey->totelem); - for(a=0; a<tot; a++, data+=3) + for (a=0; a<tot; a++, data+=3) copy_v3_v3(lt->def[a].vec, data); } } - for(cu= main->curve.first; cu; cu= cu->id.next) { - if((key = newlibadr(fd, lib, cu->key)) && key->refkey) { + for (cu= main->curve.first; cu; cu= cu->id.next) { + if ((key = newlibadr(fd, lib, cu->key)) && key->refkey) { data= key->refkey->data; - for(nu=cu->nurb.first; nu; nu=nu->next) { - if(nu->bezt) { + for (nu=cu->nurb.first; nu; nu=nu->next) { + if (nu->bezt) { BezTriple *bezt = nu->bezt; - for(a=0; a<nu->pntsu; a++, bezt++) { + for (a=0; a<nu->pntsu; a++, bezt++) { copy_v3_v3(bezt->vec[0], data); data+=3; copy_v3_v3(bezt->vec[1], data); data+=3; copy_v3_v3(bezt->vec[2], data); data+=3; bezt->alfa= *data; data++; } } - else if(nu->bp) { + else if (nu->bp) { BPoint *bp = nu->bp; - for(a=0; a<nu->pntsu*nu->pntsv; a++, bp++) { + for (a=0; a<nu->pntsu*nu->pntsv; a++, bp++) { copy_v3_v3(bp->vec, data); data+=3; bp->alfa= *data; data++; } @@ -11381,7 +11413,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) { Scene *sce= main->scene.first; while(sce) { - if(sce->r.frame_step==0) + if (sce->r.frame_step==0) sce->r.frame_step= 1; if (sce->r.mblur_samples==0) sce->r.mblur_samples = sce->r.osa; @@ -11422,10 +11454,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ScrArea *sa; SpaceLink *sl; - for(screen= main->screen.first; screen; screen= screen->id.next) { - for(sa= screen->areabase.first; sa; sa= sa->next) { - for(sl= sa->spacedata.first; sl; sl= sl->next) { - if(sl->spacetype==SPACE_VIEW3D) { + for (screen= main->screen.first; screen; screen= screen->id.next) { + for (sa= screen->areabase.first; sa; sa= sa->next) { + for (sl= sa->spacedata.first; sl; sl= sl->next) { + if (sl->spacetype==SPACE_VIEW3D) { View3D *v3d = (View3D *)sl; if (v3d->drawtype == OB_MATERIAL) v3d->drawtype = OB_SOLID; } @@ -11449,7 +11481,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* don't know what scene is active, so we'll convert if any scene has it enabled... */ while (sce) { - if(sce->r.color_mgt_flag & R_COLOR_MANAGEMENT) + if (sce->r.color_mgt_flag & R_COLOR_MANAGEMENT) convert=1; sce=sce->id.next; } @@ -11505,18 +11537,18 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Mesh *me; Object *ob; - for(sce=main->scene.first; sce; sce=sce->id.next) - if(!sce->toolsettings->particle.selectmode) + for (sce=main->scene.first; sce; sce=sce->id.next) + if (!sce->toolsettings->particle.selectmode) sce->toolsettings->particle.selectmode= SCE_SELECT_PATH; if (main->versionfile == 250 && main->subversionfile > 1) { - for(me=main->mesh.first; me; me=me->id.next) + for (me=main->mesh.first; me; me=me->id.next) multires_load_old_250(me); - for(ob=main->object.first; ob; ob=ob->id.next) { + for (ob=main->object.first; ob; ob=ob->id.next) { MultiresModifierData *mmd = (MultiresModifierData *)modifiers_findByType(ob, eModifierType_Multires); - if(mmd) { + if (mmd) { mmd->totlvl--; mmd->lvl--; mmd->sculptlvl= mmd->lvl; @@ -11531,9 +11563,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Object *ob; /* properly initialize hair clothsim data on old files */ - for(ob = main->object.first; ob; ob = ob->id.next) { + for (ob = main->object.first; ob; ob = ob->id.next) { ModifierData *md; - for(md= ob->modifiers.first; md; md= md->next) { + for (md= ob->modifiers.first; md; md= md->next) { if (md->type == eModifierType_Cloth) { ClothModifierData *clmd = (ClothModifierData *)md; if (clmd->sim_parms->velocity_smooth < 0.01f) @@ -11553,21 +11585,22 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* remove all preview window in wrong spaces */ - for(screen= main->screen.first; screen; screen= screen->id.next) { - for(sa= screen->areabase.first; sa; sa= sa->next) { - for(sl= sa->spacedata.first; sl; sl= sl->next) { - if(sl->spacetype!=SPACE_SEQ) { + for (screen= main->screen.first; screen; screen= screen->id.next) { + for (sa= screen->areabase.first; sa; sa= sa->next) { + for (sl= sa->spacedata.first; sl; sl= sl->next) { + if (sl->spacetype!=SPACE_SEQ) { ARegion *ar; ListBase *regionbase; if (sl == sa->spacedata.first) { regionbase = &sa->regionbase; - } else { + } + else { regionbase = &sl->regionbase; } - for( ar = regionbase->first; ar; ar = ar->next) { + for ( ar = regionbase->first; ar; ar = ar->next) { if (ar->regiontype == RGN_TYPE_PREVIEW) break; } @@ -11592,10 +11625,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main) SpaceLink *sl; - for(screen= main->screen.first; screen; screen= screen->id.next) { - for(sa= screen->areabase.first; sa; sa= sa->next) { - for(sl= sa->spacedata.first; sl; sl= sl->next) { - if(sl->spacetype==SPACE_SEQ) { + for (screen= main->screen.first; screen; screen= screen->id.next) { + for (sa= screen->areabase.first; sa; sa= sa->next) { + for (sl= sa->spacedata.first; sl; sl= sl->next) { + if (sl->spacetype==SPACE_SEQ) { ARegion *ar; ARegion *ar_main; ListBase *regionbase; @@ -11603,7 +11636,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (sl == sa->spacedata.first) { regionbase = &sa->regionbase; - } else { + } + else { regionbase = &sl->regionbase; } @@ -11633,7 +11667,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Material *ma; /* game engine changes */ - for(sce = main->scene.first; sce; sce = sce->id.next) { + for (sce = main->scene.first; sce; sce = sce->id.next) { sce->gm.eyeseparation = 0.10f; } @@ -11647,7 +11681,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) */ if (ob->pose && ob->data) { bArmature *arm= newlibadr(fd, lib, ob->data); - if(arm) { /* XXX - why does this fail in some cases? */ + if (arm) { /* XXX - why does this fail in some cases? */ bAnimVizSettings *avs= &ob->pose->avs; /* ghosting settings ---------------- */ @@ -11787,22 +11821,22 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Material *ma; /* ambient default from 0.5f to 1.0f */ - for(ma= main->mat.first; ma; ma=ma->id.next) + for (ma= main->mat.first; ma; ma=ma->id.next) ma->amb *= 2.0f; - for(wo= main->world.first; wo; wo=wo->id.next) { + for (wo= main->world.first; wo; wo=wo->id.next) { /* ao splitting into ao/env/indirect */ wo->ao_env_energy= wo->aoenergy; wo->aoenergy= 1.0f; - if(wo->ao_indirect_bounces == 0) + if (wo->ao_indirect_bounces == 0) wo->ao_indirect_bounces= 1; else wo->mode |= WO_INDIRECT_LIGHT; - if(wo->aomix == WO_AOSUB) + if (wo->aomix == WO_AOSUB) wo->ao_env_energy= -wo->ao_env_energy; - else if(wo->aomix == WO_AOADDSUB) + else if (wo->aomix == WO_AOADDSUB) wo->mode |= WO_AMB_OCC; wo->aomix= WO_AOMUL; @@ -11819,8 +11853,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Material *ma; /* initialize to sane default so toggling on border shows something */ - for(sce = main->scene.first; sce; sce = sce->id.next) { - if(sce->r.border.xmin == 0.0f && sce->r.border.ymin == 0.0f && + for (sce = main->scene.first; sce; sce = sce->id.next) { + if (sce->r.border.xmin == 0.0f && sce->r.border.ymin == 0.0f && sce->r.border.xmax == 0.0f && sce->r.border.ymax == 0.0f) { sce->r.border.xmin = 0.0f; sce->r.border.ymin = 0.0f; @@ -11828,7 +11862,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) sce->r.border.ymax = 1.0f; } - if((sce->r.ffcodecdata.flags & FFMPEG_MULTIPLEX_AUDIO) == 0) + if ((sce->r.ffcodecdata.flags & FFMPEG_MULTIPLEX_AUDIO) == 0) sce->r.ffcodecdata.audio_codec = 0x0; // CODEC_ID_NONE SEQ_BEGIN(sce->ed, seq) { @@ -11838,16 +11872,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } /* particle brush strength factor was changed from int to float */ - for(sce= main->scene.first; sce; sce=sce->id.next) { + for (sce= main->scene.first; sce; sce=sce->id.next) { ParticleEditSettings *pset= &sce->toolsettings->particle; int a; - for(a=0; a<PE_TOT_BRUSH; a++) + for (a=0; a<PE_TOT_BRUSH; a++) pset->brush[a].strength /= 100.0f; } - for(ma = main->mat.first; ma; ma=ma->id.next) - if(ma->mode & MA_TRACEBLE) + for (ma = main->mat.first; ma; ma=ma->id.next) + if (ma->mode & MA_TRACEBLE) ma->shade_flag |= MA_APPROX_OCCLUSION; /* sequencer changes */ @@ -11856,16 +11890,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ScrArea *sa; SpaceLink *sl; - for(screen= main->screen.first; screen; screen= screen->id.next) { - for(sa= screen->areabase.first; sa; sa= sa->next) { - for(sl= sa->spacedata.first; sl; sl= sl->next) { - if(sl->spacetype==SPACE_SEQ) { + for (screen= main->screen.first; screen; screen= screen->id.next) { + for (sa= screen->areabase.first; sa; sa= sa->next) { + for (sl= sa->spacedata.first; sl; sl= sl->next) { + if (sl->spacetype==SPACE_SEQ) { ARegion *ar_preview; ListBase *regionbase; if (sl == sa->spacedata.first) { regionbase = &sa->regionbase; - } else { + } + else { regionbase = &sl->regionbase; } @@ -11891,12 +11926,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main) * This bit was used in the past for V3D_TRANSFORM_SNAP, which is now deprecated. * Here we clear it for old files so they don't come in with V3D_RENDER_OVERRIDE set, * which would cause cameras, lamps, etc to become invisible */ - for(sc= main->screen.first; sc; sc= sc->id.next) { + for (sc= main->screen.first; sc; sc= sc->id.next) { ScrArea *sa; - for(sa= sc->areabase.first; sa; sa= sa->next) { + for (sa= sc->areabase.first; sa; sa= sa->next) { SpaceLink *sl; for (sl= sa->spacedata.first; sl; sl= sl->next) { - if(sl->spacetype==SPACE_VIEW3D) { + if (sl->spacetype==SPACE_VIEW3D) { View3D* v3d = (View3D *)sl; v3d->flag2 &= ~V3D_RENDER_OVERRIDE; } @@ -11916,9 +11951,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } /* properly initialize active flag for fluidsim modifiers */ - for(ob = main->object.first; ob; ob = ob->id.next) { + for (ob = main->object.first; ob; ob = ob->id.next) { ModifierData *md; - for(md= ob->modifiers.first; md; md= md->next) { + for (md= ob->modifiers.first; md; md= md->next) { if (md->type == eModifierType_Fluidsim) { FluidsimModifierData *fmd = (FluidsimModifierData *)md; fmd->fss->flag |= OB_FLUIDSIM_ACTIVE; @@ -11928,8 +11963,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } /* adjustment to color balance node values */ - for(scene= main->scene.first; scene; scene= scene->id.next) { - if(scene->nodetree) { + for (scene= main->scene.first; scene; scene= scene->id.next) { + if (scene->nodetree) { bNode *node=scene->nodetree->nodes.first; while(node) { @@ -11971,12 +12006,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main) bScreen *sc; /* Image editor scopes */ - for(sc= main->screen.first; sc; sc= sc->id.next) { + for (sc= main->screen.first; sc; sc= sc->id.next) { ScrArea *sa; - for(sa= sc->areabase.first; sa; sa= sa->next) { + for (sa= sc->areabase.first; sa; sa= sa->next) { SpaceLink *sl; for (sl= sa->spacedata.first; sl; sl= sl->next) { - if(sl->spacetype==SPACE_IMAGE) { + if (sl->spacetype==SPACE_IMAGE) { SpaceImage *sima = (SpaceImage *)sl; scopes_new(&sima->scopes); } @@ -12038,11 +12073,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main) do_version_mdef_250(main); /* parent type to modifier */ - for(ob = main->object.first; ob; ob = ob->id.next) { - if(ob->parent) { + for (ob = main->object.first; ob; ob = ob->id.next) { + if (ob->parent) { Object *parent= (Object *)newlibadr(fd, lib, ob->parent); - if(parent) { /* parent may not be in group */ - if(parent->type==OB_ARMATURE && ob->partype==PARSKEL) { + if (parent) { /* parent may not be in group */ + if (parent->type==OB_ARMATURE && ob->partype==PARSKEL) { ArmatureModifierData *amd; bArmature *arm= (bArmature *)newlibadr(fd, lib, parent->data); @@ -12052,7 +12087,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) amd->deformflag= arm->deformflag; ob->partype = PAROBJECT; } - else if(parent->type==OB_LATTICE && ob->partype==PARSKEL) { + else if (parent->type==OB_LATTICE && ob->partype==PARSKEL) { LatticeModifierData *lmd; lmd = (LatticeModifierData*) modifier_new(eModifierType_Lattice); @@ -12060,7 +12095,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) BLI_addtail((ListBase*)&ob->modifiers, lmd); ob->partype = PAROBJECT; } - else if(parent->type==OB_CURVE && ob->partype==PARCURVE) { + else if (parent->type==OB_CURVE && ob->partype==PARCURVE) { CurveModifierData *cmd; cmd = (CurveModifierData*) modifier_new(eModifierType_Curve); @@ -12075,33 +12110,33 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* initialize scene active layer */ for (scene= main->scene.first; scene; scene=scene->id.next) { int i; - for(i=0; i<20; i++) { - if(scene->lay & (1<<i)) { + for (i=0; i<20; i++) { + if (scene->lay & (1<<i)) { scene->layact= 1<<i; break; } } } - for(tex= main->tex.first; tex; tex= tex->id.next) { + for (tex= main->tex.first; tex; tex= tex->id.next) { /* if youre picky, this isn't correct until we do a version bump * since you could set saturation to be 0.0*/ - if(tex->saturation==0.0f) + if (tex->saturation==0.0f) tex->saturation= 1.0f; } { Curve *cu; - for(cu= main->curve.first; cu; cu= cu->id.next) { + for (cu= main->curve.first; cu; cu= cu->id.next) { cu->smallcaps_scale= 0.75f; } } for (scene= main->scene.first; scene; scene=scene->id.next) { - if(scene) { + if (scene) { Sequence *seq; SEQ_BEGIN(scene->ed, seq) { - if(seq->sat==0.0f) { + if (seq->sat==0.0f) { seq->sat= 1.0f; } } @@ -12202,18 +12237,18 @@ static void do_versions(FileData *fd, Library *lib, Main *main) { Object *ob; - for(ob = main->object.first; ob; ob = ob->id.next) { + for (ob = main->object.first; ob; ob = ob->id.next) { ModifierData *md; - for(md= ob->modifiers.first; md; md= md->next) { + for (md= ob->modifiers.first; md; md= md->next) { if (md->type == eModifierType_Smoke) { SmokeModifierData *smd = (SmokeModifierData *)md; - if((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) + if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) { smd->domain->vorticity = 2.0f; smd->domain->time_scale = 1.0f; - if(!(smd->domain->flags & (1<<4))) + if (!(smd->domain->flags & (1<<4))) continue; /* delete old MOD_SMOKE_INITVELOCITY flag */ @@ -12222,13 +12257,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* for now just add it to all flow objects in the scene */ { Object *ob2; - for(ob2 = main->object.first; ob2; ob2 = ob2->id.next) { + for (ob2 = main->object.first; ob2; ob2 = ob2->id.next) { ModifierData *md2; - for(md2= ob2->modifiers.first; md2; md2= md2->next) { + for (md2= ob2->modifiers.first; md2; md2= md2->next) { if (md2->type == eModifierType_Smoke) { SmokeModifierData *smd2 = (SmokeModifierData *)md2; - if((smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow) + if ((smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow) { smd2->flow->flags |= MOD_SMOKE_FLOW_INITVELOCITY; } @@ -12253,13 +12288,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main) bScreen *sc; Object *ob; - for(br= main->brush.first; br; br= br->id.next) { - if(br->ob_mode==0) + for (br= main->brush.first; br; br= br->id.next) { + if (br->ob_mode==0) br->ob_mode= OB_MODE_ALL_PAINT; } - for(part = main->particle.first; part; part = part->id.next) { - if(part->boids) + for (part = main->particle.first; part; part = part->id.next) { + if (part->boids) part->boids->pitch = 1.0f; part->flag &= ~PART_HAIR_REGROW; /* this was a deprecated flag before */ @@ -12294,7 +12329,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* fix rotation actuators for objects so they use real angles (radians) * since before blender went opensource this strange scalar was used: (1 / 0.02) * 2 * math.pi/360 */ - for(ob= main->object.first; ob; ob= ob->id.next) { + for (ob= main->object.first; ob; ob= ob->id.next) { bActuator *act= ob->actuators.first; while(act) { if (act->type==ACT_OBJECT) { @@ -12310,10 +12345,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main) // init facing axis property of steering actuators { Object *ob; - for(ob = main->object.first; ob; ob = ob->id.next) { + for (ob = main->object.first; ob; ob = ob->id.next) { bActuator *act; - for(act= ob->actuators.first; act; act= act->next) { - if(act->type==ACT_STEERING) { + for (act= ob->actuators.first; act; act= act->next) { + if (act->type==ACT_STEERING) { bSteeringActuator* stact = act->data; if (stact->facingaxis==0) { @@ -12328,9 +12363,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Object *ob; /* ocean res is now squared, reset old ones - will be massive */ - for(ob = main->object.first; ob; ob = ob->id.next) { + for (ob = main->object.first; ob; ob = ob->id.next) { ModifierData *md; - for(md= ob->modifiers.first; md; md= md->next) { + for (md= ob->modifiers.first; md; md= md->next) { if (md->type == eModifierType_Ocean) { OceanModifierData *omd = (OceanModifierData *)md; omd->resolution = 7; @@ -12346,12 +12381,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Key *key; /* Fix for sample line scope initializing with no height */ - for(sc= main->screen.first; sc; sc= sc->id.next) { + for (sc= main->screen.first; sc; sc= sc->id.next) { sa= sc->areabase.first; while(sa) { SpaceLink *sl; for (sl= sa->spacedata.first; sl; sl= sl->next) { - if(sl->spacetype==SPACE_IMAGE) { + if (sl->spacetype==SPACE_IMAGE) { SpaceImage *sima= (SpaceImage *)sl; if (sima->sample_line_hist.height == 0 ) sima->sample_line_hist.height = 100; @@ -12387,11 +12422,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* fix for objects which have zero dquat's * since this is multiplied with the quat rather than added */ - for(ob= main->object.first; ob; ob= ob->id.next) { - if(is_zero_v4(ob->dquat)) { + for (ob= main->object.first; ob; ob= ob->id.next) { + if (is_zero_v4(ob->dquat)) { unit_qt(ob->dquat); } - if(is_zero_v3(ob->drotAxis) && ob->drotAngle == 0.0f) { + if (is_zero_v3(ob->drotAxis) && ob->drotAngle == 0.0f) { unit_axis_angle(ob->drotAxis, &ob->drotAngle); } } @@ -12412,7 +12447,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile <3)){ + if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile <3)) { bScreen *sc; Brush *brush; Object *ob; @@ -12420,18 +12455,18 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Material *mat; int tex_nr, transp_tex; - for(mat = main->mat.first; mat; mat = mat->id.next){ - if(!(mat->mode & MA_TRANSP) && !(mat->material_type & MA_TYPE_VOLUME)){ + for (mat = main->mat.first; mat; mat = mat->id.next) { + if (!(mat->mode & MA_TRANSP) && !(mat->material_type & MA_TYPE_VOLUME)) { transp_tex= 0; - for(tex_nr=0; tex_nr<MAX_MTEX; tex_nr++){ - if(!mat->mtex[tex_nr]) continue; - if(mat->mtex[tex_nr]->mapto & MAP_ALPHA) transp_tex= 1; + for (tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) { + if (!mat->mtex[tex_nr]) continue; + if (mat->mtex[tex_nr]->mapto & MAP_ALPHA) transp_tex= 1; } /* weak! material alpha could be animated */ - if(mat->alpha < 1.0f || mat->fresnel_tra > 0.0f || transp_tex){ + if (mat->alpha < 1.0f || mat->fresnel_tra > 0.0f || transp_tex) { mat->mode |= MA_TRANSP; mat->mode &= ~(MA_ZTRANSP|MA_RAYTRANSP); } @@ -12448,17 +12483,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } for (brush= main->brush.first; brush; brush= brush->id.next) { - if(brush->height == 0) + if (brush->height == 0) brush->height= 0.4f; } /* replace 'rim material' option for in offset*/ - for(ob = main->object.first; ob; ob = ob->id.next) { + for (ob = main->object.first; ob; ob = ob->id.next) { ModifierData *md; - for(md= ob->modifiers.first; md; md= md->next) { + for (md= ob->modifiers.first; md; md= md->next) { if (md->type == eModifierType_Solidify) { SolidifyModifierData *smd = (SolidifyModifierData *)md; - if(smd->flag & MOD_SOLIDIFY_RIM_MATERIAL) { + if (smd->flag & MOD_SOLIDIFY_RIM_MATERIAL) { smd->mat_ofs_rim= 1; smd->flag &= ~MOD_SOLIDIFY_RIM_MATERIAL; } @@ -12467,20 +12502,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } /* particle draw color from material */ - for(part = main->particle.first; part; part = part->id.next) { - if(part->draw & PART_DRAW_MAT_COL) + for (part = main->particle.first; part; part = part->id.next) { + if (part->draw & PART_DRAW_MAT_COL) part->draw_col = PART_DRAW_COL_MAT; } } - if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 6)){ + if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 6)) { Mesh *me; - for(me= main->mesh.first; me; me= me->id.next) + for (me= main->mesh.first; me; me= me->id.next) mesh_calc_normals_tessface(me->mvert, me->totvert, me->mface, me->totface, NULL); } - if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 2)){ + if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 2)) { /* update blur area sizes from 0..1 range to 0..100 percentage */ Scene *scene; bNode *node; @@ -12494,30 +12529,30 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if (main->versionfile < 258 || (main->versionfile == 258 && main->subversionfile < 1)){ + if (main->versionfile < 258 || (main->versionfile == 258 && main->subversionfile < 1)) { /* screen view2d settings were not properly initialized [#27164] * v2d->scroll caused the bug but best reset other values too which are in old blend files only. * need to make less ugly - possibly an iterator? */ bScreen *screen; - for(screen= main->screen.first; screen; screen= screen->id.next) { + for (screen= main->screen.first; screen; screen= screen->id.next) { ScrArea *sa; /* add regions */ - for(sa= screen->areabase.first; sa; sa= sa->next) { + for (sa= screen->areabase.first; sa; sa= sa->next) { SpaceLink *sl= sa->spacedata.first; - if(sl->spacetype==SPACE_IMAGE) { + if (sl->spacetype==SPACE_IMAGE) { ARegion *ar; for (ar=sa->regionbase.first; ar; ar= ar->next) { - if(ar->regiontype == RGN_TYPE_WINDOW) { + if (ar->regiontype == RGN_TYPE_WINDOW) { View2D *v2d= &ar->v2d; v2d->minzoom= v2d->maxzoom= v2d->scroll= v2d->keeptot= v2d->keepzoom= v2d->keepofs= v2d->align= 0; } } } for (sl= sa->spacedata.first; sl; sl= sl->next) { - if(sl->spacetype==SPACE_IMAGE) { + if (sl->spacetype==SPACE_IMAGE) { ARegion *ar; for (ar=sl->regionbase.first; ar; ar= ar->next) { - if(ar->regiontype == RGN_TYPE_WINDOW) { + if (ar->regiontype == RGN_TYPE_WINDOW) { View2D *v2d= &ar->v2d; v2d->minzoom= v2d->maxzoom= v2d->scroll= v2d->keeptot= v2d->keepzoom= v2d->keepofs= v2d->align= 0; } @@ -12530,8 +12565,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) { /* Initialize texture point density curve falloff */ Tex *tex; - for(tex= main->tex.first; tex; tex= tex->id.next) { - if(tex->pd) { + for (tex= main->tex.first; tex; tex= tex->id.next) { + if (tex->pd) { if (tex->pd->falloff_speed_scale == 0.0f) tex->pd->falloff_speed_scale = 100.0f; @@ -12551,8 +12586,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* add default value for behind strength of camera actuator */ Object *ob; bActuator *act; - for(ob = main->object.first; ob; ob= ob->id.next) { - for(act= ob->actuators.first; act; act= act->next) { + for (ob = main->object.first; ob; ob= ob->id.next) { + for (act= ob->actuators.first; act; act= act->next) { if (act->type == ACT_CAMERA) { bCameraActuator *ba= act->data; @@ -12564,14 +12599,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main) { ParticleSettings *part; - for(part = main->particle.first; part; part = part->id.next) { + for (part = main->particle.first; part; part = part->id.next) { /* Initialize particle billboard scale */ part->bb_size[0] = part->bb_size[1] = 1.0f; } } } - if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 1)){ + if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 1)) { { Scene *scene; Sequence *seq; @@ -12588,26 +12623,26 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } { bScreen *screen; - for(screen= main->screen.first; screen; screen= screen->id.next) { + for (screen= main->screen.first; screen; screen= screen->id.next) { ScrArea *sa; /* add regions */ - for(sa= screen->areabase.first; sa; sa= sa->next) { + for (sa= screen->areabase.first; sa; sa= sa->next) { SpaceLink *sl= sa->spacedata.first; - if(sl->spacetype==SPACE_SEQ) { + if (sl->spacetype==SPACE_SEQ) { ARegion *ar; for (ar=sa->regionbase.first; ar; ar= ar->next) { - if(ar->regiontype == RGN_TYPE_WINDOW) { - if(ar->v2d.min[1] == 4.0f) + if (ar->regiontype == RGN_TYPE_WINDOW) { + if (ar->v2d.min[1] == 4.0f) ar->v2d.min[1]= 0.5f; } } } for (sl= sa->spacedata.first; sl; sl= sl->next) { - if(sl->spacetype==SPACE_SEQ) { + if (sl->spacetype==SPACE_SEQ) { ARegion *ar; for (ar=sl->regionbase.first; ar; ar= ar->next) { - if(ar->regiontype == RGN_TYPE_WINDOW) { - if(ar->v2d.min[1] == 4.0f) + if (ar->regiontype == RGN_TYPE_WINDOW) { + if (ar->v2d.min[1] == 4.0f) ar->v2d.min[1]= 0.5f; } } @@ -12688,7 +12723,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 2)){ + if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 2)) { { /* Convert default socket values from bNodeStack */ Scene *sce; @@ -12738,7 +12773,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 4)){ + if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 4)) { { /* Adaptive time step for particle systems */ ParticleSettings *part; @@ -12751,42 +12786,42 @@ static void do_versions(FileData *fd, Library *lib, Main *main) { /* set defaults for obstacle avoidance, recast data */ Scene *sce; - for(sce = main->scene.first; sce; sce = sce->id.next) + for (sce = main->scene.first; sce; sce = sce->id.next) { if (sce->gm.levelHeight == 0.f) sce->gm.levelHeight = 2.f; - if(sce->gm.recastData.cellsize == 0.0f) + if (sce->gm.recastData.cellsize == 0.0f) sce->gm.recastData.cellsize = 0.3f; - if(sce->gm.recastData.cellheight == 0.0f) + if (sce->gm.recastData.cellheight == 0.0f) sce->gm.recastData.cellheight = 0.2f; - if(sce->gm.recastData.agentmaxslope == 0.0f) + if (sce->gm.recastData.agentmaxslope == 0.0f) sce->gm.recastData.agentmaxslope = (float)M_PI/4; - if(sce->gm.recastData.agentmaxclimb == 0.0f) + if (sce->gm.recastData.agentmaxclimb == 0.0f) sce->gm.recastData.agentmaxclimb = 0.9f; - if(sce->gm.recastData.agentheight == 0.0f) + if (sce->gm.recastData.agentheight == 0.0f) sce->gm.recastData.agentheight = 2.0f; - if(sce->gm.recastData.agentradius == 0.0f) + if (sce->gm.recastData.agentradius == 0.0f) sce->gm.recastData.agentradius = 0.6f; - if(sce->gm.recastData.edgemaxlen == 0.0f) + if (sce->gm.recastData.edgemaxlen == 0.0f) sce->gm.recastData.edgemaxlen = 12.0f; - if(sce->gm.recastData.edgemaxerror == 0.0f) + if (sce->gm.recastData.edgemaxerror == 0.0f) sce->gm.recastData.edgemaxerror = 1.3f; - if(sce->gm.recastData.regionminsize == 0.0f) + if (sce->gm.recastData.regionminsize == 0.0f) sce->gm.recastData.regionminsize = 8.f; - if(sce->gm.recastData.regionmergesize == 0.0f) + if (sce->gm.recastData.regionmergesize == 0.0f) sce->gm.recastData.regionmergesize = 20.f; - if(sce->gm.recastData.vertsperpoly<3) + if (sce->gm.recastData.vertsperpoly<3) sce->gm.recastData.vertsperpoly = 6; - if(sce->gm.recastData.detailsampledist == 0.0f) + if (sce->gm.recastData.detailsampledist == 0.0f) sce->gm.recastData.detailsampledist = 6.0f; - if(sce->gm.recastData.detailsamplemaxerror == 0.0f) + if (sce->gm.recastData.detailsamplemaxerror == 0.0f) sce->gm.recastData.detailsamplemaxerror = 1.0f; } } } - if (main->versionfile < 260){ + if (main->versionfile < 260) { { /* set default alpha value of Image outputs in image and render layer nodes to 0 */ Scene *sce; @@ -12795,7 +12830,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (sce=main->scene.first; sce; sce=sce->id.next) { /* there are files with invalid audio_channels value, the real cause is unknown, but we fix it here anyway to avoid crashes */ - if(sce->r.ffcodecdata.audio_channels == 0) + if (sce->r.ffcodecdata.audio_channels == 0) sce->r.ffcodecdata.audio_channels = 2; if (sce->nodetree) @@ -12811,17 +12846,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ParticleSettings *part; for (part=main->particle.first; part; part=part->id.next) { - if(ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) { + if (ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) { part->draw |= PART_DRAW_ROTATE_OB; - if(part->rotmode == 0) + if (part->rotmode == 0) part->rotmode = PART_ROT_VEL; } } } } - if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 1)){ + if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 1)) { Object *ob; for (ob= main->object.first; ob; ob= ob->id.next) { @@ -12830,7 +12865,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) { Camera *cam; - for(cam= main->camera.first; cam; cam= cam->id.next) { + for (cam= main->camera.first; cam; cam= cam->id.next) { if (cam->sensor_x < 0.01f) cam->sensor_x = DEFAULT_SENSOR_WIDTH; @@ -12843,11 +12878,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 2)) { bNodeTreeType *ntreetype= ntreeGetType(NTREE_SHADER); - if(ntreetype && ntreetype->foreach_nodetree) + if (ntreetype && ntreetype->foreach_nodetree) ntreetype->foreach_nodetree(main, NULL, do_version_ntree_tex_mapping_260); } - if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 4)){ + if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 4)) { { /* Convert node angles to radians! */ Scene *sce; @@ -12878,19 +12913,19 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (sa= sc->areabase.first; sa; sa= sa->next) { SpaceLink *sl; for (sl= sa->spacedata.first; sl; sl= sl->next) { - if(sl->spacetype==SPACE_VIEW3D) { + if (sl->spacetype==SPACE_VIEW3D) { View3D *v3d= (View3D *)sl; - if(v3d->bundle_size==0.0f) { + if (v3d->bundle_size==0.0f) { v3d->bundle_size= 0.2f; v3d->flag2 |= V3D_SHOW_RECONSTRUCTION; } - else if(sl->spacetype==SPACE_CLIP) { + else if (sl->spacetype==SPACE_CLIP) { SpaceClip *sc= (SpaceClip *)sl; - if(sc->scopes.track_preview_height==0) + if (sc->scopes.track_preview_height==0) sc->scopes.track_preview_height= 120; } - if(v3d->bundle_drawtype==0) + if (v3d->bundle_drawtype==0) v3d->bundle_drawtype= OB_PLAINAXES; } } @@ -12900,7 +12935,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (clip= main->movieclip.first; clip; clip= clip->id.next) { MovieTrackingTrack *track; - if(clip->aspx<1.0f) { + if (clip->aspx<1.0f) { clip->aspx= 1.0f; clip->aspy= 1.0f; } @@ -12909,21 +12944,21 @@ static void do_versions(FileData *fd, Library *lib, Main *main) IMB_TC_FREE_RUN | IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN; - if(clip->proxy.build_size_flag==0) + if (clip->proxy.build_size_flag==0) clip->proxy.build_size_flag= IMB_PROXY_25; - if(clip->proxy.quality==0) + if (clip->proxy.quality==0) clip->proxy.quality= 90; - if(clip->tracking.camera.pixel_aspect<0.01f) + if (clip->tracking.camera.pixel_aspect<0.01f) clip->tracking.camera.pixel_aspect= 1.f; track= clip->tracking.tracks.first; while(track) { - if(track->pyramid_levels==0) + if (track->pyramid_levels==0) track->pyramid_levels= 2; - if(track->minimum_correlation==0.0f) + if (track->minimum_correlation==0.0f) track->minimum_correlation= 0.75f; track= track->next; @@ -12938,14 +12973,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main) MovieClip *clip; bScreen *sc; - for(sce = main->scene.first; sce; sce = sce->id.next) { + for (sce = main->scene.first; sce; sce = sce->id.next) { do_versions_image_settings_2_60(sce); } for (clip= main->movieclip.first; clip; clip= clip->id.next) { MovieTrackingSettings *settings= &clip->tracking.settings; - if(settings->default_pyramid_levels==0) { + if (settings->default_pyramid_levels==0) { settings->default_tracker= TRACKER_KLT; settings->default_pyramid_levels= 2; settings->default_minimum_correlation= 0.75; @@ -12959,7 +12994,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (sa= sc->areabase.first; sa; sa= sa->next) { SpaceLink *sl; for (sl= sa->spacedata.first; sl; sl= sl->next) { - if(sl->spacetype==SPACE_VIEW3D) { + if (sl->spacetype==SPACE_VIEW3D) { View3D *v3d= (View3D *)sl; v3d->flag2&= ~V3D_RENDER_SHADOW; } @@ -13044,7 +13079,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) { /* Initialize BGE exit key to esc key */ Scene *scene; - for(scene= main->scene.first; scene; scene= scene->id.next) { + for (scene= main->scene.first; scene; scene= scene->id.next) { if (!scene->gm.exitkey) scene->gm.exitkey = 218; // Blender key code for ESC } @@ -13059,14 +13094,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main) clip->proxy.build_tc_flag|= IMB_TC_RECORD_RUN_NO_GAPS; - if(!tracking->settings.object_distance) + if (!tracking->settings.object_distance) tracking->settings.object_distance= 1.0f; - if(tracking->objects.first == NULL) + if (tracking->objects.first == NULL) BKE_tracking_new_object(tracking, "Camera"); while(tracking_object) { - if(!tracking_object->scale) + if (!tracking_object->scale) tracking_object->scale= 1.0f; tracking_object= tracking_object->next; @@ -13078,13 +13113,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (con= ob->constraints.first; con; con=con->next) { bConstraintTypeInfo *cti= constraint_get_typeinfo(con); - if(!cti) + if (!cti) continue; - if(cti->type==CONSTRAINT_TYPE_OBJECTSOLVER) { + if (cti->type==CONSTRAINT_TYPE_OBJECTSOLVER) { bObjectSolverConstraint *data= (bObjectSolverConstraint *)con->data; - if(data->invmat[3][3]==0.0f) + if (data->invmat[3][3]==0.0f) unit_m4(data->invmat); } } @@ -13147,12 +13182,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* convert Camera Actuator values to defines */ Object *ob; bActuator *act; - for(ob = main->object.first; ob; ob= ob->id.next) { - for(act= ob->actuators.first; act; act= act->next) { + for (ob = main->object.first; ob; ob= ob->id.next) { + for (act= ob->actuators.first; act; act= act->next) { if (act->type == ACT_CAMERA) { bCameraActuator *ba= act->data; - if(ba->axis==(float) 'x') ba->axis=OB_POSX; + if (ba->axis==(float) 'x') ba->axis=OB_POSX; else if (ba->axis==(float)'y') ba->axis=OB_POSY; /* don't do an if/else to avoid imediate subversion bump*/ // ba->axis=((ba->axis == (float) 'x')?OB_POSX_X:OB_POSY); @@ -13165,7 +13200,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* convert deprecated sculpt_paint_unified_* fields to UnifiedPaintSettings */ Scene *scene; - for(scene= main->scene.first; scene; scene= scene->id.next) { + for (scene= main->scene.first; scene; scene= scene->id.next) { ToolSettings *ts= scene->toolsettings; UnifiedPaintSettings *ups= &ts->unified_paint_settings; ups->size= ts->sculpt_paint_unified_size; @@ -13182,7 +13217,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* convert extended ascii to utf-8 for text editor */ Text *text; for (text= main->text.first; text; text= text->id.next) - if(!(text->flags & TXT_ISEXT)) { + if (!(text->flags & TXT_ISEXT)) { TextLine *tl; for (tl= text->lines.first; tl; tl= tl->next) { @@ -13198,12 +13233,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main) { /* set new dynamic paint values */ Object *ob; - for(ob = main->object.first; ob; ob = ob->id.next) { + for (ob = main->object.first; ob; ob = ob->id.next) { ModifierData *md; - for(md= ob->modifiers.first; md; md= md->next) { + for (md= ob->modifiers.first; md; md= md->next) { if (md->type == eModifierType_DynamicPaint) { DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md; - if(pmd->canvas) + if (pmd->canvas) { DynamicPaintSurface *surface = pmd->canvas->surfaces.first; for (; surface; surface=surface->next) { @@ -13222,13 +13257,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile < 262) { Object *ob; - for(ob=main->object.first; ob; ob= ob->id.next) { + for (ob=main->object.first; ob; ob= ob->id.next) { ModifierData *md; for (md=ob->modifiers.first; md; md=md->next) { if (md->type==eModifierType_Cloth) { ClothModifierData *clmd = (ClothModifierData*) md; - if(clmd->sim_parms) + if (clmd->sim_parms) clmd->sim_parms->vel_damping = 1.0f; } } @@ -13246,7 +13281,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (md = ob->modifiers.first; md; md = md->next) { if (md->type == eModifierType_Fluidsim) { FluidsimModifierData *fmd = (FluidsimModifierData *)md; - if(fmd->fss->animRate == 0.0f) + if (fmd->fss->animRate == 0.0f) fmd->fss->animRate = 1.0f; } } @@ -13317,7 +13352,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) static void do_versions_after_linking(FileData *fd, Library *lib, Main *main) { /* old Animation System (using IPO's) needs to be converted to the new Animato system */ - if(main->versionfile < 250) + if (main->versionfile < 250) do_versions_ipos_to_animato(main); } #endif @@ -13361,7 +13396,7 @@ static void lib_link_all(FileData *fd, Main *main) static void direct_link_keymapitem(FileData *fd, wmKeyMapItem *kmi) { kmi->properties= newdataadr(fd, kmi->properties); - if(kmi->properties) + if (kmi->properties) IDP_DirectLinkProperty(kmi->properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); kmi->ptr= NULL; kmi->flag &= ~KMI_UPDATE; @@ -13379,7 +13414,7 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead) /* read all data into fd->datamap */ bhead= read_data_into_oldnewmap(fd, bhead, "user def"); - if(user->keymaps.first) { + if (user->keymaps.first) { /* backwards compatibility */ user->user_keymaps= user->keymaps; user->keymaps.first= user->keymaps.last= NULL; @@ -13389,7 +13424,7 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead) link_list(fd, &user->user_keymaps); link_list(fd, &user->addons); - for(keymap=user->user_keymaps.first; keymap; keymap=keymap->next) { + for (keymap=user->user_keymaps.first; keymap; keymap=keymap->next) { keymap->modal_items= NULL; keymap->poll = NULL; keymap->flag &= ~KEYMAP_UPDATE; @@ -13397,17 +13432,17 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead) link_list(fd, &keymap->diff_items); link_list(fd, &keymap->items); - for(kmdi=keymap->diff_items.first; kmdi; kmdi=kmdi->next) { + for (kmdi=keymap->diff_items.first; kmdi; kmdi=kmdi->next) { kmdi->remove_item= newdataadr(fd, kmdi->remove_item); kmdi->add_item= newdataadr(fd, kmdi->add_item); - if(kmdi->remove_item) + if (kmdi->remove_item) direct_link_keymapitem(fd, kmdi->remove_item); - if(kmdi->add_item) + if (kmdi->add_item) direct_link_keymapitem(fd, kmdi->add_item); } - for(kmi=keymap->items.first; kmi; kmi=kmi->next) + for (kmi=keymap->items.first; kmi; kmi=kmi->next) direct_link_keymapitem(fd, kmi); } @@ -13461,14 +13496,14 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) overwriting the libraries from the memory file. previously it did not save ID_LI/ID_ID blocks in this case, but they are needed to make quit.blend recover them correctly. */ - if(fd->memfile) + if (fd->memfile) bhead= blo_nextbhead(fd, bhead); else bhead= read_libblock(fd, bfd->main, bhead, LIB_LOCAL, NULL); break; case ID_ID: /* same as above */ - if(fd->memfile) + if (fd->memfile) bhead= blo_nextbhead(fd, bhead); else /* always adds to the most recently loaded @@ -13487,7 +13522,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) } /* do before read_libraries, but skip undo case */ -// if(fd->memfile==NULL) (the mesh shuffle hacks don't work yet? ton) +// if (fd->memfile==NULL) (the mesh shuffle hacks don't work yet? ton) do_versions(fd, NULL, bfd->main); read_libraries(fd, &fd->mainlist); @@ -13515,8 +13550,8 @@ static int verg_bheadsort(const void *v1, const void *v2) { const struct bheadsort *x1=v1, *x2=v2; - if( x1->old > x2->old) return 1; - else if( x1->old < x2->old) return -1; + if ( x1->old > x2->old) return 1; + else if ( x1->old < x2->old) return -1; return 0; } @@ -13530,7 +13565,7 @@ static void sort_bhead_old_map(FileData *fd) tot++; fd->tot_bheadmap= tot; - if(tot==0) return; + if (tot==0) return; bhs= fd->bheadmap= MEM_mallocN(tot*sizeof(struct bheadsort), "bheadsort"); @@ -13546,7 +13581,7 @@ static void sort_bhead_old_map(FileData *fd) static BHead *find_previous_lib(FileData *fd, BHead *bhead) { /* skip library datablocks in undo, see comment in read_libblock */ - if(fd->memfile) + if (fd->memfile) return NULL; for (; bhead; bhead= blo_prevbhead(fd, bhead)) @@ -13572,7 +13607,7 @@ static BHead *find_bhead(FileData *fd, void *old) bhs_s.old= old; bhs= bsearch(&bhs_s, fd->bheadmap, fd->tot_bheadmap, sizeof(struct bheadsort), verg_bheadsort); - if(bhs) + if (bhs) return bhs->bhead; #if 0 @@ -13602,18 +13637,18 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old) ID *id; bhead= find_bhead(fd, old); - if(bhead) { + if (bhead) { /* from another library? */ - if(bhead->code==ID_ID) { + if (bhead->code==ID_ID) { BHead *bheadlib= find_previous_lib(fd, bhead); - if(bheadlib) { + if (bheadlib) { Library *lib= read_struct(fd, bheadlib, "Library"); Main *ptr= blo_find_main(fd, &fd->mainlist, lib->name, fd->relabase); id= is_yet_read(fd, ptr, bhead); - if(id==NULL) { + if (id==NULL) { read_libblock(fd, ptr, bhead, LIB_READ+LIB_INDIRECT, NULL); // commented because this can print way too much // if(G.f & G_DEBUG) printf("expand_doit: other lib %s\n", lib->name); @@ -13631,7 +13666,7 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old) /* Update: the issue is that in file reading, the oldnewmap is OK, but for existing data, it has to be inserted in the map to be found! */ - if(id->flag & LIB_PRE_EXISTING) + if (id->flag & LIB_PRE_EXISTING) oldnewmap_insert(fd->libmap, bhead->old, id, 1); change_idid_adr_fd(fd, bhead->old, id); @@ -13644,7 +13679,7 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old) } else { id= is_yet_read(fd, mainvar, bhead); - if(id==NULL) { + if (id==NULL) { read_libblock(fd, mainvar, bhead, LIB_TESTIND, NULL); } else { @@ -13664,8 +13699,8 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old) static void expand_ipo(FileData *fd, Main *mainvar, Ipo *ipo) { IpoCurve *icu; - for(icu= ipo->curve.first; icu; icu= icu->next) { - if(icu->driver) + for (icu= ipo->curve.first; icu; icu= icu->next) { + if (icu->driver) expand_doit(fd, mainvar, icu->driver->ob); } } @@ -13794,11 +13829,11 @@ static void expand_particlesettings(FileData *fd, Main *mainvar, ParticleSetting expand_doit(fd, mainvar, part->eff_group); expand_doit(fd, mainvar, part->bb_ob); - if(part->adt) + if (part->adt) expand_animdata(fd, mainvar, part->adt); - for(a=0; a<MAX_MTEX; a++) { - if(part->mtex[a]) { + for (a=0; a<MAX_MTEX; a++) { + if (part->mtex[a]) { expand_doit(fd, mainvar, part->mtex[a]->tex); expand_doit(fd, mainvar, part->mtex[a]->object); } @@ -13809,7 +13844,7 @@ static void expand_group(FileData *fd, Main *mainvar, Group *group) { GroupObject *go; - for(go= group->gobject.first; go; go= go->next) { + for (go= group->gobject.first; go; go= go->next) { expand_doit(fd, mainvar, go->ob); } } @@ -13818,7 +13853,7 @@ static void expand_key(FileData *fd, Main *mainvar, Key *key) { expand_doit(fd, mainvar, key->ipo); // XXX depreceated - old animation system - if(key->adt) + if (key->adt) expand_animdata(fd, mainvar, key->adt); } @@ -13826,14 +13861,14 @@ static void expand_nodetree(FileData *fd, Main *mainvar, bNodeTree *ntree) { bNode *node; - if(ntree->adt) + if (ntree->adt) expand_animdata(fd, mainvar, ntree->adt); - if(ntree->gpd) + if (ntree->gpd) expand_doit(fd, mainvar, ntree->gpd); - for(node= ntree->nodes.first; node; node= node->next) - if(node->id && node->type!=CMP_NODE_R_LAYERS) + for (node= ntree->nodes.first; node; node= node->next) + if (node->id && node->type!=CMP_NODE_R_LAYERS) expand_doit(fd, mainvar, node->id); } @@ -13843,10 +13878,10 @@ static void expand_texture(FileData *fd, Main *mainvar, Tex *tex) expand_doit(fd, mainvar, tex->ima); expand_doit(fd, mainvar, tex->ipo); // XXX depreceated - old animation system - if(tex->adt) + if (tex->adt) expand_animdata(fd, mainvar, tex->adt); - if(tex->nodetree) + if (tex->nodetree) expand_nodetree(fd, mainvar, tex->nodetree); } @@ -13860,8 +13895,8 @@ static void expand_material(FileData *fd, Main *mainvar, Material *ma) { int a; - for(a=0; a<MAX_MTEX; a++) { - if(ma->mtex[a]) { + for (a=0; a<MAX_MTEX; a++) { + if (ma->mtex[a]) { expand_doit(fd, mainvar, ma->mtex[a]->tex); expand_doit(fd, mainvar, ma->mtex[a]->object); } @@ -13869,13 +13904,13 @@ static void expand_material(FileData *fd, Main *mainvar, Material *ma) expand_doit(fd, mainvar, ma->ipo); // XXX depreceated - old animation system - if(ma->adt) + if (ma->adt) expand_animdata(fd, mainvar, ma->adt); - if(ma->nodetree) + if (ma->nodetree) expand_nodetree(fd, mainvar, ma->nodetree); - if(ma->group) + if (ma->group) expand_doit(fd, mainvar, ma->group); } @@ -13883,8 +13918,8 @@ static void expand_lamp(FileData *fd, Main *mainvar, Lamp *la) { int a; - for(a=0; a<MAX_MTEX; a++) { - if(la->mtex[a]) { + for (a=0; a<MAX_MTEX; a++) { + if (la->mtex[a]) { expand_doit(fd, mainvar, la->mtex[a]->tex); expand_doit(fd, mainvar, la->mtex[a]->object); } @@ -13895,7 +13930,7 @@ static void expand_lamp(FileData *fd, Main *mainvar, Lamp *la) if (la->adt) expand_animdata(fd, mainvar, la->adt); - if(la->nodetree) + if (la->nodetree) expand_nodetree(fd, mainvar, la->nodetree); } @@ -13913,8 +13948,8 @@ static void expand_world(FileData *fd, Main *mainvar, World *wrld) { int a; - for(a=0; a<MAX_MTEX; a++) { - if(wrld->mtex[a]) { + for (a=0; a<MAX_MTEX; a++) { + if (wrld->mtex[a]) { expand_doit(fd, mainvar, wrld->mtex[a]->tex); expand_doit(fd, mainvar, wrld->mtex[a]->object); } @@ -13925,7 +13960,7 @@ static void expand_world(FileData *fd, Main *mainvar, World *wrld) if (wrld->adt) expand_animdata(fd, mainvar, wrld->adt); - if(wrld->nodetree) + if (wrld->nodetree) expand_nodetree(fd, mainvar, wrld->nodetree); } @@ -13934,11 +13969,11 @@ static void expand_mball(FileData *fd, Main *mainvar, MetaBall *mb) { int a; - for(a=0; a<mb->totcol; a++) { + for (a=0; a<mb->totcol; a++) { expand_doit(fd, mainvar, mb->mat[a]); } - if(mb->adt) + if (mb->adt) expand_animdata(fd, mainvar, mb->adt); } @@ -13946,7 +13981,7 @@ static void expand_curve(FileData *fd, Main *mainvar, Curve *cu) { int a; - for(a=0; a<cu->totcol; a++) { + for (a=0; a<cu->totcol; a++) { expand_doit(fd, mainvar, cu->mat[a]); } @@ -13960,7 +13995,7 @@ static void expand_curve(FileData *fd, Main *mainvar, Curve *cu) expand_doit(fd, mainvar, cu->taperobj); expand_doit(fd, mainvar, cu->textoncurve); - if(cu->adt) + if (cu->adt) expand_animdata(fd, mainvar, cu->adt); } @@ -13971,30 +14006,30 @@ static void expand_mesh(FileData *fd, Main *mainvar, Mesh *me) TFace *tf; int a, i; - if(me->adt) + if (me->adt) expand_animdata(fd, mainvar, me->adt); - for(a=0; a<me->totcol; a++) { + for (a=0; a<me->totcol; a++) { expand_doit(fd, mainvar, me->mat[a]); } expand_doit(fd, mainvar, me->key); expand_doit(fd, mainvar, me->texcomesh); - if(me->tface) { + if (me->tface) { tf= me->tface; - for(i=0; i<me->totface; i++, tf++) - if(tf->tpage) + for (i=0; i<me->totface; i++, tf++) + if (tf->tpage) expand_doit(fd, mainvar, tf->tpage); } - for(a=0; a<me->fdata.totlayer; a++) { + for (a=0; a<me->fdata.totlayer; a++) { layer= &me->fdata.layers[a]; - if(layer->type == CD_MTFACE) { + if (layer->type == CD_MTFACE) { mtf= (MTFace*)layer->data; - for(i=0; i<me->totface; i++, mtf++) - if(mtf->tpage) + for (i=0; i<me->totface; i++, mtf++) + if (mtf->tpage) expand_doit(fd, mainvar, mtf->tpage); } } @@ -14057,7 +14092,7 @@ static void expand_armature(FileData *fd, Main *mainvar, bArmature *arm) { Bone *curBone; - if(arm->adt) + if (arm->adt) expand_animdata(fd, mainvar, arm->adt); for (curBone = arm->bonebase.first; curBone; curBone=curBone->next) { @@ -14089,7 +14124,7 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob) expand_doit(fd, mainvar, ob->data); /* expand_object_expandModifier() */ - if(ob->modifiers.first) { + if (ob->modifiers.first) { struct { FileData *fd; Main *mainvar; } data; data.fd= fd; data.mainvar= mainvar; @@ -14109,17 +14144,17 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob) expand_constraint_channels(fd, mainvar, &ob->constraintChannels); - for (strip=ob->nlastrips.first; strip; strip=strip->next){ + for (strip=ob->nlastrips.first; strip; strip=strip->next) { expand_doit(fd, mainvar, strip->object); expand_doit(fd, mainvar, strip->act); expand_doit(fd, mainvar, strip->ipo); } // XXX depreceated - old animation system (for version patching only) - if(ob->adt) + if (ob->adt) expand_animdata(fd, mainvar, ob->adt); - for(a=0; a<ob->totcol; a++) { + for (a=0; a<ob->totcol; a++) { expand_doit(fd, mainvar, ob->mat[a]); } @@ -14127,24 +14162,24 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob) if (paf && paf->group) expand_doit(fd, mainvar, paf->group); - if(ob->dup_group) + if (ob->dup_group) expand_doit(fd, mainvar, ob->dup_group); - if(ob->proxy) + if (ob->proxy) expand_doit(fd, mainvar, ob->proxy); - if(ob->proxy_group) + if (ob->proxy_group) expand_doit(fd, mainvar, ob->proxy_group); - for(psys=ob->particlesystem.first; psys; psys=psys->next) + for (psys=ob->particlesystem.first; psys; psys=psys->next) expand_doit(fd, mainvar, psys->part); sens= ob->sensors.first; while(sens) { - if(sens->type==SENS_TOUCH) { + if (sens->type==SENS_TOUCH) { bTouchSensor *ts= sens->data; expand_doit(fd, mainvar, ts->ma); } - else if(sens->type==SENS_MESSAGE) { + else if (sens->type==SENS_MESSAGE) { bMessageSensor *ms= sens->data; expand_doit(fd, mainvar, ms->fromObject); } @@ -14153,7 +14188,7 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob) cont= ob->controllers.first; while(cont) { - if(cont->type==CONT_PYTHON) { + if (cont->type==CONT_PYTHON) { bPythonCont *pc= cont->data; expand_doit(fd, mainvar, pc->text); } @@ -14162,63 +14197,63 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob) act= ob->actuators.first; while(act) { - if(act->type==ACT_SOUND) { + if (act->type==ACT_SOUND) { bSoundActuator *sa= act->data; expand_doit(fd, mainvar, sa->sound); } - else if(act->type==ACT_CAMERA) { + else if (act->type==ACT_CAMERA) { bCameraActuator *ca= act->data; expand_doit(fd, mainvar, ca->ob); } - else if(act->type==ACT_EDIT_OBJECT) { + else if (act->type==ACT_EDIT_OBJECT) { bEditObjectActuator *eoa= act->data; - if(eoa) { + if (eoa) { expand_doit(fd, mainvar, eoa->ob); expand_doit(fd, mainvar, eoa->me); } } - else if(act->type==ACT_OBJECT) { + else if (act->type==ACT_OBJECT) { bObjectActuator *oa= act->data; expand_doit(fd, mainvar, oa->reference); } - else if(act->type==ACT_ADD_OBJECT) { + else if (act->type==ACT_ADD_OBJECT) { bAddObjectActuator *aoa= act->data; expand_doit(fd, mainvar, aoa->ob); } - else if(act->type==ACT_SCENE) { + else if (act->type==ACT_SCENE) { bSceneActuator *sa= act->data; expand_doit(fd, mainvar, sa->camera); expand_doit(fd, mainvar, sa->scene); } - else if(act->type==ACT_2DFILTER) { + else if (act->type==ACT_2DFILTER) { bTwoDFilterActuator *tdfa= act->data; expand_doit(fd, mainvar, tdfa->text); } - else if(act->type==ACT_ACTION) { + else if (act->type==ACT_ACTION) { bActionActuator *aa= act->data; expand_doit(fd, mainvar, aa->act); } - else if(act->type==ACT_SHAPEACTION) { + else if (act->type==ACT_SHAPEACTION) { bActionActuator *aa= act->data; expand_doit(fd, mainvar, aa->act); } - else if(act->type==ACT_PROPERTY) { + else if (act->type==ACT_PROPERTY) { bPropertyActuator *pa= act->data; expand_doit(fd, mainvar, pa->ob); } - else if(act->type==ACT_MESSAGE) { + else if (act->type==ACT_MESSAGE) { bMessageActuator *ma= act->data; expand_doit(fd, mainvar, ma->toObject); } - else if(act->type==ACT_PARENT) { + else if (act->type==ACT_PARENT) { bParentActuator *pa= act->data; expand_doit(fd, mainvar, pa->ob); } - else if(act->type==ACT_ARMATURE) { + else if (act->type==ACT_ARMATURE) { bArmatureActuator *arma= act->data; expand_doit(fd, mainvar, arma->target); } - else if(act->type==ACT_STEERING) { + else if (act->type==ACT_STEERING) { bSteeringActuator *sta= act->data; expand_doit(fd, mainvar, sta->target); expand_doit(fd, mainvar, sta->navmesh); @@ -14226,7 +14261,7 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob) act= act->next; } - if(ob->pd && ob->pd->tex) + if (ob->pd && ob->pd->tex) expand_doit(fd, mainvar, ob->pd->tex); } @@ -14236,40 +14271,40 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce) Base *base; SceneRenderLayer *srl; - for(base= sce->base.first; base; base= base->next) { + for (base= sce->base.first; base; base= base->next) { expand_doit(fd, mainvar, base->object); } expand_doit(fd, mainvar, sce->camera); expand_doit(fd, mainvar, sce->world); - if(sce->adt) + if (sce->adt) expand_animdata(fd, mainvar, sce->adt); expand_keyingsets(fd, mainvar, &sce->keyingsets); - if(sce->set) + if (sce->set) expand_doit(fd, mainvar, sce->set); - if(sce->nodetree) + if (sce->nodetree) expand_nodetree(fd, mainvar, sce->nodetree); - for(srl= sce->r.layers.first; srl; srl= srl->next) { + for (srl= sce->r.layers.first; srl; srl= srl->next) { expand_doit(fd, mainvar, srl->mat_override); expand_doit(fd, mainvar, srl->light_override); } - if(sce->r.dometext) + if (sce->r.dometext) expand_doit(fd, mainvar, sce->gm.dome.warptext); - if(sce->gpd) + if (sce->gpd) expand_doit(fd, mainvar, sce->gpd); - if(sce->ed) { + if (sce->ed) { Sequence *seq; SEQ_BEGIN(sce->ed, seq) { - if(seq->scene) expand_doit(fd, mainvar, seq->scene); - if(seq->scene_camera) expand_doit(fd, mainvar, seq->scene_camera); - if(seq->sound) expand_doit(fd, mainvar, seq->sound); + if (seq->scene) expand_doit(fd, mainvar, seq->scene); + if (seq->scene_camera) expand_doit(fd, mainvar, seq->scene_camera); + if (seq->sound) expand_doit(fd, mainvar, seq->sound); } SEQ_END } @@ -14278,8 +14313,8 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce) { TimeMarker *marker; - for(marker= sce->markers.first; marker; marker= marker->next) { - if(marker->camera) { + for (marker= sce->markers.first; marker; marker= marker->next) { + if (marker->camera) { expand_doit(fd, mainvar, marker->camera); } } @@ -14291,7 +14326,7 @@ static void expand_camera(FileData *fd, Main *mainvar, Camera *ca) { expand_doit(fd, mainvar, ca->ipo); // XXX depreceated - old animation system - if(ca->adt) + if (ca->adt) expand_animdata(fd, mainvar, ca->adt); } @@ -14320,7 +14355,7 @@ static void expand_main(FileData *fd, Main *mainvar) ID *id; int a, doit= 1; - if(fd==NULL) return; + if (fd==NULL) return; while(doit) { doit= 0; @@ -14330,7 +14365,7 @@ static void expand_main(FileData *fd, Main *mainvar) id= lbarray[a]->first; while(id) { - if(id->flag & LIB_TEST) { + if (id->flag & LIB_TEST) { switch(GS(id->name)) { @@ -14416,8 +14451,8 @@ static int object_in_any_scene(Main *mainvar, Object *ob) { Scene *sce; - for(sce= mainvar->scene.first; sce; sce= sce->id.next) - if(object_in_scene(ob, sce)) + for (sce= mainvar->scene.first; sce; sce= sce->id.next) + if (object_in_scene(ob, sce)) return 1; return 0; } @@ -14429,9 +14464,9 @@ static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, const const short is_group_append= (is_link==FALSE && idcode==ID_GR); /* give all objects which are LIB_INDIRECT a base, or for a group when *lib has been set */ - for(ob= mainvar->object.first; ob; ob= ob->id.next) { + for (ob= mainvar->object.first; ob; ob= ob->id.next) { - if( ob->id.flag & LIB_INDIRECT ) { + if ( ob->id.flag & LIB_INDIRECT ) { /* IF below is quite confusing! if we are appending, but this object wasnt just added along with a group, @@ -14442,12 +14477,12 @@ static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, const int do_it= 0; - if(ob->id.us==0) { + if (ob->id.us==0) { do_it= 1; } - else if(idcode==ID_GR) { - if(ob->id.us==1 && is_link==FALSE && ob->id.lib==lib) { - if((ob->flag & OB_FROMGROUP) && object_in_any_scene(mainvar, ob)==0) { + else if (idcode==ID_GR) { + if (ob->id.us==1 && is_link==FALSE && ob->id.lib==lib) { + if ((ob->flag & OB_FROMGROUP) && object_in_any_scene(mainvar, ob)==0) { do_it= 1; } } @@ -14455,20 +14490,20 @@ static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, const else { /* when appending, make sure any indirectly loaded objects * get a base else they cant be accessed at all [#27437] */ - if(ob->id.us==1 && is_link==FALSE && ob->id.lib==lib) { + if (ob->id.us==1 && is_link==FALSE && ob->id.lib==lib) { /* we may be appending from a scene where we already * have a linked object which is not in any scene [#27616] */ - if((ob->id.flag & LIB_PRE_EXISTING)==0) { + if ((ob->id.flag & LIB_PRE_EXISTING)==0) { - if(object_in_any_scene(mainvar, ob)==0) { + if (object_in_any_scene(mainvar, ob)==0) { do_it= 1; } } } } - if(do_it) { + if (do_it) { base= MEM_callocN( sizeof(Base), "add_ext_base"); BLI_addtail(&(sce->base), base); base->lay= ob->lay; @@ -14489,8 +14524,8 @@ static void give_base_to_groups(Main *mainvar, Scene *scene) Group *group; /* give all objects which are LIB_INDIRECT a base, or for a group when *lib has been set */ - for(group= mainvar->group.first; group; group= group->id.next) { - if(((group->id.flag & LIB_INDIRECT)==0 && (group->id.flag & LIB_PRE_EXISTING)==0)) { + for (group= mainvar->group.first; group; group= group->id.next) { + if (((group->id.flag & LIB_INDIRECT)==0 && (group->id.flag & LIB_PRE_EXISTING)==0)) { Base *base; /* add_object(...) messes with the selection */ @@ -14522,20 +14557,20 @@ static ID *append_named_part(Main *mainl, FileData *fd, const char *idname, cons ID *id= NULL; int found=0; - for(bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) { - if(bhead->code==idcode) { + for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) { + if (bhead->code==idcode) { const char *idname_test= bhead_id_name(fd, bhead); - if(strcmp(idname_test + 2, idname)==0) { + if (strcmp(idname_test + 2, idname)==0) { found= 1; id= is_yet_read(fd, mainl, bhead); - if(id==NULL) { + if (id==NULL) { read_libblock(fd, mainl, bhead, LIB_TESTEXT, &id); } else { printf("append: already linked\n"); oldnewmap_insert(fd->libmap, bhead->old, id, 1); - if(id->flag & LIB_INDIRECT) { + if (id->flag & LIB_INDIRECT) { id->flag -= LIB_INDIRECT; id->flag |= LIB_EXTERN; } @@ -14544,7 +14579,7 @@ static ID *append_named_part(Main *mainl, FileData *fd, const char *idname, cons break; } } - else if(bhead->code==ENDB) { + else if (bhead->code==ENDB) { break; } } @@ -14559,9 +14594,9 @@ static ID *append_named_part_ex(const bContext *C, Main *mainl, FileData *fd, co { ID *id= append_named_part(mainl, fd, idname, idcode); - if(id && (GS(id->name) == ID_OB)) { /* loose object: give a base */ + if (id && (GS(id->name) == ID_OB)) { /* loose object: give a base */ Scene *scene= CTX_data_scene(C); /* can be NULL */ - if(scene) { + if (scene) { Base *base; Object *ob; @@ -14571,7 +14606,7 @@ static ID *append_named_part_ex(const bContext *C, Main *mainl, FileData *fd, co ob= (Object *)id; /* link at active layer (view3d->lay if in context, else scene->lay */ - if((flag & FILE_ACTIVELAY)) { + if ((flag & FILE_ACTIVELAY)) { View3D *v3d = CTX_wm_view3d(C); ob->lay = v3d ? v3d->layact : scene->lay; } @@ -14581,7 +14616,7 @@ static ID *append_named_part_ex(const bContext *C, Main *mainl, FileData *fd, co base->object= ob; ob->id.us++; - if(flag & FILE_AUTOSELECT) { + if (flag & FILE_AUTOSELECT) { base->flag |= SELECT; base->object->flag = base->flag; /* do NOT make base active here! screws up GUI stuff, if you want it do it on src/ level */ @@ -14619,7 +14654,8 @@ static void append_id_part(FileData *fd, Main *mainvar, ID *id, ID **id_r) break; } - } else if (bhead->code==ENDB) + } + else if (bhead->code==ENDB) break; } } @@ -14665,7 +14701,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in curlib= mainl->curlib; /* make the lib path relative if required */ - if(flag & FILE_RELPATH) { + if (flag & FILE_RELPATH) { /* use the full path, this could have been read by other library even */ BLI_strncpy(curlib->name, curlib->filepath, sizeof(curlib->name)); @@ -14682,13 +14718,13 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in lib_verify_nodetree(mainvar, FALSE); fix_relpaths_library(G.main->name, mainvar); /* make all relative paths, relative to the open blend file */ - if(C) { + if (C) { Scene *scene= CTX_data_scene(C); /* give a base to loose objects. If group append, do it for objects too */ - if(scene) { + if (scene) { const short is_link= (flag & FILE_LINK) != 0; - if(idcode==ID_SCE) { + if (idcode==ID_SCE) { /* don't instance anything when linking in scenes, assume the scene its self instances the data */ } else { @@ -14708,7 +14744,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in /* 20041208: put back. It only linked direct, not indirect objects (ton) */ /* patch to prevent switch_endian happens twice */ - if((*fd)->flags & FD_FLAGS_SWITCH_ENDIAN) { + if ((*fd)->flags & FD_FLAGS_SWITCH_ENDIAN) { blo_freefiledata( *fd ); *fd = NULL; } @@ -14760,10 +14796,10 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) int tot= mainvar_count_libread_blocks(mainptr); // printf("found LIB_READ %s\n", mainptr->curlib->name); - if(tot) { + if (tot) { FileData *fd= mainptr->curlib->filedata; - if(fd==NULL) { + if (fd==NULL) { /* printf and reports for now... its important users know this */ BKE_reportf_wrap(basefd->reports, RPT_INFO, @@ -14773,7 +14809,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) fd= blo_openblenderfile(mainptr->curlib->filepath, basefd->reports); /* allow typing in a new lib path */ - if(G.rt==-666) { + if (G.rt==-666) { while(fd==NULL) { char newlib_path[FILE_MAX] = { 0 }; printf("Missing library...'\n"); @@ -14782,14 +14818,14 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) printf(" relative lib: %s\n", mainptr->curlib->name); printf(" enter a new path:\n"); - if(scanf("%s", newlib_path) > 0) { + if (scanf("%s", newlib_path) > 0) { BLI_strncpy(mainptr->curlib->name, newlib_path, sizeof(mainptr->curlib->name)); BLI_strncpy(mainptr->curlib->filepath, newlib_path, sizeof(mainptr->curlib->filepath)); cleanup_path(G.main->name, mainptr->curlib->filepath); fd= blo_openblenderfile(mainptr->curlib->filepath, basefd->reports); - if(fd) { + if (fd) { printf("found: '%s', party on macuno!\n", mainptr->curlib->filepath); } } @@ -14818,7 +14854,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) mainptr->curlib->filepath); } } - if(fd) { + if (fd) { doit= 1; a= set_listbasepointers(mainptr, lbarray); while(a--) { @@ -14826,7 +14862,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) while(id) { ID *idn= id->next; - if(id->flag & LIB_READ) { + if (id->flag & LIB_READ) { ID *realid= NULL; BLI_remlink(lbarray[a], id); @@ -14863,13 +14899,13 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) } /* test if there are unread libblocks */ - for(mainptr= mainl->next; mainptr; mainptr= mainptr->next) { + for (mainptr= mainl->next; mainptr; mainptr= mainptr->next) { a= set_listbasepointers(mainptr, lbarray); while(a--) { ID *id= lbarray[a]->first; while(id) { ID *idn= id->next; - if(id->flag & LIB_READ) { + if (id->flag & LIB_READ) { BLI_remlink(lbarray[a], id); BKE_reportf_wrap(basefd->reports, RPT_ERROR, "LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", @@ -14884,20 +14920,20 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) } /* do versions, link, and free */ - for(mainptr= mainl->next; mainptr; mainptr= mainptr->next) { + for (mainptr= mainl->next; mainptr; mainptr= mainptr->next) { /* some mains still have to be read, then * versionfile is still zero! */ - if(mainptr->versionfile) { - if(mainptr->curlib->filedata) // can be zero... with shift+f1 append + if (mainptr->versionfile) { + if (mainptr->curlib->filedata) // can be zero... with shift+f1 append do_versions(mainptr->curlib->filedata, mainptr->curlib, mainptr); else do_versions(basefd, NULL, mainptr); } - if(mainptr->curlib->filedata) + if (mainptr->curlib->filedata) lib_link_all(mainptr->curlib->filedata, mainptr); - if(mainptr->curlib->filedata) blo_freefiledata(mainptr->curlib->filedata); + if (mainptr->curlib->filedata) blo_freefiledata(mainptr->curlib->filedata); mainptr->curlib->filedata= NULL; } } |