diff options
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readblenentry.c | 6 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 863 | ||||
-rw-r--r-- | source/blender/blenloader/intern/undofile.c | 6 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_250.c | 315 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_260.c | 282 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_270.c | 48 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 6 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_legacy.c | 303 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_userdef.c | 102 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 3 |
10 files changed, 1289 insertions, 645 deletions
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index 8067a322490..5e4fe4ce269 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -99,8 +99,9 @@ void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp) fprintf(fp, "[\n"); for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) { - if (bhead->code == ENDB) + if (bhead->code == ENDB) { break; + } else { const short *sp = fd->filesdna->structs[bhead->SDNAnr]; const char *name = fd->filesdna->types[sp[0]]; @@ -150,8 +151,9 @@ LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, int ofblocktype, BLI_linklist_prepend(&names, strdup(idname + 2)); tot++; } - else if (bhead->code == ENDB) + else if (bhead->code == ENDB) { break; + } } *tot_names = tot; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 706f28eb312..16e8c040fda 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -416,8 +416,9 @@ static OldNewMap *oldnewmap_new(void) static void oldnewmap_insert(OldNewMap *onm, const void *oldaddr, void *newaddr, int nr) { - if (oldaddr == NULL || newaddr == NULL) + if (oldaddr == NULL || newaddr == NULL) { return; + } if (UNLIKELY(onm->nentries == ENTRIES_CAPACITY(onm))) { oldnewmap_increase_size(onm); @@ -438,24 +439,29 @@ void blo_do_versions_oldnewmap_insert(OldNewMap *onm, const void *oldaddr, void static void *oldnewmap_lookup_and_inc(OldNewMap *onm, const void *addr, bool increase_users) { OldNew *entry = oldnewmap_lookup_entry(onm, addr); - if (entry == NULL) + if (entry == NULL) { return NULL; - if (increase_users) + } + if (increase_users) { entry->nr++; + } return entry->newp; } /* for libdata, OldNew.nr has ID code, no increment */ static void *oldnewmap_liblookup(OldNewMap *onm, const void *addr, const void *lib) { - if (addr == NULL) + if (addr == NULL) { return NULL; + } ID *id = oldnewmap_lookup_and_inc(onm, addr, false); - if (id == NULL) + if (id == NULL) { return NULL; - if (!lib || id->lib) + } + if (!lib || id->lib) { return id; + } return NULL; } @@ -548,8 +554,9 @@ void blo_split_main(ListBase *mainlist, Main *main) mainlist->first = mainlist->last = main; main->next = NULL; - if (BLI_listbase_is_empty(&main->libraries)) + if (BLI_listbase_is_empty(&main->libraries)) { return; + } /* (Library.temp_index -> Main), lookup table */ const uint lib_main_array_len = BLI_listbase_count(&main->libraries); @@ -593,8 +600,9 @@ static void read_file_version(FileData *fd, Main *main) main->minsubversionfile = fg->minsubversion; MEM_freeN(fg); } - else if (bhead->code == ENDB) + else if (bhead->code == ENDB) { break; + } } } if (main->curlib) { @@ -659,8 +667,9 @@ static Main *blo_find_main(FileData *fd, const char *filepath, const char *relab const char *libname = (m->curlib) ? m->curlib->filepath : m->name; if (BLI_path_cmp(name1, libname) == 0) { - if (G.debug & G_DEBUG) + if (G.debug & G_DEBUG) { printf("blo_find_main: found library %s\n", libname); + } return m; } } @@ -680,8 +689,9 @@ static Main *blo_find_main(FileData *fd, const char *filepath, const char *relab read_file_version(fd, m); - if (G.debug & G_DEBUG) + if (G.debug & G_DEBUG) { printf("blo_find_main: added new lib %s\n", filepath); + } return m; } @@ -694,8 +704,9 @@ 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) + if ((bhead->code & 0xFFFF) == 0) { bhead->code >>= 16; + } if (bhead->code != ENDB) { BLI_endian_switch_int32(&bhead->len); @@ -707,8 +718,9 @@ static void switch_endian_bh4(BHead4 *bhead) static void switch_endian_bh8(BHead8 *bhead) { /* the ID_.. codes */ - if ((bhead->code & 0xFFFF) == 0) + if ((bhead->code & 0xFFFF) == 0) { bhead->code >>= 16; + } if (bhead->code != ENDB) { BLI_endian_switch_int32(&bhead->len); @@ -1046,7 +1058,7 @@ static bool read_file_dna(FileData *fd, const char **r_error_message) /* We can't use read_global because this needs 'DNA1' to be decoded, * however the first 4 chars are _always_ the subversion. */ FileGlobal *fg = (void *)&bhead[1]; - BLI_STATIC_ASSERT(offsetof(FileGlobal, subvstr) == 0, "Must be first: subvstr"); + BLI_STATIC_ASSERT(offsetof(FileGlobal, subvstr) == 0, "Must be first: subvstr") char num[5]; memcpy(num, fg->subvstr, 4); num[4] = 0; @@ -1069,8 +1081,9 @@ static bool read_file_dna(FileData *fd, const char **r_error_message) return false; } } - else if (bhead->code == ENDB) + else if (bhead->code == ENDB) { break; + } } *r_error_message = "Missing DNA block"; @@ -1183,8 +1196,9 @@ static int fd_read_from_memfile(FileData *filedata, void *buffer, uint size) static MemFileChunk *chunk = NULL; size_t chunkoffset, readsize, totread; - if (size == 0) + if (size == 0) { return 0; + } if (seek != (size_t)filedata->file_offset) { chunk = filedata->memfile->chunks.first; @@ -1223,8 +1237,9 @@ static int fd_read_from_memfile(FileData *filedata, void *buffer, uint size) /* data can be spread over multiple chunks, so clamp size * to within this chunk, and then it will read further in * the next chunk */ - if (chunkoffset + readsize > chunk->size) + if (chunkoffset + readsize > chunk->size) { readsize = chunk->size - chunkoffset; + } memcpy(POINTER_OFFSET(buffer, totread), chunk->buf + chunkoffset, readsize); totread += readsize; @@ -1428,8 +1443,9 @@ static int fd_read_gzip_from_memory_init(FileData *fd) 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; @@ -1456,8 +1472,9 @@ FileData *blo_filedata_from_memory(const void *mem, int memsize, ReportList *rep return NULL; } } - else + else { fd->read = fd_read_from_memory; + } fd->flags |= FD_FLAGS_NOT_MY_BUFFER; @@ -1517,29 +1534,40 @@ void blo_filedata_free(FileData *fd) } #endif - if (fd->filesdna) + if (fd->filesdna) { DNA_sdna_free(fd->filesdna); - if (fd->compflags) + } + if (fd->compflags) { MEM_freeN((void *)fd->compflags); + } - if (fd->datamap) + if (fd->datamap) { oldnewmap_free(fd->datamap); - if (fd->globmap) + } + if (fd->globmap) { oldnewmap_free(fd->globmap); - if (fd->imamap) + } + if (fd->imamap) { oldnewmap_free(fd->imamap); - if (fd->movieclipmap) + } + if (fd->movieclipmap) { oldnewmap_free(fd->movieclipmap); - if (fd->scenemap) + } + if (fd->scenemap) { oldnewmap_free(fd->scenemap); - if (fd->soundmap) + } + if (fd->soundmap) { oldnewmap_free(fd->soundmap); - if (fd->packedmap) + } + if (fd->packedmap) { oldnewmap_free(fd->packedmap); - if (fd->libmap && !(fd->flags & FD_FLAGS_NOT_MY_LIBMAP)) + } + if (fd->libmap && !(fd->flags & FD_FLAGS_NOT_MY_LIBMAP)) { oldnewmap_free(fd->libmap); - if (fd->bheadmap) + } + if (fd->bheadmap) { MEM_freeN(fd->bheadmap); + } #ifdef USE_GHASH_BHEAD if (fd->bhead_idname_hash) { @@ -1702,38 +1730,43 @@ static void *newglobadr(FileData *fd, const void *adr) /* direct datablocks with static void *newimaadr(FileData *fd, const void *adr) /* used to restore image data after undo */ { - if (fd->imamap && adr) + if (fd->imamap && adr) { return oldnewmap_lookup_and_inc(fd->imamap, adr, true); + } return NULL; } static void *newsceadr(FileData *fd, const void *adr) /* used to restore scene data after undo */ { - if (fd->scenemap && adr) + if (fd->scenemap && adr) { return oldnewmap_lookup_and_inc(fd->scenemap, adr, true); + } return NULL; } static void *newmclipadr(FileData *fd, const void *adr) /* used to restore movie clip data after undo */ { - if (fd->movieclipmap && adr) + if (fd->movieclipmap && adr) { return oldnewmap_lookup_and_inc(fd->movieclipmap, adr, true); + } return NULL; } static void *newsoundadr(FileData *fd, const void *adr) /* used to restore sound data after undo */ { - if (fd->soundmap && adr) + if (fd->soundmap && adr) { return oldnewmap_lookup_and_inc(fd->soundmap, adr, true); + } return NULL; } static void *newpackedadr(FileData *fd, const void *adr) /* used to restore packed data after undo */ { - if (fd->packedmap && adr) + if (fd->packedmap && adr) { return oldnewmap_lookup_and_inc(fd->packedmap, adr, true); + } return oldnewmap_lookup_and_inc(fd->datamap, adr, true); } @@ -1784,8 +1817,9 @@ static void change_link_placeholder_to_real_ID_pointer_fd(FileData *fd, const vo if (old == entry->newp && entry->nr == ID_LINK_PLACEHOLDER) { entry->newp = new; - if (new) + if (new) { entry->nr = GS(((ID *)new)->name); + } } } } @@ -1800,10 +1834,12 @@ static void change_link_placeholder_to_real_ID_pointer(ListBase *mainlist, for (mainptr = mainlist->first; mainptr; mainptr = mainptr->next) { FileData *fd; - if (mainptr->curlib) + if (mainptr->curlib) { fd = mainptr->curlib->filedata; - else + } + else { fd = basefd; + } if (fd) { change_link_placeholder_to_real_ID_pointer_fd(fd, old, new); @@ -1850,8 +1886,9 @@ void blo_end_scene_pointer_map(FileData *fd, Main *oldmain) /* used entries were restored, so we put them to zero */ for (i = 0; i < fd->scenemap->nentries; i++, entry++) { - if (entry->nr > 0) + if (entry->nr > 0) { entry->newp = NULL; + } } for (; sce; sce = sce->id.next) { @@ -1907,8 +1944,9 @@ void blo_end_image_pointer_map(FileData *fd, Main *oldmain) /* used entries were restored, so we put them to zero */ for (i = 0; i < fd->imamap->nentries; i++, entry++) { - if (entry->nr > 0) + if (entry->nr > 0) { entry->newp = NULL; + } } for (; ima; ima = ima->id.next) { @@ -1924,8 +1962,9 @@ void blo_end_image_pointer_map(FileData *fd, Main *oldmain) slot->render = newimaadr(fd, slot->render); } - for (i = 0; i < TEXTARGET_COUNT; i++) + for (i = 0; i < TEXTARGET_COUNT; i++) { ima->gputexture[i] = newimaadr(fd, ima->gputexture[i]); + } ima->rr = newimaadr(fd, ima->rr); } for (; sce; sce = sce->id.next) { @@ -1958,20 +1997,24 @@ void blo_make_movieclip_pointer_map(FileData *fd, Main *oldmain) fd->movieclipmap = oldnewmap_new(); for (; clip; clip = clip->id.next) { - if (clip->cache) + if (clip->cache) { oldnewmap_insert(fd->movieclipmap, clip->cache, clip->cache, 0); + } - if (clip->tracking.camera.intrinsics) + if (clip->tracking.camera.intrinsics) { oldnewmap_insert( fd->movieclipmap, clip->tracking.camera.intrinsics, clip->tracking.camera.intrinsics, 0); + } } for (; sce; sce = sce->id.next) { if (sce->nodetree) { bNode *node; - for (node = sce->nodetree->nodes.first; node; node = node->next) - if (node->type == CMP_NODE_MOVIEDISTORTION) + for (node = sce->nodetree->nodes.first; node; node = node->next) { + if (node->type == CMP_NODE_MOVIEDISTORTION) { oldnewmap_insert(fd->movieclipmap, node->storage, node->storage, 0); + } + } } } } @@ -1987,8 +2030,9 @@ void blo_end_movieclip_pointer_map(FileData *fd, Main *oldmain) /* used entries were restored, so we put them to zero */ for (i = 0; i < fd->movieclipmap->nentries; i++, entry++) { - if (entry->nr > 0) + if (entry->nr > 0) { entry->newp = NULL; + } } for (; clip; clip = clip->id.next) { @@ -1999,9 +2043,11 @@ void blo_end_movieclip_pointer_map(FileData *fd, Main *oldmain) for (; sce; sce = sce->id.next) { if (sce->nodetree) { bNode *node; - for (node = sce->nodetree->nodes.first; node; node = node->next) - if (node->type == CMP_NODE_MOVIEDISTORTION) + for (node = sce->nodetree->nodes.first; node; node = node->next) { + if (node->type == CMP_NODE_MOVIEDISTORTION) { node->storage = newmclipadr(fd, node->storage); + } + } } } } @@ -2013,8 +2059,9 @@ void blo_make_sound_pointer_map(FileData *fd, Main *oldmain) fd->soundmap = oldnewmap_new(); for (; sound; sound = sound->id.next) { - if (sound->waveform) + if (sound->waveform) { oldnewmap_insert(fd->soundmap, sound->waveform, sound->waveform, 0); + } } } @@ -2028,8 +2075,9 @@ void blo_end_sound_pointer_map(FileData *fd, Main *oldmain) /* used entries were restored, so we put them to zero */ for (i = 0; i < fd->soundmap->nentries; i++, entry++) { - if (entry->nr > 0) + if (entry->nr > 0) { entry->newp = NULL; + } } for (; sound; sound = sound->id.next) { @@ -2058,25 +2106,34 @@ void blo_make_packed_pointer_map(FileData *fd, Main *oldmain) for (ima = oldmain->images.first; ima; ima = ima->id.next) { ImagePackedFile *imapf; - if (ima->packedfile) + if (ima->packedfile) { insert_packedmap(fd, ima->packedfile); + } - for (imapf = ima->packedfiles.first; imapf; imapf = imapf->next) - if (imapf->packedfile) + for (imapf = ima->packedfiles.first; imapf; imapf = imapf->next) { + if (imapf->packedfile) { insert_packedmap(fd, imapf->packedfile); + } + } } - for (vfont = oldmain->fonts.first; vfont; vfont = vfont->id.next) - if (vfont->packedfile) + for (vfont = oldmain->fonts.first; vfont; vfont = vfont->id.next) { + if (vfont->packedfile) { insert_packedmap(fd, vfont->packedfile); + } + } - for (sound = oldmain->sounds.first; sound; sound = sound->id.next) - if (sound->packedfile) + for (sound = oldmain->sounds.first; sound; sound = sound->id.next) { + if (sound->packedfile) { insert_packedmap(fd, sound->packedfile); + } + } - for (lib = oldmain->libraries.first; lib; lib = lib->id.next) - if (lib->packedfile) + for (lib = oldmain->libraries.first; lib; lib = lib->id.next) { + if (lib->packedfile) { insert_packedmap(fd, lib->packedfile); + } + } } /* set old main packed data to zero if it has been restored */ @@ -2092,8 +2149,9 @@ void blo_end_packed_pointer_map(FileData *fd, Main *oldmain) /* used entries were restored, so we put them to zero */ for (i = 0; i < fd->packedmap->nentries; i++, entry++) { - if (entry->nr > 0) + if (entry->nr > 0) { entry->newp = NULL; + } } for (ima = oldmain->images.first; ima; ima = ima->id.next) { @@ -2101,18 +2159,22 @@ void blo_end_packed_pointer_map(FileData *fd, Main *oldmain) ima->packedfile = newpackedadr(fd, ima->packedfile); - for (imapf = ima->packedfiles.first; imapf; imapf = imapf->next) + for (imapf = ima->packedfiles.first; imapf; imapf = imapf->next) { imapf->packedfile = newpackedadr(fd, imapf->packedfile); + } } - for (vfont = oldmain->fonts.first; vfont; vfont = vfont->id.next) + for (vfont = oldmain->fonts.first; vfont; vfont = vfont->id.next) { vfont->packedfile = newpackedadr(fd, vfont->packedfile); + } - for (sound = oldmain->sounds.first; sound; sound = sound->id.next) + for (sound = oldmain->sounds.first; sound; sound = sound->id.next) { sound->packedfile = newpackedadr(fd, sound->packedfile); + } - for (lib = oldmain->libraries.first; lib; lib = lib->id.next) + for (lib = oldmain->libraries.first; lib; lib = lib->id.next) { lib->packedfile = newpackedadr(fd, lib->packedfile); + } } /* undo file support: add all library pointers in lookup */ @@ -2125,8 +2187,9 @@ void blo_add_library_pointer_map(ListBase *old_mainlist, FileData *fd) int i = set_listbasepointers(ptr, lbarray); while (i--) { ID *id; - for (id = lbarray[i]->first; id; id = id->next) + for (id = lbarray[i]->first; id; id = id->next) { oldnewmap_insert(fd->libmap, id, id, GS(id->name)); + } } } @@ -2229,8 +2292,9 @@ static void link_list_ex(FileData *fd, ListBase *lb, link_list_cb callback) /* o { Link *ln, *prev; - if (BLI_listbase_is_empty(lb)) + if (BLI_listbase_is_empty(lb)) { return; + } lb->first = newdataadr(fd, lb->first); if (callback != NULL) { @@ -2260,8 +2324,9 @@ static void link_glob_list(FileData *fd, ListBase *lb) /* for glob data */ Link *ln, *prev; void *poin; - if (BLI_listbase_is_empty(lb)) + if (BLI_listbase_is_empty(lb)) { return; + } poin = newdataadr(fd, lb->first); if (lb->first) { oldnewmap_insert(fd->globmap, lb->first, poin, 0); @@ -2301,8 +2366,9 @@ static void test_pointer_array(FileData *fd, void **mat) lpoin = *mat; while (len-- > 0) { - if ((fd->flags & FD_FLAGS_SWITCH_ENDIAN)) + if ((fd->flags & FD_FLAGS_SWITCH_ENDIAN)) { BLI_endian_switch_int64(lpoin); + } *ipoin = (int)((*lpoin) >> 3); ipoin++; lpoin++; @@ -2353,8 +2419,9 @@ static void IDP_DirectLinkIDPArray(IDProperty *prop, int switch_endian, FileData prop->totallen = 0; } - for (i = 0; i < prop->len; i++) + for (i = 0; i < prop->len; i++) { IDP_DirectLinkProperty(&array[i], switch_endian, fd); + } } static void IDP_DirectLinkArray(IDProperty *prop, int switch_endian, FileData *fd) @@ -2370,8 +2437,9 @@ static void IDP_DirectLinkArray(IDProperty *prop, int switch_endian, FileData *f test_pointer_array(fd, prop->data.pointer); array = prop->data.pointer; - for (i = 0; i < prop->len; i++) + for (i = 0; i < prop->len; i++) { IDP_DirectLinkProperty(array[i], switch_endian, fd); + } } else if (prop->subtype == IDP_DOUBLE) { if (switch_endian) { @@ -2478,8 +2546,9 @@ static void _IDP_DirectLinkGroup_OrFree(IDProperty **prop, static void IDP_LibLinkProperty(IDProperty *prop, FileData *fd) { - if (!prop) + if (!prop) { return; + } switch (prop->type) { case IDP_ID: /* PointerProperty */ @@ -2676,10 +2745,12 @@ static void direct_link_brush(FileData *fd, Brush *brush) brush->gradient = newdataadr(fd, brush->gradient); - if (brush->curve) + if (brush->curve) { direct_link_curvemapping(fd, brush->curve); - else + } + else { BKE_brush_curve_preset(brush, CURVE_PRESET_SHARP); + } /* grease pencil */ brush->gpencil_settings = newdataadr(fd, brush->gpencil_settings); @@ -2690,14 +2761,17 @@ static void direct_link_brush(FileData *fd, Brush *brush) brush->gpencil_settings->curve_strength); brush->gpencil_settings->curve_jitter = newdataadr(fd, brush->gpencil_settings->curve_jitter); - if (brush->gpencil_settings->curve_sensitivity) + if (brush->gpencil_settings->curve_sensitivity) { direct_link_curvemapping(fd, brush->gpencil_settings->curve_sensitivity); + } - if (brush->gpencil_settings->curve_strength) + if (brush->gpencil_settings->curve_strength) { direct_link_curvemapping(fd, brush->gpencil_settings->curve_strength); + } - if (brush->gpencil_settings->curve_jitter) + if (brush->gpencil_settings->curve_jitter) { direct_link_curvemapping(fd, brush->gpencil_settings->curve_jitter); + } } brush->preview = NULL; @@ -2778,8 +2852,9 @@ static void lib_link_ipo(FileData *fd, Main *main) if (ipo->id.tag & LIB_TAG_NEED_LINK) { IpoCurve *icu; for (icu = ipo->curve.first; icu; icu = icu->next) { - if (icu->driver) + if (icu->driver) { icu->driver->ob = newlibadr(fd, ipo->id.lib, icu->driver->ob); + } } ipo->id.tag &= ~LIB_TAG_NEED_LINK; } @@ -2810,8 +2885,9 @@ static void lib_link_nlastrips(FileData *fd, ID *id, ListBase *striplist) strip->object = newlibadr(fd, id->lib, strip->object); strip->act = newlibadr_us(fd, id->lib, strip->act); strip->ipo = newlibadr(fd, id->lib, strip->ipo); - for (amod = strip->modifiers.first; amod; amod = amod->next) + for (amod = strip->modifiers.first; amod; amod = amod->next) { amod->ob = newlibadr(fd, id->lib, amod->ob); + } } } @@ -2822,8 +2898,9 @@ static void direct_link_nlastrips(FileData *fd, ListBase *strips) link_list(fd, strips); - for (strip = strips->first; strip; strip = strip->next) + for (strip = strips->first; strip; strip = strip->next) { link_list(fd, &strip->modifiers); + } } // XXX deprecated - old animation system @@ -2863,8 +2940,9 @@ static void lib_link_fcurves(FileData *fd, ID *id, ListBase *list) { FCurve *fcu; - if (list == NULL) + if (list == NULL) { return; + } /* relink ID-block references... */ for (fcu = list->first; fcu; fcu = fcu->next) { @@ -2876,10 +2954,12 @@ static void lib_link_fcurves(FileData *fd, ID *id, ListBase *list) for (dvar = driver->variables.first; dvar; dvar = dvar->next) { DRIVER_TARGETS_LOOPER_BEGIN (dvar) { /* only relink if still used */ - if (tarIndex < dvar->num_targets) + if (tarIndex < dvar->num_targets) { dtar->id = newlibadr(fd, id->lib, dtar->id); - else + } + else { dtar->id = NULL; + } } DRIVER_TARGETS_LOOPER_END; } @@ -2975,10 +3055,12 @@ static void direct_link_fcurves(FileData *fd, ListBase *list) for (dvar = driver->variables.first; dvar; dvar = dvar->next) { DRIVER_TARGETS_LOOPER_BEGIN (dvar) { /* only relink the targets being used */ - if (tarIndex < dvar->num_targets) + if (tarIndex < dvar->num_targets) { dtar->rna_path = newdataadr(fd, dtar->rna_path); - else + } + else { dtar->rna_path = NULL; + } } DRIVER_TARGETS_LOOPER_END; } @@ -3057,8 +3139,9 @@ static void lib_link_nladata_strips(FileData *fd, ID *id, ListBase *list) strip->act = newlibadr_us(fd, id->lib, strip->act); /* fix action id-root (i.e. if it comes from a pre 2.57 .blend file) */ - if ((strip->act) && (strip->act->idroot == 0)) + if ((strip->act) && (strip->act->idroot == 0)) { strip->act->idroot = GS(id->name); + } } } @@ -3145,18 +3228,21 @@ static void direct_link_keyingsets(FileData *fd, ListBase *list) static void lib_link_animdata(FileData *fd, ID *id, AnimData *adt) { - if (adt == NULL) + if (adt == NULL) { return; + } /* link action data */ 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)) + if ((adt->action) && (adt->action->idroot == 0)) { adt->action->idroot = GS(id->name); - if ((adt->tmpact) && (adt->tmpact->idroot == 0)) + } + if ((adt->tmpact) && (adt->tmpact->idroot == 0)) { adt->tmpact->idroot = GS(id->name); + } /* link drivers */ lib_link_fcurves(fd, id, &adt->drivers); @@ -3170,8 +3256,9 @@ static void lib_link_animdata(FileData *fd, ID *id, AnimData *adt) static void direct_link_animdata(FileData *fd, AnimData *adt) { /* NOTE: must have called newdataadr already before doing this... */ - if (adt == NULL) + if (adt == NULL) { return; + } /* link drivers */ link_list(fd, &adt->drivers); @@ -3415,8 +3502,9 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) /* verify static socket templates */ FOREACH_NODETREE_BEGIN (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; @@ -3440,8 +3528,9 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) for (node = ntree->nodes.first; node; node = node->next) { if (node->type == NODE_GROUP) { bNodeTree *ngroup = (bNodeTree *)node->id; - if (ngroup && (ngroup->flag & NTREE_DO_VERSIONS_GROUP_EXPOSE_2_56_2)) + if (ngroup && (ngroup->flag & NTREE_DO_VERSIONS_GROUP_EXPOSE_2_56_2)) { lib_node_do_versions_group_indices(node); + } } } } @@ -3485,11 +3574,13 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) /*static const float offsety = 0.0f;*/ if (create_io_nodes) { - if (ntree->inputs.first) + if (ntree->inputs.first) { input_node = nodeAddStaticNode(NULL, ntree, NODE_GROUP_INPUT); + } - if (ntree->outputs.first) + if (ntree->outputs.first) { output_node = nodeAddStaticNode(NULL, ntree, NODE_GROUP_OUTPUT); + } } /* Redirect links from/to the node tree interface to input/output node. @@ -3508,8 +3599,9 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) ++num_inputs; if (link->tonode) { - if (input_locx > link->tonode->locx - offsetx) + if (input_locx > link->tonode->locx - offsetx) { input_locx = link->tonode->locx - offsetx; + } input_locy += link->tonode->locy; } } @@ -3525,8 +3617,9 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) ++num_outputs; if (link->fromnode) { - if (output_locx < link->fromnode->locx + offsetx) + if (output_locx < link->fromnode->locx + offsetx) { output_locx = link->fromnode->locx + offsetx; + } output_locy += link->fromnode->locy; } } @@ -3535,8 +3628,9 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) } } - if (free_link) + if (free_link) { nodeRemLink(ntree, link); + } } if (num_inputs > 0) { @@ -3698,19 +3792,23 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree) node->parent = newdataadr(fd, node->parent); node->lasty = 0; - for (sock = node->inputs.first; sock; sock = sock->next) + for (sock = node->inputs.first; sock; sock = sock->next) { direct_link_node_socket(fd, sock); - for (sock = node->outputs.first; sock; sock = sock->next) + } + for (sock = node->outputs.first; sock; sock = sock->next) { direct_link_node_socket(fd, sock); + } } /* interface socket lists */ link_list(fd, &ntree->inputs); link_list(fd, &ntree->outputs); - for (sock = ntree->inputs.first; sock; sock = sock->next) + for (sock = ntree->inputs.first; sock; sock = sock->next) { direct_link_node_socket(fd, sock); - for (sock = ntree->outputs.first; sock; sock = sock->next) + } + for (sock = ntree->outputs.first; sock; sock = sock->next) { direct_link_node_socket(fd, sock); + } for (link = ntree->links.first; link; link = link->next) { link->fromnode = newdataadr(fd, link->fromnode); @@ -3846,8 +3944,9 @@ static void direct_link_constraints(FileData *fd, ListBase *lb) } case CONSTRAINT_TYPE_CHILDOF: { /* XXX version patch, in older code this flag wasn't always set, and is inherent to type */ - if (con->ownspace == CONSTRAINT_SPACE_POSE) + if (con->ownspace == CONSTRAINT_SPACE_POSE) { con->flag |= CONSTRAINT_SPACEONCE; + } break; } case CONSTRAINT_TYPE_TRANSFORM_CACHE: { @@ -3862,8 +3961,9 @@ static void lib_link_pose(FileData *fd, Main *bmain, Object *ob, bPose *pose) { bArmature *arm = ob->data; - if (!pose || !arm) + if (!pose || !arm) { return; + } /* always rebuild to match proxy or lib changes, but on Undo */ bool rebuild = false; @@ -3879,8 +3979,9 @@ static void lib_link_pose(FileData *fd, Main *bmain, Object *ob, bPose *pose) if (ob->proxy) { /* sync proxy layer */ - if (pose->proxy_layer) + if (pose->proxy_layer) { arm->layer = pose->proxy_layer; + } /* sync proxy active bone */ if (pose->proxy_act_bone[0]) { @@ -3958,8 +4059,9 @@ 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); + } } static void direct_link_armature(FileData *fd, bArmature *arm) @@ -4051,8 +4153,9 @@ static void direct_link_light(FileData *fd, Light *la) direct_link_animdata(fd, la->adt); la->curfalloff = newdataadr(fd, la->curfalloff); - if (la->curfalloff) + if (la->curfalloff) { direct_link_curvemapping(fd, la->curfalloff); + } la->nodetree = newdataadr(fd, la->nodetree); if (la->nodetree) { @@ -4139,8 +4242,9 @@ static void direct_link_key(FileData *fd, Key *key) for (kb = key->block.first; kb; kb = kb->next) { kb->data = newdataadr(fd, kb->data); - if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) + if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) { switch_endian_keyblock(key, kb); + } } } @@ -4326,10 +4430,12 @@ static void direct_link_image(FileData *fd, Image *ima) ImagePackedFile *imapf; /* for undo system, pointers could be restored */ - if (fd->imamap) + if (fd->imamap) { ima->cache = newimaadr(fd, ima->cache); - else + } + else { ima->cache = NULL; + } /* if not restored, we keep the binded opengl index */ if (!ima->cache) { @@ -4457,8 +4563,9 @@ static void direct_link_curve(FileData *fd, Curve *cu) cu->tb = tb; cu->tb[0].w = cu->linewidth; } - if (cu->wordspace == 0.0f) + if (cu->wordspace == 0.0f) { cu->wordspace = 1.0f; + } } cu->editnurb = NULL; @@ -4470,8 +4577,9 @@ static void direct_link_curve(FileData *fd, Curve *cu) nu->bp = newdataadr(fd, nu->bp); nu->knotsu = newdataadr(fd, nu->knotsu); nu->knotsv = newdataadr(fd, nu->knotsv); - if (cu->vfont == NULL) + if (cu->vfont == NULL) { nu->charidx = 0; + } if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) { switch_endian_knots(nu); @@ -4618,8 +4726,9 @@ 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) @@ -4627,8 +4736,9 @@ static void direct_link_pointcache(FileData *fd, PointCache *cache) if ((cache->flag & PTCACHE_DISK_CACHE) == 0) { link_list_ex(fd, &cache->mem_cache, direct_link_pointcache_cb); } - else + else { BLI_listbase_clear(&cache->mem_cache); + } cache->flag &= ~PTCACHE_SIMULATION_VALID; cache->simframe = 0; @@ -4671,10 +4781,12 @@ static void direct_link_pointcache_list(FileData *fd, static void lib_link_partdeflect(FileData *fd, ID *id, PartDeflect *pd) { - if (pd && pd->tex) + if (pd && pd->tex) { pd->tex = newlibadr_us(fd, id->lib, pd->tex); - if (pd && pd->f_source) + } + if (pd && pd->f_source) { pd->f_source = newlibadr(fd, id->lib, pd->f_source); + } } static void lib_link_particlesettings(FileData *fd, Main *main) @@ -4750,8 +4862,9 @@ static void lib_link_particlesettings(FileData *fd, Main *main) static void direct_link_partdeflect(PartDeflect *pd) { - if (pd) + if (pd) { pd->rng = NULL; + } } static void direct_link_particlesettings(FileData *fd, ParticleSettings *part) @@ -4767,18 +4880,22 @@ static void direct_link_particlesettings(FileData *fd, ParticleSettings *part) direct_link_partdeflect(part->pd2); part->clumpcurve = newdataadr(fd, part->clumpcurve); - if (part->clumpcurve) + if (part->clumpcurve) { direct_link_curvemapping(fd, part->clumpcurve); + } part->roughcurve = newdataadr(fd, part->roughcurve); - if (part->roughcurve) + if (part->roughcurve) { direct_link_curvemapping(fd, part->roughcurve); + } part->twistcurve = newdataadr(fd, part->twistcurve); - if (part->twistcurve) + if (part->twistcurve) { direct_link_curvemapping(fd, part->twistcurve); + } part->effector_weights = newdataadr(fd, part->effector_weights); - if (!part->effector_weights) + if (!part->effector_weights) { part->effector_weights = BKE_effector_add_weights(part->eff_group); + } link_list(fd, &part->instance_weights); @@ -4814,8 +4931,9 @@ static void lib_link_particlesystems(FileData *fd, Object *ob, ID *id, ListBase if (psys->part) { ParticleTarget *pt = psys->targets.first; - for (; pt; pt = pt->next) + for (; pt; pt = pt->next) { pt->ob = newlibadr(fd, id->lib, pt->ob); + } psys->parent = newlibadr(fd, id->lib, psys->parent); psys->target_ob = newlibadr(fd, id->lib, psys->target_ob); @@ -4850,8 +4968,9 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles) psys->particles = newdataadr(fd, psys->particles); if (psys->particles && psys->particles->hair) { - for (a = 0, pa = psys->particles; a < psys->totpart; a++, pa++) + for (a = 0, pa = psys->particles; a < psys->totpart; a++, pa++) { pa->hair = newdataadr(fd, pa->hair); + } } if (psys->particles && psys->particles->keys) { @@ -4874,8 +4993,9 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles) } } else if (psys->particles) { - for (a = 0, pa = psys->particles; a < psys->totpart; a++, pa++) + for (a = 0, pa = psys->particles; a < psys->totpart; a++, pa++) { pa->boid = NULL; + } } psys->fluid_springs = newdataadr(fd, psys->fluid_springs); @@ -4903,8 +5023,9 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles) if (psys->clmd->sim_parms) { psys->clmd->sim_parms->effector_weights = NULL; - if (psys->clmd->sim_parms->presets > 10) + if (psys->clmd->sim_parms->presets > 10) { psys->clmd->sim_parms->presets = 0; + } } psys->hair_in_mesh = psys->hair_out_mesh = NULL; @@ -5043,8 +5164,9 @@ static void direct_link_mdisps(FileData *fd, int count, MDisps *mdisps, int exte /* this does swap for data written at write_mdisps() - readfile.c */ BLI_endian_switch_float_array(*mdisps[i].disps, mdisps[i].totdisp * 3); } - if (!external && !mdisps[i].disps) + if (!external && !mdisps[i].disps) { mdisps[i].totdisp = 0; + } } } } @@ -5056,8 +5178,9 @@ static void direct_link_grid_paint_mask(FileData *fd, int count, GridPaintMask * for (i = 0; i < count; ++i) { GridPaintMask *gpm = &grid_paint_mask[i]; - if (gpm->data) + if (gpm->data) { gpm->data = newdataadr(fd, gpm->data); + } } } } @@ -5081,17 +5204,20 @@ static void direct_link_customdata(FileData *fd, CustomData *data, int count) while (i < data->totlayer) { CustomDataLayer *layer = &data->layers[i]; - if (layer->flag & CD_FLAG_EXTERNAL) + if (layer->flag & CD_FLAG_EXTERNAL) { layer->flag &= ~CD_FLAG_IN_MEMORY; + } layer->flag &= ~CD_FLAG_NOFREE; if (CustomData_verify_versions(data, i)) { layer->data = newdataadr(fd, layer->data); - if (layer->type == CD_MDISPS) + if (layer->type == CD_MDISPS) { direct_link_mdisps(fd, count, layer->data, layer->flag & CD_FLAG_EXTERNAL); - else if (layer->type == CD_GRID_PAINT_MASK) + } + else if (layer->type == CD_GRID_PAINT_MASK) { direct_link_grid_paint_mask(fd, count, layer->data); + } i++; } } @@ -5164,8 +5290,9 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh) * array, or the verts array contains out-of-date * data. */ if (mesh->totvert == ((MultiresLevel *)mesh->mr->levels.last)->totvert) { - if (mesh->mr->verts) + if (mesh->mr->verts) { MEM_freeN(mesh->mr->verts); + } mesh->mr->verts = MEM_dupallocN(mesh->mvert); } @@ -5318,10 +5445,12 @@ static void lib_link_object(FileData *fd, Main *main) ob->proxy->proxy_from = NULL; ob->proxy = NULL; - if (ob->id.lib) + if (ob->id.lib) { printf("Proxy lost from object %s lib %s\n", ob->id.name + 2, ob->id.lib->name); - else + } + else { printf("Proxy lost from object %s lib <NONE>\n", ob->id.name + 2); + } } else { /* this triggers object_update to always use a copy */ @@ -5334,10 +5463,12 @@ static void lib_link_object(FileData *fd, Main *main) ob->data = newlibadr_us(fd, ob->id.lib, ob->data); if (ob->data == NULL && poin != NULL) { - if (ob->id.lib) + if (ob->id.lib) { printf("Can't find obdata of %s lib %s\n", ob->id.name + 2, ob->id.lib->name); - else + } + else { printf("Object %s lost data.\n", ob->id.name + 2); + } ob->type = OB_EMPTY; warn = true; @@ -5357,8 +5488,9 @@ static void lib_link_object(FileData *fd, Main *main) 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 * the material list size gets out of sync. [#22663] */ @@ -5395,9 +5527,10 @@ static void lib_link_object(FileData *fd, Main *main) FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType( ob, eModifierType_Fluidsim); - if (fluidmd && fluidmd->fss) + if (fluidmd && fluidmd->fss) { fluidmd->fss->ipo = newlibadr_us( fd, ob->id.lib, fluidmd->fss->ipo); // XXX deprecated - old animation system + } } { @@ -5411,8 +5544,9 @@ static void lib_link_object(FileData *fd, Main *main) } /* texture field */ - if (ob->pd) + if (ob->pd) { lib_link_partdeflect(fd, &ob->id, ob->pd); + } if (ob->soft) { ob->soft->collision_group = newlibadr(fd, ob->id.lib, ob->soft->collision_group); @@ -5436,8 +5570,9 @@ static void lib_link_object(FileData *fd, Main *main) for (level = ob->lodlevels.first; level; level = level->next) { level->source = newlibadr(fd, ob->id.lib, level->source); - if (!level->source && level == ob->lodlevels.first) + if (!level->source && level == ob->lodlevels.first) { level->source = ob; + } } } } @@ -5452,8 +5587,9 @@ static void lib_link_object(FileData *fd, Main *main) static void direct_link_motionpath(FileData *fd, bMotionPath *mpath) { /* sanity check */ - if (mpath == NULL) + if (mpath == NULL) { return; + } /* relink points cache */ mpath->points = newdataadr(fd, mpath->points); @@ -5467,8 +5603,9 @@ static void direct_link_pose(FileData *fd, bPose *pose) { bPoseChannel *pchan; - if (!pose) + if (!pose) { return; + } link_list(fd, &pose->chanbase); link_list(fd, &pose->agroups); @@ -5491,8 +5628,9 @@ static void direct_link_pose(FileData *fd, bPose *pose) IDP_DirectLinkGroup_OrFree(&pchan->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); pchan->mpath = newdataadr(fd, pchan->mpath); - if (pchan->mpath) + if (pchan->mpath) { direct_link_motionpath(fd, pchan->mpath); + } BLI_listbase_clear(&pchan->iktree); BLI_listbase_clear(&pchan->siktree); @@ -5520,8 +5658,9 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) md->runtime = NULL; /* if modifiers disappear, or for upward compatibility */ - if (NULL == modifierType_getInfo(md->type)) + if (NULL == modifierType_getInfo(md->type)) { md->type = eModifierType_None; + } if (md->type == eModifierType_Subsurf) { SubsurfModifierData *smd = (SubsurfModifierData *)md; @@ -5545,8 +5684,9 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) direct_link_pointcache_list(fd, &clmd->ptcaches, &clmd->point_cache, 0); if (clmd->sim_parms) { - if (clmd->sim_parms->presets > 10) + if (clmd->sim_parms->presets > 10) { clmd->sim_parms->presets = 0; + } clmd->sim_parms->reset = 0; @@ -5594,8 +5734,9 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) smd->domain->coba = newdataadr(fd, smd->domain->coba); smd->domain->effector_weights = newdataadr(fd, smd->domain->effector_weights); - if (!smd->domain->effector_weights) + if (!smd->domain->effector_weights) { smd->domain->effector_weights = BKE_effector_add_weights(NULL); + } direct_link_pointcache_list( fd, &(smd->domain->ptcaches[0]), &(smd->domain->point_cache[0]), 1); @@ -5663,8 +5804,9 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) surface->data = NULL; direct_link_pointcache_list(fd, &(surface->ptcaches), &(surface->pointcache), 1); - if (!(surface->effector_weights = newdataadr(fd, surface->effector_weights))) + if (!(surface->effector_weights = newdataadr(fd, surface->effector_weights))) { surface->effector_weights = BKE_effector_add_weights(NULL); + } } } } @@ -5752,16 +5894,21 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) mmd->bindcos = newdataadr(fd, mmd->bindcos); if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) { - if (mmd->bindoffsets) + if (mmd->bindoffsets) { BLI_endian_switch_int32_array(mmd->bindoffsets, mmd->totvert + 1); - if (mmd->bindcagecos) + } + if (mmd->bindcagecos) { BLI_endian_switch_float_array(mmd->bindcagecos, mmd->totcagevert * 3); - if (mmd->dynverts) + } + if (mmd->dynverts) { BLI_endian_switch_int32_array(mmd->dynverts, mmd->totvert); - if (mmd->bindweights) + } + if (mmd->bindweights) { BLI_endian_switch_float_array(mmd->bindweights, mmd->totvert); - if (mmd->bindcos) + } + if (mmd->bindcos) { BLI_endian_switch_float_array(mmd->bindcos, mmd->totcagevert * 3); + } } } else if (md->type == eModifierType_Ocean) { @@ -5773,15 +5920,17 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) WarpModifierData *tmd = (WarpModifierData *)md; tmd->curfalloff = newdataadr(fd, tmd->curfalloff); - if (tmd->curfalloff) + if (tmd->curfalloff) { direct_link_curvemapping(fd, tmd->curfalloff); + } } else if (md->type == eModifierType_WeightVGEdit) { WeightVGEditModifierData *wmd = (WeightVGEditModifierData *)md; wmd->cmap_curve = newdataadr(fd, wmd->cmap_curve); - if (wmd->cmap_curve) + if (wmd->cmap_curve) { direct_link_curvemapping(fd, wmd->cmap_curve); + } } else if (md->type == eModifierType_LaplacianDeform) { LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)md; @@ -5826,9 +5975,10 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) fd, smd->verts[i].binds[j].vert_weights); if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) { - if (smd->verts[i].binds[j].vert_inds) + 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); + } if (smd->verts[i].binds[j].vert_weights) { if (smd->verts[i].binds[j].mode == MOD_SDEF_MODE_CENTROID || @@ -5859,8 +6009,9 @@ static void direct_link_gpencil_modifiers(FileData *fd, ListBase *lb) md->error = NULL; /* if modifiers disappear, or for upward compatibility */ - if (NULL == BKE_gpencil_modifierType_getInfo(md->type)) + if (NULL == BKE_gpencil_modifierType_getInfo(md->type)) { md->type = eModifierType_None; + } if (md->type == eGpencilModifierType_Lattice) { LatticeGpencilModifierData *gpmd = (LatticeGpencilModifierData *)md; @@ -5897,8 +6048,9 @@ static void direct_link_shaderfxs(FileData *fd, ListBase *lb) fx->error = NULL; /* if shader disappear, or for upward compatibility */ - if (NULL == BKE_shaderfxType_getInfo(fx->type)) + if (NULL == BKE_shaderfxType_getInfo(fx->type)) { fx->type = eShaderFxType_None; + } } } @@ -5930,8 +6082,9 @@ static void direct_link_object(FileData *fd, Object *ob) direct_link_pose(fd, ob->pose); ob->mpath = newdataadr(fd, ob->mpath); - if (ob->mpath) + if (ob->mpath) { direct_link_motionpath(fd, ob->mpath); + } link_list(fd, &ob->defbase); link_list(fd, &ob->fmaps); @@ -6021,8 +6174,9 @@ static void direct_link_object(FileData *fd, Object *ob) } sb->effector_weights = newdataadr(fd, sb->effector_weights); - if (!sb->effector_weights) + if (!sb->effector_weights) { sb->effector_weights = BKE_effector_add_weights(NULL); + } sb->shared = newdataadr(fd, sb->shared); if (sb->shared == NULL) { @@ -6046,8 +6200,9 @@ static void direct_link_object(FileData *fd, Object *ob) rbo->shared = MEM_callocN(sizeof(*rbo->shared), "RigidBodyObShared"); } ob->rigidbody_constraint = newdataadr(fd, ob->rigidbody_constraint); - if (ob->rigidbody_constraint) + if (ob->rigidbody_constraint) { ob->rigidbody_constraint->physics_constraint = NULL; + } link_list(fd, &ob->particlesystem); direct_link_particlesystems(fd, &ob->particlesystem); @@ -6115,8 +6270,9 @@ static void direct_link_view_settings(FileData *fd, ColorManagedViewSettings *vi { view_settings->curve_mapping = newdataadr(fd, view_settings->curve_mapping); - if (view_settings->curve_mapping) + if (view_settings->curve_mapping) { direct_link_curvemapping(fd, view_settings->curve_mapping); + } } /** \} */ @@ -6334,8 +6490,9 @@ 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; + } } } @@ -6360,8 +6517,9 @@ static void lib_link_sequence_modifiers(FileData *fd, Scene *scene, ListBase *lb SequenceModifierData *smd; for (smd = lb->first; smd; smd = smd->next) { - if (smd->mask_id) + if (smd->mask_id) { smd->mask_id = newlibadr_us(fd, scene->id.lib, smd->mask_id); + } } } @@ -6414,8 +6572,9 @@ static bool scene_validate_setscene__liblink(Scene *sce, const int totscene) Scene *sce_iter; int a; - if (sce->set == NULL) + if (sce->set == NULL) { return 1; + } for (a = 0, sce_iter = sce; sce_iter->set; sce_iter = sce_iter->set, a++) { if (sce_iter->id.tag & LIB_TAG_NEED_LINK) { @@ -6460,21 +6619,25 @@ static void lib_link_scene(FileData *fd, Main *main) link_paint(fd, sce, &sce->toolsettings->uvsculpt->paint); link_paint(fd, sce, &sce->toolsettings->gp_paint->paint); - if (sce->toolsettings->sculpt) + if (sce->toolsettings->sculpt) { sce->toolsettings->sculpt->gravity_object = newlibadr( fd, sce->id.lib, sce->toolsettings->sculpt->gravity_object); + } - if (sce->toolsettings->imapaint.stencil) + if (sce->toolsettings->imapaint.stencil) { sce->toolsettings->imapaint.stencil = newlibadr_us( fd, sce->id.lib, sce->toolsettings->imapaint.stencil); + } - if (sce->toolsettings->imapaint.clone) + if (sce->toolsettings->imapaint.clone) { sce->toolsettings->imapaint.clone = newlibadr_us( fd, sce->id.lib, sce->toolsettings->imapaint.clone); + } - if (sce->toolsettings->imapaint.canvas) + if (sce->toolsettings->imapaint.canvas) { sce->toolsettings->imapaint.canvas = newlibadr_us( fd, sce->id.lib, sce->toolsettings->imapaint.canvas); + } sce->toolsettings->particle.shape_object = newlibadr( fd, sce->id.lib, sce->toolsettings->particle.shape_object); @@ -6494,8 +6657,9 @@ static void lib_link_scene(FileData *fd, Main *main) TIP_("LIB: object lost from scene: '%s'"), sce->id.name + 2); BLI_remlink(&sce->base, base_legacy); - if (base_legacy == sce->basact) + if (base_legacy == sce->basact) { sce->basact = NULL; + } MEM_freeN(base_legacy); } } @@ -6504,9 +6668,10 @@ static void lib_link_scene(FileData *fd, Main *main) SEQ_BEGIN (sce->ed, seq) { IDP_LibLinkProperty(seq->prop, fd); - if (seq->ipo) + if (seq->ipo) { seq->ipo = newlibadr_us( fd, sce->id.lib, seq->ipo); // XXX deprecated - old animation system + } seq->scene_sound = NULL; if (seq->scene) { seq->scene = newlibadr(fd, sce->id.lib, seq->scene); @@ -6558,12 +6723,15 @@ static void lib_link_scene(FileData *fd, Main *main) /* rigidbody world relies on it's linked collections */ if (sce->rigidbody_world) { RigidBodyWorld *rbw = sce->rigidbody_world; - if (rbw->group) + if (rbw->group) { rbw->group = newlibadr(fd, sce->id.lib, rbw->group); - if (rbw->constraints) + } + if (rbw->constraints) { rbw->constraints = newlibadr(fd, sce->id.lib, rbw->constraints); - if (rbw->effector_weights) + } + if (rbw->effector_weights) { rbw->effector_weights->group = newlibadr(fd, sce->id.lib, rbw->effector_weights->group); + } } if (sce->nodetree) { @@ -6649,21 +6817,25 @@ static void link_recurs_seq(FileData *fd, ListBase *lb) link_list(fd, lb); for (seq = lb->first; seq; seq = seq->next) { - if (seq->seqbase.first) + if (seq->seqbase.first) { link_recurs_seq(fd, &seq->seqbase); + } } } static void direct_link_paint(FileData *fd, const Scene *scene, Paint *p) { - if (p->num_input_samples < 1) + if (p->num_input_samples < 1) { p->num_input_samples = 1; + } p->cavity_curve = newdataadr(fd, p->cavity_curve); - if (p->cavity_curve) + if (p->cavity_curve) { direct_link_curvemapping(fd, p->cavity_curve); - else + } + else { BKE_paint_cavity_curve_preset(p, CURVE_PRESET_LINE); + } p->tool_slots = newdataadr(fd, p->tool_slots); @@ -6687,8 +6859,9 @@ static void direct_link_sequence_modifiers(FileData *fd, ListBase *lb) link_list(fd, lb); for (smd = lb->first; smd; smd = smd->next) { - if (smd->mask_sequence) + if (smd->mask_sequence) { smd->mask_sequence = newdataadr(fd, smd->mask_sequence); + } if (smd->type == seqModifierType_Curves) { CurvesModifierData *cmd = (CurvesModifierData *)smd; @@ -6785,14 +6958,16 @@ static void direct_link_scene(FileData *fd, Scene *sce) seq->seq3 = newdataadr(fd, seq->seq3); /* a patch: after introduction of effects with 3 input strips */ - if (seq->seq3 == NULL) + if (seq->seq3 == NULL) { seq->seq3 = seq->seq2; + } seq->effectdata = newdataadr(fd, seq->effectdata); seq->stereo3d_format = newdataadr(fd, seq->stereo3d_format); - if (seq->type & SEQ_TYPE_EFFECT) + if (seq->type & SEQ_TYPE_EFFECT) { seq->flag |= SEQ_EFFECT_NOT_LOADED; + } if (seq->type == SEQ_TYPE_SPEED) { SpeedControlVars *s = seq->effectdata; @@ -6871,10 +7046,12 @@ static void direct_link_scene(FileData *fd, Scene *sce) poin = POINTER_OFFSET(ed->seqbasep, -offset); poin = newdataadr(fd, poin); - if (poin) + if (poin) { ed->seqbasep = (ListBase *)POINTER_OFFSET(poin, offset); - else + } + else { ed->seqbasep = &ed->seqbase; + } } /* stack */ link_list(fd, &(ed->metastack)); @@ -6882,15 +7059,18 @@ static void direct_link_scene(FileData *fd, Scene *sce) for (ms = ed->metastack.first; ms; ms = ms->next) { ms->parseq = newdataadr(fd, ms->parseq); - if (ms->oldbasep == old_seqbasep) + if (ms->oldbasep == old_seqbasep) { ms->oldbasep = &ed->seqbase; + } else { poin = POINTER_OFFSET(ms->oldbasep, -offset); poin = newdataadr(fd, poin); - if (poin) + if (poin) { ms->oldbasep = (ListBase *)POINTER_OFFSET(poin, offset); - else + } + else { ms->oldbasep = &ed->seqbase; + } } } } @@ -6963,8 +7143,9 @@ static void direct_link_scene(FileData *fd, Scene *sce) /* set effector weights */ rbw->effector_weights = newdataadr(fd, rbw->effector_weights); - if (!rbw->effector_weights) + if (!rbw->effector_weights) { rbw->effector_weights = BKE_effector_add_weights(NULL); + } } sce->preview = direct_link_preview_image(fd, sce->preview); @@ -6994,10 +7175,12 @@ static void direct_link_scene(FileData *fd, Scene *sce) if (fd->memfile) { /* If it's undo try to recover the cache. */ - if (fd->scenemap) + if (fd->scenemap) { sce->eevee.light_cache = newsceadr(fd, sce->eevee.light_cache); - else + } + else { sce->eevee.light_cache = NULL; + } } else { /* else try to read the cache from file. */ @@ -7052,8 +7235,9 @@ static void direct_link_gpencil(FileData *fd, bGPdata *gpd) bGPDpalette *palette; /* we must firstly have some grease-pencil data to link! */ - if (gpd == NULL) + if (gpd == NULL) { return; + } /* relink animdata */ gpd->adt = newdataadr(fd, gpd->adt); @@ -7238,11 +7422,13 @@ static void direct_link_area(FileData *fd, ScrArea *area) /* if we do not have the spacetype registered we cannot * free it, so don't allocate any new memory for such spacetypes. */ - if (!BKE_spacetype_exists(sl->spacetype)) + if (!BKE_spacetype_exists(sl->spacetype)) { sl->spacetype = SPACE_EMPTY; + } - for (ar = sl->regionbase.first; ar; ar = ar->next) + for (ar = sl->regionbase.first; ar; ar = ar->next) { direct_link_region(fd, ar, sl->spacetype); + } if (sl->spacetype == SPACE_VIEW3D) { View3D *v3d = (View3D *)sl; @@ -7262,10 +7448,12 @@ static void direct_link_area(FileData *fd, ScrArea *area) } v3d->shading.prev_type = OB_SOLID; - if (v3d->fx_settings.dof) + if (v3d->fx_settings.dof) { v3d->fx_settings.dof = newdataadr(fd, v3d->fx_settings.dof); - if (v3d->fx_settings.ssao) + } + if (v3d->fx_settings.ssao) { v3d->fx_settings.ssao = newdataadr(fd, v3d->fx_settings.ssao); + } blo_do_versions_view3d_split_250(v3d, &sl->regionbase); } @@ -7570,11 +7758,13 @@ static void lib_link_area(FileData *fd, ID *parent_id, ScrArea *area) /* first nodetree in path is same as snode->nodetree */ path->nodetree = snode->nodetree; } - else + else { path->nodetree = newlibadr_us(fd, parent_id->lib, path->nodetree); + } - if (!path->nodetree) + if (!path->nodetree) { break; + } } /* remaining path entries are invalid, remove */ @@ -7953,9 +8143,10 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, if (ads) { ads->source = restore_pointer_by_name(id_map, (ID *)ads->source, USER_REAL); - if (ads->filter_grp) + if (ads->filter_grp) { ads->filter_grp = restore_pointer_by_name( id_map, (ID *)ads->filter_grp, USER_IGNORE); + } } /* force recalc of list of channels (i.e. includes calculating F-Curve colors) @@ -7986,9 +8177,10 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, saction->ads.source = restore_pointer_by_name( id_map, (ID *)saction->ads.source, USER_REAL); - if (saction->ads.filter_grp) + if (saction->ads.filter_grp) { saction->ads.filter_grp = restore_pointer_by_name( id_map, (ID *)saction->ads.filter_grp, USER_IGNORE); + } /* force recalc of list of channels, potentially updating the active action * while we're at it (as it can only be updated that way) [#28962] @@ -8035,17 +8227,19 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, if (ads) { ads->source = restore_pointer_by_name(id_map, (ID *)ads->source, USER_REAL); - if (ads->filter_grp) + if (ads->filter_grp) { ads->filter_grp = restore_pointer_by_name( id_map, (ID *)ads->filter_grp, USER_IGNORE); + } } } else if (sl->spacetype == SPACE_TEXT) { SpaceText *st = (SpaceText *)sl; st->text = restore_pointer_by_name(id_map, (ID *)st->text, USER_REAL); - if (st->text == NULL) + if (st->text == NULL) { st->text = newmain->texts.first; + } } else if (sl->spacetype == SPACE_SCRIPT) { SpaceScript *scpt = (SpaceScript *)sl; @@ -8101,11 +8295,13 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, /* first nodetree in path is same as snode->nodetree */ path->nodetree = snode->nodetree; } - else + else { path->nodetree = restore_pointer_by_name(id_map, (ID *)path->nodetree, USER_REAL); + } - if (!path->nodetree) + if (!path->nodetree) { break; + } } /* remaining path entries are invalid, remove */ @@ -8122,8 +8318,9 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, path = snode->treepath.last; snode->edittree = path->nodetree; } - else + else { snode->edittree = NULL; + } } else if (sl->spacetype == SPACE_CLIP) { SpaceClip *sclip = (SpaceClip *)sl; @@ -8210,8 +8407,9 @@ void blo_do_versions_view3d_split_250(View3D *v3d, ListBase *regions) } /* this was not initialized correct always */ - if (v3d->gridsubdiv == 0) + if (v3d->gridsubdiv == 0) { v3d->gridsubdiv = 10; + } } static bool direct_link_screen(FileData *fd, bScreen *sc) @@ -8487,15 +8685,19 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip) clip->adt = newdataadr(fd, clip->adt); - if (fd->movieclipmap) + if (fd->movieclipmap) { clip->cache = newmclipadr(fd, clip->cache); - else + } + else { clip->cache = NULL; + } - if (fd->movieclipmap) + if (fd->movieclipmap) { clip->tracking.camera.intrinsics = newmclipadr(fd, clip->tracking.camera.intrinsics); - else + } + else { clip->tracking.camera.intrinsics = NULL; + } direct_link_movieTracks(fd, &tracking->tracks); direct_link_moviePlaneTracks(fd, &tracking->plane_tracks); @@ -8598,8 +8800,9 @@ static void direct_link_mask(FileData *fd, Mask *mask) for (i = 0; i < spline->tot_point; i++) { MaskSplinePoint *point = &spline->points[i]; - if (point->tot_uw) + if (point->tot_uw) { point->uw = newdataadr(fd, point->uw); + } } /* detect active point */ @@ -8900,17 +9103,21 @@ static void direct_link_linestyle(FileData *fd, FreestyleLineStyle *linestyle) 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) + for (modifier = linestyle->color_modifiers.first; modifier; modifier = modifier->next) { direct_link_linestyle_color_modifier(fd, modifier); + } link_list(fd, &linestyle->alpha_modifiers); - for (modifier = linestyle->alpha_modifiers.first; modifier; modifier = modifier->next) + for (modifier = linestyle->alpha_modifiers.first; modifier; modifier = modifier->next) { direct_link_linestyle_alpha_modifier(fd, modifier); + } link_list(fd, &linestyle->thickness_modifiers); - for (modifier = linestyle->thickness_modifiers.first; modifier; modifier = modifier->next) + for (modifier = linestyle->thickness_modifiers.first; modifier; modifier = modifier->next) { direct_link_linestyle_thickness_modifier(fd, modifier); + } link_list(fd, &linestyle->geometry_modifiers); - for (modifier = linestyle->geometry_modifiers.first; modifier; modifier = modifier->next) + for (modifier = linestyle->geometry_modifiers.first; modifier; modifier = modifier->next) { direct_link_linestyle_geometry_modifier(fd, modifier); + } for (a = 0; a < MAX_MTEX; a++) { linestyle->mtex[a] = newdataadr(fd, linestyle->mtex[a]); } @@ -9126,10 +9333,12 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const int ta } } - if (r_id) + if (r_id) { *r_id = id; - if (!id) + } + if (!id) { return blo_bhead_next(fd, bhead); + } id->lib = main->curlib; id->us = ID_FAKE_USERS(id); @@ -9306,17 +9515,21 @@ 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 (fd->fileversion < 265 || (fd->fileversion == 265 && fg->subversion < 1)) { + 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 */ - if (fd->fileversion <= 250) + if (fd->fileversion <= 250) { BLI_strncpy(bfd->filename, BKE_main_blendfile_path(bfd->main), sizeof(bfd->filename)); + } } - if (G.fileflags & G_FILE_RECOVER) + if (G.fileflags & G_FILE_RECOVER) { BLI_strncpy(fd->relabase, fg->filename, sizeof(fd->relabase)); + } bfd->curscreen = fg->curscreen; bfd->curscene = fg->curscene; @@ -9338,8 +9551,9 @@ static void link_global(FileData *fd, BlendFileData *bfd) bfd->curscene = newlibadr(fd, NULL, bfd->curscene); // this happens in files older than 2.35 if (bfd->curscene == NULL) { - if (bfd->curscreen) + if (bfd->curscreen) { bfd->curscene = bfd->curscreen->scene; + } } } @@ -9356,8 +9570,9 @@ static void do_versions_userdef(FileData *fd, BlendFileData *bfd) Main *bmain = bfd->main; UserDef *user = bfd->user; - if (user == NULL) + if (user == NULL) { return; + } if (MAIN_VERSION_OLDER(bmain, 266, 4)) { bTheme *btheme; @@ -9544,14 +9759,17 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead) kmdi->remove_item = newdataadr(fd, kmdi->remove_item); kmdi->add_item = newdataadr(fd, kmdi->add_item); - if (kmdi->remove_item) + if (kmdi->remove_item) { direct_link_keymapitem(fd, kmdi->remove_item); - if (kmdi->add_item) + } + if (kmdi->add_item) { direct_link_keymapitem(fd, kmdi->add_item); + } } - for (kmi = keymap->items.first; kmi; kmi = kmi->next) + for (kmi = keymap->items.first; kmi; kmi = kmi->next) { direct_link_keymapitem(fd, kmi); + } } for (wmKeyConfigPref *kpt = user->user_keyconfig_prefs.first; kpt; kpt = kpt->next) { @@ -9749,10 +9967,12 @@ static int verg_bheadsort(const void *v1, const void *v2) { const struct BHeadSort *x1 = v1, *x2 = v2; - if (x1->old > x2->old) + if (x1->old > x2->old) { return 1; - else if (x1->old < x2->old) + } + else if (x1->old < x2->old) { return -1; + } return 0; } @@ -9762,12 +9982,14 @@ static void sort_bhead_old_map(FileData *fd) struct BHeadSort *bhs; int tot = 0; - for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) + for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) { tot++; + } fd->tot_bheadmap = tot; - if (tot == 0) + if (tot == 0) { return; + } bhs = fd->bheadmap = MEM_malloc_arrayN(tot, sizeof(struct BHeadSort), "BHeadSort"); @@ -9782,12 +10004,14 @@ static void sort_bhead_old_map(FileData *fd) static BHead *find_previous_lib(FileData *fd, BHead *bhead) { /* skip library datablocks in undo, see comment in read_libblock */ - if (fd->memfile) + if (fd->memfile) { return NULL; + } for (; bhead; bhead = blo_bhead_prev(fd, bhead)) { - if (bhead->code == ID_LI) + if (bhead->code == ID_LI) { break; + } } return bhead; @@ -9800,17 +10024,20 @@ static BHead *find_bhead(FileData *fd, void *old) #endif struct BHeadSort *bhs, bhs_s; - if (!old) + if (!old) { return NULL; + } - if (fd->bheadmap == NULL) + if (fd->bheadmap == NULL) { sort_bhead_old_map(fd); + } bhs_s.old = old; bhs = bsearch(&bhs_s, fd->bheadmap, fd->tot_bheadmap, sizeof(struct BHeadSort), verg_bheadsort); - if (bhs) + if (bhs) { return bhs->bhead; + } #if 0 for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) { @@ -9978,8 +10205,9 @@ static void expand_ipo(FileData *fd, Main *mainvar, Ipo *ipo) { IpoCurve *icu; for (icu = ipo->curve.first; icu; icu = icu->next) { - if (icu->driver) + if (icu->driver) { expand_doit(fd, mainvar, icu->driver->ob); + } } } @@ -10002,8 +10230,9 @@ static void expand_id(FileData *fd, Main *mainvar, ID *id) static void expand_idprops(FileData *fd, Main *mainvar, IDProperty *prop) { - if (!prop) + if (!prop) { return; + } switch (prop->type) { case IDP_ID: @@ -10131,8 +10360,9 @@ static void expand_animdata(FileData *fd, Main *mainvar, AnimData *adt) expand_fcurves(fd, mainvar, &adt->drivers); /* nla-data - referenced actions */ - for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) + for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) { expand_animdata_nlastrips(fd, mainvar, &nlt->strips); + } } static void expand_particlesettings(FileData *fd, Main *mainvar, ParticleSettings *part) @@ -10145,8 +10375,9 @@ static void expand_particlesettings(FileData *fd, Main *mainvar, ParticleSetting expand_doit(fd, mainvar, part->bb_ob); expand_doit(fd, mainvar, part->collision_group); - if (part->adt) + if (part->adt) { expand_animdata(fd, mainvar, part->adt); + } for (a = 0; a < MAX_MTEX; a++) { if (part->mtex[a]) { @@ -10212,8 +10443,9 @@ static void expand_key(FileData *fd, Main *mainvar, Key *key) { expand_doit(fd, mainvar, key->ipo); // XXX deprecated - old animation system - if (key->adt) + if (key->adt) { expand_animdata(fd, mainvar, key->adt); + } } static void expand_nodetree(FileData *fd, Main *mainvar, bNodeTree *ntree) @@ -10221,11 +10453,13 @@ static void expand_nodetree(FileData *fd, Main *mainvar, bNodeTree *ntree) bNode *node; bNodeSocket *sock; - if (ntree->adt) + if (ntree->adt) { expand_animdata(fd, mainvar, ntree->adt); + } - if (ntree->gpd) + if (ntree->gpd) { expand_doit(fd, mainvar, ntree->gpd); + } for (node = ntree->nodes.first; node; node = node->next) { if (node->id && node->type != CMP_NODE_R_LAYERS) { @@ -10234,16 +10468,20 @@ static void expand_nodetree(FileData *fd, Main *mainvar, bNodeTree *ntree) expand_idprops(fd, mainvar, node->prop); - for (sock = node->inputs.first; sock; sock = sock->next) + for (sock = node->inputs.first; sock; sock = sock->next) { expand_idprops(fd, mainvar, sock->prop); - for (sock = node->outputs.first; sock; sock = sock->next) + } + for (sock = node->outputs.first; sock; sock = sock->next) { expand_idprops(fd, mainvar, sock->prop); + } } - for (sock = ntree->inputs.first; sock; sock = sock->next) + for (sock = ntree->inputs.first; sock; sock = sock->next) { expand_idprops(fd, mainvar, sock->prop); - for (sock = ntree->outputs.first; sock; sock = sock->next) + } + for (sock = ntree->outputs.first; sock; sock = sock->next) { expand_idprops(fd, mainvar, sock->prop); + } } static void expand_texture(FileData *fd, Main *mainvar, Tex *tex) @@ -10251,11 +10489,13 @@ static void expand_texture(FileData *fd, Main *mainvar, Tex *tex) expand_doit(fd, mainvar, tex->ima); expand_doit(fd, mainvar, tex->ipo); // XXX deprecated - old animation system - if (tex->adt) + if (tex->adt) { expand_animdata(fd, mainvar, tex->adt); + } - if (tex->nodetree) + if (tex->nodetree) { expand_nodetree(fd, mainvar, tex->nodetree); + } } static void expand_brush(FileData *fd, Main *mainvar, Brush *brush) @@ -10273,11 +10513,13 @@ static void expand_material(FileData *fd, Main *mainvar, Material *ma) { expand_doit(fd, mainvar, ma->ipo); // XXX deprecated - old animation system - if (ma->adt) + if (ma->adt) { expand_animdata(fd, mainvar, ma->adt); + } - if (ma->nodetree) + if (ma->nodetree) { expand_nodetree(fd, mainvar, ma->nodetree); + } if (ma->gp_style) { MaterialGPencilStyle *gp_style = ma->gp_style; @@ -10290,11 +10532,13 @@ static void expand_light(FileData *fd, Main *mainvar, Light *la) { expand_doit(fd, mainvar, la->ipo); // XXX deprecated - old animation system - if (la->adt) + if (la->adt) { expand_animdata(fd, mainvar, la->adt); + } - if (la->nodetree) + if (la->nodetree) { expand_nodetree(fd, mainvar, la->nodetree); + } } static void expand_lattice(FileData *fd, Main *mainvar, Lattice *lt) @@ -10302,19 +10546,22 @@ static void expand_lattice(FileData *fd, Main *mainvar, Lattice *lt) expand_doit(fd, mainvar, lt->ipo); // XXX deprecated - old animation system expand_doit(fd, mainvar, lt->key); - if (lt->adt) + if (lt->adt) { expand_animdata(fd, mainvar, lt->adt); + } } static void expand_world(FileData *fd, Main *mainvar, World *wrld) { expand_doit(fd, mainvar, wrld->ipo); // XXX deprecated - old animation system - if (wrld->adt) + if (wrld->adt) { expand_animdata(fd, mainvar, wrld->adt); + } - if (wrld->nodetree) + if (wrld->nodetree) { expand_nodetree(fd, mainvar, wrld->nodetree); + } } static void expand_mball(FileData *fd, Main *mainvar, MetaBall *mb) @@ -10325,8 +10572,9 @@ static void expand_mball(FileData *fd, Main *mainvar, MetaBall *mb) expand_doit(fd, mainvar, mb->mat[a]); } - if (mb->adt) + if (mb->adt) { expand_animdata(fd, mainvar, mb->adt); + } } static void expand_curve(FileData *fd, Main *mainvar, Curve *cu) @@ -10347,16 +10595,18 @@ static void expand_curve(FileData *fd, Main *mainvar, Curve *cu) expand_doit(fd, mainvar, cu->taperobj); expand_doit(fd, mainvar, cu->textoncurve); - if (cu->adt) + if (cu->adt) { expand_animdata(fd, mainvar, cu->adt); + } } static void expand_mesh(FileData *fd, Main *mainvar, Mesh *me) { int a; - if (me->adt) + if (me->adt) { expand_animdata(fd, mainvar, me->adt); + } for (a = 0; a < me->totcol; a++) { expand_doit(fd, mainvar, me->mat[a]); @@ -10394,8 +10644,9 @@ static void expand_constraints(FileData *fd, Main *mainvar, ListBase *lb) /* deprecated manual expansion stuff */ for (curcon = lb->first; curcon; curcon = curcon->next) { - if (curcon->ipo) + if (curcon->ipo) { expand_doit(fd, mainvar, curcon->ipo); // XXX deprecated - old animation system + } } } @@ -10403,8 +10654,9 @@ static void expand_pose(FileData *fd, Main *mainvar, bPose *pose) { bPoseChannel *chan; - if (!pose) + if (!pose) { return; + } for (chan = pose->chanbase.first; chan; chan = chan->next) { expand_constraints(fd, mainvar, &chan->constraints); @@ -10424,8 +10676,9 @@ static void expand_bones(FileData *fd, Main *mainvar, Bone *bone) static void expand_armature(FileData *fd, Main *mainvar, bArmature *arm) { - if (arm->adt) + if (arm->adt) { expand_animdata(fd, mainvar, arm->adt); + } for (Bone *curBone = arm->bonebase.first; curBone; curBone = curBone->next) { expand_bones(fd, mainvar, curBone); @@ -10512,27 +10765,33 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob) } // XXX deprecated - old animation system (for version patching only) - if (ob->adt) + if (ob->adt) { expand_animdata(fd, mainvar, ob->adt); + } for (a = 0; a < ob->totcol; a++) { expand_doit(fd, mainvar, ob->mat[a]); } paf = blo_do_version_give_parteff_245(ob); - if (paf && paf->group) + if (paf && paf->group) { expand_doit(fd, mainvar, paf->group); + } - if (ob->instance_collection) + if (ob->instance_collection) { expand_doit(fd, mainvar, ob->instance_collection); + } - if (ob->proxy) + if (ob->proxy) { expand_doit(fd, mainvar, ob->proxy); - if (ob->proxy_group) + } + if (ob->proxy_group) { expand_doit(fd, mainvar, ob->proxy_group); + } - for (psys = ob->particlesystem.first; psys; psys = psys->next) + for (psys = ob->particlesystem.first; psys; psys = psys->next) { expand_doit(fd, mainvar, psys->part); + } if (ob->pd) { expand_doit(fd, mainvar, ob->pd->tex); @@ -10585,25 +10844,30 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce) expand_doit(fd, mainvar, sce->camera); expand_doit(fd, mainvar, sce->world); - if (sce->adt) + if (sce->adt) { expand_animdata(fd, mainvar, sce->adt); + } expand_keyingsets(fd, mainvar, &sce->keyingsets); - if (sce->set) + if (sce->set) { expand_doit(fd, mainvar, sce->set); + } - if (sce->nodetree) + if (sce->nodetree) { expand_nodetree(fd, mainvar, sce->nodetree); + } for (srl = sce->r.layers.first; srl; srl = srl->next) { expand_doit(fd, mainvar, srl->mat_override); for (module = srl->freestyleConfig.modules.first; module; module = module->next) { - if (module->script) + if (module->script) { expand_doit(fd, mainvar, module->script); + } } for (lineset = srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) { - if (lineset->group) + if (lineset->group) { expand_doit(fd, mainvar, lineset->group); + } expand_doit(fd, mainvar, lineset->linestyle); } } @@ -10625,8 +10889,9 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce) } } - if (sce->gpd) + if (sce->gpd) { expand_doit(fd, mainvar, sce->gpd); + } if (sce->ed) { Sequence *seq; @@ -10634,16 +10899,21 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce) SEQ_BEGIN (sce->ed, seq) { expand_idprops(fd, mainvar, seq->prop); - if (seq->scene) + if (seq->scene) { expand_doit(fd, mainvar, seq->scene); - if (seq->scene_camera) + } + if (seq->scene_camera) { expand_doit(fd, mainvar, seq->scene_camera); - if (seq->clip) + } + if (seq->clip) { expand_doit(fd, mainvar, seq->clip); - if (seq->mask) + } + if (seq->mask) { expand_doit(fd, mainvar, seq->mask); - if (seq->sound) + } + if (seq->sound) { expand_doit(fd, mainvar, seq->sound); + } if (seq->type == SEQ_TYPE_TEXT && seq->effectdata) { TextVars *data = seq->effectdata; @@ -10685,8 +10955,9 @@ static void expand_camera(FileData *fd, Main *mainvar, Camera *ca) { expand_doit(fd, mainvar, ca->ipo); // XXX deprecated - old animation system - if (ca->adt) + if (ca->adt) { expand_animdata(fd, mainvar, ca->adt); + } } static void expand_cachefile(FileData *fd, Main *mainvar, CacheFile *cache_file) @@ -10700,8 +10971,9 @@ static void expand_speaker(FileData *fd, Main *mainvar, Speaker *spk) { expand_doit(fd, mainvar, spk->sound); - if (spk->adt) + if (spk->adt) { expand_animdata(fd, mainvar, spk->adt); + } } static void expand_sound(FileData *fd, Main *mainvar, bSound *snd) @@ -10711,14 +10983,16 @@ static void expand_sound(FileData *fd, Main *mainvar, bSound *snd) static void expand_lightprobe(FileData *fd, Main *mainvar, LightProbe *prb) { - if (prb->adt) + if (prb->adt) { expand_animdata(fd, mainvar, prb->adt); + } } static void expand_movieclip(FileData *fd, Main *mainvar, MovieClip *clip) { - if (clip->adt) + if (clip->adt) { expand_animdata(fd, mainvar, clip->adt); + } } static void expand_mask_parent(FileData *fd, Main *mainvar, MaskParent *parent) @@ -10732,8 +11006,9 @@ static void expand_mask(FileData *fd, Main *mainvar, Mask *mask) { MaskLayer *mask_layer; - if (mask->adt) + if (mask->adt) { expand_animdata(fd, mainvar, mask->adt); + } for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { MaskSpline *spline; @@ -10763,22 +11038,27 @@ static void expand_linestyle(FileData *fd, Main *mainvar, FreestyleLineStyle *li expand_doit(fd, mainvar, linestyle->mtex[a]->object); } } - if (linestyle->nodetree) + if (linestyle->nodetree) { expand_nodetree(fd, mainvar, linestyle->nodetree); + } - if (linestyle->adt) + if (linestyle->adt) { expand_animdata(fd, mainvar, linestyle->adt); + } for (m = linestyle->color_modifiers.first; m; m = m->next) { - if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT) + if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT) { expand_doit(fd, mainvar, ((LineStyleColorModifier_DistanceFromObject *)m)->target); + } } for (m = linestyle->alpha_modifiers.first; m; m = m->next) { - if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT) + if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT) { expand_doit(fd, mainvar, ((LineStyleAlphaModifier_DistanceFromObject *)m)->target); + } } for (m = linestyle->thickness_modifiers.first; m; m = m->next) { - if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT) + if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT) { expand_doit(fd, mainvar, ((LineStyleThicknessModifier_DistanceFromObject *)m)->target); + } } } @@ -11169,8 +11449,9 @@ static ID *link_named_part( } else { /* already linked */ - if (G.debug) + if (G.debug) { printf("append: already linked\n"); + } oldnewmap_insert(fd->libmap, bhead->old, id, bhead->code); if (!force_indirect && (id->tag & LIB_TAG_INDIRECT)) { id->tag &= ~LIB_TAG_INDIRECT; @@ -11205,8 +11486,9 @@ int BLO_library_link_copypaste(Main *mainl, BlendHandle *bh, const unsigned int for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) { ID *id = NULL; - if (bhead->code == ENDB) + if (bhead->code == ENDB) { break; + } if (BKE_idcode_is_valid(bhead->code) && BKE_idcode_is_linkable(bhead->code) && (id_types_mask == 0 || @@ -11644,8 +11926,9 @@ static FileData *read_library_file_data(FileData *basefd, fd->reports = basefd->reports; - if (fd->libmap) + if (fd->libmap) { oldnewmap_free(fd->libmap); + } fd->libmap = oldnewmap_new(); @@ -11732,21 +12015,25 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) split_main_newid(mainptr, main_newid); /* File data can be zero with link/append. */ - if (mainptr->curlib->filedata) + if (mainptr->curlib->filedata) { do_versions(mainptr->curlib->filedata, mainptr->curlib, main_newid); - else + } + else { do_versions(basefd, NULL, main_newid); + } add_main_to_main(mainptr, main_newid); } /* Lib linking. */ - if (mainptr->curlib->filedata) + if (mainptr->curlib->filedata) { lib_link_all(mainptr->curlib->filedata, mainptr); + } /* Free file data we no longer need. */ - if (mainptr->curlib->filedata) + if (mainptr->curlib->filedata) { blo_filedata_free(mainptr->curlib->filedata); + } mainptr->curlib->filedata = NULL; } BKE_main_free(main_newid); diff --git a/source/blender/blenloader/intern/undofile.c b/source/blender/blenloader/intern/undofile.c index 55103a98b9e..95a4771b313 100644 --- a/source/blender/blenloader/intern/undofile.c +++ b/source/blender/blenloader/intern/undofile.c @@ -81,10 +81,12 @@ void BLO_memfile_merge(MemFile *first, MemFile *second) fc->is_identical = true; } } - if (fc) + if (fc) { fc = fc->next; - if (sc) + } + if (sc) { sc = sc->next; + } } BLO_memfile_free(first); diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c index 7873f0620c3..d7c26564576 100644 --- a/source/blender/blenloader/intern/versioning_250.c +++ b/source/blender/blenloader/intern/versioning_250.c @@ -92,10 +92,12 @@ static void area_add_header_region(ScrArea *sa, ListBase *lb) BLI_addtail(lb, ar); ar->regiontype = RGN_TYPE_HEADER; - if (sa->headertype == 1) + if (sa->headertype == 1) { ar->alignment = RGN_ALIGN_BOTTOM; - else + } + else { ar->alignment = RGN_ALIGN_TOP; + } /* initialize view2d data for header region, to allow panning */ /* is copy from ui_view2d.c */ @@ -203,8 +205,9 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb) case SPACE_SEQ: ar_main = (ARegion *)lb->first; for (; ar_main; ar_main = ar_main->next) { - if (ar_main->regiontype == RGN_TYPE_WINDOW) + if (ar_main->regiontype == RGN_TYPE_WINDOW) { break; + } } ar = MEM_callocN(sizeof(ARegion), "preview area for sequencer"); BLI_insertlinkbefore(lb, ar_main, ar); @@ -337,8 +340,9 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb) * 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) + if (saction->mode == SACTCONT_SHAPEKEY) { saction->action = NULL; + } break; } case SPACE_SEQ: { @@ -397,29 +401,33 @@ static void do_versions_windowmanager_2_50(bScreen *screen) /* add regions */ for (sa = screen->areabase.first; sa; sa = sa->next) { /* we keep headertype variable to convert old files only */ - if (sa->headertype) + if (sa->headertype) { area_add_header_region(sa, &sa->regionbase); + } area_add_window_regions(sa, sa->spacedata.first, &sa->regionbase); /* space imageselect is deprecated */ for (sl = sa->spacedata.first; sl; sl = sl->next) { - if (sl->spacetype == SPACE_IMASEL) + if (sl->spacetype == SPACE_IMASEL) { sl->spacetype = SPACE_EMPTY; /* spacedata then matches */ + } } /* space sound is deprecated */ for (sl = sa->spacedata.first; sl; sl = sl->next) { - if (sl->spacetype == SPACE_SOUND) + if (sl->spacetype == SPACE_SOUND) { sl->spacetype = SPACE_EMPTY; /* spacedata then matches */ + } } /* pushed back spaces also need regions! */ if (sa->spacedata.first) { sl = sa->spacedata.first; for (sl = sl->next; sl; sl = sl->next) { - if (sa->headertype) + if (sa->headertype) { area_add_header_region(sa, &sl->regionbase); + } area_add_window_regions(sa, sl, &sl->regionbase); } } @@ -436,8 +444,9 @@ static void versions_gpencil_add_main(ListBase *lb, ID *id, const char *name) BKE_id_new_name_validate(lb, id, name); /* alphabetic insertion: is in BKE_id_new_name_validate */ - if (G.debug & G_DEBUG) + if (G.debug & G_DEBUG) { printf("Converted GPencil to ID: %s\n", id->name + 2); + } } static void do_versions_gpencil_2_50(Main *main, bScreen *screen) @@ -538,8 +547,9 @@ static void do_version_bone_roll_256(Bone *bone) copy_m3_m4(submat, bone->arm_mat); mat3_to_vec_roll(submat, NULL, &bone->arm_roll); - for (child = bone->childbase.first; child; child = child->next) + for (child = bone->childbase.first; child; child = child->next) { do_version_bone_roll_256(child); + } } /* deprecated, only keep this for readfile.c */ @@ -591,8 +601,9 @@ static void do_versions_socket_default_value_259(bNodeSocket *sock) bNodeSocketValueVector *valvector; bNodeSocketValueRGBA *valrgba; - if (sock->default_value) + if (sock->default_value) { return; + } switch (sock->type) { case SOCK_FLOAT: @@ -678,15 +689,17 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) * to have them show in RNA viewer and accessible otherwise. */ for (ma = bmain->materials.first; ma; ma = ma->id.next) { - if (ma->nodetree && ma->nodetree->id.name[0] == '\0') + if (ma->nodetree && ma->nodetree->id.name[0] == '\0') { strcpy(ma->nodetree->id.name, "NTShader Nodetree"); + } } /* and composite trees */ for (sce = bmain->scenes.first; sce; sce = sce->id.next) { enum { R_PANORAMA = (1 << 10) }; - if (sce->nodetree && sce->nodetree->id.name[0] == '\0') + if (sce->nodetree && sce->nodetree->id.name[0] == '\0') { strcpy(sce->nodetree->id.name, "NTCompositing Nodetree"); + } /* move to cameras */ if (sce->r.mode & R_PANORAMA) { @@ -708,13 +721,16 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) bNode *node; if (tx->nodetree) { - if (tx->nodetree->id.name[0] == '\0') + if (tx->nodetree->id.name[0] == '\0') { strcpy(tx->nodetree->id.name, "NTTexture Nodetree"); + } /* which_output 0 is now "not specified" */ - for (node = tx->nodetree->nodes.first; node; node = node->next) - if (node->type == TEX_NODE_OUTPUT) + for (node = tx->nodetree->nodes.first; node; node = node->next) { + if (node->type == TEX_NODE_OUTPUT) { node->custom1++; + } + } } } @@ -795,15 +811,17 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) int a; ob->matbits = MEM_calloc_arrayN(ob->totcol, sizeof(char), "ob->matbits"); - for (a = 0; a < ob->totcol; a++) + for (a = 0; a < ob->totcol; a++) { ob->matbits[a] = (ob->colbits & (1 << a)) != 0; + } } } /* texture filter */ for (tex = bmain->textures.first; tex; tex = tex->id.next) { - if (tex->afmax == 0) + if (tex->afmax == 0) { tex->afmax = 8; + } } for (sce = bmain->scenes.first; sce; sce = sce->id.next) { @@ -816,8 +834,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) * (i.e. will result in blank box when enabled) */ ts->autokey_mode = U.autokey_mode; - if (ts->autokey_mode == 0) + if (ts->autokey_mode == 0) { ts->autokey_mode = 2; /* 'add/replace' but not on */ + } ts->uv_selectmode = UV_SELECT_VERTEX; ts->vgroup_weight = 1.0f; } @@ -828,8 +847,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) Object *ob; for (ob = bmain->objects.first; ob; ob = ob->id.next) { - if (ob->flag & 8192) // OB_POSEMODE = 8192 + if (ob->flag & 8192) { // OB_POSEMODE = 8192 ob->mode |= OB_MODE_POSE; + } } } @@ -839,16 +859,19 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) ParticleSettings *part; bool do_gravity = false; - for (sce = bmain->scenes.first; sce; sce = sce->id.next) - if (sce->unit.scale_length == 0.0f) + for (sce = bmain->scenes.first; sce; sce = sce->id.next) { + if (sce->unit.scale_length == 0.0f) { sce->unit.scale_length = 1.0f; + } + } for (ob = bmain->objects.first; ob; ob = ob->id.next) { /* fluid-sim stuff */ FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType( ob, eModifierType_Fluidsim); - if (fluidmd) + if (fluidmd) { fluidmd->fss->fmd = fluidmd; + } /* rotation modes were added, * but old objects would now default to being 'quaternion based' */ @@ -856,8 +879,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) } for (sce = bmain->scenes.first; sce; sce = sce->id.next) { - if (sce->audio.main == 0.0f) + if (sce->audio.main == 0.0f) { sce->audio.main = 1.0f; + } sce->r.ffcodecdata.audio_mixrate = sce->audio.mixrate; sce->r.ffcodecdata.audio_volume = sce->audio.main; @@ -880,8 +904,9 @@ 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->particles.first; part; part = part->id.next) + for (part = bmain->particles.first; part; part = part->id.next) { part->effector_weights->global_gravity = part->acc[2] / -9.81f; + } } for (ob = bmain->objects.first; ob; ob = ob->id.next) { @@ -891,24 +916,29 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) for (md = ob->modifiers.first; md; md = md->next) { ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth); - if (clmd) + if (clmd) { clmd->sim_parms->effector_weights->global_gravity = clmd->sim_parms->gravity[2] / -9.81f; + } } - if (ob->soft) + if (ob->soft) { ob->soft->effector_weights->global_gravity = ob->soft->grav / 9.81f; + } } /* Normal wind shape is plane */ if (ob->pd) { - if (ob->pd->forcefield == PFIELD_WIND) + if (ob->pd->forcefield == PFIELD_WIND) { ob->pd->shape = PFIELD_SHAPE_PLANE; + } - if (ob->pd->flag & PFIELD_PLANAR) + if (ob->pd->flag & PFIELD_PLANAR) { ob->pd->shape = PFIELD_SHAPE_PLANE; - else if (ob->pd->flag & PFIELD_SURFACE) + } + else if (ob->pd->flag & PFIELD_SURFACE) { ob->pd->shape = PFIELD_SHAPE_SURFACE; + } ob->pd->flag |= PFIELD_DO_LOCATION; } @@ -954,8 +984,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) data = key->refkey->data; tot = MIN2(me->totvert, key->refkey->totelem); - for (a = 0; a < tot; a++, data += 3) + for (a = 0; a < tot; a++, data += 3) { copy_v3_v3(me->mvert[a].co, data); + } } } @@ -964,8 +995,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) data = key->refkey->data; tot = MIN2(lt->pntsu * lt->pntsv * lt->pntsw, key->refkey->totelem); - for (a = 0; a < tot; a++, data += 3) + for (a = 0; a < tot; a++, data += 3) { copy_v3_v3(lt->def[a].vec, data); + } } } @@ -1007,8 +1039,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) { Scene *sce = bmain->scenes.first; while (sce) { - if (sce->r.frame_step == 0) + if (sce->r.frame_step == 0) { sce->r.frame_step = 1; + } sce = sce->id.next; } @@ -1033,8 +1066,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) Object *ob = bmain->objects.first; while (ob) { /* shaded mode disabled for now */ - if (ob->dt == OB_MATERIAL) + if (ob->dt == OB_MATERIAL) { ob->dt = OB_TEXTURE; + } ob = ob->id.next; } } @@ -1049,8 +1083,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) for (sl = sa->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_VIEW3D) { View3D *v3d = (View3D *)sl; - if (v3d->drawtype == OB_MATERIAL) + if (v3d->drawtype == OB_MATERIAL) { v3d->drawtype = OB_SOLID; + } } } } @@ -1071,8 +1106,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) /* don't know what scene is active, so we'll convert if any scene has it enabled... */ while (sce) { - if (sce->r.color_mgt_flag & R_COLOR_MANAGEMENT) + if (sce->r.color_mgt_flag & R_COLOR_MANAGEMENT) { convert = 1; + } sce = sce->id.next; } @@ -1102,13 +1138,16 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) Mesh *me; Object *ob; - for (sce = bmain->scenes.first; sce; sce = sce->id.next) - if (!sce->toolsettings->particle.selectmode) + for (sce = bmain->scenes.first; sce; sce = sce->id.next) { + if (!sce->toolsettings->particle.selectmode) { sce->toolsettings->particle.selectmode = SCE_SELECT_PATH; + } + } if (bmain->versionfile == 250 && bmain->subversionfile > 1) { - for (me = bmain->meshes.first; me; me = me->id.next) + for (me = bmain->meshes.first; me; me = me->id.next) { multires_load_old_250(me); + } for (ob = bmain->objects.first; ob; ob = ob->id.next) { MultiresModifierData *mmd = (MultiresModifierData *)modifiers_findByType( @@ -1133,8 +1172,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) for (md = ob->modifiers.first; md; md = md->next) { if (md->type == eModifierType_Cloth) { ClothModifierData *clmd = (ClothModifierData *)md; - if (clmd->sim_parms->velocity_smooth < 0.01f) + if (clmd->sim_parms->velocity_smooth < 0.01f) { clmd->sim_parms->velocity_smooth = 0.f; + } } } } @@ -1163,8 +1203,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) } for (ar = regionbase->first; ar; ar = ar->next) { - if (ar->regiontype == RGN_TYPE_PREVIEW) + if (ar->regiontype == RGN_TYPE_PREVIEW) { break; + } } if (ar && (ar->regiontype == RGN_TYPE_PREVIEW)) { @@ -1201,15 +1242,18 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) regionbase = &sl->regionbase; } - if (sseq->view == 0) + if (sseq->view == 0) { sseq->view = SEQ_VIEW_SEQUENCE; - if (sseq->mainb == 0) + } + if (sseq->mainb == 0) { sseq->mainb = SEQ_DRAW_IMG_IMBUF; + } ar_main = (ARegion *)regionbase->first; for (; ar_main; ar_main = ar_main->next) { - if (ar_main->regiontype == RGN_TYPE_WINDOW) + if (ar_main->regiontype == RGN_TYPE_WINDOW) { break; + } } ar = MEM_callocN(sizeof(ARegion), "preview area for sequencer"); BLI_insertlinkbefore(regionbase, ar_main, ar); @@ -1247,26 +1291,32 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) avs->path_ef = 250; /* flags */ - if (arm->pathflag & ARM_PATH_FNUMS) + if (arm->pathflag & ARM_PATH_FNUMS) { avs->path_viewflag |= MOTIONPATH_VIEW_FNUMS; - if (arm->pathflag & ARM_PATH_KFRAS) + } + if (arm->pathflag & ARM_PATH_KFRAS) { avs->path_viewflag |= MOTIONPATH_VIEW_KFRAS; - if (arm->pathflag & ARM_PATH_KFNOS) + } + if (arm->pathflag & ARM_PATH_KFNOS) { avs->path_viewflag |= MOTIONPATH_VIEW_KFNOS; + } /* bake flags */ - if (arm->pathflag & ARM_PATH_HEADS) + if (arm->pathflag & ARM_PATH_HEADS) { avs->path_bakeflag |= MOTIONPATH_BAKE_HEADS; + } /* type */ - if (arm->pathflag & ARM_PATH_ACFRA) + if (arm->pathflag & ARM_PATH_ACFRA) { avs->path_type = MOTIONPATH_TYPE_ACFRA; + } /* stepsize */ avs->path_step = 1; } - else + else { animviz_settings_init(&ob->pose->avs); + } } } @@ -1315,10 +1365,12 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) ListBase *regionbase; ARegion *ar; - if (sl == sa->spacedata.first) + if (sl == sa->spacedata.first) { regionbase = &sa->regionbase; - else + } + else { regionbase = &sl->regionbase; + } if (ELEM(sl->spacetype, SPACE_ACTION, SPACE_NLA)) { for (ar = (ARegion *)regionbase->first; ar; ar = ar->next) { @@ -1347,8 +1399,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) sce->r.border.ymax = 1.0f; } - if ((sce->r.ffcodecdata.flags & FFMPEG_MULTIPLEX_AUDIO) == 0) + if ((sce->r.ffcodecdata.flags & FFMPEG_MULTIPLEX_AUDIO) == 0) { sce->r.ffcodecdata.audio_codec = 0x0; // CODEC_ID_NONE + } SEQ_BEGIN (sce->ed, seq) { seq->volume = 1.0f; @@ -1361,8 +1414,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) ParticleEditSettings *pset = &sce->toolsettings->particle; int a; - for (a = 0; a < ARRAY_SIZE(pset->brush); a++) + for (a = 0; a < ARRAY_SIZE(pset->brush); a++) { pset->brush[a].strength /= 100.0f; + } } /* sequencer changes */ @@ -1387,8 +1441,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) ar_preview = (ARegion *)regionbase->first; for (; ar_preview; ar_preview = ar_preview->next) { - if (ar_preview->regiontype == RGN_TYPE_PREVIEW) + if (ar_preview->regiontype == RGN_TYPE_PREVIEW) { break; + } } if (ar_preview && (ar_preview->regiontype == RGN_TYPE_PREVIEW)) { sequencer_init_preview_region(ar_preview); @@ -1428,8 +1483,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) bNodeTree *ntree; for (brush = bmain->brushes.first; brush; brush = brush->id.next) { - if (brush->curve) + if (brush->curve) { brush->curve->preset = CURVE_PRESET_SMOOTH; + } } /* properly initialize active flag for fluidsim modifiers */ @@ -1481,8 +1537,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 2)) { Object *ob; - for (ob = bmain->objects.first; ob; ob = ob->id.next) + for (ob = bmain->objects.first; ob; ob = ob->id.next) { blo_do_version_old_trackto_to_constraints(ob); + } } if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 5)) { @@ -1523,22 +1580,28 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) ListBase *regionbase; ARegion *ar; - if (sl == sa->spacedata.first) + if (sl == sa->spacedata.first) { regionbase = &sa->regionbase; - else + } + else { regionbase = &sl->regionbase; + } - if (snode->v2d.minzoom > 0.09f) + if (snode->v2d.minzoom > 0.09f) { snode->v2d.minzoom = 0.09f; - if (snode->v2d.maxzoom < 2.31f) + } + if (snode->v2d.maxzoom < 2.31f) { snode->v2d.maxzoom = 2.31f; + } for (ar = regionbase->first; ar; ar = ar->next) { if (ar->regiontype == RGN_TYPE_WINDOW) { - if (ar->v2d.minzoom > 0.09f) + if (ar->v2d.minzoom > 0.09f) { ar->v2d.minzoom = 0.09f; - if (ar->v2d.maxzoom < 2.31f) + } + if (ar->v2d.maxzoom < 2.31f) { ar->v2d.maxzoom = 2.31f; + } } } } @@ -1598,8 +1661,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) for (tex = bmain->textures.first; tex; tex = tex->id.next) { /* if youre picky, this isn't correct until we do a version bump * since you could set saturation to be 0.0*/ - if (tex->saturation == 0.0f) + if (tex->saturation == 0.0f) { tex->saturation = 1.0f; + } } { @@ -1627,44 +1691,54 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) /* Sanity Check */ /* infinite number of dabs */ - if (brush->spacing == 0) + if (brush->spacing == 0) { brush->spacing = 10; + } /* will have no effect */ - if (brush->alpha == 0) + if (brush->alpha == 0) { brush->alpha = 0.5f; + } /* bad radius */ - if (brush->unprojected_radius == 0) + if (brush->unprojected_radius == 0) { brush->unprojected_radius = 0.125f; + } /* unusable size */ - if (brush->size == 0) + if (brush->size == 0) { brush->size = 35; + } /* can't see overlay */ - if (brush->texture_overlay_alpha == 0) + if (brush->texture_overlay_alpha == 0) { brush->texture_overlay_alpha = 33; + } /* same as draw brush */ - if (brush->crease_pinch_factor == 0) + if (brush->crease_pinch_factor == 0) { brush->crease_pinch_factor = 0.5f; + } /* will sculpt no vertexes */ - if (brush->plane_trim == 0) + if (brush->plane_trim == 0) { brush->plane_trim = 0.5f; + } /* same as smooth stroke off */ - if (brush->smooth_stroke_radius == 0) + if (brush->smooth_stroke_radius == 0) { brush->smooth_stroke_radius = 75; + } /* will keep cursor in one spot */ - if (brush->smooth_stroke_radius == 1) + if (brush->smooth_stroke_radius == 1) { brush->smooth_stroke_factor = 0.9f; + } /* same as dots */ - if (brush->rate == 0) + if (brush->rate == 0) { brush->rate = 0.1f; + } /* New Settings */ if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 5)) { @@ -1694,14 +1768,17 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) if (bmain->versionfile < 253) { Scene *sce; for (sce = bmain->scenes.first; sce; sce = sce->id.next) { - if (sce->toolsettings->sculpt_paint_unified_alpha == 0) + if (sce->toolsettings->sculpt_paint_unified_alpha == 0) { sce->toolsettings->sculpt_paint_unified_alpha = 0.5f; + } - if (sce->toolsettings->sculpt_paint_unified_unprojected_radius == 0) + if (sce->toolsettings->sculpt_paint_unified_unprojected_radius == 0) { sce->toolsettings->sculpt_paint_unified_unprojected_radius = 0.125f; + } - if (sce->toolsettings->sculpt_paint_unified_size == 0) + if (sce->toolsettings->sculpt_paint_unified_size == 0) { sce->toolsettings->sculpt_paint_unified_size = 35; + } } } @@ -1719,8 +1796,9 @@ 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); @@ -1756,13 +1834,15 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) bScreen *sc; for (br = bmain->brushes.first; br; br = br->id.next) { - if (br->ob_mode == 0) + if (br->ob_mode == 0) { br->ob_mode = OB_MODE_ALL_PAINT; + } } for (part = bmain->particles.first; part; part = part->id.next) { - if (part->boids) + if (part->boids) { part->boids->pitch = 1.0f; + } part->flag &= ~PART_HAIR_REGROW; /* this was a deprecated flag before */ part->kink_amp_clump = 1.f; /* keep old files looking similar */ @@ -1825,8 +1905,9 @@ 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; - if (sima->sample_line_hist.height == 0) + if (sima->sample_line_hist.height == 0) { sima->sample_line_hist.height = 100; + } } } sa = sa->next; @@ -1841,8 +1922,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) KeyBlock *kb; for (kb = key->block.first; kb; kb = kb->next) { - if (IS_EQF(kb->slidermin, kb->slidermax) && IS_EQF(kb->slidermax, 0.0f)) + if (IS_EQF(kb->slidermin, kb->slidermax) && IS_EQF(kb->slidermax, 0.0f)) { kb->slidermax = kb->slidermin + 1.0f; + } } } } @@ -1853,9 +1935,11 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) Bone *bone; Object *ob; - for (arm = bmain->armatures.first; arm; arm = arm->id.next) - for (bone = arm->bonebase.first; bone; bone = bone->next) + for (arm = bmain->armatures.first; arm; arm = arm->id.next) { + for (bone = arm->bonebase.first; bone; bone = bone->next) { do_version_bone_roll_256(bone); + } + } /* fix for objects which have zero dquat's * since this is multiplied with the quat rather than added */ @@ -1883,12 +1967,16 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) /* first make sure the own_index for new sockets is valid */ 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) + for (sock = node->inputs.first; sock; sock = sock->next) { + if (sock->own_index >= ntree->cur_index) { ntree->cur_index = sock->own_index + 1; - for (sock = node->outputs.first; sock; sock = sock->next) - if (sock->own_index >= ntree->cur_index) + } + } + for (sock = node->outputs.first; sock; sock = sock->next) { + if (sock->own_index >= ntree->cur_index) { ntree->cur_index = sock->own_index + 1; + } + } } /* add ntree->inputs/ntree->outputs sockets for all unlinked sockets in the group tree. */ @@ -1968,8 +2056,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) } for (brush = bmain->brushes.first; brush; brush = brush->id.next) { - if (brush->height == 0) + if (brush->height == 0) { brush->height = 0.4f; + } } /* replace 'rim material' option for in offset*/ @@ -1988,30 +2077,35 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) /* particle draw color from material */ for (part = bmain->particles.first; part; part = part->id.next) { - if (part->draw & PART_DRAW_MAT_COL) + if (part->draw & PART_DRAW_MAT_COL) { part->draw_col = PART_DRAW_COL_MAT; + } } } if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 6)) { Mesh *me; - for (me = bmain->meshes.first; me; me = me->id.next) + for (me = bmain->meshes.first; me; me = me->id.next) { BKE_mesh_calc_normals_tessface(me->mvert, me->totvert, me->mface, me->totface, NULL); + } } if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 2)) { /* update blur area sizes from 0..1 range to 0..100 percentage */ Scene *scene; bNode *node; - for (scene = bmain->scenes.first; scene; scene = scene->id.next) - if (scene->nodetree) - for (node = scene->nodetree->nodes.first; node; node = node->next) + for (scene = bmain->scenes.first; scene; scene = scene->id.next) { + if (scene->nodetree) { + for (node = scene->nodetree->nodes.first; node; node = node->next) { if (node->type == CMP_NODE_BLUR) { NodeBlurData *nbd = node->storage; nbd->percentx *= 100.0f; nbd->percenty *= 100.0f; } + } + } + } } if (bmain->versionfile < 258 || (bmain->versionfile == 258 && bmain->subversionfile < 1)) { @@ -2088,8 +2182,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) ARegion *ar; for (ar = sa->regionbase.first; ar; ar = ar->next) { if (ar->regiontype == RGN_TYPE_WINDOW) { - if (ar->v2d.min[1] == 4.0f) + if (ar->v2d.min[1] == 4.0f) { ar->v2d.min[1] = 0.5f; + } } } } @@ -2098,8 +2193,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) ARegion *ar; for (ar = sl->regionbase.first; ar; ar = ar->next) { if (ar->regiontype == RGN_TYPE_WINDOW) { - if (ar->v2d.min[1] == 4.0f) + if (ar->v2d.min[1] == 4.0f) { ar->v2d.min[1] = 0.5f; + } } } } @@ -2125,17 +2221,21 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) uint i = 0; /* only need to touch curves that had this flag set */ - if ((fcu->flag & FCURVE_AUTO_HANDLES) == 0) + if ((fcu->flag & FCURVE_AUTO_HANDLES) == 0) { continue; - if ((fcu->totvert == 0) || (fcu->bezt == NULL)) + } + if ((fcu->totvert == 0) || (fcu->bezt == NULL)) { continue; + } /* only change auto-handles to auto-clamped */ for (bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) { - if (bezt->h1 == HD_AUTO) + if (bezt->h1 == HD_AUTO) { bezt->h1 = HD_AUTO_ANIM; - if (bezt->h2 == HD_AUTO) + } + if (bezt->h2 == HD_AUTO) { bezt->h2 = HD_AUTO_ANIM; + } } fcu->flag &= ~FCURVE_AUTO_HANDLES; @@ -2152,16 +2252,20 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) bNodeSocket *sock; for (node = ntree->nodes.first; node; node = node->next) { - for (sock = node->inputs.first; sock; sock = sock->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) + } + for (sock = node->outputs.first; sock; sock = sock->next) { do_versions_socket_default_value_259(sock); + } } - for (sock = ntree->inputs.first; sock; sock = sock->next) + for (sock = ntree->inputs.first; sock; sock = sock->next) { do_versions_socket_default_value_259(sock); - for (sock = ntree->outputs.first; sock; sock = sock->next) + } + for (sock = ntree->outputs.first; sock; sock = sock->next) { do_versions_socket_default_value_259(sock); + } ntree->update |= NTREE_UPDATE; } @@ -2175,8 +2279,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) */ bNodeTree *ntree; /* all node trees in bmain->nodetree are considered groups */ - for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) + for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) { ntree->nodetype = NODE_GROUP; + } } } diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c index 324b3db3038..6c9ec7607a2 100644 --- a/source/blender/blenloader/intern/versioning_260.c +++ b/source/blender/blenloader/intern/versioning_260.c @@ -205,15 +205,19 @@ static void do_versions_nodetree_socket_use_flags_2_62(bNodeTree *ntree) bNodeLink *link; for (node = ntree->nodes.first; node; node = node->next) { - for (sock = node->inputs.first; sock; sock = sock->next) + for (sock = node->inputs.first; sock; sock = sock->next) { sock->flag &= ~SOCK_IN_USE; - for (sock = node->outputs.first; sock; sock = sock->next) + } + for (sock = node->outputs.first; sock; sock = sock->next) { sock->flag &= ~SOCK_IN_USE; + } } - for (sock = ntree->inputs.first; sock; sock = sock->next) + for (sock = ntree->inputs.first; sock; sock = sock->next) { sock->flag &= ~SOCK_IN_USE; - for (sock = ntree->outputs.first; sock; sock = sock->next) + } + for (sock = ntree->outputs.first; sock; sock = sock->next) { sock->flag &= ~SOCK_IN_USE; + } for (link = ntree->links.first; link; link = link->next) { link->fromsock->flag |= SOCK_IN_USE; @@ -296,8 +300,9 @@ static void do_versions_nodetree_multi_file_output_format_2_62_1(Scene *sce, bNo nodeRemoveSocket(ntree, node, old_image); nodeRemoveSocket(ntree, node, old_z); - if (old_data) + if (old_data) { MEM_freeN(old_data); + } } else if (node->type == CMP_NODE_OUTPUT_MULTI_FILE__DEPRECATED) { NodeImageMultiFile *nimf = node->storage; @@ -307,8 +312,9 @@ static void do_versions_nodetree_multi_file_output_format_2_62_1(Scene *sce, bNo node->type = CMP_NODE_OUTPUT_FILE; /* initialize the node-wide image format from render data, if available */ - if (sce) + if (sce) { nimf->format = sce->r.im_format; + } /* transfer render format toggle to node format toggle */ for (sock = node->inputs.first; sock; sock = sock->next) { @@ -543,16 +549,20 @@ static void do_versions_nodetree_customnodes(bNodeTree *ntree, int UNUSED(is_gro node->flag |= NODE_INIT; /* sockets idname */ - for (sock = node->inputs.first; sock; sock = sock->next) + for (sock = node->inputs.first; sock; sock = sock->next) { BLI_strncpy(sock->idname, node_socket_get_static_idname(sock), sizeof(sock->idname)); - for (sock = node->outputs.first; sock; sock = sock->next) + } + for (sock = node->outputs.first; sock; sock = sock->next) { BLI_strncpy(sock->idname, node_socket_get_static_idname(sock), sizeof(sock->idname)); + } } /* tree sockets idname */ - for (sock = ntree->inputs.first; sock; sock = sock->next) + for (sock = ntree->inputs.first; sock; sock = sock->next) { BLI_strncpy(sock->idname, node_socket_get_static_idname(sock), sizeof(sock->idname)); - for (sock = ntree->outputs.first; sock; sock = sock->next) + } + for (sock = ntree->outputs.first; sock; sock = sock->next) { BLI_strncpy(sock->idname, node_socket_get_static_idname(sock), sizeof(sock->idname)); + } } /* initialize socket in_out values */ @@ -561,15 +571,19 @@ static void do_versions_nodetree_customnodes(bNodeTree *ntree, int UNUSED(is_gro bNodeSocket *sock; for (node = ntree->nodes.first; node; node = node->next) { - for (sock = node->inputs.first; sock; sock = sock->next) + for (sock = node->inputs.first; sock; sock = sock->next) { sock->in_out = SOCK_IN; - for (sock = node->outputs.first; sock; sock = sock->next) + } + for (sock = node->outputs.first; sock; sock = sock->next) { sock->in_out = SOCK_OUT; + } } - for (sock = ntree->inputs.first; sock; sock = sock->next) + for (sock = ntree->inputs.first; sock; sock = sock->next) { sock->in_out = SOCK_IN; - for (sock = ntree->outputs.first; sock; sock = sock->next) + } + for (sock = ntree->outputs.first; sock; sock = sock->next) { sock->in_out = SOCK_OUT; + } } /* initialize socket identifier strings */ @@ -629,15 +643,18 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) for (sce = bmain->scenes.first; sce; sce = sce->id.next) { /* there are files with invalid audio_channels value, the real cause * is unknown, but we fix it here anyway to avoid crashes */ - if (sce->r.ffcodecdata.audio_channels == 0) + if (sce->r.ffcodecdata.audio_channels == 0) { sce->r.ffcodecdata.audio_channels = 2; + } - if (sce->nodetree) + if (sce->nodetree) { do_versions_nodetree_image_default_alpha_output(sce->nodetree); + } } - for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) + for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) { do_versions_nodetree_image_default_alpha_output(ntree); + } } { @@ -648,8 +665,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) if (ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) { part->draw |= PART_DRAW_ROTATE_OB; - if (part->rotmode == 0) + if (part->rotmode == 0) { part->rotmode = PART_ROT_VEL; + } } } } @@ -665,11 +683,13 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) { Camera *cam; for (cam = bmain->cameras.first; cam; cam = cam->id.next) { - if (cam->sensor_x < 0.01f) + if (cam->sensor_x < 0.01f) { cam->sensor_x = DEFAULT_SENSOR_WIDTH; + } - if (cam->sensor_y < 0.01f) + if (cam->sensor_y < 0.01f) { cam->sensor_y = DEFAULT_SENSOR_HEIGHT; + } } } } @@ -701,17 +721,20 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) bNodeTree *ntree; for (sce = bmain->scenes.first; sce; sce = sce->id.next) { - if (sce->nodetree) + if (sce->nodetree) { do_versions_nodetree_convert_angle(sce->nodetree); + } } for (mat = bmain->materials.first; mat; mat = mat->id.next) { - if (mat->nodetree) + if (mat->nodetree) { do_versions_nodetree_convert_angle(mat->nodetree); + } } - for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) + for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) { do_versions_nodetree_convert_angle(ntree); + } } { @@ -731,13 +754,15 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) v3d->flag2 |= V3D_SHOW_RECONSTRUCTION; } - if (v3d->bundle_drawtype == 0) + if (v3d->bundle_drawtype == 0) { v3d->bundle_drawtype = OB_PLAINAXES; + } } else if (sl->spacetype == SPACE_CLIP) { SpaceClip *sclip = (SpaceClip *)sl; - if (sclip->scopes.track_preview_height == 0) + if (sclip->scopes.track_preview_height == 0) { sclip->scopes.track_preview_height = 120; + } } } } @@ -754,19 +779,23 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) clip->proxy.build_tc_flag = IMB_TC_RECORD_RUN | IMB_TC_FREE_RUN | IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN; - if (clip->proxy.build_size_flag == 0) + if (clip->proxy.build_size_flag == 0) { clip->proxy.build_size_flag = IMB_PROXY_25; + } - if (clip->proxy.quality == 0) + if (clip->proxy.quality == 0) { clip->proxy.quality = 90; + } - if (clip->tracking.camera.pixel_aspect < 0.01f) + if (clip->tracking.camera.pixel_aspect < 0.01f) { clip->tracking.camera.pixel_aspect = 1.0f; + } track = clip->tracking.tracks.first; while (track) { - if (track->minimum_correlation == 0.0f) + if (track->minimum_correlation == 0.0f) { track->minimum_correlation = 0.75f; + } track = track->next; } @@ -828,8 +857,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) Brush *brush; for (brush = bmain->brushes.first; brush; brush = brush->id.next) { - if (brush->sculpt_tool == SCULPT_TOOL_ROTATE) + if (brush->sculpt_tool == SCULPT_TOOL_ROTATE) { brush->alpha = 1.0f; + } } } @@ -843,28 +873,33 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) bNodeTree *ntree; for (sce = bmain->scenes.first; sce; sce = sce->id.next) { - if (sce->nodetree) + if (sce->nodetree) { do_versions_nodetree_socket_use_flags_2_62(sce->nodetree); + } } for (mat = bmain->materials.first; mat; mat = mat->id.next) { - if (mat->nodetree) + if (mat->nodetree) { do_versions_nodetree_socket_use_flags_2_62(mat->nodetree); + } } for (tex = bmain->textures.first; tex; tex = tex->id.next) { - if (tex->nodetree) + if (tex->nodetree) { do_versions_nodetree_socket_use_flags_2_62(tex->nodetree); + } } for (Light *la = bmain->lights.first; la; la = la->id.next) { - if (la->nodetree) + if (la->nodetree) { do_versions_nodetree_socket_use_flags_2_62(la->nodetree); + } } for (world = bmain->worlds.first; world; world = world->id.next) { - if (world->nodetree) + if (world->nodetree) { do_versions_nodetree_socket_use_flags_2_62(world->nodetree); + } } for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) { @@ -881,15 +916,18 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) clip->proxy.build_tc_flag |= IMB_TC_RECORD_RUN_NO_GAPS; - if (!tracking->settings.object_distance) + if (!tracking->settings.object_distance) { tracking->settings.object_distance = 1.0f; + } - if (BLI_listbase_is_empty(&tracking->objects)) + if (BLI_listbase_is_empty(&tracking->objects)) { BKE_tracking_object_add(tracking, "Camera"); + } while (tracking_object) { - if (!tracking_object->scale) + if (!tracking_object->scale) { tracking_object->scale = 1.0f; + } tracking_object = tracking_object->next; } @@ -901,8 +939,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) if (con->type == CONSTRAINT_TYPE_OBJECTSOLVER) { bObjectSolverConstraint *data = (bObjectSolverConstraint *)con->data; - if (data->invmat[3][3] == 0.0f) + if (data->invmat[3][3] == 0.0f) { unit_m4(data->invmat); + } } } } @@ -938,8 +977,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) tl->len += added; /* reset cursor position if line was changed */ - if (added && tl == text->curl) + if (added && tl == text->curl) { text->curc = 0; + } } } } @@ -975,8 +1015,9 @@ 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; - if (clmd->sim_parms) + if (clmd->sim_parms) { clmd->sim_parms->vel_damping = 1.0f; + } } } } @@ -992,8 +1033,9 @@ 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_Fluidsim) { FluidsimModifierData *fmd = (FluidsimModifierData *)md; - if (fmd->fss->animRate == 0.0f) + if (fmd->fss->animRate == 0.0f) { fmd->fss->animRate = 1.0f; + } } } } @@ -1005,13 +1047,15 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) bNodeTree *ntree; for (sce = bmain->scenes.first; sce; sce = sce->id.next) { - if (sce->nodetree) + if (sce->nodetree) { do_versions_nodetree_multi_file_output_format_2_62_1(sce, sce->nodetree); + } } /* XXX can't associate with scene for group nodes, image format will stay uninitialized */ - for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) + for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) { do_versions_nodetree_multi_file_output_format_2_62_1(NULL, ntree); + } } /* only swap for pre-release bmesh merge which had MLoopCol red/blue swap */ @@ -1030,8 +1074,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) for (scene = bmain->scenes.first; scene; scene = scene->id.next) { KeyingSet *ks; for (ks = scene->keyingsets.first; ks; ks = ks->next) { - if (!ks->idname[0]) + if (!ks->idname[0]) { BLI_strncpy(ks->idname, ks->name, sizeof(ks->idname)); + } } } } @@ -1085,11 +1130,14 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) Scene *sce; bNodeTree *ntree; - for (sce = bmain->scenes.first; sce; sce = sce->id.next) - if (sce->nodetree) + for (sce = bmain->scenes.first; sce; sce = sce->id.next) { + if (sce->nodetree) { do_versions_nodetree_multi_file_output_path_2_63_1(sce->nodetree); - for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) + } + } + for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) { do_versions_nodetree_multi_file_output_path_2_63_1(ntree); + } } if (bmain->versionfile < 263 || (bmain->versionfile == 263 && bmain->subversionfile < 3)) { @@ -1194,28 +1242,39 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) World *world; bNodeTree *ntree; - for (sce = bmain->scenes.first; sce; sce = sce->id.next) - if (sce->nodetree) + for (sce = bmain->scenes.first; sce; sce = sce->id.next) { + if (sce->nodetree) { do_versions_nodetree_frame_2_64_6(sce->nodetree); + } + } - for (mat = bmain->materials.first; mat; mat = mat->id.next) - if (mat->nodetree) + for (mat = bmain->materials.first; mat; mat = mat->id.next) { + if (mat->nodetree) { do_versions_nodetree_frame_2_64_6(mat->nodetree); + } + } - for (tex = bmain->textures.first; tex; tex = tex->id.next) - if (tex->nodetree) + for (tex = bmain->textures.first; tex; tex = tex->id.next) { + if (tex->nodetree) { do_versions_nodetree_frame_2_64_6(tex->nodetree); + } + } - for (Light *la = bmain->lights.first; la; la = la->id.next) - if (la->nodetree) + for (Light *la = bmain->lights.first; la; la = la->id.next) { + if (la->nodetree) { do_versions_nodetree_frame_2_64_6(la->nodetree); + } + } - for (world = bmain->worlds.first; world; world = world->id.next) - if (world->nodetree) + for (world = bmain->worlds.first; world; world = world->id.next) { + if (world->nodetree) { do_versions_nodetree_frame_2_64_6(world->nodetree); + } + } - for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) + for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) { do_versions_nodetree_frame_2_64_6(ntree); + } } if (bmain->versionfile < 263 || (bmain->versionfile == 263 && bmain->subversionfile < 7)) { @@ -1366,10 +1425,13 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) FOREACH_NODETREE_END; /* keep compatibility for dupliobject particle size */ - for (part = bmain->particles.first; part; part = part->id.next) - if (ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) - if ((part->draw & PART_DRAW_ROTATE_OB) == 0) + for (part = bmain->particles.first; part; part = part->id.next) { + if (ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) { + if ((part->draw & PART_DRAW_ROTATE_OB) == 0) { part->draw |= PART_DRAW_NO_SCALE_OB; + } + } + } } if (bmain->versionfile < 263 || (bmain->versionfile == 263 && bmain->subversionfile < 17)) { @@ -1504,9 +1566,11 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) FOREACH_NODETREE_BEGIN (bmain, ntree, id) { if (ntree->type == NTREE_SHADER) { bNode *node; - for (node = ntree->nodes.first; node; node = node->next) - if (node->type == SH_NODE_TEX_COORD) + for (node = ntree->nodes.first; node; node = node->next) { + if (node->type == SH_NODE_TEX_COORD) { node->flag |= NODE_OPTIONS; + } + } } } FOREACH_NODETREE_END; @@ -1724,8 +1788,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) } SEQ_END; - if (scene->r.bake_samples == 0) + if (scene->r.bake_samples == 0) { scene->r.bake_samples = 256; + } } for (Image *image = bmain->images.first; image; image = image->id.next) { @@ -1741,8 +1806,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) if (tex->type == TEX_IMAGE && (tex->imaflag & TEX_USEALPHA) == 0) { Image *image = blo_do_versions_newlibadr(fd, tex->id.lib, tex->ima); - if (image && (image->flag & IMA_DO_PREMUL) == 0) + if (image && (image->flag & IMA_DO_PREMUL) == 0) { image->flag |= IMA_IGNORE_ALPHA; + } } } @@ -1754,8 +1820,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) Image *image = blo_do_versions_newlibadr(fd, ntree->id.lib, node->id); if (image) { - if ((image->flag & IMA_DO_PREMUL) == 0 && image->alpha_mode == IMA_ALPHA_STRAIGHT) + if ((image->flag & IMA_DO_PREMUL) == 0 && image->alpha_mode == IMA_ALPHA_STRAIGHT) { node->custom1 |= CMP_NODE_IMAGE_USE_STRAIGHT_OUTPUT; + } } } } @@ -1768,9 +1835,11 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) * for compatibility all textures assumed it to be enabled */ Tex *tex; - for (tex = bmain->textures.first; tex; tex = tex->id.next) - if (tex->type == TEX_IMAGE) + for (tex = bmain->textures.first; tex; tex = tex->id.next) { + if (tex->type == TEX_IMAGE) { tex->imaflag |= TEX_USEALPHA; + } + } } if (bmain->versionfile < 265 || (bmain->versionfile == 265 && bmain->subversionfile < 7)) { @@ -1895,8 +1964,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) /* Only add interface nodes once. * In old Blender versions they will be removed automatically due to undefined type */ - if (MAIN_VERSION_OLDER(bmain, 266, 2)) + if (MAIN_VERSION_OLDER(bmain, 266, 2)) { ntree->flag |= NTREE_DO_VERSIONS_CUSTOMNODES_GROUP_CREATE_INTERFACE; + } } FOREACH_NODETREE_END; } @@ -1911,11 +1981,13 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) */ bNode *node; FOREACH_NODETREE_BEGIN (bmain, ntree, id) { - if (id == &ntree->id) + if (id == &ntree->id) { continue; /* already fixed for node groups */ + } - for (node = ntree->nodes.first; node; node = node->next) + for (node = ntree->nodes.first; node; node = node->next) { nodeUniqueName(ntree, node); + } } FOREACH_NODETREE_END; } @@ -1938,8 +2010,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) for (brush = bmain->brushes.first; brush; brush = brush->id.next) { brush->overlay_flags = 0; - if (brush->flag & BRUSH_TEXTURE_OVERLAY) + if (brush->flag & BRUSH_TEXTURE_OVERLAY) { brush->overlay_flags |= (BRUSH_OVERLAY_PRIMARY | BRUSH_OVERLAY_CURSOR); + } } #undef BRUSH_TEXTURE_OVERLAY } @@ -1983,8 +2056,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) sce->r.unit_line_thickness = 1.0f; } for (srl = sce->r.layers.first; srl; srl = srl->next) { - if (srl->freestyleConfig.mode == 0) + if (srl->freestyleConfig.mode == 0) { srl->freestyleConfig.mode = FREESTYLE_CONTROL_EDITOR_MODE; + } if (srl->freestyleConfig.raycasting_algorithm == FREESTYLE_ALGO_CULLED_ADAPTIVE_CUMULATIVE || srl->freestyleConfig.raycasting_algorithm == @@ -2024,10 +2098,12 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) linestyle->thickness_position = LS_THICKNESS_CENTER; linestyle->thickness_ratio = 0.5f; } - if (linestyle->chaining == 0) + if (linestyle->chaining == 0) { linestyle->chaining = LS_CHAINING_PLAIN; - if (linestyle->rounds == 0) + } + if (linestyle->rounds == 0) { linestyle->rounds = 3; + } } } @@ -2045,24 +2121,28 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) if (sl->spacetype == SPACE_NODE) { SpaceNode *snode = (SpaceNode *)sl; bNodeTreePath *path = snode->treepath.last; - if (!path) + if (!path) { continue; + } active_viewer_key = path->parent_key; break; } } - if (active_viewer_key.value != 0) + if (active_viewer_key.value != 0) { break; + } } - if (active_viewer_key.value != 0) + if (active_viewer_key.value != 0) { break; + } } for (scene = bmain->scenes.first; scene; scene = scene->id.next) { /* NB: scene->nodetree is a local ID block, has been direct_link'ed */ - if (scene->nodetree) + if (scene->nodetree) { scene->nodetree->active_viewer_key = active_viewer_key; + } } } @@ -2100,12 +2180,15 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) for (brush = bmain->brushes.first; brush; brush = brush->id.next) { brush->flag &= ~BRUSH_FIXED; - if (brush->cursor_overlay_alpha < 2) + if (brush->cursor_overlay_alpha < 2) { brush->cursor_overlay_alpha = 33; - if (brush->texture_overlay_alpha < 2) + } + if (brush->texture_overlay_alpha < 2) { brush->texture_overlay_alpha = 33; - if (brush->mask_overlay_alpha < 2) + } + if (brush->mask_overlay_alpha < 2) { brush->mask_overlay_alpha = 33; + } } #undef BRUSH_FIXED } @@ -2119,12 +2202,15 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) for (con = ob->constraints.first; con; con = con->next) { if (con->type == CONSTRAINT_TYPE_SHRINKWRAP) { bShrinkwrapConstraint *data = (bShrinkwrapConstraint *)con->data; - if (data->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS) + if (data->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS) { data->projAxis = OB_POSX; - else if (data->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS) + } + else if (data->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS) { data->projAxis = OB_POSY; - else + } + else { data->projAxis = OB_POSZ; + } data->projAxisSpace = CONSTRAINT_SPACE_LOCAL; } } @@ -2177,15 +2263,17 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) if (sa->spacetype == SPACE_NODE) { ar = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS); - if (ar) + if (ar) { continue; + } /* add subdiv level; after header */ ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER); /* is error! */ - if (ar == NULL) + if (ar == NULL) { continue; + } arnew = MEM_callocN(sizeof(ARegion), "node tools"); @@ -2304,12 +2392,14 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) for (scene = bmain->scenes.first; scene; scene = scene->id.next) { /* this can now be turned off */ ToolSettings *ts = scene->toolsettings; - if (ts->sculpt) + if (ts->sculpt) { ts->sculpt->flags |= SCULPT_DYNTOPO_SUBDIVIDE; + } /* 'Increment' mode disabled for nodes, use true grid snapping instead */ - if (scene->toolsettings->snap_node_mode == SCE_SNAP_MODE_INCREMENT) + if (scene->toolsettings->snap_node_mode == SCE_SNAP_MODE_INCREMENT) { scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID; + } #ifdef WITH_FFMPEG /* Update for removed "sound-only" option in FFMPEG export settings. */ @@ -2404,14 +2494,18 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) }; int symmetry_flags = sd->flags & 7; - if (symmetry_flags & SCULPT_SYMM_X) + if (symmetry_flags & SCULPT_SYMM_X) { sd->paint.symmetry_flags |= PAINT_SYMM_X; - if (symmetry_flags & SCULPT_SYMM_Y) + } + if (symmetry_flags & SCULPT_SYMM_Y) { sd->paint.symmetry_flags |= PAINT_SYMM_Y; - if (symmetry_flags & SCULPT_SYMM_Z) + } + if (symmetry_flags & SCULPT_SYMM_Z) { sd->paint.symmetry_flags |= PAINT_SYMM_Z; - if (symmetry_flags & SCULPT_SYMMETRY_FEATHER) + } + if (symmetry_flags & SCULPT_SYMMETRY_FEATHER) { sd->paint.symmetry_flags |= PAINT_SYMMETRY_FEATHER; + } } } } diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index 3d2a46db769..bd405bd6410 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -324,12 +324,15 @@ static void do_versions_compositor_render_passes_storage(bNode *node) node_cmp_rlayers_sock_to_pass(pass_index), sizeof(sockdata->pass_name)); - if (pass_index == 0) + if (pass_index == 0) { sockname = "Image"; - else if (pass_index == 1) + } + else if (pass_index == 1) { sockname = "Alpha"; - else + } + else { sockname = node_cmp_rlayers_sock_to_pass(pass_index); + } BLI_strncpy(sock->name, sockname, sizeof(sock->name)); } } @@ -359,10 +362,12 @@ static char *replace_bbone_easing_rnapath(char *old_path) /* NOTE: This will break paths for any bones/custom-properties * which happen be named after the bbone property id's */ - if (strstr(old_path, "bbone_in")) + if (strstr(old_path, "bbone_in")) { new_path = BLI_str_replaceN(old_path, "bbone_in", "bbone_easein"); - else if (strstr(old_path, "bbone_out")) + } + else if (strstr(old_path, "bbone_out")) { new_path = BLI_str_replaceN(old_path, "bbone_out", "bbone_easeout"); + } if (new_path) { MEM_freeN(old_path); @@ -658,8 +663,9 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) Brush *br; for (br = bmain->brushes.first; br; br = br->id.next) { if ((br->ob_mode & OB_MODE_SCULPT) && - ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK)) + ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK)) { br->alpha = 1.0f; + } } } @@ -729,10 +735,12 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) if (!MAIN_VERSION_ATLEAST(bmain, 273, 3)) { ParticleSettings *part; for (part = bmain->particles.first; part; part = part->id.next) { - if (part->clumpcurve) + if (part->clumpcurve) { part->child_flag |= PART_CHILD_USE_CLUMP_CURVE; - if (part->roughcurve) + } + if (part->roughcurve) { part->child_flag |= PART_CHILD_USE_ROUGH_CURVE; + } } } @@ -918,10 +926,12 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) #define SEQ_USE_PROXY_CUSTOM_DIR (1 << 19) #define SEQ_USE_PROXY_CUSTOM_FILE (1 << 21) if (seq->strip && seq->strip->proxy && !seq->strip->proxy->storage) { - if (seq->flag & SEQ_USE_PROXY_CUSTOM_DIR) + if (seq->flag & SEQ_USE_PROXY_CUSTOM_DIR) { seq->strip->proxy->storage = SEQ_STORAGE_PROXY_CUSTOM_DIR; - if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) + } + if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) { seq->strip->proxy->storage = SEQ_STORAGE_PROXY_CUSTOM_FILE; + } } #undef SEQ_USE_PROXY_CUSTOM_DIR #undef SEQ_USE_PROXY_CUSTOM_FILE @@ -1193,10 +1203,12 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) } } - if (enabled) + if (enabled) { gpd->flag |= GP_DATA_SHOW_ONIONSKINS; - else + } + else { gpd->flag &= ~GP_DATA_SHOW_ONIONSKINS; + } } } if (!MAIN_VERSION_ATLEAST(bmain, 276, 5)) { @@ -1437,14 +1449,18 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) copy_v4_v4(palcolor->color, gpl->color); copy_v4_v4(palcolor->fill, gpl->fill); - if (gpl->flag & GP_LAYER_HIDE) + if (gpl->flag & GP_LAYER_HIDE) { palcolor->flag |= PC_COLOR_HIDE; - if (gpl->flag & GP_LAYER_LOCKED) + } + if (gpl->flag & GP_LAYER_LOCKED) { palcolor->flag |= PC_COLOR_LOCKED; - if (gpl->flag & GP_LAYER_ONIONSKIN) + } + if (gpl->flag & GP_LAYER_ONIONSKIN) { palcolor->flag |= PC_COLOR_ONIONSKIN; - if (gpl->flag & GP_LAYER_VOLUMETRIC) + } + if (gpl->flag & GP_LAYER_VOLUMETRIC) { palcolor->flag |= PC_COLOR_VOLUMETRIC; + } /* set layer opacity to 1 */ gpl->opacity = 1.0f; diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index ceeeaf11e9d..fbe0f70527b 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -853,8 +853,9 @@ void do_versions_after_linking_280(Main *bmain) /* Update Curve object Shape Key data layout to include the Radius property */ if (!MAIN_VERSION_ATLEAST(bmain, 280, 23)) { for (Curve *cu = bmain->curves.first; cu; cu = cu->id.next) { - if (!cu->key || cu->key->elemsize != sizeof(float[4])) + if (!cu->key || cu->key->elemsize != sizeof(float[4])) { continue; + } cu->key->elemstr[0] = 3; /*KEYELEM_ELEM_SIZE_CURVE*/ cu->key->elemsize = sizeof(float[3]); @@ -865,8 +866,9 @@ void do_versions_after_linking_280(Main *bmain) int old_count = block->totelem; void *old_data = block->data; - if (!old_data || old_count <= 0) + if (!old_data || old_count <= 0) { continue; + } block->totelem = new_count; block->data = MEM_callocN(sizeof(float[3]) * new_count, __func__); diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c index 2d181407811..6329a3959b9 100644 --- a/source/blender/blenloader/intern/versioning_legacy.c +++ b/source/blender/blenloader/intern/versioning_legacy.c @@ -97,8 +97,9 @@ static void vcol_to_fcol(Mesh *me) uint *mcol, *mcoln, *mcolmain; int a; - if (me->totface == 0 || me->mcol == NULL) + if (me->totface == 0 || me->mcol == NULL) { return; + } mcoln = mcolmain = MEM_malloc_arrayN(me->totface, 4 * sizeof(int), "mcoln"); mcol = (uint *)me->mcol; @@ -128,8 +129,9 @@ static void do_version_bone_head_tail_237(Bone *bone) mul_v3_fl(vec, bone->length); add_v3_v3v3(bone->arm_tail, bone->arm_head, vec); - for (child = bone->childbase.first; child; child = child->next) + for (child = bone->childbase.first; child; child = child->next) { do_version_bone_head_tail_237(child); + } } static void bone_version_238(ListBase *lb) @@ -142,8 +144,9 @@ static void bone_version_238(ListBase *lb) bone->rad_tail = 0.1f * bone->length; bone->dist -= bone->rad_head; - if (bone->dist <= 0.0f) + if (bone->dist <= 0.0f) { bone->dist = 0.0f; + } } bone_version_238(&bone->childbase); } @@ -154,8 +157,9 @@ static void bone_version_239(ListBase *lb) Bone *bone; for (bone = lb->first; bone; bone = bone->next) { - if (bone->layer == 0) + if (bone->layer == 0) { bone->layer = 1; + } bone_version_239(&bone->childbase); } } @@ -197,8 +201,9 @@ static void ntree_version_242(bNodeTree *ntree) if (node->type == CMP_NODE_HUE_SAT) { if (node->storage) { NodeHueSat *nhs = node->storage; - if (nhs->val == 0.0f) + if (nhs->val == 0.0f) { nhs->val = 1.0f; + } } } } @@ -219,8 +224,9 @@ static void ntree_version_245(FileData *fd, Library *lib, bNodeTree *ntree) if (!node->storage) { ntf = MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats"); node->storage = ntf; - if (node->custom1) + if (node->custom1) { ntf->x = 1.0f; + } } } @@ -247,8 +253,9 @@ static void idproperties_fix_groups_lengths_recurse(IDProperty *prop) int i; for (loop = prop->data.group.first, i = 0; loop; loop = loop->next, i++) { - if (loop->type == IDP_GROUP) + if (loop->type == IDP_GROUP) { idproperties_fix_groups_lengths_recurse(loop); + } } if (prop->len != i) { @@ -279,19 +286,22 @@ static void customdata_version_242(Mesh *me) if (!me->vdata.totlayer) { CustomData_add_layer(&me->vdata, CD_MVERT, CD_ASSIGN, me->mvert, me->totvert); - if (me->dvert) + if (me->dvert) { CustomData_add_layer(&me->vdata, CD_MDEFORMVERT, CD_ASSIGN, me->dvert, me->totvert); + } } - if (!me->edata.totlayer) + if (!me->edata.totlayer) { CustomData_add_layer(&me->edata, CD_MEDGE, CD_ASSIGN, me->medge, me->totedge); + } if (!me->fdata.totlayer) { CustomData_add_layer(&me->fdata, CD_MFACE, CD_ASSIGN, me->mface, me->totface); if (me->tface) { - if (me->mcol) + if (me->mcol) { MEM_freeN(me->mcol); + } me->mcol = CustomData_add_layer(&me->fdata, CD_MCOL, CD_CALLOC, NULL, me->totface); me->mtface = CustomData_add_layer(&me->fdata, CD_MTFACE, CD_CALLOC, NULL, me->totface); @@ -323,19 +333,23 @@ static void customdata_version_242(Mesh *me) if (layer->type == CD_MTFACE) { if (layer->name[0] == 0) { - if (mtfacen == 0) + if (mtfacen == 0) { strcpy(layer->name, "UVMap"); - else + } + else { BLI_snprintf(layer->name, sizeof(layer->name), "UVMap.%.3d", mtfacen); + } } mtfacen++; } else if (layer->type == CD_MCOL) { if (layer->name[0] == 0) { - if (mcoln == 0) + if (mcoln == 0) { strcpy(layer->name, "Col"); - else + } + else { BLI_snprintf(layer->name, sizeof(layer->name), "Col.%.3d", mcoln); + } } mcoln++; } @@ -394,8 +408,9 @@ static void do_version_free_effect_245(Effect *eff) if (eff->type == EFF_PARTICLE) { paf = (PartEff *)eff; - if (paf->keys) + if (paf->keys) { MEM_freeN(paf->keys); + } } MEM_freeN(eff); } @@ -437,8 +452,9 @@ static void do_version_constraints_245(ListBase *lb) bLocateLikeConstraint *data = (bLocateLikeConstraint *)con->data; /* new headtail functionality makes Bone-Tip function obsolete */ - if (data->flag & LOCLIKE_TIP) + if (data->flag & LOCLIKE_TIP) { con->headtail = 1.0f; + } } } } @@ -449,8 +465,9 @@ PartEff *blo_do_version_give_parteff_245(Object *ob) paf = ob->effect.first; while (paf) { - if (paf->type == EFF_PARTICLE) + if (paf->type == EFF_PARTICLE) { return paf; + } paf = paf->next; } return NULL; @@ -518,8 +535,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) ob->colbits = 0; if (ob->totcol) { for (a = 0; a < ob->totcol; a++) { - if (ob->mat[a]) + if (ob->mat[a]) { ob->colbits |= (1 << a); + } } } ob = ob->id.next; @@ -541,8 +559,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) /* mcol changed */ Mesh *me = bmain->meshes.first; while (me) { - if (me->mcol) + if (me->mcol) { vcol_to_fcol(me); + } me = me->id.next; } } @@ -551,8 +570,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) Object *ob; ob = bmain->objects.first; while (ob) { - if (ob->dt == 0) + if (ob->dt == 0) { ob->dt = OB_SOLID; + } ob = ob->id.next; } } @@ -568,8 +588,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) if (sl->spacetype == SPACE_VIEW3D) { View3D *v3d = (View3D *)sl; - if (v3d->gridlines == 0) + if (v3d->gridlines == 0) { v3d->gridlines = 20; + } } sl = sl->next; } @@ -609,8 +630,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) if (bmain->versionfile <= 153) { Scene *sce = bmain->scenes.first; while (sce) { - if (sce->r.blurfac == 0.0f) + if (sce->r.blurfac == 0.0f) { sce->r.blurfac = 1.0f; + } sce = sce->id.next; } } @@ -618,8 +640,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) if (bmain->versionfile <= 163) { Scene *sce = bmain->scenes.first; while (sce) { - if (sce->r.frs_sec == 0) + if (sce->r.frs_sec == 0) { sce->r.frs_sec = 25; + } sce = sce->id.next; } } @@ -662,8 +685,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) if (bmain->versionfile <= 169) { Mesh *me = bmain->meshes.first; while (me) { - if (me->subdiv == 0) + if (me->subdiv == 0) { me->subdiv = 1; + } me = me->id.next; } } @@ -759,10 +783,12 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) sound->min_gain = 0.0; sound->distance = 1.0; - if (sound->attenuation > 0.0f) + if (sound->attenuation > 0.0f) { sound->flags |= SOUND_FLAGS_3D; - else + } + else { sound->flags &= ~SOUND_FLAGS_3D; + } sound = sound->id.next; } @@ -784,10 +810,12 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) me->subdiv = 1; } else { - if (me->subdiv < 2) + if (me->subdiv < 2) { me->subdiv = 1; - else + } + else { me->subdiv--; + } } } } @@ -1146,8 +1174,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) if (wrld->aodist == 0.0f) { wrld->aodist = 10.0f; } - if (wrld->aoenergy == 0.0f) + if (wrld->aoenergy == 0.0f) { wrld->aoenergy = 1.0f; + } wrld = wrld->id.next; } @@ -1196,8 +1225,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) for (sl = sa->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_TEXT) { SpaceText *st = (SpaceText *)sl; - if (st->tabnumber == 0) + if (st->tabnumber == 0) { st->tabnumber = 2; + } } } } @@ -1211,16 +1241,18 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) Editing *ed; while (tex) { - if (tex->nabla == 0.0f) + if (tex->nabla == 0.0f) { tex->nabla = 0.025f; + } tex = tex->id.next; } while (sce) { ed = sce->ed; if (ed) { SEQ_BEGIN (sce->ed, seq) { - if (seq->type == SEQ_TYPE_IMAGE || seq->type == SEQ_TYPE_MOVIE) + if (seq->type == SEQ_TYPE_IMAGE || seq->type == SEQ_TYPE_MOVIE) { seq->alpha_mode = SEQ_ALPHA_STRAIGHT; + } } SEQ_END; } @@ -1236,8 +1268,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) while (cam) { if (cam->ortho_scale == 0.0f) { cam->ortho_scale = 256.0f / cam->lens; - if (cam->type == CAM_ORTHO) + if (cam->type == CAM_ORTHO) { printf("NOTE: ortho render has changed, tweak new Camera 'scale' value.\n"); + } } cam = cam->id.next; } @@ -1247,10 +1280,12 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) /* softbody init new vars */ for (ob = bmain->objects.first; ob; ob = ob->id.next) { if (ob->soft) { - if (ob->soft->defgoal == 0.0f) + if (ob->soft->defgoal == 0.0f) { ob->soft->defgoal = 0.7f; - if (ob->soft->physics_speed == 0.0f) + } + if (ob->soft->physics_speed == 0.0f) { ob->soft->physics_speed = 1.0f; + } if (ob->soft->interval == 0) { ob->soft->interval = 2; @@ -1278,20 +1313,23 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) for (arm = bmain->armatures.first; arm; arm = arm->id.next) { BKE_armature_where_is(arm); - for (bone = arm->bonebase.first; bone; bone = bone->next) + for (bone = arm->bonebase.first; bone; bone = bone->next) { do_version_bone_head_tail_237(bone); + } } for (ob = bmain->objects.first; ob; ob = ob->id.next) { if (ob->parent) { Object *parent = blo_do_versions_newlibadr(fd, lib, ob->parent); - if (parent && parent->type == OB_LATTICE) + if (parent && parent->type == OB_LATTICE) { ob->partype = PARSKEL; + } } /* btw. armature_rebuild_pose is further only called on leave editmode */ if (ob->type == OB_ARMATURE) { - if (ob->pose) + if (ob->pose) { BKE_pose_tag_recalc(bmain, ob->pose); + } /* cannot call stuff now (pointers!), done in setup_app_data */ ob->id.recalc |= ID_RECALC_ALL; @@ -1319,13 +1357,16 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) smd->subdivType = me->subsurftype; smd->modifier.mode = 0; - if (me->subdiv != 0) + if (me->subdiv != 0) { smd->modifier.mode |= 1; - if (me->subdivr != 0) + } + if (me->subdivr != 0) { smd->modifier.mode |= 2; + } - if (me->flag & ME_OPT_EDGES) + if (me->flag & ME_OPT_EDGES) { smd->flags |= eSubsurfModifierFlag_ControlEdges; + } BLI_addtail(&ob->modifiers, smd); @@ -1341,8 +1382,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) if (obc && obc->type == OB_CURVE) { Curve *cu = blo_do_versions_newlibadr(fd, lib, obc->data); - if (cu) + if (cu) { cu->flag |= CU_PATH; + } } } } @@ -1431,12 +1473,15 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) paf = blo_do_version_give_parteff_245(ob); if (paf) { - if (paf->disp == 0) + if (paf->disp == 0) { paf->disp = 100; - if (paf->speedtex == 0) + } + if (paf->speedtex == 0) { paf->speedtex = 8; - if (paf->omat == 0) + } + if (paf->omat == 0) { paf->omat = 1; + } } } @@ -1460,8 +1505,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) for (kb = key->block.first; kb; kb = kb->next) { if (kb == key->refkey) { - if (kb->name[0] == 0) + if (kb->name[0] == 0) { strcpy(kb->name, "Basis"); + } } else { if (kb->name[0] == 0) { @@ -1499,8 +1545,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) /* updating stepsize for ghost drawing */ for (arm = bmain->armatures.first; arm; arm = arm->id.next) { bone_version_239(&arm->bonebase); - if (arm->layer == 0) + if (arm->layer == 0) { arm->layer = 1; + } } for (; sce; sce = sce->id.next) { @@ -1511,16 +1558,19 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) } for (; cam; cam = cam->id.next) { - if (set_passepartout) + if (set_passepartout) { cam->flag |= CAM_SHOWPASSEPARTOUT; + } /* make sure old cameras have title safe on */ - if (!(cam->flag & CAM_SHOW_SAFE_MARGINS)) + if (!(cam->flag & CAM_SHOW_SAFE_MARGINS)) { cam->flag |= CAM_SHOW_SAFE_MARGINS; + } /* set an appropriate camera passepartout alpha */ - if (!(cam->passepartalpha)) + if (!(cam->passepartalpha)) { cam->passepartalpha = 0.2f; + } } } @@ -1534,12 +1584,14 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) /* updating layers still */ for (arm = bmain->armatures.first; arm; arm = arm->id.next) { bone_version_239(&arm->bonebase); - if (arm->layer == 0) + if (arm->layer == 0) { arm->layer = 1; + } } for (sce = bmain->scenes.first; sce; sce = sce->id.next) { - if (sce->audio.mixrate == 0) + if (sce->audio.mixrate == 0) { sce->audio.mixrate = 48000; + } /* We don't add default layer since blender2.8 because the layers * are now in Scene->view_layers and a default layer is created in @@ -1548,14 +1600,16 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) SceneRenderLayer *srl; /* new layer flag for sky, was default for solid */ for (srl = sce->r.layers.first; srl; srl = srl->next) { - if (srl->layflag & SCE_LAY_SOLID) + if (srl->layflag & SCE_LAY_SOLID) { srl->layflag |= SCE_LAY_SKY; + } srl->passflag &= (SCE_PASS_COMBINED | SCE_PASS_Z | SCE_PASS_NORMAL | SCE_PASS_VECTOR); } /* node version changes */ - if (sce->nodetree) + if (sce->nodetree) { ntree_version_241(sce->nodetree); + } /* uv calculation options moved to toolsettings */ if (sce->toolsettings->unwrapper == 0) { @@ -1564,12 +1618,15 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) } } - for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) + for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) { ntree_version_241(ntree); + } - for (la = bmain->lights.first; la; la = la->id.next) - if (la->buffers == 0) + for (la = bmain->lights.first; la; la = la->id.next) { + if (la->buffers == 0) { la->buffers = 1; + } + } /* for empty drawsize and drawtype */ for (ob = bmain->objects.first; ob; ob = ob->id.next) { @@ -1614,8 +1671,9 @@ 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; - if (v3d->gridsubdiv == 0) + if (v3d->gridsubdiv == 0) { v3d->gridsubdiv = 10; + } } } sa = sa->next; @@ -1626,20 +1684,25 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) enum { R_THREADS = (1 << 19), }; - if (sce->toolsettings->select_thresh == 0.0f) + if (sce->toolsettings->select_thresh == 0.0f) { sce->toolsettings->select_thresh = 0.01f; + } if (sce->r.threads == 0) { - if (sce->r.mode & R_THREADS) + if (sce->r.mode & R_THREADS) { sce->r.threads = 2; - else + } + else { sce->r.threads = 1; + } } - if (sce->nodetree) + if (sce->nodetree) { ntree_version_242(sce->nodetree); + } } - for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) + for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) { ntree_version_242(ntree); + } /* add default radius values to old curve points */ for (cu = bmain->curves.first; cu; cu = cu->id.next) { @@ -1647,14 +1710,16 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) if (nu) { if (nu->bezt) { for (bezt = nu->bezt, a = 0; a < nu->pntsu; a++, bezt++) { - if (!bezt->radius) + if (!bezt->radius) { bezt->radius = 1.0; + } } } else if (nu->bp) { for (bp = nu->bp, a = 0; a < nu->pntsu * nu->pntsv; a++, bp++) { - if (!bp->radius) + if (!bp->radius) { bp->radius = 1.0; + } } } } @@ -1675,10 +1740,12 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) switch (curcon->type) { case CONSTRAINT_TYPE_MINMAX: { bMinMaxConstraint *data = curcon->data; - if (data->sticky == 1) + if (data->sticky == 1) { data->flag |= MINMAX_STICKY; - else + } + else { data->flag &= ~MINMAX_STICKY; + } break; } @@ -1686,8 +1753,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) bRotateLikeConstraint *data = curcon->data; /* version patch from buttons_object.c */ - if (data->flag == 0) + if (data->flag == 0) { data->flag = ROTLIKE_X | ROTLIKE_Y | ROTLIKE_Z; + } break; } @@ -1704,10 +1772,12 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) switch (curcon->type) { case CONSTRAINT_TYPE_MINMAX: { bMinMaxConstraint *data = curcon->data; - if (data->sticky == 1) + if (data->sticky == 1) { data->flag |= MINMAX_STICKY; - else + } + else { data->flag &= ~MINMAX_STICKY; + } break; } case CONSTRAINT_TYPE_KINEMATIC: { @@ -1722,8 +1792,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) bRotateLikeConstraint *data = curcon->data; /* version patch from buttons_object.c */ - if (data->flag == 0) + if (data->flag == 0) { data->flag = ROTLIKE_X | ROTLIKE_Y | ROTLIKE_Z; + } break; } } @@ -1737,23 +1808,28 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) if (md->type == eModifierType_Curve) { CurveModifierData *cmd = (CurveModifierData *)md; - if (cmd->defaxis == 0) + if (cmd->defaxis == 0) { cmd->defaxis = ob->trackflag + 1; + } } } } for (ma = bmain->materials.first; ma; ma = ma->id.next) { - if (ma->nodetree) + if (ma->nodetree) { ntree_version_242(ma->nodetree); + } } - for (me = bmain->meshes.first; me; me = me->id.next) + for (me = bmain->meshes.first; me; me = me->id.next) { customdata_version_242(me); + } - for (collection = bmain->collections.first; collection; collection = collection->id.next) - if (collection->layer == 0) + for (collection = bmain->collections.first; collection; collection = collection->id.next) { + if (collection->layer == 0) { collection->layer = (1 << 20) - 1; + } + } /* now, subversion control! */ if (bmain->subversionfile < 3) { @@ -1796,14 +1872,18 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) tex->iuser.cycl = (tex->imaflag & TEX_ANIMCYCLIC) != 0; } for (sce = bmain->scenes.first; sce; sce = sce->id.next) { - if (sce->nodetree) + if (sce->nodetree) { do_version_ntree_242_2(sce->nodetree); + } } - for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) + for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) { do_version_ntree_242_2(ntree); - for (ma = bmain->materials.first; ma; ma = ma->id.next) - if (ma->nodetree) + } + for (ma = bmain->materials.first; ma; ma = ma->id.next) { + if (ma->nodetree) { do_version_ntree_242_2(ma->nodetree); + } + } } if (bmain->subversionfile < 4) { @@ -1857,8 +1937,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) /* render layer added, this is not the active layer */ if (bmain->versionfile <= 243 || bmain->subversionfile < 2) { Mesh *me; - for (me = bmain->meshes.first; me; me = me->id.next) + for (me = bmain->meshes.first; me; me = me->id.next) { customdata_version_243(me); + } } } @@ -1926,8 +2007,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) bLocLimitConstraint *data = (bLocLimitConstraint *)curcon->data; /* old limit without parent option for objects */ - if (data->flag2) + if (data->flag2) { curcon->ownspace = CONSTRAINT_SPACE_LOCAL; + } break; } } @@ -1956,8 +2038,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) bActionConstraint *data = (bActionConstraint *)curcon->data; /* 'data->local' used to mean that target was in local-space */ - if (data->local) + if (data->local) { curcon->tarspace = CONSTRAINT_SPACE_LOCAL; + } break; } } @@ -1982,8 +2065,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) /* add point caches */ for (ob = bmain->objects.first; ob; ob = ob->id.next) { - if (ob->soft && !ob->soft->pointcache) + if (ob->soft && !ob->soft->pointcache) { ob->soft->pointcache = BKE_ptcache_add(&ob->soft->ptcaches); + } for (psys = ob->particlesystem.first; psys; psys = psys->next) { if (psys->pointcache) { @@ -1993,8 +2077,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) psys->pointcache->flag &= ~PTCACHE_BAKED; } } - else + else { psys->pointcache = BKE_ptcache_add(&psys->ptcaches); + } } for (md = ob->modifiers.first; md; md = md->next) { @@ -2043,13 +2128,15 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) } for (part = bmain->particles.first; part; part = part->id.next) { - if (part->ren_child_nbr == 0) + if (part->ren_child_nbr == 0) { part->ren_child_nbr = part->child_nbr; + } } for (sce = bmain->scenes.first; sce; sce = sce->id.next) { - if (sce->nodetree) + if (sce->nodetree) { ntree_version_245(fd, lib, sce->nodetree); + } if (sce->r.simplify_subsurf == 0) { sce->r.simplify_subsurf = 6; @@ -2057,8 +2144,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) } } - for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) + for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) { ntree_version_245(fd, lib, ntree); + } /* fix for temporary flag changes during 245 cycle */ for (ima = bmain->images.first; ima; ima = ima->id.next) { @@ -2095,13 +2183,15 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) ModifierData *md; Object *ob; - for (arm = bmain->armatures.first; arm; arm = arm->id.next) + for (arm = bmain->armatures.first; arm; arm = arm->id.next) { arm->deformflag |= ARM_DEF_B_BONE_REST; + } for (ob = bmain->objects.first; ob; ob = ob->id.next) { for (md = ob->modifiers.first; md; md = md->next) { - if (md->type == eModifierType_Armature) + if (md->type == eModifierType_Armature) { ((ArmatureModifierData *)md)->deformflag |= ARM_DEF_B_BONE_REST; + } } } } @@ -2143,8 +2233,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) int k; for (k = 0; k < sb->totkey; k++) { - if (sb->keys[k]) + if (sb->keys[k]) { MEM_freeN(sb->keys[k]); + } } MEM_freeN(sb->keys); @@ -2166,8 +2257,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) int k; for (k = 0; k < sb->totkey; k++) { - if (sb->keys[k]) + if (sb->keys[k]) { MEM_freeN(sb->keys[k]); + } } MEM_freeN(sb->keys); @@ -2289,8 +2381,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) { FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType( ob, eModifierType_Fluidsim); - if (fluidmd && fluidmd->fss && fluidmd->fss->type == OB_FLUIDSIM_PARTICLE) + if (fluidmd && fluidmd->fss && fluidmd->fss->type == OB_FLUIDSIM_PARTICLE) { part->type = PART_FLUID; + } } do_version_free_effects_245(&ob->effect); @@ -2324,8 +2417,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) Object *ob; /* dupliface scale */ - for (ob = bmain->objects.first; ob; ob = ob->id.next) + for (ob = bmain->objects.first; ob; ob = ob->id.next) { ob->instance_faces_scale = 1.0f; + } } if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 11)) { @@ -2337,19 +2431,23 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) for (strip = ob->nlastrips.first; strip; strip = strip->next) { float length, actlength, repeat; - if (strip->flag & ACTSTRIP_USESTRIDE) + if (strip->flag & ACTSTRIP_USESTRIDE) { repeat = 1.0f; - else + } + else { repeat = strip->repeat; + } length = strip->end - strip->start; - if (length == 0.0f) + if (length == 0.0f) { length = 1.0f; + } actlength = strip->actend - strip->actstart; strip->scale = length / (repeat * actlength); - if (strip->scale == 0.0f) + if (strip->scale == 0.0f) { strip->scale = 1.0f; + } } if (ob->soft) { ob->soft->inpush = ob->soft->inspring; @@ -2364,8 +2462,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) for (sce = bmain->scenes.first; sce; sce = sce->id.next) { SEQ_BEGIN (sce->ed, seq) { - if (seq->blend_mode == 0) + if (seq->blend_mode == 0) { seq->blend_opacity = 100.0f; + } } SEQ_END; } @@ -2426,8 +2525,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) if (bmain->versionfile < 246 || (bmain->versionfile == 246 && bmain->subversionfile < 1)) { Object *ob; for (ob = bmain->objects.first; ob; ob = ob->id.next) { - if (ob->pd && (ob->pd->forcefield == PFIELD_WIND)) + if (ob->pd && (ob->pd->forcefield == PFIELD_WIND)) { ob->pd->f_noise = 0.0f; + } } } @@ -2503,8 +2603,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) if (bmain->versionfile < 249 && bmain->subversionfile < 1) { Object *ob; for (ob = bmain->objects.first; ob; ob = ob->id.next) { - if (ob->pd) + if (ob->pd) { ob->pd->seed = ((uint)(ceil(PIL_check_seconds_timer())) + 1) % 128; + } } } diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c index 069b1907cce..91f605460c9 100644 --- a/source/blender/blenloader/intern/versioning_userdef.c +++ b/source/blender/blenloader/intern/versioning_userdef.c @@ -157,14 +157,16 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef) #define USER_VERSION_ATLEAST(ver, subver) MAIN_VERSION_ATLEAST(bmain, ver, subver) /* the UserDef struct is not corrected with do_versions() .... ugh! */ - if (userdef->wheellinescroll == 0) + if (userdef->wheellinescroll == 0) { userdef->wheellinescroll = 3; + } if (userdef->menuthreshold1 == 0) { userdef->menuthreshold1 = 5; userdef->menuthreshold2 = 2; } - if (userdef->mixbufsize == 0) + if (userdef->mixbufsize == 0) { userdef->mixbufsize = 2048; + } if (userdef->autokey_mode == 0) { /* 'add/replace' but not on */ userdef->autokey_mode = 2; @@ -177,8 +179,9 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef) userdef->gizmo_size = 75; userdef->gizmo_flag |= USER_GIZMO_DRAW; } - if (userdef->pad_rot_angle == 0.0f) + if (userdef->pad_rot_angle == 0.0f) { userdef->pad_rot_angle = 15.0f; + } /* graph editor - unselected F-Curve visibility */ if (userdef->fcu_inactive_alpha == 0) { @@ -197,18 +200,21 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef) /* added seam, normal color, undo */ if (!USER_VERSION_ATLEAST(235, 0)) { userdef->uiflag |= USER_GLOBALUNDO; - if (userdef->undosteps == 0) + if (userdef->undosteps == 0) { userdef->undosteps = 32; + } } if (!USER_VERSION_ATLEAST(236, 0)) { /* illegal combo... */ - if (userdef->flag & USER_LMOUSESELECT) + if (userdef->flag & USER_LMOUSESELECT) { userdef->flag &= ~USER_TWOBUTTONMOUSE; + } } if (!USER_VERSION_ATLEAST(240, 0)) { userdef->uiflag |= USER_PLAINMENUS; - if (userdef->obcenter_dia == 0) + if (userdef->obcenter_dia == 0) { userdef->obcenter_dia = 6; + } } if (!USER_VERSION_ATLEAST(242, 0)) { /* set defaults for 3D View rotating axis indicator */ @@ -221,12 +227,14 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef) } if (!USER_VERSION_ATLEAST(244, 0)) { /* set default number of recently-used files (if not set) */ - if (userdef->recent_files == 0) + if (userdef->recent_files == 0) { userdef->recent_files = 10; + } } if (!USER_VERSION_ATLEAST(245, 3)) { - if (userdef->coba_weight.tot == 0) + if (userdef->coba_weight.tot == 0) { BKE_colorband_init(&userdef->coba_weight, true); + } } if (!USER_VERSION_ATLEAST(245, 3)) { userdef->flag |= USER_ADD_VIEWALIGNED | USER_ADD_EDITMODE; @@ -242,56 +250,76 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef) if (!USER_VERSION_ATLEAST(250, 3)) { /* new audio system */ - if (userdef->audiochannels == 0) + if (userdef->audiochannels == 0) { userdef->audiochannels = 2; - if (userdef->audioformat == 0) + } + if (userdef->audioformat == 0) { userdef->audioformat = 0x24; - if (userdef->audiorate == 0) + } + if (userdef->audiorate == 0) { userdef->audiorate = 48000; + } } if (!USER_VERSION_ATLEAST(250, 8)) { wmKeyMap *km; for (km = userdef->user_keymaps.first; km; km = km->next) { - if (STREQ(km->idname, "Armature_Sketch")) + if (STREQ(km->idname, "Armature_Sketch")) { strcpy(km->idname, "Armature Sketch"); - else if (STREQ(km->idname, "View3D")) + } + else if (STREQ(km->idname, "View3D")) { strcpy(km->idname, "3D View"); - else if (STREQ(km->idname, "View3D Generic")) + } + else if (STREQ(km->idname, "View3D Generic")) { strcpy(km->idname, "3D View Generic"); - else if (STREQ(km->idname, "EditMesh")) + } + else if (STREQ(km->idname, "EditMesh")) { strcpy(km->idname, "Mesh"); - else if (STREQ(km->idname, "UVEdit")) + } + else if (STREQ(km->idname, "UVEdit")) { strcpy(km->idname, "UV Editor"); - else if (STREQ(km->idname, "Animation_Channels")) + } + else if (STREQ(km->idname, "Animation_Channels")) { strcpy(km->idname, "Animation Channels"); - else if (STREQ(km->idname, "GraphEdit Keys")) + } + else if (STREQ(km->idname, "GraphEdit Keys")) { strcpy(km->idname, "Graph Editor"); - else if (STREQ(km->idname, "GraphEdit Generic")) + } + else if (STREQ(km->idname, "GraphEdit Generic")) { strcpy(km->idname, "Graph Editor Generic"); - else if (STREQ(km->idname, "Action_Keys")) + } + else if (STREQ(km->idname, "Action_Keys")) { strcpy(km->idname, "Dopesheet"); - else if (STREQ(km->idname, "NLA Data")) + } + else if (STREQ(km->idname, "NLA Data")) { strcpy(km->idname, "NLA Editor"); - else if (STREQ(km->idname, "Node Generic")) + } + else if (STREQ(km->idname, "Node Generic")) { strcpy(km->idname, "Node Editor"); - else if (STREQ(km->idname, "Logic Generic")) + } + else if (STREQ(km->idname, "Logic Generic")) { strcpy(km->idname, "Logic Editor"); - else if (STREQ(km->idname, "File")) + } + else if (STREQ(km->idname, "File")) { strcpy(km->idname, "File Browser"); - else if (STREQ(km->idname, "FileMain")) + } + else if (STREQ(km->idname, "FileMain")) { strcpy(km->idname, "File Browser Main"); - else if (STREQ(km->idname, "FileButtons")) + } + else if (STREQ(km->idname, "FileButtons")) { strcpy(km->idname, "File Browser Buttons"); - else if (STREQ(km->idname, "Buttons Generic")) + } + else if (STREQ(km->idname, "Buttons Generic")) { strcpy(km->idname, "Property Editor"); + } } } if (!USER_VERSION_ATLEAST(252, 3)) { - if (userdef->flag & USER_LMOUSESELECT) + if (userdef->flag & USER_LMOUSESELECT) { userdef->flag &= ~USER_TWOBUTTONMOUSE; + } } if (!USER_VERSION_ATLEAST(252, 4)) { /* default new handle type is auto handles */ @@ -308,8 +336,9 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef) /* if new keyframes handle default is stuff "auto", make it "auto-clamped" instead * was changed in 260 as part of GSoC11, but version patch was wrong */ - if (userdef->keyhandles_new == HD_AUTO) + if (userdef->keyhandles_new == HD_AUTO) { userdef->keyhandles_new = HD_AUTO_ANIM; + } /* enable (Cycles) addon by default */ BKE_addon_ensure(&userdef->addons, "cycles"); @@ -331,10 +360,12 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef) if (userdef->v2d_min_gridsize == 0) { userdef->v2d_min_gridsize = 35; } - if (userdef->widget_unit == 0) + if (userdef->widget_unit == 0) { userdef->widget_unit = 20; - if (userdef->anisotropic_filter <= 0) + } + if (userdef->anisotropic_filter <= 0) { userdef->anisotropic_filter = 1; + } if (userdef->ndof_sensitivity == 0.0f) { userdef->ndof_sensitivity = 1.0f; @@ -345,11 +376,13 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef) if (userdef->ndof_orbit_sensitivity == 0.0f) { userdef->ndof_orbit_sensitivity = userdef->ndof_sensitivity; - if (!(userdef->flag & USER_TRACKBALL)) + if (!(userdef->flag & USER_TRACKBALL)) { userdef->ndof_flag |= NDOF_TURNTABLE; + } } - if (userdef->tweak_threshold == 0) + if (userdef->tweak_threshold == 0) { userdef->tweak_threshold = 10; + } } /* NOTE!! from now on use userdef->versionfile and userdef->subversionfile */ @@ -508,8 +541,9 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef) } } - if (userdef->pixelsize == 0.0f) + if (userdef->pixelsize == 0.0f) { userdef->pixelsize = 1.0f; + } for (bTheme *btheme = userdef->themes.first; btheme; btheme = btheme->next) { do_versions_theme(userdef, btheme); diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 1764395f639..4abe873403d 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2776,8 +2776,9 @@ static void write_region(WriteData *wd, ARegion *ar, int spacetype) writestruct(wd, DATA, BoundBox, 1, rv3d->clipbb); } } - else + else { printf("regiondata write missing!\n"); + } break; default: printf("regiondata write missing!\n"); |