From 28316493bd82f5e5d2be40effdad4431f9c49c6e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 30 Nov 2018 14:51:16 +1100 Subject: Cleanup: style --- source/blender/blenloader/intern/readblenentry.c | 22 +- source/blender/blenloader/intern/readfile.c | 819 +++++++++++---------- source/blender/blenloader/intern/undofile.c | 2 +- source/blender/blenloader/intern/versioning_250.c | 364 ++++----- source/blender/blenloader/intern/versioning_260.c | 12 +- source/blender/blenloader/intern/versioning_270.c | 14 +- source/blender/blenloader/intern/versioning_280.c | 16 +- .../blenloader/intern/versioning_defaults.c | 6 +- .../blender/blenloader/intern/versioning_legacy.c | 182 ++--- source/blender/blenloader/intern/writefile.c | 8 +- 10 files changed, 730 insertions(+), 715 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index 4d294870fb1..6bf0e7bf809 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -106,7 +106,7 @@ BlendHandle *BLO_blendhandle_from_memory(const void *mem, int memsize) void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp) { - FileData *fd = (FileData *) bh; + FileData *fd = (FileData *)bh; BHead *bhead; fprintf(fp, "[\n"); @@ -144,7 +144,7 @@ void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp) */ LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, int ofblocktype, int *tot_names) { - FileData *fd = (FileData *) bh; + FileData *fd = (FileData *)bh; LinkNode *names = NULL; BHead *bhead; int tot = 0; @@ -174,7 +174,7 @@ LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, int ofblocktype, */ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *tot_prev) { - FileData *fd = (FileData *) bh; + FileData *fd = (FileData *)bh; LinkNode *previews = NULL; BHead *bhead; int looking = 0; @@ -210,11 +210,11 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to if (prv) { memcpy(new_prv, prv, sizeof(PreviewImage)); if (prv->rect[0] && prv->w[0] && prv->h[0]) { - unsigned int *rect = NULL; - size_t len = new_prv->w[0] * new_prv->h[0] * sizeof(unsigned int); + uint *rect = NULL; + size_t len = new_prv->w[0] * new_prv->h[0] * sizeof(uint); new_prv->rect[0] = MEM_callocN(len, __func__); bhead = blo_nextbhead(fd, bhead); - rect = (unsigned int *)(bhead + 1); + rect = (uint *)(bhead + 1); BLI_assert(len == bhead->len); memcpy(new_prv->rect[0], rect, len); } @@ -227,11 +227,11 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to } if (prv->rect[1] && prv->w[1] && prv->h[1]) { - unsigned int *rect = NULL; - size_t len = new_prv->w[1] * new_prv->h[1] * sizeof(unsigned int); + uint *rect = NULL; + size_t len = new_prv->w[1] * new_prv->h[1] * sizeof(uint); new_prv->rect[1] = MEM_callocN(len, __func__); bhead = blo_nextbhead(fd, bhead); - rect = (unsigned int *)(bhead + 1); + rect = (uint *)(bhead + 1); BLI_assert(len == bhead->len); memcpy(new_prv->rect[1], rect, len); } @@ -270,7 +270,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to */ LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh) { - FileData *fd = (FileData *) bh; + FileData *fd = (FileData *)bh; GSet *gathered = BLI_gset_ptr_new("linkable_groups gh"); LinkNode *names = NULL; BHead *bhead; @@ -302,7 +302,7 @@ LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh) */ void BLO_blendhandle_close(BlendHandle *bh) { - FileData *fd = (FileData *) bh; + FileData *fd = (FileData *)bh; blo_freefiledata(fd); } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 42b672d47b5..e61cfbf2aac 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -308,7 +308,7 @@ static const char *library_parent_filepath(Library *lib) static OldNewMap *oldnewmap_new(void) { - OldNewMap *onm= MEM_callocN(sizeof(*onm), "OldNewMap"); + OldNewMap *onm = MEM_callocN(sizeof(*onm), "OldNewMap"); onm->entriessize = 1024; onm->entries = MEM_malloc_arrayN(onm->entriessize, sizeof(*onm->entries), "OldNewMap.entries"); @@ -318,7 +318,7 @@ static OldNewMap *oldnewmap_new(void) static int verg_oldnewmap(const void *v1, const void *v2) { - const struct OldNew *x1=v1, *x2=v2; + const struct OldNew *x1 = v1, *x2 = v2; if (x1->old > x2->old) return 1; else if (x1->old < x2->old) return -1; @@ -338,7 +338,7 @@ static void oldnewmap_insert(OldNewMap *onm, const void *oldaddr, void *newaddr, { OldNew *entry; - if (oldaddr==NULL || newaddr==NULL) return; + if (oldaddr == NULL || newaddr == NULL) return; if (UNLIKELY(onm->nentries == onm->entriessize)) { onm->entriessize *= 2; @@ -412,7 +412,7 @@ static void *oldnewmap_lookup_and_inc(OldNewMap *onm, const void *addr, bool inc if (addr == NULL) return NULL; - if (onm->lasthit < onm->nentries-1) { + if (onm->lasthit < onm->nentries - 1) { OldNew *entry = &onm->entries[++onm->lasthit]; if (entry->old == addr) { @@ -525,13 +525,13 @@ void blo_join_main(ListBase *mainlist) } } -static void split_libdata(ListBase *lb_src, Main **lib_main_array, const unsigned int lib_main_array_len) +static void split_libdata(ListBase *lb_src, Main **lib_main_array, const uint lib_main_array_len) { for (ID *id = lb_src->first, *idnext; id; id = idnext) { idnext = id->next; if (id->lib) { - if (((unsigned int)id->lib->temp_index < lib_main_array_len) && + if (((uint)id->lib->temp_index < lib_main_array_len) && /* this check should never fail, just incase 'id->lib' is a dangling pointer. */ (lib_main_array[id->lib->temp_index]->curlib == id->lib)) { @@ -557,8 +557,8 @@ void blo_split_main(ListBase *mainlist, Main *main) return; /* (Library.temp_index -> Main), lookup table */ - const unsigned int lib_main_array_len = BLI_listbase_count(&main->library); - Main **lib_main_array = MEM_malloc_arrayN(lib_main_array_len, sizeof(*lib_main_array), __func__); + const uint lib_main_array_len = BLI_listbase_count(&main->library); + Main **lib_main_array = MEM_malloc_arrayN(lib_main_array_len, sizeof(*lib_main_array), __func__); int i = 0; for (Library *lib = main->library.first; lib; lib = lib->id.next, i++) { @@ -588,13 +588,13 @@ static void read_file_version(FileData *fd, Main *main) { BHead *bhead; - for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) { + for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) { if (bhead->code == GLOB) { - FileGlobal *fg= read_struct(fd, bhead, "Global"); + FileGlobal *fg = read_struct(fd, bhead, "Global"); if (fg) { - main->subversionfile= fg->subversion; - main->minversionfile= fg->minversion; - main->minsubversionfile= fg->minsubversion; + main->subversionfile = fg->subversion; + main->minversionfile = fg->minversion; + main->minsubversionfile = fg->minsubversion; MEM_freeN(fg); } else if (bhead->code == ENDB) @@ -615,7 +615,7 @@ static void read_file_bhead_idname_map_create(FileData *fd) /* dummy values */ bool is_link = false; int code_prev = ENDB; - unsigned int reserve = 0; + uint reserve = 0; for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) { if (code_prev != bhead->code) { @@ -693,7 +693,7 @@ static Main *blo_find_main(FileData *fd, const char *filepath, const char *relab 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) { BLI_endian_switch_int32(&bhead->len); @@ -705,7 +705,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) { BLI_endian_switch_int32(&bhead->len); @@ -716,7 +716,7 @@ static void switch_endian_bh8(BHead8 *bhead) static void bh4_from_bh8(BHead *bhead, BHead8 *bhead8, int do_endian_swap) { - BHead4 *bhead4 = (BHead4 *) bhead; + BHead4 *bhead4 = (BHead4 *)bhead; int64_t old; bhead4->code = bhead8->code; @@ -733,7 +733,7 @@ static void bh4_from_bh8(BHead *bhead, BHead8 *bhead8, int do_endian_swap) /* this patch is to avoid a long long being read from not-eight aligned positions * is necessary on any modern 64bit architecture) */ memcpy(&old, &bhead8->old, 8); - bhead4->old = (int) (old >> 3); + bhead4->old = (int)(old >> 3); bhead4->SDNAnr = bhead8->SDNAnr; bhead4->nr = bhead8->nr; @@ -742,7 +742,7 @@ static void bh4_from_bh8(BHead *bhead, BHead8 *bhead8, int do_endian_swap) static void bh8_from_bh4(BHead *bhead, BHead4 *bhead4) { - BHead8 *bhead8 = (BHead8 *) bhead; + BHead8 *bhead8 = (BHead8 *)bhead; bhead8->code = bhead4->code; bhead8->len = bhead4->len; @@ -750,7 +750,7 @@ static void bh8_from_bh4(BHead *bhead, BHead4 *bhead4) if (bhead8->code != ENDB) { bhead8->old = bhead4->old; bhead8->SDNAnr = bhead4->SDNAnr; - bhead8->nr= bhead4->nr; + bhead8->nr = bhead4->nr; } } @@ -765,7 +765,7 @@ static BHeadN *get_bhead(FileData *fd) * since uninitialized memory gets compared */ BHead8 bhead8 = {0}; BHead4 bhead4 = {0}; - BHead bhead = {0}; + BHead bhead = {0}; /* First read the bhead structure. * Depending on the platform the file was written on this can @@ -794,7 +794,7 @@ static BHeadN *get_bhead(FileData *fd) } else { fd->eof = 1; - bhead.len= 0; + bhead.len = 0; } } else { @@ -817,7 +817,7 @@ static BHeadN *get_bhead(FileData *fd) } else { fd->eof = 1; - bhead.len= 0; + bhead.len = 0; } } @@ -1034,7 +1034,7 @@ static int *read_file_thumbnail(FileData *fd) return blend_thumb; } -static int fd_read_gzip_from_file(FileData *filedata, void *buffer, unsigned int size) +static int fd_read_gzip_from_file(FileData *filedata, void *buffer, uint size) { int readsize = gzread(filedata->gzfiledes, buffer, size); @@ -1048,10 +1048,10 @@ static int fd_read_gzip_from_file(FileData *filedata, void *buffer, unsigned int return (readsize); } -static int fd_read_from_memory(FileData *filedata, void *buffer, unsigned int size) +static int fd_read_from_memory(FileData *filedata, void *buffer, uint size) { /* don't read more bytes then there are available in the buffer */ - int readsize = (int)MIN2(size, (unsigned int)(filedata->buffersize - filedata->seek)); + int readsize = (int)MIN2(size, (uint)(filedata->buffersize - filedata->seek)); memcpy(buffer, filedata->buffer + filedata->seek, readsize); filedata->seek += readsize; @@ -1059,21 +1059,23 @@ static int fd_read_from_memory(FileData *filedata, void *buffer, unsigned int si return (readsize); } -static int fd_read_from_memfile(FileData *filedata, void *buffer, unsigned int size) +static int fd_read_from_memfile(FileData *filedata, void *buffer, uint size) { - static unsigned int seek = (1<<30); /* the current position */ - static unsigned int offset = 0; /* size of previous chunks */ + static uint seek = (1 << 30); /* the current position */ + static uint offset = 0; /* size of previous chunks */ static MemFileChunk *chunk = NULL; - unsigned int chunkoffset, readsize, totread; + uint chunkoffset, readsize, totread; if (size == 0) return 0; - if (seek != (unsigned int)filedata->seek) { + if (seek != (uint)filedata->seek) { chunk = filedata->memfile->chunks.first; seek = 0; while (chunk) { - if (seek + chunk->size > (unsigned) filedata->seek) break; + if (seek + chunk->size > (uint)filedata->seek) { + break; + } seek += chunk->size; chunk = chunk->next; } @@ -1086,7 +1088,7 @@ static int fd_read_from_memfile(FileData *filedata, void *buffer, unsigned int s 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; } @@ -1097,14 +1099,14 @@ static int fd_read_from_memfile(FileData *filedata, void *buffer, unsigned int s return 0; } - chunkoffset = seek-offset; - readsize = size-totread; + chunkoffset = seek - offset; + readsize = size - totread; /* 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) - readsize= chunk->size-chunkoffset; + if (chunkoffset + readsize > chunk->size) + readsize = chunk->size - chunkoffset; memcpy(POINTER_OFFSET(buffer, totread), chunk->buf + chunkoffset, readsize); totread += readsize; @@ -1209,15 +1211,15 @@ static FileData *blo_openblenderfile_minimal(const char *filepath) return NULL; } -static int fd_read_gzip_from_memory(FileData *filedata, void *buffer, unsigned int size) +static int fd_read_gzip_from_memory(FileData *filedata, void *buffer, uint size) { int err; - filedata->strm.next_out = (Bytef *) buffer; + filedata->strm.next_out = (Bytef *)buffer; filedata->strm.avail_out = size; // Inflate another chunk. - err = inflate (&filedata->strm, Z_SYNC_FLUSH); + err = inflate(&filedata->strm, Z_SYNC_FLUSH); if (err == Z_STREAM_END) { return 0; @@ -1235,13 +1237,13 @@ static int fd_read_gzip_from_memory(FileData *filedata, void *buffer, unsigned i static int fd_read_gzip_from_memory_init(FileData *fd) { - fd->strm.next_in = (Bytef *) fd->buffer; + fd->strm.next_in = (Bytef *)fd->buffer; fd->strm.avail_in = fd->buffersize; fd->strm.total_out = 0; fd->strm.zalloc = Z_NULL; fd->strm.zfree = Z_NULL; - if (inflateInit2(&fd->strm, (16+MAX_WBITS)) != Z_OK) + if (inflateInit2(&fd->strm, (16 + MAX_WBITS)) != Z_OK) return 0; fd->read = fd_read_gzip_from_memory; @@ -1251,8 +1253,8 @@ static int fd_read_gzip_from_memory_init(FileData *fd) FileData *blo_openblendermemory(const void *mem, int memsize, ReportList *reports) { - if (!mem || memsizedatamap, adr, true); } @@ -1496,7 +1498,7 @@ static void *newdataadr(FileData *fd, const void *adr) /* only direct databocks * fcurve group pointer and keeps lasthit optimal for linking all further * fcurves. */ -static void *newdataadr_ex(FileData *fd, const void *adr, bool increase_lasthit) /* only direct databocks */ +static void *newdataadr_ex(FileData *fd, const void *adr, bool increase_lasthit) /* only direct databocks */ { if (increase_lasthit) { return newdataadr(fd, adr); @@ -1509,24 +1511,24 @@ static void *newdataadr_ex(FileData *fd, const void *adr, bool increase_lasthit) } } -static void *newdataadr_no_us(FileData *fd, const void *adr) /* only direct databocks */ +static void *newdataadr_no_us(FileData *fd, const void *adr) /* only direct databocks */ { return oldnewmap_lookup_and_inc(fd->datamap, adr, false); } -static void *newglobadr(FileData *fd, const void *adr) /* direct datablocks with global linking */ +static void *newglobadr(FileData *fd, const void *adr) /* direct datablocks with global linking */ { return oldnewmap_lookup_and_inc(fd->globmap, adr, true); } -static void *newimaadr(FileData *fd, const void *adr) /* used to restore image data after undo */ +static void *newimaadr(FileData *fd, const void *adr) /* used to restore image data after undo */ { if (fd->imamap && adr) return oldnewmap_lookup_and_inc(fd->imamap, adr, true); return NULL; } -static void *newsceadr(FileData *fd, const void *adr) /* used to restore scene data after undo */ +static void *newsceadr(FileData *fd, const void *adr) /* used to restore scene data after undo */ { if (fd->scenemap && adr) return oldnewmap_lookup_and_inc(fd->scenemap, adr, true); @@ -1556,17 +1558,17 @@ static void *newpackedadr(FileData *fd, const void *adr) /* used to restore } -static void *newlibadr(FileData *fd, const void *lib, const void *adr) /* only lib data */ +static void *newlibadr(FileData *fd, const void *lib, const void *adr) /* only lib data */ { return oldnewmap_liblookup(fd->libmap, adr, lib); } -void *blo_do_versions_newlibadr(FileData *fd, const void *lib, const void *adr) /* only lib data */ +void *blo_do_versions_newlibadr(FileData *fd, const void *lib, const void *adr) /* only lib data */ { return newlibadr(fd, lib, adr); } -static void *newlibadr_us(FileData *fd, const void *lib, const void *adr) /* increases user number */ +static void *newlibadr_us(FileData *fd, const void *lib, const void *adr) /* increases user number */ { ID *id = newlibadr(fd, lib, adr); @@ -1575,12 +1577,12 @@ static void *newlibadr_us(FileData *fd, const void *lib, const void *adr) /* inc return id; } -void *blo_do_versions_newlibadr_us(FileData *fd, const void *lib, const void *adr) /* increases user number */ +void *blo_do_versions_newlibadr_us(FileData *fd, const void *lib, const void *adr) /* increases user number */ { return newlibadr_us(fd, lib, adr); } -static void *newlibadr_real_us(FileData *fd, const void *lib, const void *adr) /* ensures real user */ +static void *newlibadr_real_us(FileData *fd, const void *lib, const void *adr) /* ensures real user */ { ID *id = newlibadr(fd, lib, adr); @@ -1599,9 +1601,9 @@ static void change_idid_adr_fd(FileData *fd, const void *old, void *new) for (i = 0; i < fd->libmap->nentries; i++) { OldNew *entry = &fd->libmap->entries[i]; - if (old==entry->newp && entry->nr==ID_ID) { + 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); } } } @@ -1632,7 +1634,7 @@ void blo_clear_proxy_pointers_from_lib(Main *oldmain) { Object *ob = oldmain->object.first; - for (; ob; ob= ob->id.next) { + for (; ob; ob = ob->id.next) { if (ob->id.lib) ob->proxy_from = NULL; } @@ -1678,16 +1680,22 @@ void blo_make_image_pointer_map(FileData *fd, Main *oldmain) fd->imamap = oldnewmap_new(); for (; ima; ima = ima->id.next) { - if (ima->cache) + if (ima->cache) { oldnewmap_insert(fd->imamap, ima->cache, ima->cache, 0); - for (a = 0; a < TEXTARGET_COUNT; a++) - if (ima->gputexture[a]) + } + for (a = 0; a < TEXTARGET_COUNT; a++) { + if (ima->gputexture[a]) { oldnewmap_insert(fd->imamap, ima->gputexture[a], ima->gputexture[a], 0); - if (ima->rr) + } + } + if (ima->rr) { oldnewmap_insert(fd->imamap, ima->rr, ima->rr, 0); - LISTBASE_FOREACH(RenderSlot *, slot, &ima->renderslots) - if (slot->render) - oldnewmap_insert(fd->imamap, slot->render, slot->render, 0); + } + LISTBASE_FOREACH(RenderSlot *, slot, &ima->renderslots) { + if (slot->render) { + oldnewmap_insert(fd->imamap, slot->render, slot->render, 0); + } + } } for (; sce; sce = sce->id.next) { if (sce->nodetree && sce->nodetree->previews) { @@ -1724,8 +1732,9 @@ void blo_end_image_pointer_map(FileData *fd, Main *oldmain) } ima->rr = NULL; } - LISTBASE_FOREACH(RenderSlot *, slot, &ima->renderslots) + LISTBASE_FOREACH(RenderSlot *, slot, &ima->renderslots) { slot->render = newimaadr(fd, slot->render); + } for (i = 0; i < TEXTARGET_COUNT; i++) ima->gputexture[i] = newimaadr(fd, ima->gputexture[i]); @@ -1788,7 +1797,7 @@ void blo_end_movieclip_pointer_map(FileData *fd, Main *oldmain) int i; /* used entries were restored, so we put them to zero */ - for (i=0; i < fd->movieclipmap->nentries; i++, entry++) { + for (i = 0; i < fd->movieclipmap->nentries; i++, entry++) { if (entry->nr > 0) entry->newp = NULL; } @@ -1893,7 +1902,7 @@ void blo_end_packed_pointer_map(FileData *fd, Main *oldmain) int i; /* used entries were restored, so we put them to zero */ - for (i=0; i < fd->packedmap->nentries; i++, entry++) { + for (i = 0; i < fd->packedmap->nentries; i++, entry++) { if (entry->nr > 0) entry->newp = NULL; } @@ -1945,8 +1954,8 @@ static void switch_endian_structs(const struct SDNA *filesdna, BHead *bhead) int blocksize, nblocks; char *data; - data = (char *)(bhead+1); - blocksize = filesdna->typelens[ filesdna->structs[bhead->SDNAnr][0] ]; + data = (char *)(bhead + 1); + blocksize = filesdna->typelens[filesdna->structs[bhead->SDNAnr][0]]; nblocks = bhead->nr; while (nblocks--) { @@ -1967,12 +1976,12 @@ static void *read_struct(FileData *fd, BHead *bh, const char *blockname) if (fd->compflags[bh->SDNAnr] != SDNA_CMP_REMOVED) { if (fd->compflags[bh->SDNAnr] == SDNA_CMP_NOT_EQUAL) { - temp = DNA_struct_reconstruct(fd->memsdna, fd->filesdna, fd->compflags, bh->SDNAnr, bh->nr, (bh+1)); + temp = DNA_struct_reconstruct(fd->memsdna, fd->filesdna, fd->compflags, bh->SDNAnr, bh->nr, (bh + 1)); } else { /* SDNA_CMP_EQUAL */ temp = MEM_mallocN(bh->len, blockname); - memcpy(temp, (bh+1), bh->len); + memcpy(temp, (bh + 1), bh->len); } } } @@ -1982,7 +1991,7 @@ static void *read_struct(FileData *fd, BHead *bh, const char *blockname) typedef void (*link_list_cb)(FileData *fd, void *data); -static void link_list_ex(FileData *fd, ListBase *lb, link_list_cb callback) /* only direct data */ +static void link_list_ex(FileData *fd, ListBase *lb, link_list_cb callback) /* only direct data */ { Link *ln, *prev; @@ -2006,12 +2015,12 @@ static void link_list_ex(FileData *fd, ListBase *lb, link_list_cb callback) /* lb->last = prev; } -static void link_list(FileData *fd, ListBase *lb) /* only direct data */ +static void link_list(FileData *fd, ListBase *lb) /* only direct data */ { link_list_ex(fd, lb, NULL); } -static void link_glob_list(FileData *fd, ListBase *lb) /* for glob data */ +static void link_glob_list(FileData *fd, ListBase *lb) /* for glob data */ { Link *ln, *prev; void *poin; @@ -2044,16 +2053,16 @@ static void test_pointer_array(FileData *fd, void **mat) int *ipoin, *imat; size_t len; - /* manually convert the pointer array in - * the old dna format to a pointer array in - * the new dna format. - */ + /* manually convert the pointer array in + * the old dna format to a pointer array in + * the new dna format. + */ if (*mat) { - len = MEM_allocN_len(*mat)/fd->filesdna->pointerlen; + len = MEM_allocN_len(*mat) / fd->filesdna->pointerlen; - if (fd->filesdna->pointerlen==8 && fd->memsdna->pointerlen==4) { - ipoin=imat= MEM_malloc_arrayN(len, 4, "newmatar"); - lpoin= *mat; + if (fd->filesdna->pointerlen == 8 && fd->memsdna->pointerlen == 4) { + ipoin = imat = MEM_malloc_arrayN(len, 4, "newmatar"); + lpoin = *mat; while (len-- > 0) { if ((fd->flags & FD_FLAGS_SWITCH_ENDIAN)) @@ -2066,7 +2075,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_malloc_arrayN(len, 8, "newmatar"); ipoin = *mat; @@ -2076,7 +2085,7 @@ static void test_pointer_array(FileData *fd, void **mat) lpoin++; } MEM_freeN(*mat); - *mat= lmat; + *mat = lmat; } } } @@ -2153,7 +2162,7 @@ static void IDP_DirectLinkGroup(IDProperty *prop, int switch_endian, FileData *f link_list(fd, lb); /*Link child id properties now*/ - for (loop=prop->data.group.first; loop; loop=loop->next) { + for (loop = prop->data.group.first; loop; loop = loop->next) { IDP_DirectLinkProperty(loop, switch_endian, fd); } } @@ -2517,7 +2526,7 @@ 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); @@ -2542,7 +2551,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); } } @@ -2581,7 +2590,7 @@ static void lib_link_fcurves(FileData *fd, ID *id, ListBase *list) ChannelDriver *driver = fcu->driver; DriverVar *dvar; - for (dvar= driver->variables.first; dvar; dvar= dvar->next) { + for (dvar = driver->variables.first; dvar; dvar = dvar->next) { DRIVER_TARGETS_LOOPER(dvar) { /* only relink if still used */ @@ -2626,9 +2635,9 @@ static void direct_link_fmodifiers(FileData *fd, ListBase *list, FCurve *curve) } case FMODIFIER_TYPE_ENVELOPE: { - FMod_Envelope *data= (FMod_Envelope *)fcm->data; + FMod_Envelope *data = (FMod_Envelope *)fcm->data; - data->data= newdataadr(fd, data->data); + data->data = newdataadr(fd, data->data); break; } @@ -2668,9 +2677,9 @@ static void direct_link_fcurves(FileData *fd, ListBase *list) fcu->flag &= ~FCURVE_DISABLED; /* driver */ - fcu->driver= newdataadr(fd, fcu->driver); + fcu->driver = newdataadr(fd, fcu->driver); if (fcu->driver) { - ChannelDriver *driver= fcu->driver; + ChannelDriver *driver = fcu->driver; DriverVar *dvar; /* compiled expression data will need to be regenerated (old pointer may still be set here) */ @@ -2684,7 +2693,7 @@ static void direct_link_fcurves(FileData *fd, ListBase *list) /* relink variables, targets and their paths */ link_list(fd, &driver->variables); - for (dvar= driver->variables.first; dvar; dvar= dvar->next) { + for (dvar = driver->variables.first; dvar; dvar = dvar->next) { DRIVER_TARGETS_LOOPER(dvar) { /* only relink the targets being used */ @@ -2741,7 +2750,7 @@ static void direct_link_action(FileData *fd, bAction *act) link_list(fd, &act->markers); // XXX deprecated - old animation system <<< - for (achan = act->chanbase.first; achan; achan=achan->next) { + for (achan = act->chanbase.first; achan; achan = achan->next) { achan->grp = newdataadr(fd, achan->grp); link_list(fd, &achan->constraintChannels); @@ -2750,9 +2759,9 @@ static void direct_link_action(FileData *fd, bAction *act) direct_link_fcurves(fd, &act->curves); - for (agrp = act->groups.first; agrp; agrp= agrp->next) { - agrp->channels.first= newdataadr(fd, agrp->channels.first); - agrp->channels.last= newdataadr(fd, agrp->channels.last); + for (agrp = act->groups.first; agrp; agrp = agrp->next) { + agrp->channels.first = newdataadr(fd, agrp->channels.first); + agrp->channels.last = newdataadr(fd, agrp->channels.last); } } @@ -2832,7 +2841,7 @@ static void lib_link_keyingsets(FileData *fd, ID *id, ListBase *list) /* here, we're only interested in the ID pointer stored in some of the paths */ for (ks = list->first; ks; ks = ks->next) { for (ksp = ks->paths.first; ksp; ksp = ksp->next) { - ksp->id= newlibadr(fd, id->lib, ksp->id); + ksp->id = newlibadr(fd, id->lib, ksp->id); } } } @@ -2850,7 +2859,7 @@ static void direct_link_keyingsets(FileData *fd, ListBase *list) for (ksp = ks->paths.first; ksp; ksp = ksp->next) { /* rna path */ - ksp->rna_path= newdataadr(fd, ksp->rna_path); + ksp->rna_path = newdataadr(fd, ksp->rna_path); } } } @@ -2863,8 +2872,8 @@ static void lib_link_animdata(FileData *fd, ID *id, AnimData *adt) return; /* link action data */ - adt->action= newlibadr_us(fd, id->lib, adt->action); - adt->tmpact= newlibadr_us(fd, id->lib, adt->tmpact); + adt->action = newlibadr_us(fd, id->lib, adt->action); + adt->tmpact = newlibadr_us(fd, id->lib, adt->tmpact); /* fix action id-roots (i.e. if they come from a pre 2.57 .blend file) */ if ((adt->action) && (adt->action->idroot == 0)) @@ -3081,11 +3090,11 @@ static void lib_link_nodetree(FileData *fd, Main *main) */ static void lib_node_do_versions_group_indices(bNode *gnode) { - bNodeTree *ngroup = (bNodeTree*)gnode->id; + bNodeTree *ngroup = (bNodeTree *)gnode->id; bNodeSocket *sock; bNodeLink *link; - for (sock=gnode->outputs.first; sock; sock = sock->next) { + for (sock = gnode->outputs.first; sock; sock = sock->next) { int old_index = sock->to_index; for (link = ngroup->links.first; link; link = link->next) { @@ -3098,7 +3107,7 @@ static void lib_node_do_versions_group_indices(bNode *gnode) } } } - for (sock=gnode->inputs.first; sock; sock = sock->next) { + for (sock = gnode->inputs.first; sock; sock = sock->next) { int old_index = sock->to_index; for (link = ngroup->links.first; link; link = link->next) { @@ -3120,20 +3129,20 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) { /* this crashes blender on undo/redo */ #if 0 - if (open == 1) { - reinit_nodesystem(); - } + if (open == 1) { + reinit_nodesystem(); + } #endif /* set node->typeinfo pointers */ - FOREACH_NODETREE(main, ntree, id) { + FOREACH_NODETREE (main, ntree, id) { ntreeSetTypes(NULL, ntree); } FOREACH_NODETREE_END /* verify static socket templates */ - FOREACH_NODETREE(main, ntree, id) { + FOREACH_NODETREE (main, ntree, id) { bNode *node; - for (node=ntree->nodes.first; node; node=node->next) + for (node = ntree->nodes.first; node; node = node->next) node_verify_socket_templates(ntree, node); } FOREACH_NODETREE_END @@ -3151,12 +3160,12 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) } if (has_old_groups) { - FOREACH_NODETREE(main, ntree, id) { + FOREACH_NODETREE (main, ntree, id) { /* updates external links for all group nodes in a tree */ bNode *node; for (node = ntree->nodes.first; node; node = node->next) { if (node->type == NODE_GROUP) { - bNodeTree *ngroup = (bNodeTree*)node->id; + bNodeTree *ngroup = (bNodeTree *)node->id; if (ngroup && (ngroup->flag & NTREE_DO_VERSIONS_GROUP_EXPOSE_2_56_2)) lib_node_do_versions_group_indices(node); } @@ -3196,7 +3205,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) float input_locx = 1000000.0f, input_locy = 0.0f; float output_locx = -1000000.0f, output_locy = 0.0f; /* rough guess, not nice but we don't have access to UI constants here ... */ - static const float offsetx = 42 + 3*20 + 20; + static const float offsetx = 42 + 3 * 20 + 20; /*static const float offsety = 0.0f;*/ if (create_io_nodes) { @@ -3305,9 +3314,9 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree) bNodeSocket *sock; bNodeLink *link; - ntree->init = 0; /* to set callbacks and force setting types */ + ntree->init = 0; /* to set callbacks and force setting types */ ntree->is_updating = false; - ntree->typeinfo= NULL; + ntree->typeinfo = NULL; ntree->interface_type = NULL; ntree->progress = NULL; @@ -3346,33 +3355,33 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree) if (node->storage) { /* could be handlerized at some point */ - if (ntree->type==NTREE_SHADER) { - if (node->type==SH_NODE_CURVE_VEC || node->type==SH_NODE_CURVE_RGB) { + if (ntree->type == NTREE_SHADER) { + if (node->type == SH_NODE_CURVE_VEC || node->type == SH_NODE_CURVE_RGB) { direct_link_curvemapping(fd, node->storage); } - else if (node->type==SH_NODE_SCRIPT) { - NodeShaderScript *nss = (NodeShaderScript *) node->storage; + else if (node->type == SH_NODE_SCRIPT) { + NodeShaderScript *nss = (NodeShaderScript *)node->storage; nss->bytecode = newdataadr(fd, nss->bytecode); } - else if (node->type==SH_NODE_TEX_POINTDENSITY) { - NodeShaderTexPointDensity *npd = (NodeShaderTexPointDensity *) node->storage; + else if (node->type == SH_NODE_TEX_POINTDENSITY) { + NodeShaderTexPointDensity *npd = (NodeShaderTexPointDensity *)node->storage; memset(&npd->pd, 0, sizeof(npd->pd)); } } - else if (ntree->type==NTREE_COMPOSIT) { + else if (ntree->type == NTREE_COMPOSIT) { if (ELEM(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT)) direct_link_curvemapping(fd, node->storage); else if (ELEM(node->type, CMP_NODE_IMAGE, CMP_NODE_R_LAYERS, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) ((ImageUser *)node->storage)->ok = 1; - else if (node->type==CMP_NODE_CRYPTOMATTE) { - NodeCryptomatte *nc = (NodeCryptomatte *) node->storage; + else if (node->type == CMP_NODE_CRYPTOMATTE) { + NodeCryptomatte *nc = (NodeCryptomatte *)node->storage; nc->matte_id = newdataadr(fd, nc->matte_id); } } - 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; } } @@ -3398,7 +3407,7 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree) 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); @@ -3441,7 +3450,7 @@ typedef struct tConstraintLinkData { /* callback function used to relink constraint ID-links */ static void lib_link_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, bool is_reference, void *userdata) { - tConstraintLinkData *cld= (tConstraintLinkData *)userdata; + tConstraintLinkData *cld = (tConstraintLinkData *)userdata; /* for reference types, we need to increment the usercounts on load... */ if (is_reference) { @@ -3460,7 +3469,7 @@ static void lib_link_constraints(FileData *fd, ID *id, ListBase *conlist) bConstraint *con; /* legacy fixes */ - for (con = conlist->first; con; con=con->next) { + 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) { @@ -3487,13 +3496,13 @@ static void direct_link_constraints(FileData *fd, ListBase *lb) bConstraint *con; link_list(fd, lb); - for (con=lb->first; con; con=con->next) { + for (con = lb->first; con; con = con->next) { con->data = newdataadr(fd, con->data); switch (con->type) { case CONSTRAINT_TYPE_PYTHON: { - bPythonConstraint *data= con->data; + bPythonConstraint *data = con->data; link_list(fd, &data->targets); @@ -3503,7 +3512,7 @@ static void direct_link_constraints(FileData *fd, ListBase *lb) } case CONSTRAINT_TYPE_ARMATURE: { - bArmatureConstraint *data= con->data; + bArmatureConstraint *data = con->data; link_list(fd, &data->targets); @@ -3511,9 +3520,9 @@ static void direct_link_constraints(FileData *fd, ListBase *lb) } case CONSTRAINT_TYPE_SPLINEIK: { - bSplineIKConstraint *data= con->data; + bSplineIKConstraint *data = con->data; - data->points= newdataadr(fd, data->points); + data->points = newdataadr(fd, data->points); break; } case CONSTRAINT_TYPE_KINEMATIC: @@ -3643,7 +3652,7 @@ static void direct_link_bones(FileData *fd, Bone *bone) 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); } @@ -3731,7 +3740,7 @@ static void direct_link_lamp(FileData *fd, Lamp *la) if (la->curfalloff) direct_link_curvemapping(fd, la->curfalloff); - la->nodetree= newdataadr(fd, la->nodetree); + la->nodetree = newdataadr(fd, la->nodetree); if (la->nodetree) { direct_link_id(fd, &la->nodetree->id); direct_link_nodetree(fd, la->nodetree); @@ -3807,7 +3816,7 @@ static void direct_link_key(FileData *fd, Key *key) key->adt = newdataadr(fd, key->adt); direct_link_animdata(fd, key->adt); - key->refkey= newdataadr(fd, key->refkey); + key->refkey = newdataadr(fd, key->refkey); for (kb = key->block.first; kb; kb = kb->next) { kb->data = newdataadr(fd, kb->data); @@ -3948,7 +3957,7 @@ static void direct_link_text(FileData *fd, Text *text) ln->line = newdataadr(fd, ln->line); ln->format = NULL; - if (ln->len != (int) strlen(ln->line)) { + if (ln->len != (int)strlen(ln->line)) { printf("Error loading text, line lengths differ\n"); ln->len = strlen(ln->line); } @@ -4070,7 +4079,7 @@ static void direct_link_curve(FileData *fd, Curve *cu) Nurb *nu; TextBox *tb; - cu->adt= newdataadr(fd, cu->adt); + cu->adt = newdataadr(fd, cu->adt); direct_link_animdata(fd, cu->adt); /* Protect against integer overflow vulnerability. */ @@ -4079,18 +4088,18 @@ static void direct_link_curve(FileData *fd, Curve *cu) cu->mat = newdataadr(fd, cu->mat); test_pointer_array(fd, (void **)&cu->mat); cu->str = newdataadr(fd, cu->str); - cu->strinfo= newdataadr(fd, cu->strinfo); + cu->strinfo = newdataadr(fd, cu->strinfo); cu->tb = newdataadr(fd, cu->tb); if (cu->vfont == NULL) { link_list(fd, &(cu->nurb)); } else { - cu->nurb.first=cu->nurb.last= NULL; + cu->nurb.first = cu->nurb.last = NULL; tb = MEM_calloc_arrayN(MAXTEXTBOX, sizeof(TextBox), "TextBoxread"); if (cu->tb) { - memcpy(tb, cu->tb, cu->totbox*sizeof(TextBox)); + memcpy(tb, cu->tb, cu->totbox * sizeof(TextBox)); MEM_freeN(cu->tb); cu->tb = tb; } @@ -4236,7 +4245,7 @@ static void direct_link_pointcache_cb(FileData *fd, void *data) 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 tot = (BKE_ptcache_data_size(i) * pm->totpoint) / sizeof(int); /* data_size returns bytes */ int *poin = pm->data[i]; @@ -4246,13 +4255,13 @@ static void direct_link_pointcache_cb(FileData *fd, void *data) 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); } static void direct_link_pointcache(FileData *fd, PointCache *cache) { - if ((cache->flag & PTCACHE_DISK_CACHE)==0) { + if ((cache->flag & PTCACHE_DISK_CACHE) == 0) { link_list_ex(fd, &cache->mem_cache, direct_link_pointcache_cb); } else @@ -4268,9 +4277,9 @@ 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) { - PointCache *cache= NULL; + 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) { cache->flag |= PTCACHE_DISK_CACHE; @@ -4338,20 +4347,20 @@ static void lib_link_particlesettings(FileData *fd, Main *main) 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: { - BoidRuleGoalAvoid *brga = (BoidRuleGoalAvoid*)rule; + BoidRuleGoalAvoid *brga = (BoidRuleGoalAvoid *)rule; brga->ob = newlibadr(fd, part->id.lib, brga->ob); break; } case eBoidRuleType_FollowLeader: { - BoidRuleFollowLeader *brfl = (BoidRuleFollowLeader*)rule; + BoidRuleFollowLeader *brfl = (BoidRuleFollowLeader *)rule; brfl->ob = newlibadr(fd, part->id.lib, brfl->ob); break; } @@ -4361,7 +4370,7 @@ static void lib_link_particlesettings(FileData *fd, Main *main) } for (int a = 0; a < MAX_MTEX; a++) { - MTex *mtex= part->mtex[a]; + MTex *mtex = part->mtex[a]; if (mtex) { mtex->tex = newlibadr_us(fd, part->id.lib, mtex->tex); mtex->object = newlibadr(fd, part->id.lib, mtex->object); @@ -4413,7 +4422,7 @@ static void direct_link_particlesettings(FileData *fd, ParticleSettings *part) 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); @@ -4431,15 +4440,15 @@ 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) { ParticleTarget *pt = psys->targets.first; - for (; pt; pt=pt->next) - pt->ob=newlibadr(fd, id->lib, pt->ob); + for (; pt; pt = pt->next) + pt->ob = newlibadr(fd, id->lib, pt->ob); psys->parent = newlibadr(fd, id->lib, psys->parent); psys->target_ob = newlibadr(fd, id->lib, psys->target_ob); @@ -4448,7 +4457,7 @@ static void lib_link_particlesystems(FileData *fd, Object *ob, ID *id, ListBase /* XXX - from reading existing code this seems correct but intended usage of * pointcache /w cloth should be added in 'ParticleSystem' - campbell */ psys->clmd->point_cache = psys->pointcache; - psys->clmd->ptcaches.first = psys->clmd->ptcaches.last= NULL; + psys->clmd->ptcaches.first = psys->clmd->ptcaches.last = NULL; psys->clmd->coll_parms->group = newlibadr(fd, id->lib, psys->clmd->coll_parms->group); psys->clmd->modifier.error = NULL; } @@ -4470,18 +4479,18 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles) ParticleData *pa; int a; - for (psys=particles->first; psys; psys=psys->next) { - psys->particles=newdataadr(fd, psys->particles); + 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; atotpart; a++, pa++) - pa->hair=newdataadr(fd, pa->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; atotpart; a++, pa++) { - pa->keys= NULL; - pa->totkey= 0; + for (a = 0, pa = psys->particles; a < psys->totpart; a++, pa++) { + pa->keys = NULL; + pa->totkey = 0; } psys->flag &= ~PSYS_KEYED; @@ -4497,7 +4506,7 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles) } } else if (psys->particles) { - for (a=0, pa=psys->particles; atotpart; a++, pa++) + for (a = 0, pa = psys->particles; a < psys->totpart; a++, pa++) pa->boid = NULL; } @@ -4521,8 +4530,8 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles) psys->clmd->clothObject = NULL; psys->clmd->hairdata = NULL; - psys->clmd->sim_parms= newdataadr(fd, psys->clmd->sim_parms); - psys->clmd->coll_parms= newdataadr(fd, psys->clmd->coll_parms); + psys->clmd->sim_parms = newdataadr(fd, psys->clmd->sim_parms); + psys->clmd->coll_parms = newdataadr(fd, psys->clmd->coll_parms); if (psys->clmd->sim_parms) { psys->clmd->sim_parms->effector_weights = NULL; @@ -4720,7 +4729,7 @@ static void direct_link_customdata(FileData *fd, CustomData *data, int count) static void direct_link_mesh(FileData *fd, Mesh *mesh) { - mesh->mat= newdataadr(fd, mesh->mat); + mesh->mat = newdataadr(fd, mesh->mat); test_pointer_array(fd, (void **)&mesh->mat); mesh->mvert = newdataadr(fd, mesh->mvert); @@ -4760,7 +4769,7 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh) } /* Multires data */ - mesh->mr= newdataadr(fd, mesh->mr); + mesh->mr = newdataadr(fd, mesh->mr); if (mesh->mr) { MultiresLevel *lvl; @@ -4782,7 +4791,7 @@ 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->totvert == ((MultiresLevel *)mesh->mr->levels.last)->totvert) { if (mesh->mr->verts) MEM_freeN(mesh->mr->verts); mesh->mr->verts = MEM_dupallocN(mesh->mvert); @@ -4835,7 +4844,7 @@ static void direct_link_latt(FileData *fd, Lattice *lt) lt->def = newdataadr(fd, lt->def); lt->dvert = newdataadr(fd, lt->dvert); - direct_link_dverts(fd, lt->pntsu*lt->pntsv*lt->pntsw, lt->dvert); + direct_link_dverts(fd, lt->pntsu * lt->pntsv * lt->pntsw, lt->dvert); lt->editlatt = NULL; lt->batch_cache = NULL; @@ -4966,11 +4975,11 @@ static void lib_link_object(FileData *fd, Main *main) #else MEM_freeN(ob->pose); #endif - ob->pose= NULL; + ob->pose = NULL; ob->mode &= ~OB_MODE_POSE; } } - for (a=0; a < ob->totcol; 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 @@ -5070,7 +5079,7 @@ static void direct_link_pose(FileData *fd, bPose *pose) pose->chanhash = NULL; pose->chan_array = NULL; - for (pchan = pose->chanbase.first; pchan; pchan=pchan->next) { + for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { pchan->bone = NULL; pchan->parent = newdataadr(fd, pchan->parent); pchan->child = newdataadr(fd, pchan->child); @@ -5109,7 +5118,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) link_list(fd, lb); - for (md=lb->first; md; md=md->next) { + for (md = lb->first; md; md = md->next) { md->error = NULL; /* if modifiers disappear, or for upward compatibility */ @@ -5132,8 +5141,8 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) clmd->clothObject = NULL; clmd->hairdata = NULL; - clmd->sim_parms= newdataadr(fd, clmd->sim_parms); - clmd->coll_parms= newdataadr(fd, clmd->coll_parms); + clmd->sim_parms = newdataadr(fd, clmd->sim_parms); + clmd->coll_parms = newdataadr(fd, clmd->coll_parms); direct_link_pointcache_list(fd, &clmd->ptcaches, &clmd->point_cache, 0); @@ -5249,7 +5258,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) DynamicPaintSurface *surface; link_list(fd, &pmd->canvas->surfaces); - for (surface=pmd->canvas->surfaces.first; surface; surface=surface->next) { + for (surface = pmd->canvas->surfaces.first; surface; surface = surface->next) { surface->canvas = pmd->canvas; surface->data = NULL; direct_link_pointcache_list(fd, &(surface->ptcaches), &(surface->pointcache), 1); @@ -5322,7 +5331,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) psmd->mesh_final = NULL; psmd->mesh_original = NULL; - psmd->psys= newdataadr(fd, psmd->psys); + psmd->psys = newdataadr(fd, psmd->psys); psmd->flag &= ~eParticleSystemFlag_psys_updated; psmd->flag |= eParticleSystemFlag_file_loaded; } @@ -5360,7 +5369,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) else if (md->type == eModifierType_Warp) { WarpModifierData *tmd = (WarpModifierData *)md; - tmd->curfalloff= newdataadr(fd, tmd->curfalloff); + tmd->curfalloff = newdataadr(fd, tmd->curfalloff); if (tmd->curfalloff) direct_link_curvemapping(fd, tmd->curfalloff); } @@ -5381,7 +5390,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) lmd->cache_system = NULL; } else if (md->type == eModifierType_CorrectiveSmooth) { - CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData*)md; + CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)md; if (csmd->bind_coords) { csmd->bind_coords = newdataadr(fd, csmd->bind_coords); @@ -5414,14 +5423,20 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) { if (smd->verts[i].binds[j].vert_inds) - BLI_endian_switch_uint32_array(smd->verts[i].binds[j].vert_inds, smd->verts[i].binds[j].numverts); + BLI_endian_switch_uint32_array( + smd->verts[i].binds[j].vert_inds, smd->verts[i].binds[j].numverts); if (smd->verts[i].binds[j].vert_weights) { if (smd->verts[i].binds[j].mode == MOD_SDEF_MODE_CENTROID || smd->verts[i].binds[j].mode == MOD_SDEF_MODE_LOOPTRI) - BLI_endian_switch_float_array(smd->verts[i].binds[j].vert_weights, 3); - else - BLI_endian_switch_float_array(smd->verts[i].binds[j].vert_weights, smd->verts[i].binds[j].numverts); + { + BLI_endian_switch_float_array( + smd->verts[i].binds[j].vert_weights, 3); + } + else { + BLI_endian_switch_float_array( + smd->verts[i].binds[j].vert_weights, smd->verts[i].binds[j].numverts); + } } } } @@ -5450,7 +5465,7 @@ static void direct_link_gpencil_modifiers(FileData *fd, ListBase *lb) md->type = eModifierType_None; if (md->type == eGpencilModifierType_Lattice) { - LatticeGpencilModifierData *gpmd = (LatticeGpencilModifierData*)md; + LatticeGpencilModifierData *gpmd = (LatticeGpencilModifierData *)md; gpmd->cache_data = NULL; } else if (md->type == eGpencilModifierType_Hook) { @@ -5528,9 +5543,9 @@ static void direct_link_object(FileData *fd, Object *ob) link_list(fd, &ob->constraintChannels); // >>> XXX deprecated - old animation system - ob->mat= newdataadr(fd, ob->mat); + ob->mat = newdataadr(fd, ob->mat); test_pointer_array(fd, (void **)&ob->mat); - ob->matbits= newdataadr(fd, ob->matbits); + ob->matbits = newdataadr(fd, ob->matbits); /* do it here, below old data gets converted */ direct_link_modifiers(fd, &ob->modifiers); @@ -5538,15 +5553,15 @@ static void direct_link_object(FileData *fd, Object *ob) direct_link_shaderfxs(fd, &ob->shader_fx); link_list(fd, &ob->effect); - paf= ob->effect.first; + paf = ob->effect.first; while (paf) { if (paf->type == EFF_PARTICLE) { paf->keys = NULL; } if (paf->type == EFF_WAVE) { - WaveEff *wav = (WaveEff*) paf; + WaveEff *wav = (WaveEff *)paf; PartEff *next = paf->next; - WaveModifierData *wmd = (WaveModifierData*) modifier_new(eModifierType_Wave); + WaveModifierData *wmd = (WaveModifierData *)modifier_new(eModifierType_Wave); wmd->damp = wav->damp; wmd->flag = wav->flag; @@ -5568,9 +5583,9 @@ static void direct_link_object(FileData *fd, Object *ob) continue; } if (paf->type == EFF_BUILD) { - BuildEff *baf = (BuildEff*) paf; + BuildEff *baf = (BuildEff *)paf; PartEff *next = paf->next; - BuildModifierData *bmd = (BuildModifierData*) modifier_new(eModifierType_Build); + BuildModifierData *bmd = (BuildModifierData *)modifier_new(eModifierType_Build); bmd->start = baf->sfra; bmd->length = baf->len; @@ -5588,13 +5603,13 @@ static void direct_link_object(FileData *fd, Object *ob) paf = paf->next; } - ob->pd= newdataadr(fd, ob->pd); + ob->pd = newdataadr(fd, ob->pd); direct_link_partdeflect(ob->pd); - ob->soft= newdataadr(fd, ob->soft); + ob->soft = newdataadr(fd, ob->soft); if (ob->soft) { SoftBody *sb = ob->soft; - sb->bpoint = NULL; // init pointers so it gets rebuilt nicely + sb->bpoint = NULL; // init pointers so it gets rebuilt nicely sb->bspring = NULL; sb->scratch = NULL; /* although not used anymore */ @@ -5625,7 +5640,7 @@ static void direct_link_object(FileData *fd, Object *ob) direct_link_pointcache_list(fd, &sb->shared->ptcaches, &sb->shared->pointcache, false); } } - ob->fluidsimSettings= newdataadr(fd, ob->fluidsimSettings); /* NT */ + ob->fluidsimSettings = newdataadr(fd, ob->fluidsimSettings); /* NT */ ob->rigidbody_object = newdataadr(fd, ob->rigidbody_object); if (ob->rigidbody_object) { @@ -5647,7 +5662,7 @@ static void direct_link_object(FileData *fd, Object *ob) ObHook *hook = ob->hooks.first; HookModifierData *hmd = (HookModifierData *)modifier_new(eModifierType_Hook); - hook->indexar= newdataadr(fd, hook->indexar); + hook->indexar = newdataadr(fd, hook->indexar); if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) { BLI_endian_switch_int32_array(hook->indexar, hook->totindex); } @@ -5667,7 +5682,7 @@ static void direct_link_object(FileData *fd, Object *ob) BLI_addhead(&ob->modifiers, hmd); BLI_remlink(&ob->hooks, hook); - modifier_unique_name(&ob->modifiers, (ModifierData*)hmd); + modifier_unique_name(&ob->modifiers, (ModifierData *)hmd); MEM_freeN(hook); } @@ -5910,7 +5925,7 @@ static void composite_patch(bNodeTree *ntree, Scene *scene) bNode *node; for (node = ntree->nodes.first; node; node = node->next) { - if (node->id==NULL && node->type == CMP_NODE_R_LAYERS) + if (node->id == NULL && node->type == CMP_NODE_R_LAYERS) node->id = &scene->id; } } @@ -5954,7 +5969,7 @@ static void direct_link_lightcache_texture(FileData *fd, LightCacheTexture *lcte BLI_endian_switch_float_array((float *)lctex->data, data_size * sizeof(float)); } else if (lctex->data_type == LIGHTCACHETEX_UINT) { - BLI_endian_switch_uint32_array((unsigned int *)lctex->data, data_size * sizeof(unsigned int)); + BLI_endian_switch_uint32_array((uint *)lctex->data, data_size * sizeof(uint)); } } } @@ -6036,7 +6051,7 @@ static void lib_link_scene(FileData *fd, Main *main) if (sce->toolsettings->sculpt) sce->toolsettings->sculpt->gravity_object = - newlibadr(fd, sce->id.lib, sce->toolsettings->sculpt->gravity_object); + newlibadr(fd, sce->id.lib, sce->toolsettings->sculpt->gravity_object); if (sce->toolsettings->imapaint.stencil) sce->toolsettings->imapaint.stencil = @@ -6248,12 +6263,12 @@ static void direct_link_sequence_modifiers(FileData *fd, ListBase *lb) smd->mask_sequence = newdataadr(fd, smd->mask_sequence); if (smd->type == seqModifierType_Curves) { - CurvesModifierData *cmd = (CurvesModifierData *) smd; + CurvesModifierData *cmd = (CurvesModifierData *)smd; direct_link_curvemapping(fd, &cmd->curve_mapping); } else if (smd->type == seqModifierType_HueCorrect) { - HueCorrectModifierData *hcmd = (HueCorrectModifierData *) smd; + HueCorrectModifierData *hcmd = (HueCorrectModifierData *)smd; direct_link_curvemapping(fd, &hcmd->curve_mapping); } @@ -6288,13 +6303,13 @@ static void direct_link_scene(FileData *fd, Scene *sce) sce->basact = newdataadr(fd, sce->basact); - sce->toolsettings= newdataadr(fd, sce->toolsettings); + sce->toolsettings = newdataadr(fd, sce->toolsettings); if (sce->toolsettings) { - direct_link_paint_helper(fd, sce, (Paint**)&sce->toolsettings->sculpt); - direct_link_paint_helper(fd, sce, (Paint**)&sce->toolsettings->vpaint); - direct_link_paint_helper(fd, sce, (Paint**)&sce->toolsettings->wpaint); - direct_link_paint_helper(fd, sce, (Paint**)&sce->toolsettings->uvsculpt); - direct_link_paint_helper(fd, sce, (Paint**)&sce->toolsettings->gp_paint); + direct_link_paint_helper(fd, sce, (Paint **)&sce->toolsettings->sculpt); + direct_link_paint_helper(fd, sce, (Paint **)&sce->toolsettings->vpaint); + direct_link_paint_helper(fd, sce, (Paint **)&sce->toolsettings->wpaint); + direct_link_paint_helper(fd, sce, (Paint **)&sce->toolsettings->uvsculpt); + direct_link_paint_helper(fd, sce, (Paint **)&sce->toolsettings->gp_paint); direct_link_paint(fd, sce, &sce->toolsettings->imapaint.paint); @@ -6328,9 +6343,9 @@ static void direct_link_scene(FileData *fd, Scene *sce) SEQ_BEGIN (ed, seq) { - seq->seq1= newdataadr(fd, seq->seq1); - seq->seq2= newdataadr(fd, seq->seq2); - seq->seq3= newdataadr(fd, seq->seq3); + seq->seq1 = newdataadr(fd, seq->seq1); + 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; @@ -6350,7 +6365,7 @@ static void direct_link_scene(FileData *fd, Scene *sce) IDP_DirectLinkGroup_OrFree(&seq->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); seq->strip = newdataadr(fd, seq->strip); - if (seq->strip && seq->strip->done==0) { + if (seq->strip && seq->strip->done == 0) { seq->strip->done = true; if (ELEM(seq->type, SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD)) { @@ -6418,11 +6433,11 @@ static void direct_link_scene(FileData *fd, Scene *sce) /* 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) - ms->oldbasep= &ed->seqbase; + ms->oldbasep = &ed->seqbase; else { poin = POINTER_OFFSET(ms->oldbasep, -offset); poin = newdataadr(fd, poin); @@ -6725,7 +6740,7 @@ static void direct_link_area(FileData *fd, ScrArea *area) link_list(fd, &(area->regionbase)); BLI_listbase_clear(&area->handlers); - area->type = NULL; /* spacetype callbacks */ + area->type = NULL; /* spacetype callbacks */ area->butspacetype = SPACE_EMPTY; /* Should always be unset so that rna_Area_type_get works correctly */ area->region_active_win = -1; @@ -6747,8 +6762,8 @@ static void direct_link_area(FileData *fd, ScrArea *area) /* accident can happen when read/save new file with older version */ /* 2.50: we now always add spacedata for info */ if (area->spacedata.first == NULL) { - SpaceInfo *sinfo= MEM_callocN(sizeof(SpaceInfo), "spaceinfo"); - area->spacetype= sinfo->spacetype= SPACE_INFO; + SpaceInfo *sinfo = MEM_callocN(sizeof(SpaceInfo), "spaceinfo"); + area->spacetype = sinfo->spacetype = SPACE_INFO; BLI_addtail(&area->spacedata, sinfo); } /* add local view3d too */ @@ -6768,7 +6783,7 @@ static void direct_link_area(FileData *fd, ScrArea *area) direct_link_region(fd, ar, sl->spacetype); if (sl->spacetype == SPACE_VIEW3D) { - View3D *v3d= (View3D*) sl; + View3D *v3d = (View3D *)sl; v3d->flag |= V3D_INVALID_BACKBUF; @@ -6804,7 +6819,7 @@ static void direct_link_area(FileData *fd, ScrArea *area) snla->ads = newdataadr(fd, snla->ads); } else if (sl->spacetype == SPACE_OUTLINER) { - SpaceOops *soops = (SpaceOops *) sl; + SpaceOops *soops = (SpaceOops *)sl; /* use newdataadr_no_us and do not free old memory avoiding double * frees and use of freed memory. this could happen because of a @@ -6825,10 +6840,10 @@ static void direct_link_area(FileData *fd, ScrArea *area) } } /* we only saved what was used */ - soops->storeflag |= SO_TREESTORE_CLEANUP; // at first draw + soops->storeflag |= SO_TREESTORE_CLEANUP; // at first draw } soops->treehash = NULL; - soops->tree.first = soops->tree.last= NULL; + soops->tree.first = soops->tree.last = NULL; } else if (sl->spacetype == SPACE_IMAGE) { SpaceImage *sima = (SpaceImage *)sl; @@ -6864,7 +6879,7 @@ static void direct_link_area(FileData *fd, ScrArea *area) BLI_listbase_clear(&snode->linkdrag); } else if (sl->spacetype == SPACE_TEXT) { - SpaceText *st= (SpaceText *)sl; + SpaceText *st = (SpaceText *)sl; st->drawcache = NULL; st->scroll_accum[0] = 0.0f; @@ -6897,8 +6912,8 @@ static void direct_link_area(FileData *fd, ScrArea *area) else if (sl->spacetype == SPACE_BUTS) { SpaceButs *sbuts = (SpaceButs *)sl; - sbuts->path= NULL; - sbuts->texuser= NULL; + sbuts->path = NULL; + sbuts->texuser = NULL; sbuts->mainbo = sbuts->mainb; sbuts->mainbuser = sbuts->mainb; } @@ -6964,14 +6979,14 @@ static void lib_link_area(FileData *fd, ID *parent_id, ScrArea *area) memset(&area->runtime, 0x0, sizeof(area->runtime)); - for (SpaceLink *sl = area->spacedata.first; sl; sl= sl->next) { + for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) { switch (sl->spacetype) { case SPACE_VIEW3D: { - View3D *v3d = (View3D*) sl; + View3D *v3d = (View3D *)sl; - v3d->camera= newlibadr(fd, parent_id->lib, v3d->camera); - v3d->ob_centre= newlibadr(fd, parent_id->lib, v3d->ob_centre); + v3d->camera = newlibadr(fd, parent_id->lib, v3d->camera); + v3d->ob_centre = newlibadr(fd, parent_id->lib, v3d->ob_centre); if (v3d->localvd) { v3d->localvd->camera = newlibadr(fd, parent_id->lib, v3d->localvd->camera); @@ -7038,8 +7053,8 @@ static void lib_link_area(FileData *fd, ID *parent_id, ScrArea *area) } case SPACE_NLA: { - SpaceNla *snla= (SpaceNla *)sl; - bDopeSheet *ads= snla->ads; + SpaceNla *snla = (SpaceNla *)sl; + bDopeSheet *ads = snla->ads; if (ads) { ads->source = newlibadr(fd, parent_id->lib, ads->source); @@ -7049,9 +7064,9 @@ static void lib_link_area(FileData *fd, ID *parent_id, ScrArea *area) } case SPACE_TEXT: { - SpaceText *st= (SpaceText *)sl; + SpaceText *st = (SpaceText *)sl; - st->text= newlibadr(fd, parent_id->lib, st->text); + st->text = newlibadr(fd, parent_id->lib, st->text); break; } case SPACE_SCRIPT: @@ -7068,7 +7083,7 @@ static void lib_link_area(FileData *fd, ID *parent_id, ScrArea *area) } case SPACE_OUTLINER: { - SpaceOops *so= (SpaceOops *)sl; + SpaceOops *so = (SpaceOops *)sl; so->search_tse.id = newlibadr(fd, NULL, so->search_tse.id); if (so->treestore) { @@ -7572,7 +7587,7 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, Main } } else if (sl->spacetype == SPACE_OUTLINER) { - SpaceOops *so= (SpaceOops *)sl; + SpaceOops *so = (SpaceOops *)sl; so->search_tse.id = restore_pointer_by_name(id_map, so->search_tse.id, USER_IGNORE); @@ -7597,7 +7612,7 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, Main } } else if (sl->spacetype == SPACE_NODE) { - SpaceNode *snode= (SpaceNode *)sl; + SpaceNode *snode = (SpaceNode *)sl; bNodeTreePath *path, *path_next; bNodeTree *ntree; @@ -7614,7 +7629,7 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, Main path->nodetree = snode->nodetree; } else - path->nodetree= restore_pointer_by_name(id_map, (ID*)path->nodetree, USER_REAL); + path->nodetree = restore_pointer_by_name(id_map, (ID *)path->nodetree, USER_REAL); if (!path->nodetree) break; @@ -7703,7 +7718,7 @@ void blo_do_versions_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) { + if (ar->regiontype == RGN_TYPE_WINDOW && ar->regiondata == NULL) { RegionView3D *rv3d; rv3d = ar->regiondata = MEM_callocN(sizeof(RegionView3D), "region v3d patch"); @@ -7724,7 +7739,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc) { bool wrong_id = false; - sc->regionbase.first = sc->regionbase.last= NULL; + sc->regionbase.first = sc->regionbase.last = NULL; sc->context = NULL; sc->active_region = NULL; @@ -7803,7 +7818,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 @@ -7968,7 +7983,7 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip) MovieTracking *tracking = &clip->tracking; MovieTrackingObject *object; - clip->adt= newdataadr(fd, clip->adt); + clip->adt = newdataadr(fd, clip->adt); if (fd->movieclipmap) clip->cache = newmclipadr(fd, clip->cache); else clip->cache = NULL; @@ -8155,31 +8170,31 @@ static void lib_link_linestyle(FileData *fd, Main *main) for (m = linestyle->color_modifiers.first; m; m = m->next) { switch (m->type) { case LS_MODIFIER_DISTANCE_FROM_OBJECT: - { - LineStyleColorModifier_DistanceFromObject *cm = (LineStyleColorModifier_DistanceFromObject *)m; - cm->target = newlibadr(fd, linestyle->id.lib, cm->target); - } + { + LineStyleColorModifier_DistanceFromObject *cm = (LineStyleColorModifier_DistanceFromObject *)m; + cm->target = newlibadr(fd, linestyle->id.lib, cm->target); break; + } } } for (m = linestyle->alpha_modifiers.first; m; m = m->next) { switch (m->type) { case LS_MODIFIER_DISTANCE_FROM_OBJECT: - { - LineStyleAlphaModifier_DistanceFromObject *am = (LineStyleAlphaModifier_DistanceFromObject *)m; - am->target = newlibadr(fd, linestyle->id.lib, am->target); - } + { + LineStyleAlphaModifier_DistanceFromObject *am = (LineStyleAlphaModifier_DistanceFromObject *)m; + am->target = newlibadr(fd, linestyle->id.lib, am->target); break; + } } } for (m = linestyle->thickness_modifiers.first; m; m = m->next) { switch (m->type) { case LS_MODIFIER_DISTANCE_FROM_OBJECT: - { - LineStyleThicknessModifier_DistanceFromObject *tm = (LineStyleThicknessModifier_DistanceFromObject *)m; - tm->target = newlibadr(fd, linestyle->id.lib, tm->target); - } + { + LineStyleThicknessModifier_DistanceFromObject *tm = (LineStyleThicknessModifier_DistanceFromObject *)m; + tm->target = newlibadr(fd, linestyle->id.lib, tm->target); break; + } } } for (int a = 0; a < MAX_MTEX; a++) { @@ -8203,53 +8218,53 @@ static void direct_link_linestyle_color_modifier(FileData *fd, LineStyleModifier { switch (modifier->type) { case LS_MODIFIER_ALONG_STROKE: - { - LineStyleColorModifier_AlongStroke *m = (LineStyleColorModifier_AlongStroke *)modifier; - m->color_ramp = newdataadr(fd, m->color_ramp); - } + { + LineStyleColorModifier_AlongStroke *m = (LineStyleColorModifier_AlongStroke *)modifier; + m->color_ramp = newdataadr(fd, m->color_ramp); break; + } case LS_MODIFIER_DISTANCE_FROM_CAMERA: - { - LineStyleColorModifier_DistanceFromCamera *m = (LineStyleColorModifier_DistanceFromCamera *)modifier; - m->color_ramp = newdataadr(fd, m->color_ramp); - } + { + LineStyleColorModifier_DistanceFromCamera *m = (LineStyleColorModifier_DistanceFromCamera *)modifier; + m->color_ramp = newdataadr(fd, m->color_ramp); break; + } case LS_MODIFIER_DISTANCE_FROM_OBJECT: - { - LineStyleColorModifier_DistanceFromObject *m = (LineStyleColorModifier_DistanceFromObject *)modifier; - m->color_ramp = newdataadr(fd, m->color_ramp); - } + { + LineStyleColorModifier_DistanceFromObject *m = (LineStyleColorModifier_DistanceFromObject *)modifier; + m->color_ramp = newdataadr(fd, m->color_ramp); break; + } case LS_MODIFIER_MATERIAL: - { - LineStyleColorModifier_Material *m = (LineStyleColorModifier_Material *)modifier; - m->color_ramp = newdataadr(fd, m->color_ramp); - } + { + LineStyleColorModifier_Material *m = (LineStyleColorModifier_Material *)modifier; + m->color_ramp = newdataadr(fd, m->color_ramp); break; + } case LS_MODIFIER_TANGENT: - { - LineStyleColorModifier_Tangent *m = (LineStyleColorModifier_Tangent *)modifier; - m->color_ramp = newdataadr(fd, m->color_ramp); - } + { + LineStyleColorModifier_Tangent *m = (LineStyleColorModifier_Tangent *)modifier; + m->color_ramp = newdataadr(fd, m->color_ramp); break; + } case LS_MODIFIER_NOISE: - { - LineStyleColorModifier_Noise *m = (LineStyleColorModifier_Noise *)modifier; - m->color_ramp = newdataadr(fd, m->color_ramp); - } + { + LineStyleColorModifier_Noise *m = (LineStyleColorModifier_Noise *)modifier; + m->color_ramp = newdataadr(fd, m->color_ramp); break; + } case LS_MODIFIER_CREASE_ANGLE: - { - LineStyleColorModifier_CreaseAngle *m = (LineStyleColorModifier_CreaseAngle *)modifier; - m->color_ramp = newdataadr(fd, m->color_ramp); - } + { + LineStyleColorModifier_CreaseAngle *m = (LineStyleColorModifier_CreaseAngle *)modifier; + m->color_ramp = newdataadr(fd, m->color_ramp); break; + } case LS_MODIFIER_CURVATURE_3D: - { - LineStyleColorModifier_Curvature_3D *m = (LineStyleColorModifier_Curvature_3D *)modifier; - m->color_ramp = newdataadr(fd, m->color_ramp); - } + { + LineStyleColorModifier_Curvature_3D *m = (LineStyleColorModifier_Curvature_3D *)modifier; + m->color_ramp = newdataadr(fd, m->color_ramp); break; + } } } @@ -8257,61 +8272,61 @@ static void direct_link_linestyle_alpha_modifier(FileData *fd, LineStyleModifier { switch (modifier->type) { case LS_MODIFIER_ALONG_STROKE: - { - LineStyleAlphaModifier_AlongStroke *m = (LineStyleAlphaModifier_AlongStroke *)modifier; - m->curve = newdataadr(fd, m->curve); - direct_link_curvemapping(fd, m->curve); - } + { + LineStyleAlphaModifier_AlongStroke *m = (LineStyleAlphaModifier_AlongStroke *)modifier; + m->curve = newdataadr(fd, m->curve); + direct_link_curvemapping(fd, m->curve); break; + } case LS_MODIFIER_DISTANCE_FROM_CAMERA: - { - LineStyleAlphaModifier_DistanceFromCamera *m = (LineStyleAlphaModifier_DistanceFromCamera *)modifier; - m->curve = newdataadr(fd, m->curve); - direct_link_curvemapping(fd, m->curve); - } + { + LineStyleAlphaModifier_DistanceFromCamera *m = (LineStyleAlphaModifier_DistanceFromCamera *)modifier; + m->curve = newdataadr(fd, m->curve); + direct_link_curvemapping(fd, m->curve); break; + } case LS_MODIFIER_DISTANCE_FROM_OBJECT: - { - LineStyleAlphaModifier_DistanceFromObject *m = (LineStyleAlphaModifier_DistanceFromObject *)modifier; - m->curve = newdataadr(fd, m->curve); - direct_link_curvemapping(fd, m->curve); - } + { + LineStyleAlphaModifier_DistanceFromObject *m = (LineStyleAlphaModifier_DistanceFromObject *)modifier; + m->curve = newdataadr(fd, m->curve); + direct_link_curvemapping(fd, m->curve); break; + } case LS_MODIFIER_MATERIAL: - { - LineStyleAlphaModifier_Material *m = (LineStyleAlphaModifier_Material *)modifier; - m->curve = newdataadr(fd, m->curve); - direct_link_curvemapping(fd, m->curve); - } + { + LineStyleAlphaModifier_Material *m = (LineStyleAlphaModifier_Material *)modifier; + m->curve = newdataadr(fd, m->curve); + direct_link_curvemapping(fd, m->curve); break; + } case LS_MODIFIER_TANGENT: - { - LineStyleAlphaModifier_Tangent *m = (LineStyleAlphaModifier_Tangent *)modifier; - m->curve = newdataadr(fd, m->curve); - direct_link_curvemapping(fd, m->curve); - } + { + LineStyleAlphaModifier_Tangent *m = (LineStyleAlphaModifier_Tangent *)modifier; + m->curve = newdataadr(fd, m->curve); + direct_link_curvemapping(fd, m->curve); break; + } case LS_MODIFIER_NOISE: - { - LineStyleAlphaModifier_Noise *m = (LineStyleAlphaModifier_Noise *)modifier; - m->curve = newdataadr(fd, m->curve); - direct_link_curvemapping(fd, m->curve); - } + { + LineStyleAlphaModifier_Noise *m = (LineStyleAlphaModifier_Noise *)modifier; + m->curve = newdataadr(fd, m->curve); + direct_link_curvemapping(fd, m->curve); break; + } case LS_MODIFIER_CREASE_ANGLE: - { - LineStyleAlphaModifier_CreaseAngle *m = (LineStyleAlphaModifier_CreaseAngle *)modifier; - m->curve = newdataadr(fd, m->curve); - direct_link_curvemapping(fd, m->curve); - } + { + LineStyleAlphaModifier_CreaseAngle *m = (LineStyleAlphaModifier_CreaseAngle *)modifier; + m->curve = newdataadr(fd, m->curve); + direct_link_curvemapping(fd, m->curve); break; + } case LS_MODIFIER_CURVATURE_3D: - { - LineStyleAlphaModifier_Curvature_3D *m = (LineStyleAlphaModifier_Curvature_3D *)modifier; - m->curve = newdataadr(fd, m->curve); - direct_link_curvemapping(fd, m->curve); - } + { + LineStyleAlphaModifier_Curvature_3D *m = (LineStyleAlphaModifier_Curvature_3D *)modifier; + m->curve = newdataadr(fd, m->curve); + direct_link_curvemapping(fd, m->curve); break; + } } } @@ -8319,54 +8334,54 @@ static void direct_link_linestyle_thickness_modifier(FileData *fd, LineStyleModi { switch (modifier->type) { case LS_MODIFIER_ALONG_STROKE: - { - LineStyleThicknessModifier_AlongStroke *m = (LineStyleThicknessModifier_AlongStroke *)modifier; - m->curve = newdataadr(fd, m->curve); - direct_link_curvemapping(fd, m->curve); - } + { + LineStyleThicknessModifier_AlongStroke *m = (LineStyleThicknessModifier_AlongStroke *)modifier; + m->curve = newdataadr(fd, m->curve); + direct_link_curvemapping(fd, m->curve); break; + } case LS_MODIFIER_DISTANCE_FROM_CAMERA: - { - LineStyleThicknessModifier_DistanceFromCamera *m = (LineStyleThicknessModifier_DistanceFromCamera *)modifier; - m->curve = newdataadr(fd, m->curve); - direct_link_curvemapping(fd, m->curve); - } + { + LineStyleThicknessModifier_DistanceFromCamera *m = (LineStyleThicknessModifier_DistanceFromCamera *)modifier; + m->curve = newdataadr(fd, m->curve); + direct_link_curvemapping(fd, m->curve); break; + } case LS_MODIFIER_DISTANCE_FROM_OBJECT: - { - LineStyleThicknessModifier_DistanceFromObject *m = (LineStyleThicknessModifier_DistanceFromObject *)modifier; - m->curve = newdataadr(fd, m->curve); - direct_link_curvemapping(fd, m->curve); - } + { + LineStyleThicknessModifier_DistanceFromObject *m = (LineStyleThicknessModifier_DistanceFromObject *)modifier; + m->curve = newdataadr(fd, m->curve); + direct_link_curvemapping(fd, m->curve); break; + } case LS_MODIFIER_MATERIAL: - { - LineStyleThicknessModifier_Material *m = (LineStyleThicknessModifier_Material *)modifier; - m->curve = newdataadr(fd, m->curve); - direct_link_curvemapping(fd, m->curve); - } + { + LineStyleThicknessModifier_Material *m = (LineStyleThicknessModifier_Material *)modifier; + m->curve = newdataadr(fd, m->curve); + direct_link_curvemapping(fd, m->curve); break; + } case LS_MODIFIER_TANGENT: - { - LineStyleThicknessModifier_Tangent *m = (LineStyleThicknessModifier_Tangent *)modifier; - m->curve = newdataadr(fd, m->curve); - direct_link_curvemapping(fd, m->curve); - } + { + LineStyleThicknessModifier_Tangent *m = (LineStyleThicknessModifier_Tangent *)modifier; + m->curve = newdataadr(fd, m->curve); + direct_link_curvemapping(fd, m->curve); break; + } case LS_MODIFIER_CREASE_ANGLE: - { - LineStyleThicknessModifier_CreaseAngle *m = (LineStyleThicknessModifier_CreaseAngle *)modifier; - m->curve = newdataadr(fd, m->curve); - direct_link_curvemapping(fd, m->curve); - } + { + LineStyleThicknessModifier_CreaseAngle *m = (LineStyleThicknessModifier_CreaseAngle *)modifier; + m->curve = newdataadr(fd, m->curve); + direct_link_curvemapping(fd, m->curve); break; + } case LS_MODIFIER_CURVATURE_3D: - { - LineStyleThicknessModifier_Curvature_3D *m = (LineStyleThicknessModifier_Curvature_3D *)modifier; - m->curve = newdataadr(fd, m->curve); - direct_link_curvemapping(fd, m->curve); - } + { + LineStyleThicknessModifier_Curvature_3D *m = (LineStyleThicknessModifier_Curvature_3D *)modifier; + m->curve = newdataadr(fd, m->curve); + direct_link_curvemapping(fd, m->curve); break; + } } } @@ -8379,7 +8394,7 @@ static void direct_link_linestyle(FileData *fd, FreestyleLineStyle *linestyle) int a; LineStyleModifier *modifier; - linestyle->adt= newdataadr(fd, linestyle->adt); + linestyle->adt = newdataadr(fd, linestyle->adt); direct_link_animdata(fd, linestyle->adt); link_list(fd, &linestyle->color_modifiers); for (modifier = linestyle->color_modifiers.first; modifier; modifier = modifier->next) @@ -8454,13 +8469,13 @@ static BHead *read_data_into_oldnewmap(FileData *fd, BHead *bhead, const char *a { bhead = blo_nextbhead(fd, bhead); - while (bhead && bhead->code==DATA) { + while (bhead && bhead->code == DATA) { void *data; #if 0 /* XXX DUMB DEBUGGING OPTION TO GIVE NAMES for guarded malloc errors */ short *sp = fd->filesdna->structs[bhead->SDNAnr]; char *tmp = malloc(100); - allocname = fd->filesdna->types[ sp[0] ]; + allocname = fd->filesdna->types[sp[0]]; strcpy(tmp, allocname); data = read_struct(fd, bhead, tmp); #else @@ -8547,7 +8562,7 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short /* do after read_struct, for dna reconstruct */ lb = which_libbase(main, idcode); if (lb) { - oldnewmap_insert(fd->libmap, bhead->old, id, bhead->code); /* for ID_ID check */ + oldnewmap_insert(fd->libmap, bhead->old, id, bhead->code); /* for ID_ID check */ BLI_addtail(lb, id); } else { @@ -8662,19 +8677,19 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short direct_link_collection(fd, (Collection *)id); break; case ID_AR: - direct_link_armature(fd, (bArmature*)id); + direct_link_armature(fd, (bArmature *)id); break; case ID_AC: - direct_link_action(fd, (bAction*)id); + direct_link_action(fd, (bAction *)id); break; case ID_NT: - direct_link_nodetree(fd, (bNodeTree*)id); + direct_link_nodetree(fd, (bNodeTree *)id); break; case ID_BR: - direct_link_brush(fd, (Brush*)id); + direct_link_brush(fd, (Brush *)id); break; case ID_PA: - direct_link_particlesettings(fd, (ParticleSettings*)id); + direct_link_particlesettings(fd, (ParticleSettings *)id); break; case ID_GD: direct_link_gpencil(fd, (bGPdata *)id); @@ -8732,7 +8747,7 @@ static BHead *read_global(BlendFileData *bfd, FileData *fd, BHead *bhead) /* error in 2.65 and older: main->name was not set if you save from startup (not after loading file) */ if (bfd->filename[0] == 0) { if (fd->fileversion < 265 || (fd->fileversion == 265 && fg->subversion < 1)) - if ((G.fileflags & G_FILE_RECOVER)==0) + if ((G.fileflags & G_FILE_RECOVER) == 0) BLI_strncpy(bfd->filename, BKE_main_blendfile_path(bfd->main), sizeof(bfd->filename)); /* early 2.50 version patch - filename not in FileGlobal struct at all */ @@ -8912,7 +8927,7 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead) wmKeyMapDiffItem *kmdi; bAddon *addon; - bfd->user = user= read_struct(fd, bhead, "user def"); + bfd->user = user = read_struct(fd, bhead, "user def"); /* User struct has separate do-version handling */ user->versionfile = bfd->main->versionfile; @@ -8928,17 +8943,17 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead) link_list(fd, &user->addons); link_list(fd, &user->autoexec_paths); - for (keymap=user->user_keymaps.first; keymap; keymap=keymap->next) { - keymap->modal_items= NULL; + for (keymap = user->user_keymaps.first; keymap; keymap = keymap->next) { + keymap->modal_items = NULL; keymap->poll = NULL; keymap->flag &= ~KEYMAP_UPDATE; link_list(fd, &keymap->diff_items); link_list(fd, &keymap->items); - 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); + 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) direct_link_keymapitem(fd, kmdi->remove_item); @@ -8946,7 +8961,7 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead) 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); } @@ -8972,7 +8987,7 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead) } // XXX - user->uifonts.first = user->uifonts.last= NULL; + user->uifonts.first = user->uifonts.last = NULL; link_list(fd, &user->uistyles); @@ -9059,7 +9074,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) bhead = read_libblock(fd, mainlist.last, bhead, LIB_TAG_READ | LIB_TAG_EXTERN, NULL); } break; - /* in 2.50+ files, the file identifier for screens is patched, forward compatibility */ + /* in 2.50+ files, the file identifier for screens is patched, forward compatibility */ case ID_SCRN: bhead->code = ID_SCR; /* pass on to default */ @@ -9110,7 +9125,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) lib_verify_nodetree(bfd->main, true); fix_relpaths_library(fd->relabase, bfd->main); /* make all relative paths, relative to the open blend file */ - link_global(fd, bfd); /* as last */ + link_global(fd, bfd); /* as last */ fd->mainlist = NULL; /* Safety, this is local variable, shall not be used afterward. */ @@ -9126,7 +9141,7 @@ struct BHeadSort { static int verg_bheadsort(const void *v1, const void *v2) { - const struct BHeadSort *x1=v1, *x2=v2; + const struct BHeadSort *x1 = v1, *x2 = v2; if (x1->old > x2->old) return 1; else if (x1->old < x2->old) return -1; @@ -9189,7 +9204,7 @@ static BHead *find_bhead(FileData *fd, void *old) return bhs->bhead; #if 0 - for (bhead = blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) { + for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) { if (bhead->old == old) return bhead; } @@ -9239,7 +9254,7 @@ static BHead *find_bhead_from_idname(FileData *fd, const char *idname) static ID *is_yet_read(FileData *fd, Main *mainvar, BHead *bhead) { - const char *idname= bhead_id_name(fd, bhead); + const char *idname = bhead_id_name(fd, bhead); /* which_libbase can be NULL, intentionally not using idname+2 */ return BLI_findstring(which_libbase(mainvar, GS(idname)), idname, offsetof(ID, name)); } @@ -9254,14 +9269,14 @@ static void expand_doit_library(void *fdhandle, Main *mainvar, void *old) if (bhead) { /* from another library? */ if (bhead->code == ID_ID) { - BHead *bheadlib= find_previous_lib(fd, bhead); + BHead *bheadlib = find_previous_lib(fd, bhead); if (bheadlib) { Library *lib = read_struct(fd, bheadlib, "Library"); Main *ptr = blo_find_main(fd, lib->name, fd->relabase); if (ptr->curlib == NULL) { - const char *idname= bhead_id_name(fd, bhead); + const char *idname = bhead_id_name(fd, bhead); blo_reportf_wrap(fd->reports, RPT_WARNING, TIP_("LIB: Data refers to main .blend file: '%s' from %s"), idname, mainvar->curlib->filepath); @@ -9430,7 +9445,7 @@ static void expand_action(FileData *fd, Main *mainvar, bAction *act) bActionChannel *chan; // XXX deprecated - old animation system -------------- - for (chan=act->chanbase.first; chan; chan=chan->next) { + for (chan = act->chanbase.first; chan; chan = chan->next) { expand_doit(fd, mainvar, chan->ipo); expand_constraint_channels(fd, mainvar, &chan->constraintChannels); } @@ -9463,7 +9478,7 @@ static void expand_animdata_nlastrips(FileData *fd, Main *mainvar, ListBase *lis { NlaStrip *strip; - for (strip= list->first; strip; strip= strip->next) { + for (strip = list->first; strip; strip = strip->next) { /* check child strips */ expand_animdata_nlastrips(fd, mainvar, &strip->strips); @@ -9793,7 +9808,7 @@ static void expand_armature(FileData *fd, Main *mainvar, bArmature *arm) static void expand_object_expandModifiers( void *userData, Object *UNUSED(ob), ID **idpoin, int UNUSED(cb_flag)) { - struct { FileData *fd; Main *mainvar; } *data= userData; + struct { FileData *fd; Main *mainvar; } *data = userData; FileData *fd = data->fd; Main *mainvar = data->mainvar; @@ -9849,7 +9864,7 @@ 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); @@ -9975,7 +9990,7 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce) if (sce->ed) { Sequence *seq; - SEQ_BEGIN (sce->ed, seq) + SEQ_BEGIN(sce->ed, seq) { expand_idprops(fd, mainvar, seq->prop); @@ -10290,7 +10305,7 @@ static bool object_in_any_scene(Main *bmain, Object *ob) } static Collection *get_collection_active( - Main *bmain, Scene *scene, ViewLayer *view_layer, const int flag) + Main *bmain, Scene *scene, ViewLayer *view_layer, const int flag) { if (flag & FILE_ACTIVE_COLLECTION) { LayerCollection *lc = BKE_layer_collection_get_active(view_layer); @@ -10529,7 +10544,7 @@ static ID *link_named_part_ex( { ID *id = link_named_part(mainl, fd, idcode, name, flag); - if (id && (GS(id->name) == ID_OB)) { /* loose object: give a base */ + if (id && (GS(id->name) == ID_OB)) { /* loose object: give a base */ link_object_postprocess(id, bmain, scene, view_layer, flag); } else if (id && (GS(id->name) == ID_GR)) { @@ -10551,7 +10566,7 @@ static ID *link_named_part_ex( */ ID *BLO_library_link_named_part(Main *mainl, BlendHandle **bh, const short idcode, const char *name) { - FileData *fd = (FileData*)(*bh); + FileData *fd = (FileData *)(*bh); return link_named_part(mainl, fd, idcode, name, 0); } @@ -10573,7 +10588,7 @@ ID *BLO_library_link_named_part_ex( const short idcode, const char *name, const int flag, Main *bmain, Scene *scene, ViewLayer *view_layer) { - FileData *fd = (FileData*)(*bh); + FileData *fd = (FileData *)(*bh); return link_named_part_ex(mainl, fd, idcode, name, flag, bmain, scene, view_layer); } @@ -10656,7 +10671,7 @@ static Main *library_link_begin(Main *mainvar, FileData **fd, const char *filepa */ Main *BLO_library_link_begin(Main *mainvar, BlendHandle **bh, const char *filepath) { - FileData *fd = (FileData*)(*bh); + FileData *fd = (FileData *)(*bh); return library_link_begin(mainvar, &fd, filepath); } @@ -10776,9 +10791,9 @@ static void library_link_end(Main *mainl, FileData **fd, const short flag, Main */ void BLO_library_link_end(Main *mainl, BlendHandle **bh, int flag, Main *bmain, Scene *scene, ViewLayer *view_layer) { - FileData *fd = (FileData*)(*bh); + FileData *fd = (FileData *)(*bh); library_link_end(mainl, &fd, flag, bmain, scene, view_layer); - *bh = (BlendHandle*)fd; + *bh = (BlendHandle *)fd; } void *BLO_library_read_struct(FileData *fd, BHead *bh, const char *blockname) @@ -10822,7 +10837,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) do_it = false; /* test 1: read libdata */ - mainptr= mainl->next; + mainptr = mainl->next; while (mainptr) { if (mainvar_id_tag_any_check(mainptr, LIB_TAG_READ)) { // printf("found LIB_TAG_READ %s (%s)\n", mainptr->curlib->id.name, mainptr->curlib->name); @@ -10895,7 +10910,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) fd->libmap = oldnewmap_new(); mainptr->curlib->filedata = fd; - mainptr->versionfile= fd->fileversion; + mainptr->versionfile = fd->fileversion; /* subversion */ read_file_version(fd, mainptr); diff --git a/source/blender/blenloader/intern/undofile.c b/source/blender/blenloader/intern/undofile.c index 5ceab1ca2cc..8ee40da13c7 100644 --- a/source/blender/blenloader/intern/undofile.c +++ b/source/blender/blenloader/intern/undofile.c @@ -98,7 +98,7 @@ void BLO_memfile_merge(MemFile *first, MemFile *second) } void memfile_chunk_add( - MemFile *memfile, const char *buf, unsigned int size, + MemFile *memfile, const char *buf, uint size, MemFileChunk **compchunk_step) { MemFileChunk *curchunk = MEM_mallocN(sizeof(MemFileChunk), "MemFileChunk"); diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c index ff56875e8fd..d9c0bd8a927 100644 --- a/source/blender/blenloader/intern/versioning_250.c +++ b/source/blender/blenloader/intern/versioning_250.c @@ -106,11 +106,11 @@ static void area_add_header_region(ScrArea *sa, ListBase *lb) /* initialize view2d data for header region, to allow panning */ /* is copy from ui_view2d.c */ - ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_LIMITZOOM|V2D_KEEPASPECT); + ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT); ar->v2d.keepofs = V2D_LOCKOFS_Y; ar->v2d.keeptot = V2D_KEEPTOT_STRICT; - ar->v2d.align = V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y; - ar->v2d.flag = (V2D_PIXELOFS_X|V2D_PIXELOFS_Y); + ar->v2d.align = V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y; + ar->v2d.flag = (V2D_PIXELOFS_X | V2D_PIXELOFS_Y); } static void sequencer_init_preview_region(ARegion *ar) @@ -149,7 +149,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb) BLI_addtail(lb, ar); ar->regiontype = RGN_TYPE_CHANNELS; ar->alignment = RGN_ALIGN_LEFT; - ar->v2d.scroll = (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM); + ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM); /* for some reason, this doesn't seem to go auto like for NLA... */ ar = MEM_callocN(sizeof(ARegion), "area region from do_versions"); @@ -191,7 +191,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb) BLI_addtail(lb, ar); ar->regiontype = RGN_TYPE_UI; ar->alignment = RGN_ALIGN_LEFT; - ar->v2d.scroll = (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM); + ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM); ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL; /* temporarily hide it */ ar->flag = RGN_FLAG_HIDDEN; @@ -208,7 +208,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb) ar->alignment = RGN_ALIGN_TOP; break; case SPACE_SEQ: - ar_main = (ARegion*) lb->first; + ar_main = (ARegion *)lb->first; for (; ar_main; ar_main = ar_main->next) { if (ar_main->regiontype == RGN_TYPE_WINDOW) break; @@ -231,7 +231,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb) BLI_addtail(lb, ar); ar->regiontype = RGN_TYPE_TOOL_PROPS; - ar->alignment = RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV; + ar->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV; ar->flag = RGN_FLAG_HIDDEN; /* buttons/list view */ @@ -271,132 +271,132 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb) break; case SPACE_OUTLINER: - { - SpaceOops *soops = (SpaceOops *)sl; + { + SpaceOops *soops = (SpaceOops *)sl; - memcpy(&ar->v2d, &soops->v2d, sizeof(View2D)); + memcpy(&ar->v2d, &soops->v2d, sizeof(View2D)); - ar->v2d.scroll &= ~V2D_SCROLL_LEFT; - ar->v2d.scroll |= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM); - ar->v2d.align = (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y); - ar->v2d.keepzoom |= (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_KEEPASPECT); - ar->v2d.keeptot = V2D_KEEPTOT_STRICT; - ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f; - //ar->v2d.flag |= V2D_IS_INITIALISED; - } + ar->v2d.scroll &= ~V2D_SCROLL_LEFT; + ar->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM); + ar->v2d.align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y); + ar->v2d.keepzoom |= (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_KEEPASPECT); + ar->v2d.keeptot = V2D_KEEPTOT_STRICT; + ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f; + //ar->v2d.flag |= V2D_IS_INITIALISED; break; + } case SPACE_IPO: - { - SpaceIpo *sipo = (SpaceIpo *)sl; - memcpy(&ar->v2d, &sipo->v2d, sizeof(View2D)); + { + SpaceIpo *sipo = (SpaceIpo *)sl; + memcpy(&ar->v2d, &sipo->v2d, sizeof(View2D)); - /* init mainarea view2d */ - ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL); - ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL); + /* init mainarea view2d */ + ar->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL); + ar->v2d.scroll |= (V2D_SCROLL_LEFT | V2D_SCROLL_SCALE_VERTICAL); - ar->v2d.min[0] = FLT_MIN; - ar->v2d.min[1] = FLT_MIN; + ar->v2d.min[0] = FLT_MIN; + ar->v2d.min[1] = FLT_MIN; - ar->v2d.max[0] = MAXFRAMEF; - ar->v2d.max[1] = FLT_MAX; + ar->v2d.max[0] = MAXFRAMEF; + ar->v2d.max[1] = FLT_MAX; - //ar->v2d.flag |= V2D_IS_INITIALISED; - break; - } + //ar->v2d.flag |= V2D_IS_INITIALISED; + break; + } case SPACE_NLA: - { - SpaceNla *snla = (SpaceNla *)sl; - memcpy(&ar->v2d, &snla->v2d, sizeof(View2D)); + { + SpaceNla *snla = (SpaceNla *)sl; + memcpy(&ar->v2d, &snla->v2d, sizeof(View2D)); - ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f; - ar->v2d.tot.ymax = 0.0f; + ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f; + ar->v2d.tot.ymax = 0.0f; - ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL); - ar->v2d.scroll |= (V2D_SCROLL_RIGHT); - ar->v2d.align = V2D_ALIGN_NO_POS_Y; - ar->v2d.flag |= V2D_VIEWSYNC_AREA_VERTICAL; - break; - } + ar->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL); + ar->v2d.scroll |= (V2D_SCROLL_RIGHT); + ar->v2d.align = V2D_ALIGN_NO_POS_Y; + ar->v2d.flag |= V2D_VIEWSYNC_AREA_VERTICAL; + break; + } case SPACE_ACTION: - { - SpaceAction *saction = (SpaceAction *) sl; - - /* we totally reinit the view for the Action Editor, as some old instances had some weird cruft set */ - ar->v2d.tot.xmin = -20.0f; - ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f; - ar->v2d.tot.xmax = (float)((sa->winx > 120) ? (sa->winx) : 120); - ar->v2d.tot.ymax = 0.0f; - - ar->v2d.cur = ar->v2d.tot; - - ar->v2d.min[0] = 0.0f; - ar->v2d.min[1] = 0.0f; - - ar->v2d.max[0] = MAXFRAMEF; - ar->v2d.max[1] = FLT_MAX; - - ar->v2d.minzoom = 0.01f; - ar->v2d.maxzoom = 50; - ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL); - ar->v2d.scroll |= (V2D_SCROLL_RIGHT); - ar->v2d.keepzoom = V2D_LOCKZOOM_Y; - ar->v2d.align = V2D_ALIGN_NO_POS_Y; - ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL; - - /* for old files with ShapeKey editors open + an action set, clear the action as - * it doesn't make sense in the new system (i.e. violates concept that ShapeKey edit - * only shows ShapeKey-rooted actions only) - */ - if (saction->mode == SACTCONT_SHAPEKEY) - saction->action = NULL; - break; - } + { + SpaceAction *saction = (SpaceAction *)sl; + + /* we totally reinit the view for the Action Editor, as some old instances had some weird cruft set */ + ar->v2d.tot.xmin = -20.0f; + ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f; + ar->v2d.tot.xmax = (float)((sa->winx > 120) ? (sa->winx) : 120); + ar->v2d.tot.ymax = 0.0f; + + ar->v2d.cur = ar->v2d.tot; + + ar->v2d.min[0] = 0.0f; + ar->v2d.min[1] = 0.0f; + + ar->v2d.max[0] = MAXFRAMEF; + ar->v2d.max[1] = FLT_MAX; + + ar->v2d.minzoom = 0.01f; + ar->v2d.maxzoom = 50; + ar->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL); + ar->v2d.scroll |= (V2D_SCROLL_RIGHT); + ar->v2d.keepzoom = V2D_LOCKZOOM_Y; + ar->v2d.align = V2D_ALIGN_NO_POS_Y; + ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL; + + /* for old files with ShapeKey editors open + an action set, clear the action as + * it doesn't make sense in the new system (i.e. violates concept that ShapeKey edit + * only shows ShapeKey-rooted actions only) + */ + if (saction->mode == SACTCONT_SHAPEKEY) + saction->action = NULL; + break; + } case SPACE_SEQ: - { - SpaceSeq *sseq = (SpaceSeq *)sl; - memcpy(&ar->v2d, &sseq->v2d, sizeof(View2D)); + { + SpaceSeq *sseq = (SpaceSeq *)sl; + memcpy(&ar->v2d, &sseq->v2d, sizeof(View2D)); - ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL); - ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL); - ar->v2d.align = V2D_ALIGN_NO_NEG_Y; - ar->v2d.flag |= V2D_IS_INITIALISED; - break; - } + ar->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL); + ar->v2d.scroll |= (V2D_SCROLL_LEFT | V2D_SCROLL_SCALE_VERTICAL); + ar->v2d.align = V2D_ALIGN_NO_NEG_Y; + ar->v2d.flag |= V2D_IS_INITIALISED; + break; + } case SPACE_NODE: - { - SpaceNode *snode = (SpaceNode *)sl; - memcpy(&ar->v2d, &snode->v2d, sizeof(View2D)); + { + SpaceNode *snode = (SpaceNode *)sl; + memcpy(&ar->v2d, &snode->v2d, sizeof(View2D)); - ar->v2d.scroll = (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM); - ar->v2d.keepzoom = V2D_LIMITZOOM|V2D_KEEPASPECT; - break; - } + ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM); + ar->v2d.keepzoom = V2D_LIMITZOOM | V2D_KEEPASPECT; + break; + } case SPACE_BUTS: - { - SpaceButs *sbuts = (SpaceButs *)sl; - memcpy(&ar->v2d, &sbuts->v2d, sizeof(View2D)); + { + SpaceButs *sbuts = (SpaceButs *)sl; + memcpy(&ar->v2d, &sbuts->v2d, sizeof(View2D)); - ar->v2d.scroll |= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM); - break; - } + ar->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM); + break; + } case SPACE_FILE: - { - // SpaceFile *sfile = (SpaceFile *)sl; - ar->v2d.tot.xmin = ar->v2d.tot.ymin = 0; - ar->v2d.tot.xmax = ar->winx; - ar->v2d.tot.ymax = ar->winy; - ar->v2d.cur = ar->v2d.tot; - ar->regiontype = RGN_TYPE_WINDOW; - ar->v2d.scroll = (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM); - ar->v2d.align = (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y); - ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_LIMITZOOM|V2D_KEEPASPECT); - break; - } + { + // SpaceFile *sfile = (SpaceFile *)sl; + ar->v2d.tot.xmin = ar->v2d.tot.ymin = 0; + ar->v2d.tot.xmax = ar->winx; + ar->v2d.tot.ymax = ar->winy; + ar->v2d.cur = ar->v2d.tot; + ar->regiontype = RGN_TYPE_WINDOW; + ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM); + ar->v2d.align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y); + ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT); + break; + } case SPACE_TEXT: - { - SpaceText *st = (SpaceText *)sl; - st->flags |= ST_FIND_WRAP; - } + { + SpaceText *st = (SpaceText *)sl; + st->flags |= ST_FIND_WRAP; + } //case SPACE_XXX: // FIXME... add other ones // memcpy(&ar->v2d, &((SpaceXxx *)sl)->v2d, sizeof(View2D)); // break; @@ -420,13 +420,13 @@ static void do_versions_windowmanager_2_50(bScreen *screen) /* space imageselect is deprecated */ for (sl = sa->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_IMASEL) - sl->spacetype = SPACE_EMPTY; /* spacedata then matches */ + 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) - sl->spacetype = SPACE_EMPTY; /* spacedata then matches */ + sl->spacetype = SPACE_EMPTY; /* spacedata then matches */ } /* pushed back spaces also need regions! */ @@ -446,7 +446,7 @@ static void versions_gpencil_add_main(ListBase *lb, ID *id, const char *name) BLI_addtail(lb, id); id->us = 1; id->flag = LIB_FAKEUSER; - *( (short *)id->name )= ID_GD; + *( (short *)id->name) = ID_GD; new_id(lb, id, name); /* alphabetic insertion: is in new_id */ @@ -464,29 +464,29 @@ static void do_versions_gpencil_2_50(Main *main, bScreen *screen) 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; + View3D *v3d = (View3D *)sl; 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; + SpaceNode *snode = (SpaceNode *)sl; 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; + SpaceSeq *sseq = (SpaceSeq *)sl; if (sseq->gpd) { versions_gpencil_add_main(&main->gpencil, (ID *)sseq->gpd, "GPencil Node"); sseq->gpd = NULL; } } else if (sl->spacetype == SPACE_IMAGE) { - SpaceImage *sima = (SpaceImage *) sl; -#if 0 /* see comment on r28002 */ + SpaceImage *sima = (SpaceImage *)sl; +#if 0 /* see comment on r28002 */ if (sima->gpd) { versions_gpencil_add_main(&main->gpencil, (ID *)sima->gpd, "GPencil Image"); sima->gpd = NULL; @@ -508,7 +508,7 @@ static void do_version_mdef_250(Main *main) 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; + mmd = (MeshDeformModifierData *)md; if (mmd->bindcos) { /* make bindcos NULL in order to trick older versions @@ -577,14 +577,14 @@ static bNodeSocket *do_versions_node_group_add_socket_2_56_2(bNodeTree *ngroup, gsock->link = NULL; /* assign new unique index */ gsock->own_index = ngroup->cur_index++; - gsock->limit = (in_out==SOCK_IN ? 0xFFF : 1); + gsock->limit = (in_out == SOCK_IN ? 0xFFF : 1); // if (stype->value_structsize > 0) // gsock->default_value = MEM_callocN(stype->value_structsize, "default socket value"); - BLI_addtail(in_out==SOCK_IN ? &ngroup->inputs : &ngroup->outputs, gsock); + BLI_addtail(in_out == SOCK_IN ? &ngroup->inputs : &ngroup->outputs, gsock); - ngroup->update |= (in_out==SOCK_IN ? NTREE_UPDATE_GROUP_IN : NTREE_UPDATE_GROUP_OUT); + ngroup->update |= (in_out == SOCK_IN ? NTREE_UPDATE_GROUP_IN : NTREE_UPDATE_GROUP_OUT); return gsock; } @@ -657,7 +657,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) for (scene = bmain->scene.first; scene; scene = scene->id.next) { if (scene->ed && scene->ed->seqbasep) { - SEQ_BEGIN (scene->ed, seq) + SEQ_BEGIN(scene->ed, seq) { if (seq->type == SEQ_TYPE_SOUND_HD) { char str[FILE_MAX]; @@ -669,7 +669,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) #define SEQ_USE_PROXY_CUSTOM_FILE (1 << 21) /* 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) && - !(seq->flag & SEQ_USE_PROXY_CUSTOM_DIR)) + !(seq->flag & SEQ_USE_PROXY_CUSTOM_DIR)) { BLI_snprintf(seq->strip->proxy->dir, FILE_MAXDIR, "%s/BL_proxy", seq->strip->dir); } @@ -813,7 +813,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) ob->matbits = MEM_calloc_arrayN(ob->totcol, sizeof(char), "ob->matbits"); for (a = 0; a < ob->totcol; a++) - ob->matbits[a] = (ob->colbits & (1<matbits[a] = (ob->colbits & (1 << a)) != 0; } } @@ -862,7 +862,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) for (ob = bmain->object.first; ob; ob = ob->id.next) { /* fluid-sim stuff */ - FluidsimModifierData *fluidmd = (FluidsimModifierData *) modifiers_findByType(ob, eModifierType_Fluidsim); + FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim); if (fluidmd) fluidmd->fss->fmd = fluidmd; @@ -896,7 +896,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) /* Assign proper global gravity weights for dynamics (only z-coordinate is taken into account) */ if (do_gravity) { for (part = bmain->particle.first; part; part = part->id.next) - part->effector_weights->global_gravity = part->acc[2]/-9.81f; + part->effector_weights->global_gravity = part->acc[2] / -9.81f; } for (ob = bmain->object.first; ob; ob = ob->id.next) { @@ -904,13 +904,13 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) if (do_gravity) { for (md = ob->modifiers.first; md; md = md->next) { - ClothModifierData *clmd = (ClothModifierData *) modifiers_findByType(ob, eModifierType_Cloth); + ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth); if (clmd) - clmd->sim_parms->effector_weights->global_gravity = clmd->sim_parms->gravity[2]/-9.81f; + clmd->sim_parms->effector_weights->global_gravity = clmd->sim_parms->gravity[2] / -9.81f; } if (ob->soft) - ob->soft->effector_weights->global_gravity = ob->soft->grav/9.81f; + ob->soft->effector_weights->global_gravity = ob->soft->grav / 9.81f; } /* Normal wind shape is plane */ @@ -974,7 +974,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) for (lt = bmain->latt.first; lt; lt = lt->id.next) { if ((key = blo_do_versions_newlibadr(fd, lib, lt->key)) && key->refkey) { data = key->refkey->data; - tot = MIN2(lt->pntsu*lt->pntsv*lt->pntsw, key->refkey->totelem); + tot = MIN2(lt->pntsu * lt->pntsv * lt->pntsw, key->refkey->totelem); for (a = 0; a < tot; a++, data += 3) copy_v3_v3(lt->def[a].vec, data); @@ -990,16 +990,16 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) BezTriple *bezt = nu->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; + 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) { 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++; } @@ -1054,7 +1054,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) 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; + View3D *v3d = (View3D *)sl; if (v3d->drawtype == OB_MATERIAL) v3d->drawtype = OB_SOLID; } @@ -1117,7 +1117,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) multires_load_old_250(me); for (ob = bmain->object.first; ob; ob = ob->id.next) { - MultiresModifierData *mmd = (MultiresModifierData *) modifiers_findByType(ob, eModifierType_Multires); + MultiresModifierData *mmd = (MultiresModifierData *)modifiers_findByType(ob, eModifierType_Multires); if (mmd) { mmd->totlvl--; @@ -1211,7 +1211,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) if (sseq->mainb == 0) sseq->mainb = SEQ_DRAW_IMG_IMBUF; - ar_main = (ARegion*)regionbase->first; + ar_main = (ARegion *)regionbase->first; for (; ar_main; ar_main = ar_main->next) { if (ar_main->regiontype == RGN_TYPE_WINDOW) break; @@ -1356,7 +1356,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) regionbase = &sl->regionbase; if (ELEM(sl->spacetype, SPACE_ACTION, SPACE_NLA)) { - for (ar = (ARegion*) regionbase->first; ar; ar = ar->next) { + for (ar = (ARegion *)regionbase->first; ar; ar = ar->next) { if (ar->regiontype == RGN_TYPE_WINDOW) { ar->v2d.cur.ymax = ar->v2d.tot.ymax = 0.0f; ar->v2d.cur.ymin = ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f; @@ -1386,7 +1386,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) if ((sce->r.ffcodecdata.flags & FFMPEG_MULTIPLEX_AUDIO) == 0) sce->r.ffcodecdata.audio_codec = 0x0; // CODEC_ID_NONE - SEQ_BEGIN (sce->ed, seq) + SEQ_BEGIN(sce->ed, seq) { seq->volume = 1.0f; } @@ -1422,7 +1422,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) regionbase = &sl->regionbase; } - ar_preview = (ARegion*) regionbase->first; + ar_preview = (ARegion *)regionbase->first; for (; ar_preview; ar_preview = ar_preview->next) { if (ar_preview->regiontype == RGN_TYPE_PREVIEW) break; @@ -1437,7 +1437,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) } /* sequencer changes */ } - if (bmain->versionfile <= 251) { /* 2.5.1 had no subversions */ + if (bmain->versionfile <= 251) { /* 2.5.1 had no subversions */ bScreen *sc; /* Blender 2.5.2 - subversion 0 introduced a new setting: V3D_RENDER_OVERRIDE. @@ -1474,7 +1474,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) ModifierData *md; for (md = ob->modifiers.first; md; md = md->next) { if (md->type == eModifierType_Fluidsim) { - FluidsimModifierData *fmd = (FluidsimModifierData *) md; + FluidsimModifierData *fmd = (FluidsimModifierData *)md; fmd->fss->flag |= OB_FLUIDSIM_ACTIVE; fmd->fss->flag |= OB_FLUIDSIM_OVERRIDE_TIME; } @@ -1488,7 +1488,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) while (node) { if (node->type == CMP_NODE_COLORBALANCE) { - NodeColorBalance *n = (NodeColorBalance *) node->storage; + NodeColorBalance *n = (NodeColorBalance *)node->storage; n->lift[0] += 1.f; n->lift[1] += 1.f; n->lift[2] += 1.f; @@ -1503,7 +1503,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) while (node) { if (node->type == CMP_NODE_COLORBALANCE) { - NodeColorBalance *n = (NodeColorBalance *) node->storage; + NodeColorBalance *n = (NodeColorBalance *)node->storage; n->lift[0] += 1.f; n->lift[1] += 1.f; n->lift[2] += 1.f; @@ -1534,7 +1534,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) for (sl = sa->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_IMAGE) { - SpaceImage *sima = (SpaceImage *) sl; + SpaceImage *sima = (SpaceImage *)sl; scopes_new(&sima->scopes); } } @@ -1556,7 +1556,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) for (sl = sa->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_NODE) { - SpaceNode *snode = (SpaceNode *) sl; + SpaceNode *snode = (SpaceNode *)sl; ListBase *regionbase; ARegion *ar; @@ -1588,32 +1588,32 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) /* parent type to modifier */ for (ob = bmain->object.first; ob; ob = ob->id.next) { if (ob->parent) { - Object *parent = (Object *) blo_do_versions_newlibadr(fd, lib, ob->parent); + Object *parent = (Object *)blo_do_versions_newlibadr(fd, lib, ob->parent); if (parent) { /* parent may not be in group */ if (parent->type == OB_ARMATURE && ob->partype == PARSKEL) { ArmatureModifierData *amd; - bArmature *arm = (bArmature *) blo_do_versions_newlibadr(fd, lib, parent->data); + bArmature *arm = (bArmature *)blo_do_versions_newlibadr(fd, lib, parent->data); - amd = (ArmatureModifierData*) modifier_new(eModifierType_Armature); + amd = (ArmatureModifierData *)modifier_new(eModifierType_Armature); amd->object = ob->parent; - BLI_addtail((ListBase*)&ob->modifiers, amd); + BLI_addtail((ListBase *)&ob->modifiers, amd); amd->deformflag = arm->deformflag; ob->partype = PAROBJECT; } else if (parent->type == OB_LATTICE && ob->partype == PARSKEL) { LatticeModifierData *lmd; - lmd = (LatticeModifierData*) modifier_new(eModifierType_Lattice); + lmd = (LatticeModifierData *)modifier_new(eModifierType_Lattice); lmd->object = ob->parent; - BLI_addtail((ListBase*)&ob->modifiers, lmd); + BLI_addtail((ListBase *)&ob->modifiers, lmd); ob->partype = PAROBJECT; } else if (parent->type == OB_CURVE && ob->partype == PARCURVE) { CurveModifierData *cmd; - cmd = (CurveModifierData*) modifier_new(eModifierType_Curve); + cmd = (CurveModifierData *)modifier_new(eModifierType_Curve); cmd->object = ob->parent; - BLI_addtail((ListBase*)&ob->modifiers, cmd); + BLI_addtail((ListBase *)&ob->modifiers, cmd); ob->partype = PAROBJECT; } } @@ -1624,8 +1624,8 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) for (scene = bmain->scene.first; scene; scene = scene->id.next) { int i; for (i = 0; i < 20; i++) { - if (scene->lay & (1<layact = 1<lay & (1 << i)) { + scene->layact = 1 << i; break; } } @@ -1648,7 +1648,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) for (scene = bmain->scene.first; scene; scene = scene->id.next) { if (scene) { Sequence *seq; - SEQ_BEGIN (scene->ed, seq) + SEQ_BEGIN(scene->ed, seq) { if (seq->sat == 0.0f) { seq->sat = 1.0f; @@ -1710,11 +1710,11 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) /* spacing was originally in pixels, convert it to percentage for new version * size should not be zero due to sanity check above */ - brush->spacing = (int)(100 * ((float)brush->spacing) / ((float) brush->size)); + brush->spacing = (int)(100 * ((float)brush->spacing) / ((float)brush->size)); if (brush->add_col[0] == 0 && - brush->add_col[1] == 0 && - brush->add_col[2] == 0) + brush->add_col[1] == 0 && + brush->add_col[2] == 0) { brush->add_col[0] = 1.00f; brush->add_col[1] = 0.39f; @@ -1722,8 +1722,8 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) } if (brush->sub_col[0] == 0 && - brush->sub_col[1] == 0 && - brush->sub_col[2] == 0) + brush->sub_col[1] == 0 && + brush->sub_col[2] == 0) { brush->sub_col[0] = 0.39f; brush->sub_col[1] = 0.39f; @@ -1762,11 +1762,11 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) 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 */ - smd->domain->flags &= ~(1<<4); + smd->domain->flags &= ~(1 << 4); /* for now just add it to all flow objects in the scene */ { @@ -1818,7 +1818,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) SpaceLink *sl; for (sl = sa->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_INFO) { - SpaceInfo *sinfo = (SpaceInfo *) sl; + SpaceInfo *sinfo = (SpaceInfo *)sl; ARegion *ar; sinfo->rpt_mask = INFO_RPT_OP; @@ -1826,9 +1826,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) for (ar = sa->regionbase.first; ar; ar = ar->next) { if (ar->regiontype == RGN_TYPE_WINDOW) { ar->v2d.scroll = (V2D_SCROLL_RIGHT); - ar->v2d.align = V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y; /* align bottom left */ + ar->v2d.align = V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y; /* align bottom left */ ar->v2d.keepofs = V2D_LOCKOFS_X; - ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_LIMITZOOM|V2D_KEEPASPECT); + ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT); ar->v2d.keeptot = V2D_KEEPTOT_BOUNDS; ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f; } @@ -1867,7 +1867,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) SpaceLink *sl; for (sl = sa->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_IMAGE) { - SpaceImage *sima = (SpaceImage *) sl; + SpaceImage *sima = (SpaceImage *)sl; if (sima->sample_line_hist.height == 0) sima->sample_line_hist.height = 100; } @@ -1921,21 +1921,21 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) /* node sockets are not exposed automatically any more, * this mimics the old behavior by adding all unlinked sockets to groups. */ - for (ntree=bmain->nodetree.first; ntree; ntree=ntree->id.next) { + for (ntree = bmain->nodetree.first; ntree; ntree = ntree->id.next) { /* this adds copies and links from all unlinked internal sockets to group inputs/outputs. */ /* first make sure the own_index for new sockets is valid */ - for (node=ntree->nodes.first; node; node=node->next) { + for (node = ntree->nodes.first; node; node = node->next) { for (sock = node->inputs.first; sock; sock = sock->next) if (sock->own_index >= ntree->cur_index) - ntree->cur_index = sock->own_index+1; + ntree->cur_index = sock->own_index + 1; for (sock = node->outputs.first; sock; sock = sock->next) if (sock->own_index >= ntree->cur_index) - ntree->cur_index = sock->own_index+1; + ntree->cur_index = sock->own_index + 1; } /* add ntree->inputs/ntree->outputs sockets for all unlinked sockets in the group tree. */ - for (node=ntree->nodes.first; node; node=node->next) { + for (node = ntree->nodes.first; node; node = node->next) { for (sock = node->inputs.first; sock; sock = sock->next) { if (!sock->link && !nodeSocketIsHidden(sock)) { @@ -1959,7 +1959,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) } } for (sock = node->outputs.first; sock; sock = sock->next) { - if (nodeCountSocketLinks(ntree, sock)==0 && !nodeSocketIsHidden(sock)) { + if (nodeCountSocketLinks(ntree, sock) == 0 && !nodeSocketIsHidden(sock)) { gsock = do_versions_node_group_add_socket_2_56_2(ntree, sock->name, sock->type, SOCK_OUT); /* initialize the default socket value */ @@ -2001,7 +2001,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) if (sc->redraws_flag == 0) { /* just initialize to default? */ /* XXX: we could also have iterated through areas, and taken them from the first timeline available... */ - sc->redraws_flag = TIME_ALL_3D_WIN|TIME_ALL_ANIM_WIN; + sc->redraws_flag = TIME_ALL_3D_WIN | TIME_ALL_ANIM_WIN; } } @@ -2015,7 +2015,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) ModifierData *md; for (md = ob->modifiers.first; md; md = md->next) { if (md->type == eModifierType_Solidify) { - SolidifyModifierData *smd = (SolidifyModifierData *) md; + SolidifyModifierData *smd = (SolidifyModifierData *)md; if (smd->flag & MOD_SOLIDIFY_RIM_MATERIAL) { smd->mat_ofs_rim = 1; smd->flag &= ~MOD_SOLIDIFY_RIM_MATERIAL; @@ -2158,7 +2158,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) for (act = bmain->action.first; act; act = act->id.next) { for (fcu = act->curves.first; fcu; fcu = fcu->next) { BezTriple *bezt; - unsigned int i = 0; + uint i = 0; /* only need to touch curves that had this flag set */ if ((fcu->flag & FCURVE_AUTO_HANDLES) == 0) @@ -2187,7 +2187,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) bNode *node; bNodeSocket *sock; - for (node=ntree->nodes.first; node; node=node->next) { + for (node = ntree->nodes.first; node; node = node->next) { for (sock = node->inputs.first; sock; sock = sock->next) do_versions_socket_default_value_259(sock); for (sock = node->outputs.first; sock; sock = sock->next) diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c index 9efaca83126..9cb96f6d8b3 100644 --- a/source/blender/blenloader/intern/versioning_260.c +++ b/source/blender/blenloader/intern/versioning_260.c @@ -340,7 +340,7 @@ static void do_versions_mesh_mloopcol_swap_2_62_1(Mesh *me) if (layer->type == CD_MLOOPCOL) { mloopcol = (MLoopCol *)layer->data; for (i = 0; i < me->totloop; i++, mloopcol++) { - SWAP(unsigned char, mloopcol->r, mloopcol->b); + SWAP(uchar, mloopcol->r, mloopcol->b); } } } @@ -424,7 +424,7 @@ static void do_versions_nodetree_frame_2_64_6(bNodeTree *ntree) } /* initialize custom node color */ - node->color[0] = node->color[1] = node->color[2] = 0.608f; /* default theme color */ + node->color[0] = node->color[1] = node->color[2] = 0.608f; /* default theme color */ } } @@ -979,7 +979,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) for (md = ob->modifiers.first; md; md = md->next) { if (md->type == eModifierType_Cloth) { - ClothModifierData *clmd = (ClothModifierData *) md; + ClothModifierData *clmd = (ClothModifierData *)md; if (clmd->sim_parms) clmd->sim_parms->vel_damping = 1.0f; } @@ -1412,7 +1412,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) ColorBalanceModifierData *cbmd; smd = BKE_sequence_modifier_new(seq, NULL, seqModifierType_ColorBalance); - cbmd = (ColorBalanceModifierData *) smd; + cbmd = (ColorBalanceModifierData *)smd; cbmd->color_balance = *strip->color_balance; @@ -1789,7 +1789,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) for (cu = bmain->curve.first; cu; cu = cu->id.next) { if (cu->flag & (CU_FRONT | CU_BACK)) { - if ( cu->ext1 != 0.0f || cu->ext2 != 0.0f) { + if (cu->ext1 != 0.0f || cu->ext2 != 0.0f) { Nurb *nu; for (nu = cu->nurb.first; nu; nu = nu->next) { @@ -1920,7 +1920,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) bNode *node; FOREACH_NODETREE(bmain, ntree, id) { if (id == &ntree->id) - continue; /* already fixed for node groups */ + continue; /* already fixed for node groups */ for (node = ntree->nodes.first; node; node = node->next) nodeUniqueName(ntree, node); diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index e446e268e61..22fea82ced0 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -113,7 +113,7 @@ static bGPDpalette *BKE_gpencil_palette_addnew(bGPdata *gpd, const char *name) /* auto-name */ BLI_strncpy(palette->info, name, sizeof(palette->info)); BLI_uniquename(&gpd->palettes, palette, DATA_("GP_Palette"), '.', offsetof(bGPDpalette, info), - sizeof(palette->info)); + sizeof(palette->info)); /* return palette */ return palette; @@ -142,7 +142,7 @@ static bGPDpalettecolor *BKE_gpencil_palettecolor_addnew(bGPDpalette *palette, c /* auto-name */ BLI_strncpy(palcolor->info, name, sizeof(palcolor->info)); BLI_uniquename(&palette->colors, palcolor, DATA_("Color"), '.', offsetof(bGPDpalettecolor, info), - sizeof(palcolor->info)); + sizeof(palcolor->info)); /* return palette color */ return palcolor; @@ -447,7 +447,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) SpaceLink *space_link; for (space_link = area->spacedata.first; space_link; space_link = space_link->next) { if (space_link->spacetype == SPACE_CLIP) { - SpaceClip *space_clip = (SpaceClip *) space_link; + SpaceClip *space_clip = (SpaceClip *)space_link; if (space_clip->mode != SC_MODE_MASKEDIT) { space_clip->mode = SC_MODE_TRACKING; } @@ -682,7 +682,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) } if (!MAIN_VERSION_ATLEAST(bmain, 273, 1)) { -#define BRUSH_RAKE (1 << 7) +#define BRUSH_RAKE (1 << 7) #define BRUSH_RANDOM_ROTATION (1 << 25) Brush *br; @@ -939,7 +939,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) } case SPACE_IMAGE: { - SpaceImage *sima = (SpaceImage *) sl; + SpaceImage *sima = (SpaceImage *)sl; sima->iuser.flag |= IMA_SHOW_STEREO; break; } @@ -1044,7 +1044,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) { bScreen *screen; -#define RV3D_VIEW_PERSPORTHO 7 +#define RV3D_VIEW_PERSPORTHO 7 for (screen = bmain->screen.first; screen; screen = screen->id.next) { ScrArea *sa; for (sa = screen->areabase.first; sa; sa = sa->next) { @@ -1073,7 +1073,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) { Lamp *lamp; -#define LA_YF_PHOTON 5 +#define LA_YF_PHOTON 5 for (lamp = bmain->lamp.first; lamp; lamp = lamp->id.next) { if (lamp->type == LA_YF_PHOTON) { lamp->type = LA_LOCAL; diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 5559982d820..16f436cb378 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -1042,10 +1042,10 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } } FOREACH_NODETREE_END - if (error & NTREE_DOVERSION_NEED_OUTPUT) { - BKE_report(fd->reports, RPT_ERROR, "Eevee material conversion problem. Error in console"); - printf("You need to connect Principled and Eevee Specular shader nodes to new material output nodes.\n"); - } + if (error & NTREE_DOVERSION_NEED_OUTPUT) { + BKE_report(fd->reports, RPT_ERROR, "Eevee material conversion problem. Error in console"); + printf("You need to connect Principled and Eevee Specular shader nodes to new material output nodes.\n"); + } if (error & NTREE_DOVERSION_TRANSPARENCY_EMISSION) { BKE_report(fd->reports, RPT_ERROR, "Eevee material conversion problem. Error in console"); @@ -1124,9 +1124,9 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) gset->cur_falloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); curvemapping_initialize(gset->cur_falloff); curvemap_reset(gset->cur_falloff->cm, - &gset->cur_falloff->clipr, - CURVE_PRESET_GAUSS, - CURVEMAP_SLOPE_POSITIVE); + &gset->cur_falloff->clipr, + CURVE_PRESET_GAUSS, + CURVEMAP_SLOPE_POSITIVE); } } } @@ -2419,7 +2419,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) if (!navigation_region) { ListBase *regionbase = (slink == area->spacedata.first) ? - &area->regionbase : &slink->regionbase; + &area->regionbase : &slink->regionbase; navigation_region = MEM_callocN(sizeof(ARegion), "userpref navigation-region do_versions"); diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c index d040ff9d6ed..b88618bf7db 100644 --- a/source/blender/blenloader/intern/versioning_defaults.c +++ b/source/blender/blenloader/intern/versioning_defaults.c @@ -182,9 +182,9 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template) CurveMapping *gp_falloff_curve = ts->gp_sculpt.cur_falloff; curvemapping_initialize(gp_falloff_curve); curvemap_reset(gp_falloff_curve->cm, - &gp_falloff_curve->clipr, - CURVE_PRESET_GAUSS, - CURVEMAP_SLOPE_POSITIVE); + &gp_falloff_curve->clipr, + CURVE_PRESET_GAUSS, + CURVEMAP_SLOPE_POSITIVE); } } } diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c index 61966ec49b7..e0fb31b223b 100644 --- a/source/blender/blenloader/intern/versioning_legacy.c +++ b/source/blender/blenloader/intern/versioning_legacy.c @@ -103,14 +103,14 @@ static void vcol_to_fcol(Mesh *me) { MFace *mface; - unsigned int *mcol, *mcoln, *mcolmain; + uint *mcol, *mcoln, *mcolmain; int a; if (me->totface == 0 || me->mcol == NULL) return; mcoln = mcolmain = MEM_malloc_arrayN(me->totface, 4 * sizeof(int), "mcoln"); - mcol = (unsigned int *)me->mcol; + mcol = (uint *)me->mcol; mface = me->mface; for (a = me->totface; a > 0; a--, mface++) { mcoln[0] = mcol[mface->v1]; @@ -147,11 +147,11 @@ static void bone_version_238(ListBase *lb) 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->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 -= bone->rad_head; + if (bone->dist <= 0.0f) bone->dist = 0.0f; } bone_version_238(&bone->childbase); @@ -236,7 +236,7 @@ static void ntree_version_245(FileData *fd, Library *lib, bNodeTree *ntree) /* fix for temporary flag changes during 245 cycle */ nodeid = blo_do_versions_newlibadr(fd, lib, node->id); if (node->storage && nodeid && GS(nodeid->name) == ID_IM) { - image = (Image*)nodeid; + image = (Image *)nodeid; iuser = node->storage; if (iuser->flag & IMA_OLD_PREMUL) { iuser->flag &= ~IMA_OLD_PREMUL; @@ -378,7 +378,7 @@ static void do_version_ntree_242_2(bNodeTree *ntree) iuser->frames = nia->frames; iuser->sfra = nia->sfra; - iuser->offset = nia->nr-1; + iuser->offset = nia->nr - 1; iuser->cycl = nia->cyclic; iuser->ok = 1; @@ -526,7 +526,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) if (ob->totcol) { for (a = 0; a < ob->totcol; a++) { if (ob->mat[a]) - ob->colbits |= (1<colbits |= (1 << a); } } ob = ob->id.next; @@ -586,7 +586,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) SpaceLink *sl = sa->spacedata.first; while (sl) { if (sl->spacetype == SPACE_VIEW3D) { - View3D *v3d = (View3D*) sl; + View3D *v3d = (View3D *)sl; if (v3d->gridlines == 0) v3d->gridlines = 20; @@ -603,8 +603,8 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) Tex *tex = bmain->tex.first; while (tex) { if ((tex->rfac == 0.0f) && - (tex->gfac == 0.0f) && - (tex->bfac == 0.0f)) + (tex->gfac == 0.0f) && + (tex->bfac == 0.0f)) { tex->rfac = 1.0f; tex->gfac = 1.0f; @@ -620,8 +620,8 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) Tex *tex = bmain->tex.first; while (tex) { if ((tex->rfac == 0.0f) && - (tex->gfac == 0.0f) && - (tex->bfac == 0.0f)) + (tex->gfac == 0.0f) && + (tex->bfac == 0.0f)) { tex->rfac = 1.0f; tex->gfac = 1.0f; @@ -702,7 +702,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) SpaceLink *sl = sa->spacedata.first; while (sl) { if (sl->spacetype == SPACE_IPO) { - SpaceIpo *sipo = (SpaceIpo*) sl; + SpaceIpo *sipo = (SpaceIpo *)sl; sipo->v2d.max[0] = 15000.0; } sl = sl->next; @@ -735,7 +735,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) SpaceLink *sl = sa->spacedata.first; while (sl) { if (sl->spacetype == SPACE_TEXT) { - SpaceText *st = (SpaceText*) sl; + SpaceText *st = (SpaceText *)sl; st->lheight = 12; } sl = sl->next; @@ -834,10 +834,10 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) int i, j; for (i = 0; i < me->totface; i++) { - TFace *tf = &((TFace*) me->tface)[i]; + TFace *tf = &((TFace *)me->tface)[i]; for (j = 0; j < 4; j++) { - char *col = (char *) &tf->col[j]; + char *col = (char *)&tf->col[j]; col[0] = 255; } @@ -888,7 +888,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) for (sl = sa->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_IPO) { - SpaceSeq *sseq = (SpaceSeq*) sl; + SpaceSeq *sseq = (SpaceSeq *)sl; sseq->v2d.keeptot = 0; } } @@ -961,11 +961,11 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) for (sl = sa->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_ACTION) { - SpaceAction *sac = (SpaceAction *) sl; + SpaceAction *sac = (SpaceAction *)sl; sac->v2d.max[0] = 32000; } else if (sl->spacetype == SPACE_NLA) { - SpaceNla *sla = (SpaceNla *) sl; + SpaceNla *sla = (SpaceNla *)sl; sla->v2d.max[0] = 32000; } } @@ -1028,7 +1028,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) for (sl = sa->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_BUTS) { - SpaceButs *sbuts = (SpaceButs *) sl; + SpaceButs *sbuts = (SpaceButs *)sl; sbuts->v2d.maxzoom = 1.2f; @@ -1118,7 +1118,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) SpaceLink *sl = sa->spacedata.first; while (sl) { if (sl->spacetype == SPACE_VIEW3D) { - View3D *v3d = (View3D*) sl; + View3D *v3d = (View3D *)sl; if (v3d->gridflag == 0) { v3d->gridflag |= V3D_SHOW_X; @@ -1141,7 +1141,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) bScreen *sc; 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 */ @@ -1181,7 +1181,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) for (sl = sa->spacedata.first; sl; sl = sl->next) { /* added: 5x better zoom in for nla */ if (sl->spacetype == SPACE_NLA) { - SpaceNla *snla = (SpaceNla *) sl; + SpaceNla *snla = (SpaceNla *)sl; snla->v2d.maxzoom = 50; } } @@ -1206,7 +1206,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) SpaceLink *sl; for (sl = sa->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_VIEW3D) { - View3D *v3d = (View3D *) sl; + View3D *v3d = (View3D *)sl; v3d->flag |= V3D_SELECT_OUTLINE; } } @@ -1223,7 +1223,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) SpaceLink *sl; for (sl = sa->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_VIEW3D) { - View3D *v3d = (View3D *) sl; + View3D *v3d = (View3D *)sl; v3d->flag |= V3D_ZBUF_SELECT; } else if (sl->spacetype == SPACE_TEXT) { @@ -1250,7 +1250,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) while (sce) { ed = sce->ed; if (ed) { - SEQ_BEGIN (sce->ed, seq) + SEQ_BEGIN(sce->ed, seq) { if (seq->type == SEQ_TYPE_IMAGE || seq->type == SEQ_TYPE_MOVIE) seq->alpha_mode = SEQ_ALPHA_STRAIGHT; @@ -1338,8 +1338,8 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) else if (ob->type == OB_MESH) { Mesh *me = blo_do_versions_newlibadr(fd, lib, ob->data); - if ((me->flag&ME_SUBSURF)) { - SubsurfModifierData *smd = (SubsurfModifierData*) modifier_new(eModifierType_Subsurf); + if ((me->flag & ME_SUBSURF)) { + SubsurfModifierData *smd = (SubsurfModifierData *)modifier_new(eModifierType_Subsurf); smd->levels = MAX2(1, me->subdiv); smd->renderLevels = MAX2(1, me->subdivr); @@ -1355,7 +1355,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) BLI_addtail(&ob->modifiers, smd); - modifier_unique_name(&ob->modifiers, (ModifierData*)smd); + modifier_unique_name(&ob->modifiers, (ModifierData *)smd); } } @@ -1405,9 +1405,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) for (md = ob->modifiers.first; md; md = md->next) { if (md->type == eModifierType_Subsurf) { - SubsurfModifierData *smd = (SubsurfModifierData*) md; + SubsurfModifierData *smd = (SubsurfModifierData *)md; - smd->flags &= ~(eSubsurfModifierFlag_Incremental|eSubsurfModifierFlag_DebugIncr); + smd->flags &= ~(eSubsurfModifierFlag_Incremental | eSubsurfModifierFlag_DebugIncr); } } @@ -1439,7 +1439,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) for (con = pchan->constraints.first; con; con = con->next) { if (con->type == CONSTRAINT_TYPE_KINEMATIC) { - bKinematicConstraint *data = (bKinematicConstraint*)con->data; + bKinematicConstraint *data = (bKinematicConstraint *)con->data; data->weight = 1.0f; data->orientweight = 1.0f; data->flag &= ~CONSTRAINT_IK_ROT; @@ -1512,7 +1512,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) for (md = ob->modifiers.first; md; md = md->next) { if (md->type == eModifierType_Armature) { - ArmatureModifierData *amd = (ArmatureModifierData*) md; + ArmatureModifierData *amd = (ArmatureModifierData *)md; if (amd->object && amd->deformflag == 0) { Object *oba = blo_do_versions_newlibadr(fd, lib, amd->object); arm = blo_do_versions_newlibadr(fd, lib, oba->data); @@ -1578,7 +1578,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) 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); + srl->passflag &= (SCE_PASS_COMBINED | SCE_PASS_Z | SCE_PASS_NORMAL | SCE_PASS_VECTOR); } /* node version changes */ @@ -1641,7 +1641,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) for (sl = sa->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_VIEW3D) { - View3D *v3d = (View3D*) sl; + View3D *v3d = (View3D *)sl; if (v3d->gridsubdiv == 0) v3d->gridsubdiv = 10; } @@ -1715,7 +1715,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) /* version patch from buttons_object.c */ if (data->flag == 0) - data->flag = ROTLIKE_X|ROTLIKE_Y|ROTLIKE_Z; + data->flag = ROTLIKE_X | ROTLIKE_Y | ROTLIKE_Z; break; } @@ -1731,32 +1731,32 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) for (curcon = pchan->constraints.first; curcon; curcon = curcon->next) { switch (curcon->type) { case CONSTRAINT_TYPE_MINMAX: - { - bMinMaxConstraint *data = curcon->data; - if (data->sticky == 1) - data->flag |= MINMAX_STICKY; - else - data->flag &= ~MINMAX_STICKY; - } + { + bMinMaxConstraint *data = curcon->data; + if (data->sticky == 1) + data->flag |= MINMAX_STICKY; + else + data->flag &= ~MINMAX_STICKY; break; + } case CONSTRAINT_TYPE_KINEMATIC: - { - bKinematicConstraint *data = curcon->data; - if (!(data->flag & CONSTRAINT_IK_POS)) { - data->flag |= CONSTRAINT_IK_POS; - data->flag |= CONSTRAINT_IK_STRETCH; - } + { + bKinematicConstraint *data = curcon->data; + if (!(data->flag & CONSTRAINT_IK_POS)) { + data->flag |= CONSTRAINT_IK_POS; + data->flag |= CONSTRAINT_IK_STRETCH; } break; + } case CONSTRAINT_TYPE_ROTLIKE: - { - bRotateLikeConstraint *data = curcon->data; + { + bRotateLikeConstraint *data = curcon->data; - /* version patch from buttons_object.c */ - if (data->flag == 0) - data->flag = ROTLIKE_X|ROTLIKE_Y|ROTLIKE_Z; - } + /* version patch from buttons_object.c */ + if (data->flag == 0) + data->flag = ROTLIKE_X | ROTLIKE_Y | ROTLIKE_Z; break; + } } } } @@ -1766,10 +1766,10 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) /* copy old object level track settings to curve modifers */ for (md = ob->modifiers.first; md; md = md->next) { if (md->type == eModifierType_Curve) { - CurveModifierData *cmd = (CurveModifierData*) md; + CurveModifierData *cmd = (CurveModifierData *)md; if (cmd->defaxis == 0) - cmd->defaxis = ob->trackflag+1; + cmd->defaxis = ob->trackflag + 1; } } @@ -1819,7 +1819,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) tex->iuser.frames = tex->frames; tex->iuser.offset = tex->offset; tex->iuser.sfra = tex->sfra; - tex->iuser.cycl = (tex->imaflag & TEX_ANIMCYCLIC_)!=0; + tex->iuser.cycl = (tex->imaflag & TEX_ANIMCYCLIC_) != 0; } for (sce = bmain->scene.first; sce; sce = sce->id.next) { if (sce->nodetree) @@ -1834,7 +1834,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) if (bmain->subversionfile < 4) { for (sce = bmain->scene.first; sce; sce = sce->id.next) { - sce->r.bake_mode = 1; /* prevent to include render stuff here */ + sce->r.bake_mode = 1; /* prevent to include render stuff here */ sce->r.bake_filter = 16; sce->r.bake_flag = R_BAKE_CLEAR; } @@ -1860,7 +1860,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) /* translate old mirror modifier axis values to new flags */ for (md = ob->modifiers.first; md; md = md->next) { if (md->type == eModifierType_Mirror) { - MirrorModifierData *mmd = (MirrorModifierData*) md; + MirrorModifierData *mmd = (MirrorModifierData *)md; switch (mmd->axis) { case 0: @@ -1902,7 +1902,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) for (sl = sa->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_ACTION) { - SpaceAction *saction = (SpaceAction*) sl; + SpaceAction *saction = (SpaceAction *)sl; saction->v2d.tot.ymin = -1000.0; saction->v2d.tot.ymax = 0.0; @@ -1932,7 +1932,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) /* unless the file was created 2.44.3 but not 2.45, update the constraints */ if (!(bmain->versionfile == 244 && bmain->subversionfile == 3) && - ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile == 0)) ) + ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile == 0)) ) { for (ob = bmain->object.first; ob; ob = ob->id.next) { ListBase *list; @@ -1951,13 +1951,13 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) switch (curcon->type) { case CONSTRAINT_TYPE_LOCLIMIT: { - bLocLimitConstraint *data = (bLocLimitConstraint *) curcon->data; + bLocLimitConstraint *data = (bLocLimitConstraint *)curcon->data; /* old limit without parent option for objects */ if (data->flag2) curcon->ownspace = CONSTRAINT_SPACE_LOCAL; + break; } - break; } } } @@ -1982,13 +1982,13 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) switch (curcon->type) { case CONSTRAINT_TYPE_ACTION: { - bActionConstraint *data = (bActionConstraint *) curcon->data; + bActionConstraint *data = (bActionConstraint *)curcon->data; /* 'data->local' used to mean that target was in local-space */ if (data->local) curcon->tarspace = CONSTRAINT_SPACE_LOCAL; + break; } - break; } } @@ -2027,7 +2027,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) for (md = ob->modifiers.first; md; md = md->next) { if (md->type == eModifierType_Cloth) { - ClothModifierData *clmd = (ClothModifierData*) md; + ClothModifierData *clmd = (ClothModifierData *)md; if (!clmd->point_cache) { clmd->point_cache = BKE_ptcache_add(&clmd->ptcaches); clmd->point_cache->step = 1; @@ -2129,7 +2129,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) for (ob = bmain->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; + ((ArmatureModifierData *)md)->deformflag |= ARM_DEF_B_BONE_REST; } } } @@ -2232,7 +2232,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) md = modifier_new(eModifierType_ParticleSystem); BLI_snprintf(md->name, sizeof(md->name), "ParticleSystem %i", BLI_listbase_count(&ob->particlesystem)); - psmd = (ParticleSystemModifierData*) md; + psmd = (ParticleSystemModifierData *)md; psmd->psys = psys; BLI_addtail(&ob->modifiers, md); @@ -2329,7 +2329,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) int a; if (pset->brush[0].size == 0) { - pset->flag = PE_KEEP_LENGTHS|PE_LOCK_FIRST|PE_DEFLECT_EMITTER; + pset->flag = PE_KEEP_LENGTHS | PE_LOCK_FIRST | PE_DEFLECT_EMITTER; pset->emitterdist = 0.25f; pset->totrekey = 5; pset->totaddkey = 5; @@ -2368,10 +2368,10 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) else repeat = strip->repeat; - length = strip->end-strip->start; + length = strip->end - strip->start; if (length == 0.0f) length = 1.0f; - actlength = strip->actend-strip->actstart; + actlength = strip->actend - strip->actstart; strip->scale = length / (repeat * actlength); if (strip->scale == 0.0f) @@ -2471,8 +2471,8 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) * use it for the number of divisions per segment */ if (nu->pntsv > 1) { - nu->resolu = MAX2( 1, (int)(((float)nu->resolu / (float)nu->pntsu)+0.5f) ); - nu->resolv = MAX2( 1, (int)(((float)nu->resolv / (float)nu->pntsv)+0.5f) ); + nu->resolu = MAX2(1, (int)(((float)nu->resolu / (float)nu->pntsu) + 0.5f) ); + nu->resolv = MAX2(1, (int)(((float)nu->resolv / (float)nu->pntsv) + 0.5f) ); } } } @@ -2502,25 +2502,25 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) for (sl = sa->spacedata.first; sl; sl = sl->next) { switch (sl->spacetype) { case SPACE_ACTION: - { - SpaceAction *sact = (SpaceAction *)sl; + { + SpaceAction *sact = (SpaceAction *)sl; - sact->mode = SACTCONT_DOPESHEET; - sact->autosnap = SACTSNAP_FRAME; - } + sact->mode = SACTCONT_DOPESHEET; + sact->autosnap = SACTSNAP_FRAME; break; + } case SPACE_IPO: - { - SpaceIpo *sipo = (SpaceIpo *)sl; - sipo->autosnap = SACTSNAP_FRAME; - } + { + SpaceIpo *sipo = (SpaceIpo *)sl; + sipo->autosnap = SACTSNAP_FRAME; break; + } case SPACE_NLA: - { - SpaceNla *snla = (SpaceNla *)sl; - snla->autosnap = SACTSNAP_FRAME; - } + { + SpaceNla *snla = (SpaceNla *)sl; + snla->autosnap = SACTSNAP_FRAME; break; + } } } } @@ -2532,7 +2532,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) Object *ob; for (ob = bmain->object.first; ob; ob = ob->id.next) { if (ob->pd) - ob->pd->seed = ((unsigned int)(ceil(PIL_check_seconds_timer())) + 1) % 128; + ob->pd->seed = ((uint)(ceil(PIL_check_seconds_timer())) + 1) % 128; } } @@ -2548,7 +2548,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) SEQP_BEGIN (ed, seq) { if (seq->strip && seq->strip->proxy) { - seq->strip->proxy->quality =90; + seq->strip->proxy->quality = 90; } } SEQ_END diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 99cd9b805bf..7bf8babd3c9 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -755,10 +755,10 @@ static void write_previews(WriteData *wd, const PreviewImage *prv_orig) } writestruct_at_address(wd, DATA, PreviewImage, 1, prv_orig, &prv); if (prv.rect[0]) { - writedata(wd, DATA, prv.w[0] * prv.h[0] * sizeof(unsigned int), prv.rect[0]); + writedata(wd, DATA, prv.w[0] * prv.h[0] * sizeof(uint), prv.rect[0]); } if (prv.rect[1]) { - writedata(wd, DATA, prv.w[1] * prv.h[1] * sizeof(unsigned int), prv.rect[1]); + writedata(wd, DATA, prv.w[1] * prv.h[1] * sizeof(uint), prv.rect[1]); } } } @@ -2491,7 +2491,7 @@ static void write_lightcache_texture(WriteData *wd, LightCacheTexture *tex) data_size *= sizeof(float); } else if (tex->data_type == LIGHTCACHETEX_UINT) { - data_size *= sizeof(unsigned int); + data_size *= sizeof(uint); } writedata(wd, DATA, data_size, tex->data); } @@ -3817,7 +3817,7 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar) } /* preview image, first 2 values are width and height - * second are an RGBA image (unsigned char) + * second are an RGBA image (uchar) * note, this uses 'TEST' since new types will segfault on file load for older blender versions. */ static void write_thumb(WriteData *wd, const BlendThumbnail *thumb) -- cgit v1.2.3