Cleanup: style
authorCampbell Barton <ideasman42@gmail.com>
Fri, 30 Nov 2018 03:20:41 +0000 (14:20 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 30 Nov 2018 03:23:10 +0000 (14:23 +1100)
source/blender/blenloader/intern/readblenentry.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/runtime.c
source/blender/blenloader/intern/undofile.c
source/blender/blenloader/intern/versioning_250.c
source/blender/blenloader/intern/versioning_260.c
source/blender/blenloader/intern/versioning_270.c
source/blender/blenloader/intern/versioning_defaults.c
source/blender/blenloader/intern/versioning_legacy.c
source/blender/blenloader/intern/writefile.c

index b2bcf745eac76bcd4631c9f5faeaab906f6c7db2..0d8f056e9c4c7168c30b533bdb34fe7b47b91e47 100644 (file)
@@ -106,7 +106,7 @@ BlendHandle *BLO_blendhandle_from_memory(const void *mem, int memsize)
 
 void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp)
 {
-       FileData *fd = (FileData *) bh;
+       FileData *fd = (FileData *)bh;
        BHead *bhead;
 
        fprintf(fp, "[\n");
@@ -144,7 +144,7 @@ void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp)
  */
 LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, int ofblocktype, int *tot_names)
 {
-       FileData *fd = (FileData *) bh;
+       FileData *fd = (FileData *)bh;
        LinkNode *names = NULL;
        BHead *bhead;
        int tot = 0;
@@ -174,7 +174,7 @@ LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, int ofblocktype,
  */
 LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *tot_prev)
 {
-       FileData *fd = (FileData *) bh;
+       FileData *fd = (FileData *)bh;
        LinkNode *previews = NULL;
        BHead *bhead;
        int looking = 0;
@@ -210,11 +210,11 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
                                        if (prv) {
                                                memcpy(new_prv, prv, sizeof(PreviewImage));
                                                if (prv->rect[0] && prv->w[0] && prv->h[0]) {
-                                                       unsigned int *rect = NULL;
-                                                       size_t len = new_prv->w[0] * new_prv->h[0] * sizeof(unsigned int);
+                                                       uint *rect = NULL;
+                                                       size_t len = new_prv->w[0] * new_prv->h[0] * sizeof(uint);
                                                        new_prv->rect[0] = MEM_callocN(len, __func__);
                                                        bhead = blo_nextbhead(fd, bhead);
-                                                       rect = (unsigned int *)(bhead + 1);
+                                                       rect = (uint *)(bhead + 1);
                                                        BLI_assert(len == bhead->len);
                                                        memcpy(new_prv->rect[0], rect, len);
                                                }
@@ -227,11 +227,11 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
                                                }
 
                                                if (prv->rect[1] && prv->w[1] && prv->h[1]) {
-                                                       unsigned int *rect = NULL;
-                                                       size_t len = new_prv->w[1] * new_prv->h[1] * sizeof(unsigned int);
+                                                       uint *rect = NULL;
+                                                       size_t len = new_prv->w[1] * new_prv->h[1] * sizeof(uint);
                                                        new_prv->rect[1] = MEM_callocN(len, __func__);
                                                        bhead = blo_nextbhead(fd, bhead);
-                                                       rect = (unsigned int *)(bhead + 1);
+                                                       rect = (uint *)(bhead + 1);
                                                        BLI_assert(len == bhead->len);
                                                        memcpy(new_prv->rect[1], rect, len);
                                                }
@@ -270,7 +270,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
  */
 LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh)
 {
-       FileData *fd = (FileData *) bh;
+       FileData *fd = (FileData *)bh;
        GSet *gathered = BLI_gset_ptr_new("linkable_groups gh");
        LinkNode *names = NULL;
        BHead *bhead;
@@ -302,7 +302,7 @@ LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh)
  */
 void BLO_blendhandle_close(BlendHandle *bh)
 {
-       FileData *fd = (FileData *) bh;
+       FileData *fd = (FileData *)bh;
 
        blo_freefiledata(fd);
 }
index 657495e763e1e2ff4bfbcdc28592bf2a4e67a923..2e07143c5239e4b1162f0647ad23338d3cd57cfd 100644 (file)
@@ -287,7 +287,7 @@ static const char *library_parent_filepath(Library *lib)
 
 static OldNewMap *oldnewmap_new(void)
 {
-       OldNewMap *onm= MEM_callocN(sizeof(*onm), "OldNewMap");
+       OldNewMap *onm = MEM_callocN(sizeof(*onm), "OldNewMap");
 
        onm->entriessize = 1024;
        onm->entries = MEM_malloc_arrayN(onm->entriessize, sizeof(*onm->entries), "OldNewMap.entries");
@@ -297,7 +297,7 @@ static OldNewMap *oldnewmap_new(void)
 
 static int verg_oldnewmap(const void *v1, const void *v2)
 {
-       const struct OldNew *x1=v1, *x2=v2;
+       const struct OldNew *x1 = v1, *x2 = v2;
 
        if (x1->old > x2->old) return 1;
        else if (x1->old < x2->old) return -1;
@@ -317,7 +317,7 @@ static void oldnewmap_insert(OldNewMap *onm, const void *oldaddr, void *newaddr,
 {
        OldNew *entry;
 
-       if (oldaddr==NULL || newaddr==NULL) return;
+       if (oldaddr == NULL || newaddr == NULL) return;
 
        if (UNLIKELY(onm->nentries == onm->entriessize)) {
                onm->entriessize *= 2;
@@ -391,7 +391,7 @@ static void *oldnewmap_lookup_and_inc(OldNewMap *onm, const void *addr, bool inc
 
        if (addr == NULL) return NULL;
 
-       if (onm->lasthit < onm->nentries-1) {
+       if (onm->lasthit < onm->nentries - 1) {
                OldNew *entry = &onm->entries[++onm->lasthit];
 
                if (entry->old == addr) {
@@ -504,13 +504,13 @@ void blo_join_main(ListBase *mainlist)
        }
 }
 
-static void split_libdata(ListBase *lb_src, Main **lib_main_array, const unsigned int lib_main_array_len)
+static void split_libdata(ListBase *lb_src, Main **lib_main_array, const uint lib_main_array_len)
 {
        for (ID *id = lb_src->first, *idnext; id; id = idnext) {
                idnext = id->next;
 
                if (id->lib) {
-                       if (((unsigned int)id->lib->temp_index < lib_main_array_len) &&
+                       if (((uint)id->lib->temp_index < lib_main_array_len) &&
                            /* this check should never fail, just incase 'id->lib' is a dangling pointer. */
                            (lib_main_array[id->lib->temp_index]->curlib == id->lib))
                        {
@@ -536,8 +536,8 @@ void blo_split_main(ListBase *mainlist, Main *main)
                return;
 
        /* (Library.temp_index -> Main), lookup table */
-       const unsigned int lib_main_array_len = BLI_listbase_count(&main->library);
-       Main             **lib_main_array     = MEM_malloc_arrayN(lib_main_array_len, sizeof(*lib_main_array), __func__);
+       const uint lib_main_array_len = BLI_listbase_count(&main->library);
+       Main     **lib_main_array     = MEM_malloc_arrayN(lib_main_array_len, sizeof(*lib_main_array), __func__);
 
        int i = 0;
        for (Library *lib = main->library.first; lib; lib = lib->id.next, i++) {
@@ -567,13 +567,13 @@ static void read_file_version(FileData *fd, Main *main)
 {
        BHead *bhead;
 
-       for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
+       for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
                if (bhead->code == GLOB) {
-                       FileGlobal *fg= read_struct(fd, bhead, "Global");
+                       FileGlobal *fg = read_struct(fd, bhead, "Global");
                        if (fg) {
-                               main->subversionfile= fg->subversion;
-                               main->minversionfile= fg->minversion;
-                               main->minsubversionfile= fg->minsubversion;
+                               main->subversionfile = fg->subversion;
+                               main->minversionfile = fg->minversion;
+                               main->minsubversionfile = fg->minsubversion;
                                MEM_freeN(fg);
                        }
                        else if (bhead->code == ENDB)
@@ -594,7 +594,7 @@ static void read_file_bhead_idname_map_create(FileData *fd)
        /* dummy values */
        bool is_link = false;
        int code_prev = ENDB;
-       unsigned int reserve = 0;
+       uint reserve = 0;
 
        for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
                if (code_prev != bhead->code) {
@@ -672,7 +672,7 @@ static Main *blo_find_main(FileData *fd, const char *filepath, const char *relab
 static void switch_endian_bh4(BHead4 *bhead)
 {
        /* the ID_.. codes */
-       if ((bhead->code & 0xFFFF)==0) bhead->code >>= 16;
+       if ((bhead->code & 0xFFFF) == 0) bhead->code >>= 16;
 
        if (bhead->code != ENDB) {
                BLI_endian_switch_int32(&bhead->len);
@@ -684,7 +684,7 @@ static void switch_endian_bh4(BHead4 *bhead)
 static void switch_endian_bh8(BHead8 *bhead)
 {
        /* the ID_.. codes */
-       if ((bhead->code & 0xFFFF)==0) bhead->code >>= 16;
+       if ((bhead->code & 0xFFFF) == 0) bhead->code >>= 16;
 
        if (bhead->code != ENDB) {
                BLI_endian_switch_int32(&bhead->len);
@@ -695,7 +695,7 @@ static void switch_endian_bh8(BHead8 *bhead)
 
 static void bh4_from_bh8(BHead *bhead, BHead8 *bhead8, int do_endian_swap)
 {
-       BHead4 *bhead4 = (BHead4 *) bhead;
+       BHead4 *bhead4 = (BHead4 *)bhead;
        int64_t old;
 
        bhead4->code = bhead8->code;
@@ -712,7 +712,7 @@ static void bh4_from_bh8(BHead *bhead, BHead8 *bhead8, int do_endian_swap)
                /* this patch is to avoid a long long being read from not-eight aligned positions
                 * is necessary on any modern 64bit architecture) */
                memcpy(&old, &bhead8->old, 8);
-               bhead4->old = (int) (old >> 3);
+               bhead4->old = (int)(old >> 3);
 
                bhead4->SDNAnr = bhead8->SDNAnr;
                bhead4->nr = bhead8->nr;
@@ -721,7 +721,7 @@ static void bh4_from_bh8(BHead *bhead, BHead8 *bhead8, int do_endian_swap)
 
 static void bh8_from_bh4(BHead *bhead, BHead4 *bhead4)
 {
-       BHead8 *bhead8 = (BHead8 *) bhead;
+       BHead8 *bhead8 = (BHead8 *)bhead;
 
        bhead8->code = bhead4->code;
        bhead8->len = bhead4->len;
@@ -729,7 +729,7 @@ static void bh8_from_bh4(BHead *bhead, BHead4 *bhead4)
        if (bhead8->code != ENDB) {
                bhead8->old = bhead4->old;
                bhead8->SDNAnr = bhead4->SDNAnr;
-               bhead8->nr= bhead4->nr;
+               bhead8->nr = bhead4->nr;
        }
 }
 
@@ -744,7 +744,7 @@ static BHeadN *get_bhead(FileData *fd)
                         * since uninitialized memory gets compared */
                        BHead8 bhead8 = {0};
                        BHead4 bhead4 = {0};
-                       BHead  bhead = {0};
+                       BHead bhead = {0};
 
                        /* First read the bhead structure.
                         * Depending on the platform the file was written on this can
@@ -773,7 +773,7 @@ static BHeadN *get_bhead(FileData *fd)
                                }
                                else {
                                        fd->eof = 1;
-                                       bhead.len= 0;
+                                       bhead.len = 0;
                                }
                        }
                        else {
@@ -796,7 +796,7 @@ static BHeadN *get_bhead(FileData *fd)
                                }
                                else {
                                        fd->eof = 1;
-                                       bhead.len= 0;
+                                       bhead.len = 0;
                                }
                        }
 
@@ -1013,7 +1013,7 @@ static int *read_file_thumbnail(FileData *fd)
        return blend_thumb;
 }
 
-static int fd_read_from_file(FileData *filedata, void *buffer, unsigned int size)
+static int fd_read_from_file(FileData *filedata, void *buffer, uint size)
 {
        int readsize = read(filedata->filedes, buffer, size);
 
@@ -1027,7 +1027,7 @@ static int fd_read_from_file(FileData *filedata, void *buffer, unsigned int size
        return readsize;
 }
 
-static int fd_read_gzip_from_file(FileData *filedata, void *buffer, unsigned int size)
+static int fd_read_gzip_from_file(FileData *filedata, void *buffer, uint size)
 {
        int readsize = gzread(filedata->gzfiledes, buffer, size);
 
@@ -1041,10 +1041,10 @@ static int fd_read_gzip_from_file(FileData *filedata, void *buffer, unsigned int
        return (readsize);
 }
 
-static int fd_read_from_memory(FileData *filedata, void *buffer, unsigned int size)
+static int fd_read_from_memory(FileData *filedata, void *buffer, uint size)
 {
        /* don't read more bytes then there are available in the buffer */
-       int readsize = (int)MIN2(size, (unsigned int)(filedata->buffersize - filedata->seek));
+       int readsize = (int)MIN2(size, (uint)(filedata->buffersize - filedata->seek));
 
        memcpy(buffer, filedata->buffer + filedata->seek, readsize);
        filedata->seek += readsize;
@@ -1052,21 +1052,23 @@ static int fd_read_from_memory(FileData *filedata, void *buffer, unsigned int si
        return (readsize);
 }
 
-static int fd_read_from_memfile(FileData *filedata, void *buffer, unsigned int size)
+static int fd_read_from_memfile(FileData *filedata, void *buffer, uint size)
 {
-       static unsigned int seek = (1<<30);     /* the current position */
-       static unsigned int offset = 0;         /* size of previous chunks */
+       static uint seek = (1 << 30); /* the current position */
+       static uint offset = 0;     /* size of previous chunks */
        static MemFileChunk *chunk = NULL;
-       unsigned int chunkoffset, readsize, totread;
+       uint chunkoffset, readsize, totread;
 
        if (size == 0) return 0;
 
-       if (seek != (unsigned int)filedata->seek) {
+       if (seek != (uint)filedata->seek) {
                chunk = filedata->memfile->chunks.first;
                seek = 0;
 
                while (chunk) {
-                       if (seek + chunk->size > (unsigned) filedata->seek) break;
+                       if (seek + chunk->size > (uint)filedata->seek) {
+                               break;
+                       }
                        seek += chunk->size;
                        chunk = chunk->next;
                }
@@ -1079,7 +1081,7 @@ static int fd_read_from_memfile(FileData *filedata, void *buffer, unsigned int s
 
                do {
                        /* first check if it's on the end if current chunk */
-                       if (seek-offset == chunk->size) {
+                       if (seek - offset == chunk->size) {
                                offset += chunk->size;
                                chunk = chunk->next;
                        }
@@ -1090,14 +1092,14 @@ static int fd_read_from_memfile(FileData *filedata, void *buffer, unsigned int s
                                return 0;
                        }
 
-                       chunkoffset = seek-offset;
-                       readsize = size-totread;
+                       chunkoffset = seek - offset;
+                       readsize = size - totread;
 
                        /* data can be spread over multiple chunks, so clamp size
                         * to within this chunk, and then it will read further in
                         * the next chunk */
-                       if (chunkoffset+readsize > chunk->size)
-                               readsize= chunk->size-chunkoffset;
+                       if (chunkoffset + readsize > chunk->size)
+                               readsize = chunk->size - chunkoffset;
 
                        memcpy(POINTER_OFFSET(buffer, totread), chunk->buf + chunkoffset, readsize);
                        totread += readsize;
@@ -1202,15 +1204,15 @@ static FileData *blo_openblenderfile_minimal(const char *filepath)
        return NULL;
 }
 
-static int fd_read_gzip_from_memory(FileData *filedata, void *buffer, unsigned int size)
+static int fd_read_gzip_from_memory(FileData *filedata, void *buffer, uint size)
 {
        int err;
 
-       filedata->strm.next_out = (Bytef *) buffer;
+       filedata->strm.next_out = (Bytef *)buffer;
        filedata->strm.avail_out = size;
 
        // Inflate another chunk.
-       err = inflate (&filedata->strm, Z_SYNC_FLUSH);
+       err = inflate(&filedata->strm, Z_SYNC_FLUSH);
 
        if (err == Z_STREAM_END) {
                return 0;
@@ -1228,13 +1230,13 @@ static int fd_read_gzip_from_memory(FileData *filedata, void *buffer, unsigned i
 static int fd_read_gzip_from_memory_init(FileData *fd)
 {
 
-       fd->strm.next_in = (Bytef *) fd->buffer;
+       fd->strm.next_in = (Bytef *)fd->buffer;
        fd->strm.avail_in = fd->buffersize;
        fd->strm.total_out = 0;
        fd->strm.zalloc = Z_NULL;
        fd->strm.zfree = Z_NULL;
 
-       if (inflateInit2(&fd->strm, (16+MAX_WBITS)) != Z_OK)
+       if (inflateInit2(&fd->strm, (16 + MAX_WBITS)) != Z_OK)
                return 0;
 
        fd->read = fd_read_gzip_from_memory;
@@ -1244,8 +1246,8 @@ static int fd_read_gzip_from_memory_init(FileData *fd)
 
 FileData *blo_openblendermemory(const void *mem, int memsize, ReportList *reports)
 {
-       if (!mem || memsize<SIZEOFBLENDERHEADER) {
-               BKE_report(reports, RPT_WARNING, (mem) ? TIP_("Unable to read"): TIP_("Unable to open"));
+       if (!mem || memsize < SIZEOFBLENDERHEADER) {
+               BKE_report(reports, RPT_WARNING, (mem) ? TIP_("Unable to read") : TIP_("Unable to open"));
                return NULL;
        }
        else {
@@ -1467,7 +1469,7 @@ BlendThumbnail *BLO_thumbnail_from_file(const char *filepath)
 
 /* ************** OLD POINTERS ******************* */
 
-static void *newdataadr(FileData *fd, const void *adr)         /* only direct databocks */
+static void *newdataadr(FileData *fd, const void *adr)      /* only direct databocks */
 {
        return oldnewmap_lookup_and_inc(fd->datamap, adr, true);
 }
@@ -1484,7 +1486,7 @@ static void *newdataadr(FileData *fd, const void *adr)            /* only direct databocks
  * fcurve group pointer and keeps lasthit optimal for linking all further
  * fcurves.
  */
-static void *newdataadr_ex(FileData *fd, const void *adr, bool increase_lasthit)               /* only direct databocks */
+static void *newdataadr_ex(FileData *fd, const void *adr, bool increase_lasthit)        /* only direct databocks */
 {
        if (increase_lasthit) {
                return newdataadr(fd, adr);
@@ -1497,17 +1499,17 @@ static void *newdataadr_ex(FileData *fd, const void *adr, bool increase_lasthit)
        }
 }
 
-static void *newdataadr_no_us(FileData *fd, const void *adr)           /* only direct databocks */
+static void *newdataadr_no_us(FileData *fd, const void *adr)        /* only direct databocks */
 {
        return oldnewmap_lookup_and_inc(fd->datamap, adr, false);
 }
 
-static void *newglobadr(FileData *fd, const void *adr)     /* direct datablocks with global linking */
+static void *newglobadr(FileData *fd, const void *adr)      /* direct datablocks with global linking */
 {
        return oldnewmap_lookup_and_inc(fd->globmap, adr, true);
 }
 
-static void *newimaadr(FileData *fd, const void *adr)              /* used to restore image data after undo */
+static void *newimaadr(FileData *fd, const void *adr)           /* used to restore image data after undo */
 {
        if (fd->imamap && adr)
                return oldnewmap_lookup_and_inc(fd->imamap, adr, true);
@@ -1537,17 +1539,17 @@ static void *newpackedadr(FileData *fd, const void *adr)      /* used to restore
 }
 
 
-static void *newlibadr(FileData *fd, const void *lib, const void *adr)         /* only lib data */
+static void *newlibadr(FileData *fd, const void *lib, const void *adr)      /* only lib data */
 {
        return oldnewmap_liblookup(fd->libmap, adr, lib);
 }
 
-void *blo_do_versions_newlibadr(FileData *fd, const void *lib, const void *adr)                /* only lib data */
+void *blo_do_versions_newlibadr(FileData *fd, const void *lib, const void *adr)     /* only lib data */
 {
        return newlibadr(fd, lib, adr);
 }
 
-static void *newlibadr_us(FileData *fd, const void *lib, const void *adr)      /* increases user number */
+static void *newlibadr_us(FileData *fd, const void *lib, const void *adr)   /* increases user number */
 {
        ID *id = newlibadr(fd, lib, adr);
 
@@ -1556,12 +1558,12 @@ static void *newlibadr_us(FileData *fd, const void *lib, const void *adr)       /* inc
        return id;
 }
 
-void *blo_do_versions_newlibadr_us(FileData *fd, const void *lib, const void *adr)     /* increases user number */
+void *blo_do_versions_newlibadr_us(FileData *fd, const void *lib, const void *adr)  /* increases user number */
 {
        return newlibadr_us(fd, lib, adr);
 }
 
-static void *newlibadr_real_us(FileData *fd, const void *lib, const void *adr) /* ensures real user */
+static void *newlibadr_real_us(FileData *fd, const void *lib, const void *adr)  /* ensures real user */
 {
        ID *id = newlibadr(fd, lib, adr);
 
@@ -1580,9 +1582,9 @@ static void change_idid_adr_fd(FileData *fd, const void *old, void *new)
        for (i = 0; i < fd->libmap->nentries; i++) {
                OldNew *entry = &fd->libmap->entries[i];
 
-               if (old==entry->newp && entry->nr==ID_ID) {
+               if (old == entry->newp && entry->nr == ID_ID) {
                        entry->newp = new;
-                       if (new) entry->nr = GS( ((ID *)new)->name );
+                       if (new) entry->nr = GS( ((ID *)new)->name);
                }
        }
 }
@@ -1613,7 +1615,7 @@ void blo_clear_proxy_pointers_from_lib(Main *oldmain)
 {
        Object *ob = oldmain->object.first;
 
-       for (; ob; ob= ob->id.next) {
+       for (; ob; ob = ob->id.next) {
                if (ob->id.lib)
                        ob->proxy_from = NULL;
        }
@@ -1635,7 +1637,7 @@ void blo_make_image_pointer_map(FileData *fd, Main *oldmain)
                                oldnewmap_insert(fd->imamap, ima->gputexture[a], ima->gputexture[a], 0);
                if (ima->rr)
                        oldnewmap_insert(fd->imamap, ima->rr, ima->rr, 0);
-               for (a=0; a < IMA_MAX_RENDER_SLOT; a++)
+               for (a = 0; a < IMA_MAX_RENDER_SLOT; a++)
                        if (ima->renders[a])
                                oldnewmap_insert(fd->imamap, ima->renders[a], ima->renders[a], 0);
        }
@@ -1739,7 +1741,7 @@ void blo_end_movieclip_pointer_map(FileData *fd, Main *oldmain)
        int i;
 
        /* used entries were restored, so we put them to zero */
-       for (i=0; i < fd->movieclipmap->nentries; i++, entry++) {
+       for (i = 0; i < fd->movieclipmap->nentries; i++, entry++) {
                if (entry->nr > 0)
                        entry->newp = NULL;
        }
@@ -1844,7 +1846,7 @@ void blo_end_packed_pointer_map(FileData *fd, Main *oldmain)
        int i;
 
        /* used entries were restored, so we put them to zero */
-       for (i=0; i < fd->packedmap->nentries; i++, entry++) {
+       for (i = 0; i < fd->packedmap->nentries; i++, entry++) {
                if (entry->nr > 0)
                        entry->newp = NULL;
        }
@@ -1896,8 +1898,8 @@ static void switch_endian_structs(const struct SDNA *filesdna, BHead *bhead)
        int blocksize, nblocks;
        char *data;
 
-       data = (char *)(bhead+1);
-       blocksize = filesdna->typelens[ filesdna->structs[bhead->SDNAnr][0] ];
+       data = (char *)(bhead + 1);
+       blocksize = filesdna->typelens[filesdna->structs[bhead->SDNAnr][0]];
 
        nblocks = bhead->nr;
        while (nblocks--) {
@@ -1918,12 +1920,12 @@ static void *read_struct(FileData *fd, BHead *bh, const char *blockname)
 
                if (fd->compflags[bh->SDNAnr] != SDNA_CMP_REMOVED) {
                        if (fd->compflags[bh->SDNAnr] == SDNA_CMP_NOT_EQUAL) {
-                               temp = DNA_struct_reconstruct(fd->memsdna, fd->filesdna, fd->compflags, bh->SDNAnr, bh->nr, (bh+1));
+                               temp = DNA_struct_reconstruct(fd->memsdna, fd->filesdna, fd->compflags, bh->SDNAnr, bh->nr, (bh + 1));
                        }
                        else {
                                /* SDNA_CMP_EQUAL */
                                temp = MEM_mallocN(bh->len, blockname);
-                               memcpy(temp, (bh+1), bh->len);
+                               memcpy(temp, (bh + 1), bh->len);
                        }
                }
        }
@@ -1933,7 +1935,7 @@ static void *read_struct(FileData *fd, BHead *bh, const char *blockname)
 
 typedef void (*link_list_cb)(FileData *fd, void *data);
 
-static void link_list_ex(FileData *fd, ListBase *lb, link_list_cb callback)            /* only direct data */
+static void link_list_ex(FileData *fd, ListBase *lb, link_list_cb callback)     /* only direct data */
 {
        Link *ln, *prev;
 
@@ -1957,12 +1959,12 @@ static void link_list_ex(FileData *fd, ListBase *lb, link_list_cb callback)             /*
        lb->last = prev;
 }
 
-static void link_list(FileData *fd, ListBase *lb)              /* only direct data */
+static void link_list(FileData *fd, ListBase *lb)       /* only direct data */
 {
        link_list_ex(fd, lb, NULL);
 }
 
-static void link_glob_list(FileData *fd, ListBase *lb)         /* for glob data */
+static void link_glob_list(FileData *fd, ListBase *lb)      /* for glob data */
 {
        Link *ln, *prev;
        void *poin;
@@ -1995,16 +1997,16 @@ static void test_pointer_array(FileData *fd, void **mat)
        int *ipoin, *imat;
        size_t len;
 
-               /* manually convert the pointer array in
-                * the old dna format to a pointer array in
-                * the new dna format.
-                */
+       /* manually convert the pointer array in
+        * the old dna format to a pointer array in
+        * the new dna format.
+        */
        if (*mat) {
-               len = MEM_allocN_len(*mat)/fd->filesdna->pointerlen;
+               len = MEM_allocN_len(*mat) / fd->filesdna->pointerlen;
 
-               if (fd->filesdna->pointerlen==8 && fd->memsdna->pointerlen==4) {
-                       ipoin=imat= MEM_malloc_arrayN(len, 4, "newmatar");
-                       lpoin= *mat;
+               if (fd->filesdna->pointerlen == 8 && fd->memsdna->pointerlen == 4) {
+                       ipoin = imat = MEM_malloc_arrayN(len, 4, "newmatar");
+                       lpoin = *mat;
 
                        while (len-- > 0) {
                                if ((fd->flags & FD_FLAGS_SWITCH_ENDIAN))
@@ -2017,7 +2019,7 @@ static void test_pointer_array(FileData *fd, void **mat)
                        *mat = imat;
                }
 
-               if (fd->filesdna->pointerlen==4 && fd->memsdna->pointerlen==8) {
+               if (fd->filesdna->pointerlen == 4 && fd->memsdna->pointerlen == 8) {
                        lpoin = lmat = MEM_malloc_arrayN(len, 8, "newmatar");
                        ipoin = *mat;
 
@@ -2027,7 +2029,7 @@ static void test_pointer_array(FileData *fd, void **mat)
                                lpoin++;
                        }
                        MEM_freeN(*mat);
-                       *mat= lmat;
+                       *mat = lmat;
                }
        }
 }
@@ -2104,7 +2106,7 @@ static void IDP_DirectLinkGroup(IDProperty *prop, int switch_endian, FileData *f
        link_list(fd, lb);
 
        /*Link child id properties now*/
-       for (loop=prop->data.group.first; loop; loop=loop->next) {
+       for (loop = prop->data.group.first; loop; loop = loop->next) {
                IDP_DirectLinkProperty(loop, switch_endian, fd);
        }
 }
@@ -2395,7 +2397,7 @@ static void lib_link_nlastrips(FileData *fd, ID *id, ListBase *striplist)
        bActionStrip *strip;
        bActionModifier *amod;
 
-       for (strip=striplist->first; strip; strip=strip->next) {
+       for (strip = striplist->first; strip; strip = strip->next) {
                strip->object = newlibadr(fd, id->lib, strip->object);
                strip->act = newlibadr_us(fd, id->lib, strip->act);
                strip->ipo = newlibadr(fd, id->lib, strip->ipo);
@@ -2420,7 +2422,7 @@ static void lib_link_constraint_channels(FileData *fd, ID *id, ListBase *chanbas
 {
        bConstraintChannel *chan;
 
-       for (chan=chanbase->first; chan; chan=chan->next) {
+       for (chan = chanbase->first; chan; chan = chan->next) {
                chan->ipo = newlibadr_us(fd, id->lib, chan->ipo);
        }
 }
@@ -2459,7 +2461,7 @@ static void lib_link_fcurves(FileData *fd, ID *id, ListBase *list)
                        ChannelDriver *driver = fcu->driver;
                        DriverVar *dvar;
 
-                       for (dvar= driver->variables.first; dvar; dvar= dvar->next) {
+                       for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
                                DRIVER_TARGETS_LOOPER(dvar)
                                {
                                        /* only relink if still used */
@@ -2504,9 +2506,9 @@ static void direct_link_fmodifiers(FileData *fd, ListBase *list, FCurve *curve)
                        }
                        case FMODIFIER_TYPE_ENVELOPE:
                        {
-                               FMod_Envelope *data=  (FMod_Envelope *)fcm->data;
+                               FMod_Envelope *data =  (FMod_Envelope *)fcm->data;
 
-                               data->data= newdataadr(fd, data->data);
+                               data->data = newdataadr(fd, data->data);
 
                                break;
                        }
@@ -2546,9 +2548,9 @@ static void direct_link_fcurves(FileData *fd, ListBase *list)
                fcu->flag &= ~FCURVE_DISABLED;
 
                /* driver */
-               fcu->driver= newdataadr(fd, fcu->driver);
+               fcu->driver = newdataadr(fd, fcu->driver);
                if (fcu->driver) {
-                       ChannelDriver *driver= fcu->driver;
+                       ChannelDriver *driver = fcu->driver;
                        DriverVar *dvar;
 
                        /* compiled expression data will need to be regenerated (old pointer may still be set here) */
@@ -2561,7 +2563,7 @@ static void direct_link_fcurves(FileData *fd, ListBase *list)
 
                        /* relink variables, targets and their paths */
                        link_list(fd, &driver->variables);
-                       for (dvar= driver->variables.first; dvar; dvar= dvar->next) {
+                       for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
                                DRIVER_TARGETS_LOOPER(dvar)
                                {
                                        /* only relink the targets being used */
@@ -2618,7 +2620,7 @@ static void direct_link_action(FileData *fd, bAction *act)
        link_list(fd, &act->markers);
 
 // XXX deprecated - old animation system <<<
-       for (achan = act->chanbase.first; achan; achan=achan->next) {
+       for (achan = act->chanbase.first; achan; achan = achan->next) {
                achan->grp = newdataadr(fd, achan->grp);
 
                link_list(fd, &achan->constraintChannels);
@@ -2627,9 +2629,9 @@ static void direct_link_action(FileData *fd, bAction *act)
 
        direct_link_fcurves(fd, &act->curves);
 
-       for (agrp = act->groups.first; agrp; agrp= agrp->next) {
-               agrp->channels.first= newdataadr(fd, agrp->channels.first);
-               agrp->channels.last= newdataadr(fd, agrp->channels.last);
+       for (agrp = act->groups.first; agrp; agrp = agrp->next) {
+               agrp->channels.first = newdataadr(fd, agrp->channels.first);
+               agrp->channels.last = newdataadr(fd, agrp->channels.last);
        }
 }
 
@@ -2709,7 +2711,7 @@ static void lib_link_keyingsets(FileData *fd, ID *id, ListBase *list)
        /* here, we're only interested in the ID pointer stored in some of the paths */
        for (ks = list->first; ks; ks = ks->next) {
                for (ksp = ks->paths.first; ksp; ksp = ksp->next) {
-                       ksp->id= newlibadr(fd, id->lib, ksp->id);
+                       ksp->id = newlibadr(fd, id->lib, ksp->id);
                }
        }
 }
@@ -2727,7 +2729,7 @@ static void direct_link_keyingsets(FileData *fd, ListBase *list)
 
                for (ksp = ks->paths.first; ksp; ksp = ksp->next) {
                        /* rna path */
-                       ksp->rna_path= newdataadr(fd, ksp->rna_path);
+                       ksp->rna_path = newdataadr(fd, ksp->rna_path);
                }
        }
 }
@@ -2740,8 +2742,8 @@ static void lib_link_animdata(FileData *fd, ID *id, AnimData *adt)
                return;
 
        /* link action data */
-       adt->action= newlibadr_us(fd, id->lib, adt->action);
-       adt->tmpact= newlibadr_us(fd, id->lib, adt->tmpact);
+       adt->action = newlibadr_us(fd, id->lib, adt->action);
+       adt->tmpact = newlibadr_us(fd, id->lib, adt->tmpact);
 
        /* fix action id-roots (i.e. if they come from a pre 2.57 .blend file) */
        if ((adt->action) && (adt->action->idroot == 0))
@@ -2878,11 +2880,11 @@ static void lib_link_nodetree(FileData *fd, Main *main)
  */
 static void lib_node_do_versions_group_indices(bNode *gnode)
 {
-       bNodeTree *ngroup = (bNodeTree*)gnode->id;
+       bNodeTree *ngroup = (bNodeTree *)gnode->id;
        bNodeSocket *sock;
        bNodeLink *link;
 
-       for (sock=gnode->outputs.first; sock; sock = sock->next) {
+       for (sock = gnode->outputs.first; sock; sock = sock->next) {
                int old_index = sock->to_index;
 
                for (link = ngroup->links.first; link; link = link->next) {
@@ -2895,7 +2897,7 @@ static void lib_node_do_versions_group_indices(bNode *gnode)
                        }
                }
        }
-       for (sock=gnode->inputs.first; sock; sock = sock->next) {
+       for (sock = gnode->inputs.first; sock; sock = sock->next) {
                int old_index = sock->to_index;
 
                for (link = ngroup->links.first; link; link = link->next) {
@@ -2917,20 +2919,20 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
 {
        /* this crashes blender on undo/redo */
 #if 0
-               if (open == 1) {
-                       reinit_nodesystem();
-               }
+       if (open == 1) {
+               reinit_nodesystem();
+       }
 #endif
 
        /* set node->typeinfo pointers */
-       FOREACH_NODETREE(main, ntree, id) {
+       FOREACH_NODETREE (main, ntree, id) {
                ntreeSetTypes(NULL, ntree);
        } FOREACH_NODETREE_END
 
        /* verify static socket templates */
-       FOREACH_NODETREE(main, ntree, id) {
+       FOREACH_NODETREE (main, ntree, id) {
                bNode *node;
-               for (node=ntree->nodes.first; node; node=node->next)
+               for (node = ntree->nodes.first; node; node = node->next)
                        node_verify_socket_templates(ntree, node);
        } FOREACH_NODETREE_END
 
@@ -2948,12 +2950,12 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
                }
 
                if (has_old_groups) {
-                       FOREACH_NODETREE(main, ntree, id) {
+                       FOREACH_NODETREE (main, ntree, id) {
                                /* updates external links for all group nodes in a tree */
                                bNode *node;
                                for (node = ntree->nodes.first; node; node = node->next) {
                                        if (node->type == NODE_GROUP) {
-                                               bNodeTree *ngroup = (bNodeTree*)node->id;
+                                               bNodeTree *ngroup = (bNodeTree *)node->id;
                                                if (ngroup && (ngroup->flag & NTREE_DO_VERSIONS_GROUP_EXPOSE_2_56_2))
                                                        lib_node_do_versions_group_indices(node);
                                        }
@@ -2993,7 +2995,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
                                float input_locx = 1000000.0f, input_locy = 0.0f;
                                float output_locx = -1000000.0f, output_locy = 0.0f;
                                /* rough guess, not nice but we don't have access to UI constants here ... */
-                               static const float offsetx = 42 + 3*20 + 20;
+                               static const float offsetx = 42 + 3 * 20 + 20;
                                /*static const float offsety = 0.0f;*/
 
                                if (create_io_nodes) {
@@ -3102,9 +3104,9 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
        bNodeSocket *sock;
        bNodeLink *link;
 
-       ntree->init = 0;                /* to set callbacks and force setting types */
+       ntree->init = 0;        /* to set callbacks and force setting types */
        ntree->is_updating = false;
-       ntree->typeinfo= NULL;
+       ntree->typeinfo = NULL;
        ntree->interface_type = NULL;
 
        ntree->progress = NULL;
@@ -3143,33 +3145,33 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
 
                if (node->storage) {
                        /* could be handlerized at some point */
-                       if (ntree->type==NTREE_SHADER) {
-                               if (node->type==SH_NODE_CURVE_VEC || node->type==SH_NODE_CURVE_RGB) {
+                       if (ntree->type == NTREE_SHADER) {
+                               if (node->type == SH_NODE_CURVE_VEC || node->type == SH_NODE_CURVE_RGB) {
                                        direct_link_curvemapping(fd, node->storage);
                                }
-                               else if (node->type==SH_NODE_SCRIPT) {
-                                       NodeShaderScript *nss = (NodeShaderScript *) node->storage;
+                               else if (node->type == SH_NODE_SCRIPT) {
+                                       NodeShaderScript *nss = (NodeShaderScript *)node->storage;
                                        nss->bytecode = newdataadr(fd, nss->bytecode);
                                }
-                               else if (node->type==SH_NODE_TEX_POINTDENSITY) {
-                                       NodeShaderTexPointDensity *npd = (NodeShaderTexPointDensity *) node->storage;
+                               else if (node->type == SH_NODE_TEX_POINTDENSITY) {
+                                       NodeShaderTexPointDensity *npd = (NodeShaderTexPointDensity *)node->storage;
                                        memset(&npd->pd, 0, sizeof(npd->pd));
                                }
                        }
-                       else if (ntree->type==NTREE_COMPOSIT) {
+                       else if (ntree->type == NTREE_COMPOSIT) {
                                if (ELEM(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT))
                                        direct_link_curvemapping(fd, node->storage);
                                else if (ELEM(node->type, CMP_NODE_IMAGE, CMP_NODE_R_LAYERS, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
                                        ((ImageUser *)node->storage)->ok = 1;
-                               else if (node->type==CMP_NODE_CRYPTOMATTE) {
-                                       NodeCryptomatte *nc = (NodeCryptomatte *) node->storage;
+                               else if (node->type == CMP_NODE_CRYPTOMATTE) {
+                                       NodeCryptomatte *nc = (NodeCryptomatte *)node->storage;
                                        nc->matte_id = newdataadr(fd, nc->matte_id);
                                }
                        }
-                       else if ( ntree->type==NTREE_TEXTURE) {
-                               if (node->type==TEX_NODE_CURVE_RGB || node->type==TEX_NODE_CURVE_TIME)
+                       else if (ntree->type == NTREE_TEXTURE) {
+                               if (node->type == TEX_NODE_CURVE_RGB || node->type == TEX_NODE_CURVE_TIME)
                                        direct_link_curvemapping(fd, node->storage);
-                               else if (node->type==TEX_NODE_IMAGE)
+                               else if (node->type == TEX_NODE_IMAGE)
                                        ((ImageUser *)node->storage)->ok = 1;
                        }
                }
@@ -3195,7 +3197,7 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
        for (sock = ntree->outputs.first; sock; sock = sock->next)
                direct_link_node_socket(fd, sock);
 
-       for (link = ntree->links.first; link; link= link->next) {
+       for (link = ntree->links.first; link; link = link->next) {
                link->fromnode = newdataadr(fd, link->fromnode);
                link->tonode = newdataadr(fd, link->tonode);
                link->fromsock = newdataadr(fd, link->fromsock);
@@ -3238,7 +3240,7 @@ typedef struct tConstraintLinkData {
 /* callback function used to relink constraint ID-links */
 static void lib_link_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, bool is_reference, void *userdata)
 {
-       tConstraintLinkData *cld= (tConstraintLinkData *)userdata;
+       tConstraintLinkData *cld = (tConstraintLinkData *)userdata;
 
        /* for reference types, we need to increment the usercounts on load... */
        if (is_reference) {
@@ -3257,7 +3259,7 @@ static void lib_link_constraints(FileData *fd, ID *id, ListBase *conlist)
        bConstraint *con;
 
        /* legacy fixes */
-       for (con = conlist->first; con; con=con->next) {
+       for (con = conlist->first; con; con = con->next) {
                /* patch for error introduced by changing constraints (dunno how) */
                /* if con->data type changes, dna cannot resolve the pointer! (ton) */
                if (con->data == NULL) {
@@ -3279,13 +3281,13 @@ static void direct_link_constraints(FileData *fd, ListBase *lb)
        bConstraint *con;
 
        link_list(fd, lb);
-       for (con=lb->first; con; con=con->next) {
+       for (con = lb->first; con; con = con->next) {
                con->data = newdataadr(fd, con->data);
 
                switch (con->type) {
                        case CONSTRAINT_TYPE_PYTHON:
                        {
-                               bPythonConstraint *data= con->data;
+                               bPythonConstraint *data = con->data;
 
                                link_list(fd, &data->targets);
 
@@ -3295,9 +3297,9 @@ static void direct_link_constraints(FileData *fd, ListBase *lb)
                        }
                        case CONSTRAINT_TYPE_SPLINEIK:
                        {
-                               bSplineIKConstraint *data= con->data;
+                               bSplineIKConstraint *data = con->data;
 
-                               data->points= newdataadr(fd, data->points);
+                               data->points = newdataadr(fd, data->points);
                                break;
                        }
                        case CONSTRAINT_TYPE_KINEMATIC:
@@ -3338,7 +3340,7 @@ static void lib_link_pose(FileData *fd, Main *bmain, Object *ob, bPose *pose)
        bool rebuild = false;
 
        if (fd->memfile == NULL) {
-               if (ob->proxy || (ob->id.lib==NULL && arm->id.lib)) {
+               if (ob->proxy || (ob->id.lib == NULL && arm->id.lib)) {
                        rebuild = true;
                }
        }
@@ -3424,7 +3426,7 @@ static void direct_link_bones(FileData *fd, Bone *bone)
 
        link_list(fd, &bone->childbase);
 
-       for (child=bone->childbase.first; child; child=child->next)
+       for (child = bone->childbase.first; child; child = child->next)
                direct_link_bones(fd, child);
 }
 
@@ -3508,7 +3510,7 @@ static void direct_link_lamp(FileData *fd, Lamp *la)
        la->adt = newdataadr(fd, la->adt);
        direct_link_animdata(fd, la->adt);
 
-       for (a=0; a<MAX_MTEX; a++) {
+       for (a = 0; a < MAX_MTEX; a++) {
                la->mtex[a] = newdataadr(fd, la->mtex[a]);
        }
 
@@ -3516,7 +3518,7 @@ static void direct_link_lamp(FileData *fd, Lamp *la)
        if (la->curfalloff)
                direct_link_curvemapping(fd, la->curfalloff);
 
-       la->nodetree= newdataadr(fd, la->nodetree);
+       la->nodetree = newdataadr(fd, la->nodetree);
        if (la->nodetree) {
                direct_link_id(fd, &la->nodetree->id);
                direct_link_nodetree(fd, la->nodetree);
@@ -3592,7 +3594,7 @@ static void direct_link_key(FileData *fd, Key *key)
        key->adt = newdataadr(fd, key->adt);
        direct_link_animdata(fd, key->adt);
 
-       key->refkey= newdataadr(fd, key->refkey);
+       key->refkey = newdataadr(fd, key->refkey);
 
        for (kb = key->block.first; kb; kb = kb->next) {
                kb->data = newdataadr(fd, kb->data);
@@ -3746,7 +3748,7 @@ static void direct_link_text(FileData *fd, Text *text)
                ln->line = newdataadr(fd, ln->line);
                ln->format = NULL;
 
-               if (ln->len != (int) strlen(ln->line)) {
+               if (ln->len != (int)strlen(ln->line)) {
                        printf("Error loading text, line lengths differ\n");
                        ln->len = strlen(ln->line);
                }
@@ -3869,7 +3871,7 @@ static void direct_link_curve(FileData *fd, Curve *cu)
        Nurb *nu;
        TextBox *tb;
 
-       cu->adt= newdataadr(fd, cu->adt);
+       cu->adt = newdataadr(fd, cu->adt);
        direct_link_animdata(fd, cu->adt);
 
        /* Protect against integer overflow vulnerability. */
@@ -3878,18 +3880,18 @@ static void direct_link_curve(FileData *fd, Curve *cu)
        cu->mat = newdataadr(fd, cu->mat);
        test_pointer_array(fd, (void **)&cu->mat);
        cu->str = newdataadr(fd, cu->str);
-       cu->strinfo= newdataadr(fd, cu->strinfo);
+       cu->strinfo = newdataadr(fd, cu->strinfo);
        cu->tb = newdataadr(fd, cu->tb);
 
        if (cu->vfont == NULL) {
                link_list(fd, &(cu->nurb));
        }
        else {
-               cu->nurb.first=cu->nurb.last= NULL;
+               cu->nurb.first = cu->nurb.last = NULL;
 
                tb = MEM_calloc_arrayN(MAXTEXTBOX, sizeof(TextBox), "TextBoxread");
                if (cu->tb) {
-                       memcpy(tb, cu->tb, cu->totbox*sizeof(TextBox));
+                       memcpy(tb, cu->tb, cu->totbox * sizeof(TextBox));
                        MEM_freeN(cu->tb);
                        cu->tb = tb;
                }
@@ -3959,7 +3961,7 @@ static void direct_link_texture(FileData *fd, Tex *tex)
        if (tex->env) {
                tex->env->ima = NULL;
                memset(tex->env->cube, 0, 6 * sizeof(void *));
-               tex->env->ok= 0;
+               tex->env->ok = 0;
        }
        tex->pd = newdataadr(fd, tex->pd);
        if (tex->pd) {
@@ -4074,7 +4076,7 @@ static void direct_link_pointcache_cb(FileData *fd, void *data)
                pm->data[i] = newdataadr(fd, pm->data[i]);
 
                /* the cache saves non-struct data without DNA */
-               if (pm->data[i] && ptcache_data_struct[i][0]=='\0' && (fd->flags & FD_FLAGS_SWITCH_ENDIAN)) {
+               if (pm->data[i] && ptcache_data_struct[i][0] == '\0' && (fd->flags & FD_FLAGS_SWITCH_ENDIAN)) {
                        int tot = (BKE_ptcache_data_size(i) * pm->totpoint) / sizeof(int);  /* data_size returns bytes */
                        int *poin = pm->data[i];
 
@@ -4084,13 +4086,13 @@ static void direct_link_pointcache_cb(FileData *fd, void *data)
 
        link_list(fd, &pm->extradata);
 
-       for (extra=pm->extradata.first; extra; extra=extra->next)
+       for (extra = pm->extradata.first; extra; extra = extra->next)
                extra->data = newdataadr(fd, extra->data);
 }
 
 static void direct_link_pointcache(FileData *fd, PointCache *cache)
 {
-       if ((cache->flag & PTCACHE_DISK_CACHE)==0) {
+       if ((cache->flag & PTCACHE_DISK_CACHE) == 0) {
                link_list_ex(fd, &cache->mem_cache, direct_link_pointcache_cb);
        }
        else
@@ -4106,9 +4108,9 @@ static void direct_link_pointcache(FileData *fd, PointCache *cache)
 static void direct_link_pointcache_list(FileData *fd, ListBase *ptcaches, PointCache **ocache, int force_disk)
 {
        if (ptcaches->first) {
-               PointCache *cache= NULL;
+               PointCache *cache = NULL;
                link_list(fd, ptcaches);
-               for (cache=ptcaches->first; cache; cache=cache->next) {
+               for (cache = ptcaches->first; cache; cache = cache->next) {
                        direct_link_pointcache(fd, cache);
                        if (force_disk) {
                                cache->flag |= PTCACHE_DISK_CACHE;
@@ -4208,20 +4210,20 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
                        if (part->boids) {
                                BoidState *state = part->boids->states.first;
                                BoidRule *rule;
-                               for (; state; state=state->next) {
+                               for (; state; state = state->next) {
                                        rule = state->rules.first;
-                                       for (; rule; rule=rule->next) {
+                                       for (; rule; rule = rule->next) {
                                                switch (rule->type) {
                                                        case eBoidRuleType_Goal:
                                                        case eBoidRuleType_Avoid:
                                                        {
-                                                               BoidRuleGoalAvoid *brga = (BoidRuleGoalAvoid*)rule;
+                                                               BoidRuleGoalAvoid *brga = (BoidRuleGoalAvoid *)rule;
                                                                brga->ob = newlibadr(fd, part->id.lib, brga->ob);
                                                                break;
                                                        }
                                                        case eBoidRuleType_FollowLeader:
                                                        {
-                                                               BoidRuleFollowLeader *brfl = (BoidRuleFollowLeader*)rule;
+                                                               BoidRuleFollowLeader *brfl = (BoidRuleFollowLeader *)rule;
                                                                brfl->ob = newlibadr(fd, part->id.lib, brfl->ob);
                                                                break;
                                                        }
@@ -4231,7 +4233,7 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
                        }
 
                        for (int a = 0; a < MAX_MTEX; a++) {
-                               MTex *mtex= part->mtex[a];
+                               MTex *mtex = part->mtex[a];
                                if (mtex) {
                                        mtex->tex = newlibadr_us(fd, part->id.lib, mtex->tex);
                                        mtex->object = newlibadr(fd, part->id.lib, mtex->object);
@@ -4283,7 +4285,7 @@ static void direct_link_particlesettings(FileData *fd, ParticleSettings *part)
                BoidState *state;
                link_list(fd, &part->boids->states);
 
-               for (state=part->boids->states.first; state; state=state->next) {
+               for (state = part->boids->states.first; state; state = state->next) {
                        link_list(fd, &state->rules);
                        link_list(fd, &state->conditions);
                        link_list(fd, &state->actions);
@@ -4301,15 +4303,15 @@ static void lib_link_particlesystems(FileData *fd, Object *ob, ID *id, ListBase
 {
        ParticleSystem *psys, *psysnext;
 
-       for (psys=particles->first; psys; psys=psysnext) {
+       for (psys = particles->first; psys; psys = psysnext) {
                psysnext = psys->next;
 
                psys->part = newlibadr_us(fd, id->lib, psys->part);
                if (psys->part) {
                        ParticleTarget *pt = psys->targets.first;
 
-                       for (; pt; pt=pt->next)
-                               pt->ob=newlibadr(fd, id->lib, pt->ob);
+                       for (; pt; pt = pt->next)
+                               pt->ob = newlibadr(fd, id->lib, pt->ob);
 
                        psys->parent = newlibadr(fd, id->lib, psys->parent);
                        psys->target_ob = newlibadr(fd, id->lib, psys->target_ob);
@@ -4318,7 +4320,7 @@ static void lib_link_particlesystems(FileData *fd, Object *ob, ID *id, ListBase
                                /* XXX - from reading existing code this seems correct but intended usage of
                                 * pointcache /w cloth should be added in 'ParticleSystem' - campbell */
                                psys->clmd->point_cache = psys->pointcache;
-                               psys->clmd->ptcaches.first = psys->clmd->ptcaches.last= NULL;
+                               psys->clmd->ptcaches.first = psys->clmd->ptcaches.last = NULL;
                                psys->clmd->coll_parms->group = newlibadr(fd, id->lib, psys->clmd->coll_parms->group);
                                psys->clmd->modifier.error = NULL;
                        }
@@ -4340,18 +4342,18 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
        ParticleData *pa;
        int a;
 
-       for (psys=particles->first; psys; psys=psys->next) {
-               psys->particles=newdataadr(fd, psys->particles);
+       for (psys = particles->first; psys; psys = psys->next) {
+               psys->particles = newdataadr(fd, psys->particles);
 
                if (psys->particles && psys->particles->hair) {
-                       for (a=0, pa=psys->particles; a<psys->totpart; a++, pa++)
-                               pa->hair=newdataadr(fd, pa->hair);
+                       for (a = 0, pa = psys->particles; a < psys->totpart; a++, pa++)
+                               pa->hair = newdataadr(fd, pa->hair);
                }
 
                if (psys->particles && psys->particles->keys) {
-                       for (a=0, pa=psys->particles; a<psys->totpart; a++, pa++) {
-                               pa->keys= NULL;
-                               pa->totkey= 0;
+                       for (a = 0, pa = psys->particles; a < psys->totpart; a++, pa++) {
+                               pa->keys = NULL;
+                               pa->totkey = 0;
                        }
 
                        psys->flag &= ~PSYS_KEYED;
@@ -4367,7 +4369,7 @@ 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;
                }
 
@@ -4392,8 +4394,8 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
                        psys->clmd->clothObject = NULL;
                        psys->clmd->hairdata = NULL;
 
-                       psys->clmd->sim_parms= newdataadr(fd, psys->clmd->sim_parms);
-                       psys->clmd->coll_parms= newdataadr(fd, psys->clmd->coll_parms);
+                       psys->clmd->sim_parms = newdataadr(fd, psys->clmd->sim_parms);
+                       psys->clmd->coll_parms = newdataadr(fd, psys->clmd->coll_parms);
 
                        if (psys->clmd->sim_parms) {
                                psys->clmd->sim_parms->effector_weights = NULL;
@@ -4420,7 +4422,7 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
 
 static void lib_link_mtface(FileData *fd, Mesh *me, MTFace *mtface, int totface)
 {
-       MTFace *tf= mtface;
+       MTFace *tf = mtface;
        int i;
 
        /* Add pseudo-references (not fake users!) to images used by texface. A
@@ -4447,11 +4449,11 @@ static void lib_link_customdata_mtpoly(FileData *fd, Mesh *me, CustomData *pdata
 {
        int i;
 
-       for (i=0; i < pdata->totlayer; i++) {
+       for (i = 0; i < pdata->totlayer; i++) {
                CustomDataLayer *layer = &pdata->layers[i];
 
                if (layer->type == CD_MTEXPOLY) {
-                       MTexPoly *tf= layer->data;
+                       MTexPoly *tf = layer->data;
                        int j;
 
                        for (j = 0; j < totface; j++, tf++) {
@@ -4492,7 +4494,7 @@ static void lib_link_mesh(FileData *fd, Main *main)
                        lib_link_customdata_mtpoly(fd, me, &me->pdata, me->totpoly);
                        if (me->mr && me->mr->levels.first) {
                                lib_link_customdata_mtface(fd, me, &me->mr->fdata,
-                                                          ((MultiresLevel*)me->mr->levels.first)->totface);
+                                                          ((MultiresLevel *)me->mr->levels.first)->totface);
                        }
                }
        }
@@ -4641,7 +4643,7 @@ static void direct_link_customdata(FileData *fd, CustomData *data, int count)
 
 static void direct_link_mesh(FileData *fd, Mesh *mesh)
 {
-       mesh->mat= newdataadr(fd, mesh->mat);
+       mesh->mat = newdataadr(fd, mesh->mat);
        test_pointer_array(fd, (void **)&mesh->mat);
 
        mesh->mvert = newdataadr(fd, mesh->mvert);
@@ -4687,7 +4689,7 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
        }
 
        /* Multires data */
-       mesh->mr= newdataadr(fd, mesh->mr);
+       mesh->mr = newdataadr(fd, mesh->mr);
        if (mesh->mr) {
                MultiresLevel *lvl;
 
@@ -4709,7 +4711,7 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
                 * because some saved files either do not have a verts
                 * array, or the verts array contains out-of-date
                 * data. */
-               if (mesh->totvert == ((MultiresLevel*)mesh->mr->levels.last)->totvert) {
+               if (mesh->totvert == ((MultiresLevel *)mesh->mr->levels.last)->totvert) {
                        if (mesh->mr->verts)
                                MEM_freeN(mesh->mr->verts);
                        mesh->mr->verts = MEM_dupallocN(mesh->mvert);
@@ -4762,7 +4764,7 @@ static void direct_link_latt(FileData *fd, Lattice *lt)
        lt->def = newdataadr(fd, lt->def);
 
        lt->dvert = newdataadr(fd, lt->dvert);
-       direct_link_dverts(fd, lt->pntsu*lt->pntsv*lt->pntsw, lt->dvert);
+       direct_link_dverts(fd, lt->pntsu * lt->pntsv * lt->pntsw, lt->dvert);
 
        lt->editlatt = NULL;
 
@@ -4774,7 +4776,7 @@ static void direct_link_latt(FileData *fd, Lattice *lt)
 /* ************ READ OBJECT ***************** */
 
 static void lib_link_modifiers__linkModifiers(
-        void *userData, Object *ob, ID **idpoin, int cb_flag)
+       void *userData, Object *ob, ID **idpoin, int cb_flag)
 {
        FileData *fd = userData;
 
@@ -4851,11 +4853,11 @@ static void lib_link_object(FileData *fd, Main *main)
 #else
                                        MEM_freeN(ob->pose);
 #endif
-                                       ob->pose= NULL;
+                                       ob->pose = NULL;
                                        ob->mode &= ~OB_MODE_POSE;
                                }
                        }
-                       for (a=0; a < ob->totcol; a++)
+                       for (a = 0; a < ob->totcol; a++)
                                ob->mat[a] = newlibadr_us(fd, ob->id.lib, ob->mat[a]);
 
                        /* When the object is local and the data is library its possible
@@ -4902,7 +4904,7 @@ static void lib_link_object(FileData *fd, Main *main)
                        }
 
                        for (bController *cont = ob->controllers.first; cont; cont = cont->next) {
-                               for (a=0; a < cont->totlinks; a++)
+                               for (a = 0; a < cont->totlinks; a++)
                                        cont->links[a] = newglobadr(fd, cont->links[a]);
 
                                if (cont->type == CONT_PYTHON) {
@@ -5009,7 +5011,7 @@ static void lib_link_object(FileData *fd, Main *main)
                                                break;
                                        case ACT_ARMATURE:
                                        {
-                                               bArmatureActuator *arma= act->data;
+                                               bArmatureActuator *arma = act->data;
                                                arma->target = newlibadr(fd, ob->id.lib, arma->target);
                                                arma->subtarget = newlibadr(fd, ob->id.lib, arma->subtarget);
                                                break;
@@ -5091,7 +5093,7 @@ static void direct_link_pose(FileData *fd, bPose *pose)
        pose->chanhash = NULL;
        pose->chan_array = NULL;
 
-       for (pchan = pose->chanbase.first; pchan; pchan=pchan->next) {
+       for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
                pchan->bone = NULL;
                pchan->parent = newdataadr(fd, pchan->parent);
                pchan->child = newdataadr(fd, pchan->child);
@@ -5127,7 +5129,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
 
        link_list(fd, lb);
 
-       for (md=lb->first; md; md=md->next) {
+       for (md = lb->first; md; md = md->next) {
                md->error = NULL;
                md->scene = NULL;
 
@@ -5151,8 +5153,8 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
                        clmd->clothObject = NULL;
                        clmd->hairdata = NULL;
 
-                       clmd->sim_parms= newdataadr(fd, clmd->sim_parms);
-                       clmd->coll_parms= newdataadr(fd, clmd->coll_parms);
+                       clmd->sim_parms = newdataadr(fd, clmd->sim_parms);
+                       clmd->coll_parms = newdataadr(fd, clmd->coll_parms);
 
                        direct_link_pointcache_list(fd, &clmd->ptcaches, &clmd->point_cache, 0);
 
@@ -5261,7 +5263,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
                                        DynamicPaintSurface *surface;
                                        link_list(fd, &pmd->canvas->surfaces);
 
-                                       for (surface=pmd->canvas->surfaces.first; surface; surface=surface->next) {
+                                       for (surface = pmd->canvas->surfaces.first; surface; surface = surface->next) {
                                                surface->canvas = pmd->canvas;
                                                surface->data = NULL;
                                                direct_link_pointcache_list(fd, &(surface->ptcaches), &(surface->pointcache), 1);
@@ -5334,7 +5336,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
 
                        psmd->dm_final = NULL;
                        psmd->dm_deformed = NULL;
-                       psmd->psys= newdataadr(fd, psmd->psys);
+                       psmd->psys = newdataadr(fd, psmd->psys);
                        psmd->flag &= ~eParticleSystemFlag_psys_updated;
                        psmd->flag |= eParticleSystemFlag_file_loaded;
                }
@@ -5373,7 +5375,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
                else if (md->type == eModifierType_Warp) {
                        WarpModifierData *tmd = (WarpModifierData *)md;
 
-                       tmd->curfalloff= newdataadr(fd, tmd->curfalloff);
+                       tmd->curfalloff = newdataadr(fd, tmd->curfalloff);
                        if (tmd->curfalloff)
                                direct_link_curvemapping(fd, tmd->curfalloff);
                }
@@ -5394,7 +5396,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
                        lmd->cache_system = NULL;
                }
                else if (md->type == eModifierType_CorrectiveSmooth) {
-                       CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData*)md;
+                       CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)md;
 
                        if (csmd->bind_coords) {
                                csmd->bind_coords = newdataadr(fd, csmd->bind_coords);
@@ -5427,14 +5429,20 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
 
                                                        if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
                                                                if (smd->verts[i].binds[j].vert_inds)
-                                                                       BLI_endian_switch_uint32_array(smd->verts[i].binds[j].vert_inds, smd->verts[i].binds[j].numverts);
+                                                                       BLI_endian_switch_uint32_array(
+                                                                               smd->verts[i].binds[j].vert_inds, smd->verts[i].binds[j].numverts);
 
                                                                if (smd->verts[i].binds[j].vert_weights) {
                                                                        if (smd->verts[i].binds[j].mode == MOD_SDEF_MODE_CENTROID ||
                                                                            smd->verts[i].binds[j].mode == MOD_SDEF_MODE_LOOPTRI)
-                                                                               BLI_endian_switch_float_array(smd->verts[i].binds[j].vert_weights, 3);
-                                                                       else
-                                                                               BLI_endian_switch_float_array(smd->verts[i].binds[j].vert_weights, smd->verts[i].binds[j].numverts);
+                                                                       {
+                                                                               BLI_endian_switch_float_array(
+                                                                                       smd->verts[i].binds[j].vert_weights, 3);
+                                                                       }
+                                                                       else {
+                                                                               BLI_endian_switch_float_array(
+                                                                                       smd->verts[i].binds[j].vert_weights, smd->verts[i].binds[j].numverts);
+                                                                       }
                                                                }
                                                        }
                                                }
@@ -5493,23 +5501,23 @@ static void direct_link_object(FileData *fd, Object *ob)
        link_list(fd, &ob->constraintChannels);
 // >>> XXX deprecated - old animation system
 
-       ob->mat= newdataadr(fd, ob->mat);
+       ob->mat = newdataadr(fd, ob->mat);
        test_pointer_array(fd, (void **)&ob->mat);
-       ob->matbits= newdataadr(fd, ob->matbits);
+       ob->matbits = newdataadr(fd, ob->matbits);
 
        /* do it here, below old data gets converted */
        direct_link_modifiers(fd, &ob->modifiers);
 
        link_list(fd, &ob->effect);
-       paf= ob->effect.first;
+       paf = ob->effect.first;
        while (paf) {
                if (paf->type == EFF_PARTICLE) {
                        paf->keys = NULL;
                }
                if (paf->type == EFF_WAVE) {
-                       WaveEff *wav = (WaveEff*) paf;
+                       WaveEff *wav = (WaveEff *)paf;
                        PartEff *next = paf->next;
-                       WaveModifierData *wmd = (WaveModifierData*) modifier_new(eModifierType_Wave);
+                       WaveModifierData *wmd = (WaveModifierData *)modifier_new(eModifierType_Wave);
 
                        wmd->damp = wav->damp;
                        wmd->flag = wav->flag;
@@ -5531,9 +5539,9 @@ static void direct_link_object(FileData *fd, Object *ob)
                        continue;
                }
                if (paf->type == EFF_BUILD) {
-                       BuildEff *baf = (BuildEff*) paf;
+                       BuildEff *baf = (BuildEff *)paf;
                        PartEff *next = paf->next;
-                       BuildModifierData *bmd = (BuildModifierData*) modifier_new(eModifierType_Build);
+                       BuildModifierData *bmd = (BuildModifierData *)modifier_new(eModifierType_Build);
 
                        bmd->start = baf->sfra;
                        bmd->length = baf->len;
@@ -5551,13 +5559,13 @@ static void direct_link_object(FileData *fd, Object *ob)
                paf = paf->next;
        }
 
-       ob->pd= newdataadr(fd, ob->pd);
+       ob->pd = newdataadr(fd, ob->pd);
        direct_link_partdeflect(ob->pd);
-       ob->soft= newdataadr(fd, ob->soft);
+       ob->soft = newdataadr(fd, ob->soft);
        if (ob->soft) {
                SoftBody *sb = ob->soft;
 
-               sb->bpoint = NULL;      // init pointers so it gets rebuilt nicely
+               sb->bpoint = NULL;  // init pointers so it gets rebuilt nicely
                sb->bspring = NULL;
                sb->scratch = NULL;
                /* although not used anymore */
@@ -5578,7 +5586,7 @@ static void direct_link_object(FileData *fd, Object *ob)
                direct_link_pointcache_list(fd, &sb->ptcaches, &sb->pointcache, 0);
        }
        ob->bsoft = newdataadr(fd, ob->bsoft);
-       ob->fluidsimSettings= newdataadr(fd, ob->fluidsimSettings); /* NT */
+       ob->fluidsimSettings = newdataadr(fd, ob->fluidsimSettings); /* NT */
 
        ob->rigidbody_object = newdataadr(fd, ob->rigidbody_object);
        if (ob->rigidbody_object) {
@@ -5639,7 +5647,7 @@ static void direct_link_object(FileData *fd, Object *ob)
                ObHook *hook = ob->hooks.first;
                HookModifierData *hmd = (HookModifierData *)modifier_new(eModifierType_Hook);
 
-               hook->indexar= newdataadr(fd, hook->indexar);
+               hook->indexar = newdataadr(fd, hook->indexar);
                if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
                        BLI_endian_switch_int32_array(hook->indexar, hook->totindex);
                }
@@ -5659,7 +5667,7 @@ static void direct_link_object(FileData *fd, Object *ob)
                BLI_addhead(&ob->modifiers, hmd);
                BLI_remlink(&ob->hooks, hook);
 
-               modifier_unique_name(&ob->modifiers, (ModifierData*)hmd);
+               modifier_unique_name(&ob->modifiers, (ModifierData *)hmd);
 
                MEM_freeN(hook);
        }
@@ -5706,7 +5714,7 @@ static void composite_patch(bNodeTree *ntree, Scene *scene)
        bNode *node;
 
        for (node = ntree->nodes.first; node; node = node->next) {
-               if (node->id==NULL && node->type == CMP_NODE_R_LAYERS)
+               if (node->id == NULL && node->type == CMP_NODE_R_LAYERS)
                        node->id = &scene->id;
        }
 }
@@ -5789,7 +5797,7 @@ static void lib_link_scene(FileData *fd, Main *main)
 
                        if (sce->toolsettings->sculpt)
                                sce->toolsettings->sculpt->gravity_object =
-                                               newlibadr(fd, sce->id.lib, sce->toolsettings->sculpt->gravity_object);
+                                       newlibadr(fd, sce->id.lib, sce->toolsettings->sculpt->gravity_object);
 
                        if (sce->toolsettings->imapaint.stencil)
                                sce->toolsettings->imapaint.stencil =
@@ -5989,12 +5997,12 @@ static void direct_link_sequence_modifiers(FileData *fd, ListBase *lb)
                        smd->mask_sequence = newdataadr(fd, smd->mask_sequence);
 
                if (smd->type == seqModifierType_Curves) {
-                       CurvesModifierData *cmd = (CurvesModifierData *) smd;
+                       CurvesModifierData *cmd = (CurvesModifierData *)smd;
 
                        direct_link_curvemapping(fd, &cmd->curve_mapping);
                }
                else if (smd->type == seqModifierType_HueCorrect) {
-                       HueCorrectModifierData *hcmd = (HueCorrectModifierData *) smd;
+                       HueCorrectModifierData *hcmd = (HueCorrectModifierData *)smd;
 
                        direct_link_curvemapping(fd, &hcmd->curve_mapping);
                }
@@ -6040,12 +6048,12 @@ static void direct_link_scene(FileData *fd, Scene *sce)
 
        sce->basact = newdataadr(fd, sce->basact);
 
-       sce->toolsettings= newdataadr(fd, sce->toolsettings);
+       sce->toolsettings = newdataadr(fd, sce->toolsettings);
        if (sce->toolsettings) {
-               direct_link_paint_helper(fd, (Paint**)&sce->toolsettings->sculpt);
-               direct_link_paint_helper(fd, (Paint**)&sce->toolsettings->vpaint);
-               direct_link_paint_helper(fd, (Paint**)&sce->toolsettings->wpaint);
-               direct_link_paint_helper(fd, (Paint**)&sce->toolsettings->uvsculpt);
+               direct_link_paint_helper(fd, (Paint **)&sce->toolsettings->sculpt);
+               direct_link_paint_helper(fd, (Paint **)&sce->toolsettings->vpaint);
+               direct_link_paint_helper(fd, (Paint **)&sce->toolsettings->wpaint);
+               direct_link_paint_helper(fd, (Paint **)&sce->toolsettings->uvsculpt);
 
                direct_link_paint(fd, &sce->toolsettings->imapaint.paint);
 
@@ -6089,11 +6097,11 @@ static void direct_link_scene(FileData *fd, Scene *sce)
                /* recursive link sequences, lb will be correctly initialized */
                link_recurs_seq(fd, &ed->seqbase);
 
-               SEQ_BEGIN (ed, seq)
+               SEQ_BEGIN(ed, seq)
                {
-                       seq->seq1= newdataadr(fd, seq->seq1);
-                       seq->seq2= newdataadr(fd, seq->seq2);
-                       seq->seq3= newdataadr(fd, seq->seq3);
+                       seq->seq1 = newdataadr(fd, seq->seq1);
+                       seq->seq2 = newdataadr(fd, seq->seq2);
+                       seq->seq3 = newdataadr(fd, seq->seq3);
 
                        /* a patch: after introduction of effects with 3 input strips */
                        if (seq->seq3 == NULL) seq->seq3 = seq->seq2;
@@ -6113,7 +6121,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
                        IDP_DirectLinkGroup_OrFree(&seq->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
 
                        seq->strip = newdataadr(fd, seq->strip);
-                       if (seq->strip && seq->strip->done==0) {
+                       if (seq->strip && seq->strip->done == 0) {
                                seq->strip->done = true;
 
                                if (ELEM(seq->type, SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD)) {
@@ -6181,11 +6189,11 @@ static void direct_link_scene(FileData *fd, Scene *sce)
                        /* stack */
                        link_list(fd, &(ed->metastack));
 
-                       for (ms = ed->metastack.first; ms; ms= ms->next) {
+                       for (ms = ed->metastack.first; ms; ms = ms->next) {
                                ms->parseq = newdataadr(fd, ms->parseq);
 
                                if (ms->oldbasep == old_seqbasep)
-                                       ms->oldbasep= &ed->seqbase;
+                                       ms->oldbasep = &ed->seqbase;
                                else {
                                        poin = POINTER_OFFSET(ms->oldbasep, -offset);
                                        poin = newdataadr(fd, poin);
@@ -6440,15 +6448,15 @@ static void lib_link_screen(FileData *fd, Main *main)
                        for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
                                sa->full = newlibadr(fd, sc->id.lib, sa->full);
 
-                               for (SpaceLink *sl = sa->spacedata.first; sl; sl= sl->next) {
+                               for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
                                        switch (sl->spacetype) {
                                                case SPACE_VIEW3D:
                                                {
-                                                       View3D *v3d = (View3D*) sl;
+                                                       View3D *v3d = (View3D *)sl;
                                                        BGpic *bgpic = NULL;
 
-                                                       v3d->camera= newlibadr(fd, sc->id.lib, v3d->camera);
-                                                       v3d->ob_centre= newlibadr(fd, sc->id.lib, v3d->ob_centre);
+                                                       v3d->camera = newlibadr(fd, sc->id.lib, v3d->camera);
+                                                       v3d->ob_centre = newlibadr(fd, sc->id.lib, v3d->ob_centre);
 
                                                        /* should be do_versions but not easy adding into the listbase */
                                                        if (v3d->bgpic) {
@@ -6526,8 +6534,8 @@ static void lib_link_screen(FileData *fd, Main *main)
                                                }
                                                case SPACE_NLA:
                                                {
-                                                       SpaceNla *snla= (SpaceNla *)sl;
-                                                       bDopeSheet *ads= snla->ads;
+                                                       SpaceNla *snla = (SpaceNla *)sl;
+                                                       bDopeSheet *ads = snla->ads;
 
                                                        if (ads) {
                                                                ads->source = newlibadr(fd, sc->id.lib, ads->source);
@@ -6537,9 +6545,9 @@ static void lib_link_screen(FileData *fd, Main *main)
                                                }
                                                case SPACE_TEXT:
                                                {
-                                                       SpaceText *st= (SpaceText *)sl;
+                                                       SpaceText *st = (SpaceText *)sl;
 
-                                                       st->text= newlibadr(fd, sc->id.lib, st->text);
+                                                       st->text = newlibadr(fd, sc->id.lib, st->text);
                                                        break;
                                                }
                                                case SPACE_SCRIPT:
@@ -6556,7 +6564,7 @@ static void lib_link_screen(FileData *fd, Main *main)
                                                }
                                                case SPACE_OUTLINER:
                                                {
-                                                       SpaceOops *so= (SpaceOops *)sl;
+                                                       SpaceOops *so = (SpaceOops *)sl;
                                                        so->search_tse.id = newlibadr(fd, NULL, so->search_tse.id);
 
                                                        if (so->treestore) {
@@ -6755,7 +6763,7 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
 
        /* first windowmanager */
        for (wm = newmain->wm.first; wm; wm = wm->id.next) {
-               for (win= wm->windows.first; win; win= win->next) {
+               for (win = wm->windows.first; win; win = win->next) {
                        win->screen = restore_pointer_by_name(id_map, (ID *)win->screen, USER_REAL);
 
                        if (win->screen == NULL)
@@ -6769,7 +6777,7 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
        for (sc = newmain->screen.first; sc; sc = sc->id.next) {
                Scene *oldscene = sc->scene;
 
-               sc->scene= restore_pointer_by_name(id_map, (ID *)sc->scene, USER_REAL);
+               sc->scene = restore_pointer_by_name(id_map, (ID *)sc->scene, USER_REAL);
                if (sc->scene == NULL)
                        sc->scene = curscene;
 
@@ -6793,7 +6801,7 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
                                                v3d->camera = sc->scene->camera;
                                        v3d->ob_centre = restore_pointer_by_name(id_map, (ID *)v3d->ob_centre, USER_REAL);
 
-                                       for (bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) {
+                                       for (bgpic = v3d->bgpicbase.first; bgpic; bgpic = bgpic->next) {
                                                if ((bgpic->ima = restore_pointer_by_name(id_map, (ID *)bgpic->ima, USER_IGNORE))) {
                                                        id_us_plus((ID *)bgpic->ima);
                                                }
@@ -6807,15 +6815,17 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
                                                v3d->localvd->camera = sc->scene->camera;
 
                                                /* localview can become invalid during undo/redo steps, so we exit it when no could be found */
-#if 0                                  /* XXX  regionlocalview ? */
-                                               for (base= sc->scene->base.first; base; base= base->next) {
-                                                       if (base->lay & v3d->lay) break;
+#if 0                   /* XXX  regionlocalview ? */
+                                               for (base = sc->scene->base.first; base; base = base->next) {
+                                                       if (base->lay & v3d->lay) {
+                                                               break;
+                                                       }
                                                }
-                                               if (base==NULL) {
-                                                       v3d->lay= v3d->localvd->lay;
-                                                       v3d->layact= v3d->localvd->layact;
+                                               if (base == NULL) {
+                                                       v3d->lay = v3d->localvd->lay;
+                                                       v3d->layact = v3d->localvd->layact;
                                                        MEM_freeN(v3d->localvd);
-                                                       v3d->localvd= NULL;
+                                                       v3d->localvd = NULL;
                                                }
 #endif
                                        }
@@ -6944,7 +6954,7 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
                                        }
                                }
                                else if (sl->spacetype == SPACE_OUTLINER) {
-                                       SpaceOops *so= (SpaceOops *)sl;
+                                       SpaceOops *so = (SpaceOops *)sl;
 
                                        so->search_tse.id = restore_pointer_by_name(id_map, so->search_tse.id, USER_IGNORE);
 
@@ -6969,7 +6979,7 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
                                        }
                                }
                                else if (sl->spacetype == SPACE_NODE) {
-                                       SpaceNode *snode= (SpaceNode *)sl;
+                                       SpaceNode *snode = (SpaceNode *)sl;
                                        bNodeTreePath *path, *path_next;
                                        bNodeTree *ntree;
 
@@ -6986,7 +6996,7 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
                                                        path->nodetree = snode->nodetree;
                                                }
                                                else
-                                                       path->nodetree= restore_pointer_by_name(id_map, (ID*)path->nodetree, USER_REAL);
+                                                       path->nodetree = restore_pointer_by_name(id_map, (ID *)path->nodetree, USER_REAL);
 
                                                if (!path->nodetree)
                                                        break;
@@ -7109,7 +7119,7 @@ void blo_do_versions_view3d_split_250(View3D *v3d, ListBase *regions)
        ARegion *ar;
 
        for (ar = regions->first; ar; ar = ar->next) {
-               if (ar->regiontype==RGN_TYPE_WINDOW && ar->regiondata==NULL) {
+               if (ar->regiontype == RGN_TYPE_WINDOW && ar->regiondata == NULL) {
                        RegionView3D *rv3d;
 
                        rv3d = ar->regiondata = MEM_callocN(sizeof(RegionView3D), "region v3d patch");
@@ -7138,10 +7148,10 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
        link_list(fd, &(sc->vertbase));
        link_list(fd, &(sc->edgebase));
        link_list(fd, &(sc->areabase));
-       sc->regionbase.first = sc->regionbase.last= NULL;
+       sc->regionbase.first = sc->regionbase.last = NULL;
        sc->context = NULL;
 
-       sc->mainwin = sc->subwinactive= 0;      /* indices */
+       sc->mainwin = sc->subwinactive = 0;  /* indices */
        sc->swap = 0;
 
        /* edges */
@@ -7155,7 +7165,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
                }
 
                if (se->v1 == NULL) {
-                       printf("Error reading Screen %s... removing it.\n", sc->id.name+2);
+                       printf("Error reading Screen %s... removing it.\n", sc->id.name + 2);
                        BLI_remlink(&sc->edgebase, se);
                        wrong_id = true;
                }
@@ -7170,7 +7180,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
                link_list(fd, &(sa->regionbase));
 
                BLI_listbase_clear(&sa->handlers);
-               sa->type = NULL;        /* spacetype callbacks */
+               sa->type = NULL;    /* spacetype callbacks */
                sa->region_active_win = -1;
 
                /* if we do not have the spacetype registered (game player), we cannot
@@ -7183,9 +7193,9 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
 
                /* accident can happen when read/save new file with older version */
                /* 2.50: we now always add spacedata for info */
-               if (sa->spacedata.first==NULL) {
-                       SpaceInfo *sinfo= MEM_callocN(sizeof(SpaceInfo), "spaceinfo");
-                       sa->spacetype= sinfo->spacetype= SPACE_INFO;
+               if (sa->spacedata.first == NULL) {
+                       SpaceInfo *sinfo = MEM_callocN(sizeof(SpaceInfo), "spaceinfo");
+                       sa->spacetype = sinfo->spacetype = SPACE_INFO;
                        BLI_addtail(&sa->spacedata, sinfo);
                }
                /* add local view3d too */
@@ -7207,7 +7217,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
                                direct_link_region(fd, ar, sl->spacetype);
 
                        if (sl->spacetype == SPACE_VIEW3D) {
-                               View3D *v3d= (View3D*) sl;
+                               View3D *v3d = (View3D *)sl;
                                BGpic *bgpic;
 
                                v3d->flag |= V3D_INVALID_BACKBUF;
@@ -7259,7 +7269,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
                                snla->ads = newdataadr(fd, snla->ads);
                        }
                        else if (sl->spacetype == SPACE_OUTLINER) {
-                               SpaceOops *soops = (SpaceOops *) sl;
+                               SpaceOops *soops = (SpaceOops *)sl;
 
                                /* use newdataadr_no_us and do not free old memory avoiding double
                                 * frees and use of freed memory. this could happen because of a
@@ -7280,10 +7290,10 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
                                                }
                                        }
                                        /* we only saved what was used */
-                                       soops->storeflag |= SO_TREESTORE_CLEANUP;       // at first draw
+                                       soops->storeflag |= SO_TREESTORE_CLEANUP;   // at first draw
                                }
                                soops->treehash = NULL;
-                               soops->tree.first = soops->tree.last= NULL;
+                               soops->tree.first = soops->tree.last = NULL;
                        }
                        else if (sl->spacetype == SPACE_IMAGE) {
                                SpaceImage *sima = (SpaceImage *)sl;
@@ -7319,7 +7329,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
                                BLI_listbase_clear(&snode->linkdrag);
                        }
                        else if (sl->spacetype == SPACE_TEXT) {
-                               SpaceText *st= (SpaceText *)sl;
+                               SpaceText *st = (SpaceText *)sl;
 
                                st->drawcache = NULL;
                                st->scroll_accum[0] = 0.0f;
@@ -7365,8 +7375,8 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
                        else if (sl->spacetype == SPACE_BUTS) {
                                SpaceButs *sbuts = (SpaceButs *)sl;
 
-                               sbuts->path= NULL;
-                               sbuts->texuser= NULL;
+                               sbuts->path = NULL;
+                               sbuts->texuser = NULL;
                                sbuts->mainbo = sbuts->mainb;
                                sbuts->mainbuser = sbuts->mainb;
                        }
@@ -7494,7 +7504,7 @@ static void fix_relpaths_library(const char *basepath, Main *main)
        Library *lib;
        /* BLO_read_from_memory uses a blank filename */
        if (basepath == NULL || basepath[0] == '\0') {
-               for (lib = main->library.first; lib; lib= lib->id.next) {
+               for (lib = main->library.first; lib; lib = lib->id.next) {
                        /* when loading a linked lib into a file which has not been saved,
                         * there is nothing we can be relative to, so instead we need to make
                         * it absolute. This can happen when appending an object with a relative
@@ -7619,7 +7629,7 @@ static void lib_link_group(FileData *fd, Main *bmain)
                        if (add_us) {
                                id_us_ensure_real(&group->id);
                        }
-                       BKE_group_object_unlink(bmain, group, NULL, NULL, NULL);        /* removes NULL entries */
+                       BKE_group_object_unlink(bmain, group, NULL, NULL, NULL);    /* removes NULL entries */
 
                        group->id.tag &= ~LIB_TAG_NEED_LINK;
                }
@@ -7671,7 +7681,7 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip)
        MovieTracking *tracking = &clip->tracking;
        MovieTrackingObject *object;
 
-       clip->adt= newdataadr(fd, clip->adt);
+       clip->adt = newdataadr(fd, clip->adt);
 
        if (fd->movieclipmap) clip->cache = newmclipadr(fd, clip->cache);
        else clip->cache = NULL;
@@ -7858,31 +7868,31 @@ static void lib_link_linestyle(FileData *fd, Main *main)
                        for (m = linestyle->color_modifiers.first; m; m = m->next) {
                                switch (m->type) {
                                        case LS_MODIFIER_DISTANCE_FROM_OBJECT:
-                                               {
-                                                       LineStyleColorModifier_DistanceFromObject *cm = (LineStyleColorModifier_DistanceFromObject *)m;
-                                                       cm->target = newlibadr(fd, linestyle->id.lib, cm->target);
-                                               }
+                                       {
+                                               LineStyleColorModifier_DistanceFromObject *cm = (LineStyleColorModifier_DistanceFromObject *)m;
+                                               cm->target = newlibadr(fd, linestyle->id.lib, cm->target);
                                                break;
+                                       }
                                }
                        }
                        for (m = linestyle->alpha_modifiers.first; m; m = m->next) {
                                switch (m->type) {
                                        case LS_MODIFIER_DISTANCE_FROM_OBJECT:
-                                               {
-                                                       LineStyleAlphaModifier_DistanceFromObject *am = (LineStyleAlphaModifier_DistanceFromObject *)m;
-                                                       am->target = newlibadr(fd, linestyle->id.lib, am->target);
-                                               }
+                                       {
+                                               LineStyleAlphaModifier_DistanceFromObject *am = (LineStyleAlphaModifier_DistanceFromObject *)m;
+                                               am->target = newlibadr(fd, linestyle->id.lib, am->target);
                                                break;
+                                       }
                                }
                        }
                        for (m = linestyle->thickness_modifiers.first; m; m = m->next) {
                                switch (m->type) {
                                        case LS_MODIFIER_DISTANCE_FROM_OBJECT:
-                                               {
-                                                       LineStyleThicknessModifier_DistanceFromObject *tm = (LineStyleThicknessModifier_DistanceFromObject *)m;
-                                                       tm->target = newlibadr(fd, linestyle->id.lib, tm->target);
-                                               }
+                                       {
+                                               LineStyleThicknessModifier_DistanceFromObject *tm = (LineStyleThicknessModifier_DistanceFromObject *)m;
+                                               tm->target = newlibadr(fd, linestyle->id.lib, tm->target);
                                                break;
+                                       }
                                }
                        }
                        for (int a = 0; a < MAX_MTEX; a++) {
@@ -7906,53 +7916,53 @@ static void direct_link_linestyle_color_modifier(FileData *fd, LineStyleModifier
 {
        switch (modifier->type) {
                case LS_MODIFIER_ALONG_STROKE:
-                       {
-                               LineStyleColorModifier_AlongStroke *m = (LineStyleColorModifier_AlongStroke *)modifier;
-                               m->color_ramp = newdataadr(fd, m->color_ramp);
-                       }
+               {
+                       LineStyleColorModifier_AlongStroke *m = (LineStyleColorModifier_AlongStroke *)modifier;
+                       m->color_ramp = newdataadr(fd, m->color_ramp);
                        break;
+               }
                case LS_MODIFIER_DISTANCE_FROM_CAMERA:
-                       {
-                               LineStyleColorModifier_DistanceFromCamera *m = (LineStyleColorModifier_DistanceFromCamera *)modifier;
-                               m->color_ramp = newdataadr(fd, m->color_ramp);
-                       }
+               {
+                       LineStyleColorModifier_DistanceFromCamera *m = (LineStyleColorModifier_DistanceFromCamera *)modifier;
+                       m->color_ramp = newdataadr(fd, m->color_ramp);
                        break;
+               }
                case LS_MODIFIER_DISTANCE_FROM_OBJECT:
-                       {
-                               LineStyleColorModifier_DistanceFromObject *m = (LineStyleColorModifier_DistanceFromObject *)modifier;
-                               m->color_ramp = newdataadr(fd, m->color_ramp);
-                       }
+               {
+                       LineStyleColorModifier_DistanceFromObject *m = (LineStyleColorModifier_DistanceFromObject *)modifier;
+                       m->color_ramp = newdataadr(fd, m->color_ramp);
                        break;
+               }
                case LS_MODIFIER_MATERIAL:
-                       {
-                               LineStyleColorModifier_Material *m = (LineStyleColorModifier_Material *)modifier;
-                               m->color_ramp = newdataadr(fd, m->color_ramp);
-                       }
+               {
+                       LineStyleColorModifier_Material *m = (LineStyleColorModifier_Material *)modifier;
+                       m->color_ramp = newdataadr(fd, m->color_ramp);
                        break;
+               }
                case LS_MODIFIER_TANGENT:
-                       {
-                               LineStyleColorModifier_Tangent *m = (LineStyleColorModifier_Tangent *)modifier;
-                               m->color_ramp = newdataadr(fd, m->color_ramp);
-                       }
+               {
+                       LineStyleColorModifier_Tangent *m = (LineStyleColorModifier_Tangent *)modifier;
+                       m->color_ramp = newdataadr(fd, m->color_ramp);
                        break;
+               }
                case LS_MODIFIER_NOISE:
-                       {
-                               LineStyleColorModifier_Noise *m = (LineStyleColorModifier_Noise *)modifier;
-                               m->color_ramp = newdataadr(fd, m->color_ramp);
-                       }
+               {
+                       LineStyleColorModifier_Noise *m = (LineStyleColorModifier_Noise *)modifier;
+                       m->color_ramp = newdataadr(fd, m->color_ramp);
                        break;
+               }
                case LS_MODIFIER_CREASE_ANGLE:
-                       {
-                               LineStyleColorModifier_CreaseAngle *m = (LineStyleColorModifier_CreaseAngle *)modifier;
-                               m->color_ramp = newdataadr(fd, m->color_ramp);
-                       }
+               {
+                       LineStyleColorModifier_CreaseAngle *m = (LineStyleColorModifier_CreaseAngle *)modifier;
+                       m->color_ramp = newdataadr(fd, m->color_ramp);
                        break;
+               }
                case LS_MODIFIER_CURVATURE_3D:
-                       {
-                               LineStyleColorModifier_Curvature_3D *m = (LineStyleColorModifier_Curvature_3D *)modifier;
-                               m->color_ramp = newdataadr(fd, m->color_ramp);
-                       }
+               {
+                       LineStyleColorModifier_Curvature_3D *m = (LineStyleColorModifier_Curvature_3D *)modifier;
+                       m->color_ramp = newdataadr(fd, m->color_ramp);
                        break;
+               }
        }
 }
 
@@ -7960,61 +7970,61 @@ static void direct_link_linestyle_alpha_modifier(FileData *fd, LineStyleModifier
 {
        switch (modifier->type) {
                case LS_MODIFIER_ALONG_STROKE:
-                       {
-                               LineStyleAlphaModifier_AlongStroke *m = (LineStyleAlphaModifier_AlongStroke *)modifier;
-                               m->curve = newdataadr(fd, m->curve);
-                               direct_link_curvemapping(fd, m->curve);
-                       }
+               {
+                       LineStyleAlphaModifier_AlongStroke *m = (LineStyleAlphaModifier_AlongStroke *)modifier;
+                       m->curve = newdataadr(fd, m->curve);
+                       direct_link_curvemapping(fd, m->curve);
                        break;
+               }
                case LS_MODIFIER_DISTANCE_FROM_CAMERA:
-                       {
-                               LineStyleAlphaModifier_DistanceFromCamera *m = (LineStyleAlphaModifier_DistanceFromCamera *)modifier;
-                               m->curve = newdataadr(fd, m->curve);
-                               direct_link_curvemapping(fd, m->curve);
-                       }
+               {
+                       LineStyleAlphaModifier_DistanceFromCamera *m = (LineStyleAlphaModifier_DistanceFromCamera *)modifier;
+                       m->curve = newdataadr(fd, m->curve);
+                       direct_link_curvemapping(fd, m->curve);
                        break;
+               }
                case LS_MODIFIER_DISTANCE_FROM_OBJECT:
-                       {
-                               LineStyleAlphaModifier_DistanceFromObject *m = (LineStyleAlphaModifier_DistanceFromObject *)modifier;
-                               m->curve = newdataadr(fd, m->curve);
-                               direct_link_curvemapping(fd, m->curve);
-                       }
+               {
+                       LineStyleAlphaModifier_DistanceFromObject *m = (LineStyleAlphaModifier_DistanceFromObject *)modifier;
+                       m->curve = newdataadr(fd, m->curve);
+                       direct_link_curvemapping(fd, m->curve);
                        break;
+               }
                case LS_MODIFIER_MATERIAL:
-                       {
-                               LineStyleAlphaModifier_Material *m = (LineStyleAlphaModifier_Material *)modifier;
-                               m->curve = newdataadr(fd, m->curve);
-                               direct_link_curvemapping(fd, m->curve);
-                       }
+               {
+                       LineStyleAlphaModifier_Material *m = (LineStyleAlphaModifier_Material *)modifier;
+                       m->curve = newdataadr(fd, m->curve);
+                       direct_link_curvemapping(fd, m->curve);
                        break;
+               }
                case LS_MODIFIER_TANGENT:
-                       {
-                               LineStyleAlphaModifier_Tangent *m = (LineStyleAlphaModifier_Tangent *)modifier;
-                               m->curve = newdataadr(fd, m->curve);
-                               direct_link_curvemapping(fd, m->curve);
-                       }
+               {
+                       LineStyleAlphaModifier_Tangent *m = (LineStyleAlphaModifier_Tangent *)modifier;
+                       m->curve = newdataadr(fd, m->curve);
+                       direct_link_curvemapping(fd, m->curve);
                        break;
+               }
                case LS_MODIFIER_NOISE:
-                       {
-                               LineStyleAlphaModifier_Noise *m = (LineStyleAlphaModifier_Noise *)modifier;
-                               m->curve = newdataadr(fd, m->curve);
-                               direct_link_curvemapping(fd, m->curve);
-                       }
+               {
+                       LineStyleAlphaModifier_Noise *m = (LineStyleAlphaModifier_Noise *)modifier;
+                       m->curve = newdataadr(fd, m->curve);
+                       direct_link_curvemapping(fd, m->curve);
                        break;
+               }
                case LS_MODIFIER_CREASE_ANGLE:
-                       {
-                               LineStyleAlphaModifier_CreaseAngle *m = (LineStyleAlphaModifier_CreaseAngle *)modifier;
-                               m->curve = newdataadr(fd, m->curve);
-                               direct_link_curvemapping(fd, m->curve);
-                       }
+               {
+                       LineStyleAlphaModifier_CreaseAngle *m = (LineStyleAlphaModifier_CreaseAngle *)modifier;
+                       m->curve = newdataadr(fd, m->curve);
+                       direct_link_curvemapping(fd, m->curve);
                        break;
+               }
                case LS_MODIFIER_CURVATURE_3D:
-                       {
-                               LineStyleAlphaModifier_Curvature_3D *m = (LineStyleAlphaModifier_Curvature_3D *)modifier;
-                               m->curve = newdataadr(fd, m->curve);
-                               direct_link_curvemapping(fd, m->curve);
-                       }
+               {
+                       LineStyleAlphaModifier_Curvature_3D *m = (LineStyleAlphaModifier_Curvature_3D *)modifier;
+                       m->curve = newdataadr(fd, m->curve);
+                       direct_link_curvemapping(fd, m->curve);
                        break;
+               }
        }
 }
 
@@ -8022,54 +8032,54 @@ static void direct_link_linestyle_thickness_modifier(FileData *fd, LineStyleModi
 {
        switch (modifier->type) {
                case LS_MODIFIER_ALONG_STROKE:
-                       {
-                               LineStyleThicknessModifier_AlongStroke *m = (LineStyleThicknessModifier_AlongStroke *)modifier;
-                               m->curve = newdataadr(fd, m->curve);
-                               direct_link_curvemapping(fd, m->curve);
-                       }
+               {
+                       LineStyleThicknessModifier_AlongStroke *m = (LineStyleThicknessModifier_AlongStroke *)modifier;
+                       m->curve = newdataadr(fd, m->curve);
+                       direct_link_curvemapping(fd, m->curve);
                        break;
+               }
                case LS_MODIFIER_DISTANCE_FROM_CAMERA:
-                       {
-                               LineStyleThicknessModifier_DistanceFromCamera *m = (LineStyleThicknessModifier_DistanceFromCamera *)modifier;
-                               m->curve = newdataadr(fd, m->curve);
-                               direct_link_curvemapping(fd, m->curve);
-                       }
+               {
+                       LineStyleThicknessModifier_DistanceFromCamera *m = (LineStyleThicknessModifier_DistanceFromCamera *)modifier;
+                       m->curve = newdataadr(fd, m->curve);
+                       direct_link_curvemapping(fd, m->curve);
                        break;
+               }
                case LS_MODIFIER_DISTANCE_FROM_OBJECT:
-                       {
-                               LineStyleThicknessModifier_DistanceFromObject *m = (LineStyleThicknessModifier_DistanceFromObject *)modifier;
-                               m->curve = newdataadr(fd, m->curve);
-                               direct_link_curvemapping(fd, m->curve);
-                       }
+               {
+                       LineStyleThicknessModifier_DistanceFromObject *m = (LineStyleThicknessModifier_DistanceFromObject *)modifier;
+                       m->curve = newdataadr(fd, m->curve);
+                       direct_link_curvemapping(fd, m->curve);
                        break;
+               }
                case LS_MODIFIER_MATERIAL:
-                       {
-                               LineStyleThicknessModifier_Material *m = (LineStyleThicknessModifier_Material *)modifier;
-                               m->curve = newdataadr(fd, m->curve);
-                               direct_link_curvemapping(fd, m->curve);
-                       }
+               {
+                       LineStyleThicknessModifier_Material *m = (LineStyleThicknessModifier_Material *)modifier;
+                       m->curve = newdataadr(fd, m->curve);
+                       direct_link_curvemapping(fd, m->curve);
                        break;
+               }
                case LS_MODIFIER_TANGENT:
-                       {
-                               LineStyleThicknessModifier_Tangent *m = (LineStyleThicknessModifier_Tangent *)modifier;
-                               m->curve = newdataadr(fd, m->curve);
-                               direct_link_curvemapping(fd, m->curve);
-                       }
+               {
+                       LineStyleThicknessModifier_Tangent *m = (LineStyleThicknessModifier_Tangent *)modifier;
+                       m->curve = newdataadr(fd, m->curve);
+                       direct_link_curvemapping(fd, m->curve);
                        break;
+               }
                case LS_MODIFIER_CREASE_ANGLE:
-                       {
-                               LineStyleThicknessModifier_CreaseAngle *m = (LineStyleThicknessModifier_CreaseAngle *)modifier;
-                               m->curve = newdataadr(fd, m->curve);
-                               direct_link_curvemapping(fd, m->curve);
-                       }
+               {
+                       LineStyleThicknessModifier_CreaseAngle *m = (LineStyleThicknessModifier_CreaseAngle *)modifier;
+                       m->curve = newdataadr(fd, m->curve);
+                       direct_link_curvemapping(fd, m->curve);
                        break;
+               }
                case LS_MODIFIER_CURVATURE_3D:
-                       {
-                               LineStyleThicknessModifier_Curvature_3D *m = (LineStyleThicknessModifier_Curvature_3D *)modifier;
-                               m->curve = newdataadr(fd, m->curve);
-                               direct_link_curvemapping(fd, m->curve);
-                       }
+               {
+                       LineStyleThicknessModifier_Curvature_3D *m = (LineStyleThicknessModifier_Curvature_3D *)modifier;
+                       m->curve = newdataadr(fd, m->curve);
+                       direct_link_curvemapping(fd, m->curve);
                        break;
+               }
        }
 }
 
@@ -8082,7 +8092,7 @@ static void direct_link_linestyle(FileData *fd, FreestyleLineStyle *linestyle)
        int a;
        LineStyleModifier *modifier;
 
-       linestyle->adt= newdataadr(fd, linestyle->adt);
+       linestyle->adt = newdataadr(fd, linestyle->adt);
        direct_link_animdata(fd, linestyle->adt);
        link_list(fd, &linestyle->color_modifiers);
        for (modifier = linestyle->color_modifiers.first; modifier; modifier = modifier->next)
@@ -8155,13 +8165,13 @@ static BHead *read_data_into_oldnewmap(FileData *fd, BHead *bhead, const char *a
 {
        bhead = blo_nextbhead(fd, bhead);
 
-       while (bhead && bhead->code==DATA) {
+       while (bhead && bhead->code == DATA) {
                void *data;
 #if 0
                /* XXX DUMB DEBUGGING OPTION TO GIVE NAMES for guarded malloc errors */
                short *sp = fd->filesdna->structs[bhead->SDNAnr];
                char *tmp = malloc(100);
-               allocname = fd->filesdna->types[ sp[0] ];
+               allocname = fd->filesdna->types[sp[0]];
                strcpy(tmp, allocname);
                data = read_struct(fd, bhead, tmp);
 #else
@@ -8248,7 +8258,7 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
                /* do after read_struct, for dna reconstruct */
                lb = which_libbase(main, idcode);
                if (lb) {
-                       oldnewmap_insert(fd->libmap, bhead->old, id, bhead->code);      /* for ID_ID check */
+                       oldnewmap_insert(fd->libmap, bhead->old, id, bhead->code);  /* for ID_ID check */
                        BLI_addtail(lb, id);
                }
                else {
@@ -8359,19 +8369,19 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
                        direct_link_group(fd, (Group *)id);
                        break;
                case ID_AR:
-                       direct_link_armature(fd, (bArmature*)id);
+                       direct_link_armature(fd, (bArmature *)id);
                        break;
                case ID_AC:
-                       direct_link_action(fd, (bAction*)id);
+                       direct_link_action(fd, (bAction *)id);
                        break;
                case ID_NT:
-                       direct_link_nodetree(fd, (bNodeTree*)id);
+                       direct_link_nodetree(fd, (bNodeTree *)id);
                        break;
                case ID_BR:
-                       direct_link_brush(fd, (Brush*)id);
+                       direct_link_brush(fd, (Brush *)id);
                        break;
                case ID_PA:
-                       direct_link_particlesettings(fd, (ParticleSettings*)id);
+                       direct_link_particlesettings(fd, (ParticleSettings *)id);
                        break;
                case ID_GD:
                        direct_link_gpencil(fd, (bGPdata *)id);
@@ -8426,7 +8436,7 @@ static BHead *read_global(BlendFileData *bfd, FileData *fd, BHead *bhead)
        /* error in 2.65 and older: main->name was not set if you save from startup (not after loading file) */
        if (bfd->filename[0] == 0) {
                if (fd->fileversion < 265 || (fd->fileversion == 265 && fg->subversion < 1))
-                       if ((G.fileflags & G_FILE_RECOVER)==0)
+                       if ((G.fileflags & G_FILE_RECOVER) == 0)
                                BLI_strncpy(bfd->filename, BKE_main_blendfile_path(bfd->main), sizeof(bfd->filename));
 
                /* early 2.50 version patch - filename not in FileGlobal struct at all */
@@ -8609,7 +8619,7 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
        wmKeyMapDiffItem *kmdi;
        bAddon *addon;
 
-       bfd->user = user= read_struct(fd, bhead, "user def");
+       bfd->user = user = read_struct(fd, bhead, "user def");
 
        /* User struct has separate do-version handling */
        user->versionfile = bfd->main->versionfile;
@@ -8620,8 +8630,8 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
 
        if (user->keymaps.first) {
                /* backwards compatibility */
-               user->user_keymaps= user->keymaps;
-               user->keymaps.first= user->keymaps.last= NULL;
+               user->user_keymaps = user->keymaps;
+               user->keymaps.first = user->keymaps.last = NULL;
        }
 
        link_list(fd, &user->themes);
@@ -8629,17 +8639,17 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
        link_list(fd, &user->addons);
        link_list(fd, &user->autoexec_paths);
 
-       for (keymap=user->user_keymaps.first; keymap; keymap=keymap->next) {
-               keymap->modal_items= NULL;
+       for (keymap = user->user_keymaps.first; keymap; keymap = keymap->next) {
+               keymap->modal_items = NULL;
                keymap->poll = NULL;
                keymap->flag &= ~KEYMAP_UPDATE;
 
                link_list(fd, &keymap->diff_items);
                link_list(fd, &keymap->items);
 
-               for (kmdi=keymap->diff_items.first; kmdi; kmdi=kmdi->next) {
-                       kmdi->remove_item= newdataadr(fd, kmdi->remove_item);
-                       kmdi->add_item= newdataadr(fd, kmdi->add_item);
+               for (kmdi = keymap->diff_items.first; kmdi; kmdi = kmdi->next) {
+                       kmdi->remove_item = newdataadr(fd, kmdi->remove_item);
+                       kmdi->add_item = newdataadr(fd, kmdi->add_item);
 
                        if (kmdi->remove_item)
                                direct_link_keymapitem(fd, kmdi->remove_item);
@@ -8647,7 +8657,7 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
                                direct_link_keymapitem(fd, kmdi->add_item);
                }
 
-               for (kmi=keymap->items.first; kmi; kmi=kmi->next)
+               for (kmi = keymap->items.first; kmi; kmi = kmi->next)
                        direct_link_keymapitem(fd, kmi);
        }
 
@@ -8657,7 +8667,7 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
        }
 
        // XXX
-       user->uifonts.first = user->uifonts.last= NULL;
+       user->uifonts.first = user->uifonts.last = NULL;
 
        link_list(fd, &user->uistyles);
 
@@ -8784,7 +8794,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
        lib_verify_nodetree(bfd->main, true);
        fix_relpaths_library(fd->relabase, bfd->main); /* make all relative paths, relative to the open blend file */
 
-       link_global(fd, bfd);   /* as last */
+       link_global(fd, bfd);   /* as last */
 
        fd->mainlist = NULL;  /* Safety, this is local variable, shall not be used afterward. */
 
@@ -8800,7 +8810,7 @@ struct BHeadSort {
 
 static int verg_bheadsort(const void *v1, const void *v2)
 {
-       const struct BHeadSort *x1=v1, *x2=v2;
+       const struct BHeadSort *x1 = v1, *x2 = v2;
 
        if (x1->old > x2->old) return 1;
        else if (x1->old < x2->old) return -1;
@@ -8863,7 +8873,7 @@ static BHead *find_bhead(FileData *fd, void *old)
                return bhs->bhead;
 
 #if 0
-       for (bhead = blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
+       for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
                if (bhead->old == old)
                        return bhead;
        }
@@ -8913,7 +8923,7 @@ static BHead *find_bhead_from_idname(FileData *fd, const char *idname)
 
 static ID *is_yet_read(FileData *fd, Main *mainvar, BHead *bhead)
 {
-       const char *idname= bhead_id_name(fd, bhead);
+       const char *idname = bhead_id_name(fd, bhead);
        /* which_libbase can be NULL, intentionally not using idname+2 */
        return BLI_findstring(which_libbase(mainvar, GS(idname)), idname, offsetof(ID, name));
 }
@@ -8928,14 +8938,14 @@ static void expand_doit_library(void *fdhandle, Main *mainvar, void *old)
        if (bhead) {
                /* from another library? */
                if (bhead->code == ID_ID) {
-                       BHead *bheadlib= find_previous_lib(fd, bhead);
+                       BHead *bheadlib = find_previous_lib(fd, bhead);
 
                        if (bheadlib) {
                                Library *lib = read_struct(fd, bheadlib, "Library");
                                Main *ptr = blo_find_main(fd, lib->name, fd->relabase);
 
                                if (ptr->curlib == NULL) {
-                                       const char *idname= bhead_id_name(fd, bhead);
+                                       const char *idname = bhead_id_name(fd, bhead);
 
                                        blo_reportf_wrap(fd->reports, RPT_WARNING, TIP_("LIB: Data refers to main .blend file: '%s' from %s"),
                                                         idname, mainvar->curlib->filepath);
@@ -9091,7 +9101,7 @@ static void expand_action(FileData *fd, Main *mainvar, bAction *act)
        bActionChannel *chan;
 
        // XXX deprecated - old animation system --------------
-       for (chan=act->chanbase.first; chan; chan=chan->next) {
+       for (chan = act->chanbase.first; chan; chan = chan->next) {
                expand_doit(fd, mainvar, chan->ipo);
                expand_constraint_channels(fd, mainvar, &chan->constraintChannels);
        }
@@ -9124,7 +9134,7 @@ static void expand_animdata_nlastrips(FileData *fd, Main *mainvar, ListBase *lis
 {
        NlaStrip *strip;
 
-       for (strip= list->first; strip; strip= strip->next) {
+       for (strip = list->first; strip; strip = strip->next) {
                /* check child strips */
                expand_animdata_nlastrips(fd, mainvar, &strip->strips);
 
@@ -9400,7 +9410,7 @@ static void expand_mesh(FileData *fd, Main *mainvar, Mesh *me)
 
        if (me->tface) {
                tf = me->tface;
-               for (i=0; i<me->totface; i++, tf++) {
+               for (i = 0; i < me->totface; i++, tf++) {
                        if (tf->tpage)
                                expand_doit(fd, mainvar, tf->tpage);
                }
@@ -9413,7 +9423,7 @@ static void expand_mesh(FileData *fd, Main *mainvar, Mesh *me)
                        layer = &me->fdata.layers[a];
 
                        if (layer->type == CD_MTFACE) {
-                               mtf = (MTFace *) layer->data;
+                               mtf = (MTFace *)layer->data;
                                for (i = 0; i < me->totface; i++, mtf++) {
                                        if (mtf->tpage)
                                                expand_doit(fd, mainvar, mtf->tpage);
@@ -9428,7 +9438,7 @@ static void expand_mesh(FileData *fd, Main *mainvar, Mesh *me)
                        layer = &me->pdata.layers[a];
 
                        if (layer->type == CD_MTEXPOLY) {
-                               mtp = (MTexPoly *) layer->data;
+                               mtp = (MTexPoly *)layer->data;
 
                                for (i = 0; i < me->totpoly; i++, mtp++) {
                                        if (mtp->tpage)
@@ -9505,7 +9515,7 @@ static void expand_armature(FileData *fd, Main *mainvar, bArmature *arm)
 static void expand_object_expandModifiers(
         void *userData, Object *UNUSED(ob), ID **idpoin, int UNUSED(cb_flag))
 {
-       struct { FileData *fd; Main *mainvar; } *data= userData;
+       struct { FileData *fd; Main *mainvar; } *data = userData;
 
        FileData *fd = data->fd;
        Main *mainvar = data->mainvar;
@@ -9546,7 +9556,7 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
 
        expand_constraint_channels(fd, mainvar, &ob->constraintChannels);
 
-       for (strip=ob->nlastrips.first; strip; strip=strip->next) {
+       for (strip = ob->nlastrips.first; strip; strip = strip->next) {
                expand_doit(fd, mainvar, strip->object);
                expand_doit(fd, mainvar, strip->act);
                expand_doit(fd, mainvar, strip->ipo);
@@ -9638,7 +9648,7 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
                        bMessageActuator *ma = act->data;
                        expand_doit(fd, mainvar, ma->toObject);
                }
-               else if (act->type==ACT_PARENT) {
+               else if (act->type == ACT_PARENT) {
                        bParentActuator *pa = act->data;
                        expand_doit(fd, mainvar, pa->ob);
                }
@@ -9725,7 +9735,7 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
        if (sce->ed) {
                Sequence *seq;
 
-               SEQ_BEGIN (sce->ed, seq)
+               SEQ_BEGIN(sce->ed, seq)
                {
                        expand_idprops(fd, mainvar, seq->prop);
 
@@ -10001,7 +10011,7 @@ static void give_base_to_objects(Main *mainvar, Scene *scene, View3D *v3d, Libra
 {
        Object *ob;
        Base *base;
-       const unsigned int active_lay = (flag & FILE_ACTIVELAY) ? BKE_screen_view3d_layer_active(v3d, scene) : 0;
+       const uint active_lay = (flag & FILE_ACTIVELAY) ? BKE_screen_view3d_layer_active(v3d, scene) : 0;
        const bool is_link = (flag & FILE_LINK) != 0;
 
        BLI_assert(scene);
@@ -10054,7 +10064,7 @@ static void give_base_to_groups(
        Group *group;
        Base *base;
        Object *ob;
-       const unsigned int active_lay = BKE_screen_view3d_layer_active(v3d, scene);
+       const uint active_lay = BKE_screen_view3d_layer_active(v3d, scene);
 
        /* give all objects which are tagged a base */
        for (group = mainvar->group.first; group; group = group->id.next) {
@@ -10222,7 +10232,7 @@ static ID *link_named_part_ex(
 {
        ID *id = link_named_part(mainl, fd, idcode, name, flag);
 
-       if (id && (GS(id->name) == ID_OB)) {    /* loose object: give a base */
+       if (id && (GS(id->name) == ID_OB)) {    /* loose object: give a base */
                link_object_postprocess(id, scene, v3d, flag);
        }
        else if (id && (GS(id->name) == ID_GR)) {
@@ -10245,7 +10255,7 @@ static ID *link_named_part_ex(
  */
 ID *BLO_library_link_named_part(Main *mainl, BlendHandle **bh, const short idcode, const char *name)
 {
-       FileData *fd = (FileData*)(*bh);
+       FileData *fd = (FileData *)(*bh);
        return link_named_part(mainl, fd, idcode, name, 0);
 }
 
@@ -10267,7 +10277,7 @@ ID *BLO_library_link_named_part_ex(
         const short idcode, const char *name, const int flag,
         Scene *scene, View3D *v3d)
 {
-       FileData *fd = (FileData*)(*bh);
+       FileData *fd = (FileData *)(*bh);
        return link_named_part_ex(mainl, fd, idcode, name, flag, scene, v3d);
 }
 
@@ -10350,7 +10360,7 @@ static Main *library_link_begin(Main *mainvar, FileData **fd, const char *filepa
  */
 Main *BLO_library_link_begin(Main *mainvar, BlendHandle **bh, const char *filepath)
 {
-       FileData *fd = (FileData*)(*bh);
+       FileData *fd = (FileData *)(*bh);
        return library_link_begin(mainvar, &fd, filepath);
 }
 
@@ -10470,9 +10480,9 @@ static void library_link_end(Main *mainl, FileData **fd, const short flag, Scene
  */
 void BLO_library_link_end(Main *mainl, BlendHandle **bh, short flag, Scene *scene, View3D *v3d)
 {
-       FileData *fd = (FileData*)(*bh);
+       FileData *fd = (FileData *)(*bh);
        library_link_end(mainl, &fd, flag, scene, v3d);
-       *bh = (BlendHandle*)fd;
+       *bh = (BlendHandle *)fd;
 }
 
 void *BLO_library_read_struct(FileData *fd, BHead *bh, const char *blockname)
@@ -10516,7 +10526,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
                do_it = false;
 
                /* test 1: read libdata */
-               mainptr= mainl->next;
+               mainptr = mainl->next;
                while (mainptr) {
                        if (mainvar_id_tag_any_check(mainptr, LIB_TAG_READ)) {
                                // printf("found LIB_TAG_READ %s (%s)\n", mainptr->curlib->id.name, mainptr->curlib->name);
@@ -10589,7 +10599,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
                                                fd->libmap = oldnewmap_new();
 
                                                mainptr->curlib->filedata = fd;
-                                               mainptr->versionfile=  fd->fileversion;
+                                               mainptr->versionfile =  fd->fileversion;
 
                                                /* subversion */
                                                read_file_version(fd, mainptr);
index 985e816981999faf900b30d57b899570ec0adc90..a4e7be2c2d8877ea1a8ffe1e7c8aeb54e5f38add 100644 (file)
@@ -57,7 +57,7 @@
 
 static int handle_read_msb_int(int handle)
 {
-       unsigned char buf[4];
+       uchar buf[4];
 
        if (read(handle, buf, 4) != 4)
                return -1;
index 37cd69b72f2a6c7d8cc034d69c8294a5b43502db..f55d20b81459587f712719cdd20df0cdc6a132ed 100644 (file)
@@ -97,7 +97,7 @@ void BLO_memfile_merge(MemFile *first, MemFile *second)
 }
 
 void memfile_chunk_add(
-        MemFile *memfile, const char *buf, unsigned int size,
+        MemFile *memfile, const char *buf, uint size,
         MemFileChunk **compchunk_step)
 {
        MemFileChunk *curchunk = MEM_mallocN(sizeof(MemFileChunk), "MemFileChunk");
index 28720ef51456849625a7f3b21276a5d8d1baee22..28ab7b2842ede5f9d7813651f9fc1fb083487790 100644 (file)
@@ -108,11 +108,11 @@ static void area_add_header_region(ScrArea *sa, ListBase *lb)
 
        /* initialize view2d data for header region, to allow panning */
        /* is copy from ui_view2d.c */
-       ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_LIMITZOOM|V2D_KEEPASPECT);
+       ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
        ar->v2d.keepofs = V2D_LOCKOFS_Y;
        ar->v2d.keeptot = V2D_KEEPTOT_STRICT;
-       ar->v2d.align = V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y;
-       ar->v2d.flag = (V2D_PIXELOFS_X|V2D_PIXELOFS_Y);
+       ar->v2d.align = V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y;
+       ar->v2d.flag = (V2D_PIXELOFS_X | V2D_PIXELOFS_Y);
 }
 
 static void sequencer_init_preview_region(ARegion *ar)
@@ -151,7 +151,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
                                BLI_addtail(lb, ar);
                                ar->regiontype = RGN_TYPE_CHANNELS;
                                ar->alignment = RGN_ALIGN_LEFT;
-                               ar->v2d.scroll = (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
+                               ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
 
                                /* for some reason, this doesn't seem to go auto like for NLA... */
                                ar = MEM_callocN(sizeof(ARegion), "area region from do_versions");
@@ -193,7 +193,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
                                BLI_addtail(lb, ar);
                                ar->regiontype = RGN_TYPE_UI;
                                ar->alignment = RGN_ALIGN_LEFT;
-                               ar->v2d.scroll = (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
+                               ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
                                ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
                                /* temporarily hide it */
                                ar->flag = RGN_FLAG_HIDDEN;
@@ -210,7 +210,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
                                ar->alignment = RGN_ALIGN_TOP;
                                break;
                        case SPACE_SEQ:
-                               ar_main = (ARegion*) lb->first;
+                               ar_main = (ARegion *)lb->first;
                                for (; ar_main; ar_main = ar_main->next) {
                                        if (ar_main->regiontype == RGN_TYPE_WINDOW)
                                                break;
@@ -233,7 +233,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
 
                                BLI_addtail(lb, ar);
                                ar->regiontype = RGN_TYPE_TOOL_PROPS;
-                               ar->alignment = RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV;
+                               ar->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
                                ar->flag = RGN_FLAG_HIDDEN;
 
                                /* buttons/list view */
@@ -273,145 +273,145 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
                                break;
 
                        case SPACE_OUTLINER:
-                               {
-                                       SpaceOops *soops = (SpaceOops *)sl;
+                       {
+                               SpaceOops *soops = (SpaceOops *)sl;
 
-                                       memcpy(&ar->v2d, &soops->v2d, sizeof(View2D));
+                               memcpy(&ar->v2d, &soops->v2d, sizeof(View2D));
 
-                                       ar->v2d.scroll &= ~V2D_SCROLL_LEFT;
-                                       ar->v2d.scroll |= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
-                                       ar->v2d.align = (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y);
-                                       ar->v2d.keepzoom |= (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_KEEPASPECT);
-                                       ar->v2d.keeptot = V2D_KEEPTOT_STRICT;
-                                       ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f;
-                                       //ar->v2d.flag |= V2D_IS_INITIALISED;
-                               }
+                               ar->v2d.scroll &= ~V2D_SCROLL_LEFT;
+                               ar->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
+                               ar->v2d.align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y);
+                               ar->v2d.keepzoom |= (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_KEEPASPECT);
+                               ar->v2d.keeptot = V2D_KEEPTOT_STRICT;
+                               ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f;
+                               //ar->v2d.flag |= V2D_IS_INITIALISED;
                                break;
+                       }
                        case SPACE_TIME:
-                               {
-                                       SpaceTime *stime = (SpaceTime *)sl;
-                                       memcpy(&ar->v2d, &stime->v2d, sizeof(View2D));
-
-                                       ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
-                                       ar->v2d.align |= V2D_ALIGN_NO_NEG_Y;
-                                       ar->v2d.keepofs |= V2D_LOCKOFS_Y;
-                                       ar->v2d.keepzoom |= V2D_LOCKZOOM_Y;
-                                       ar->v2d.tot.ymin = ar->v2d.cur.ymin = -10.0;
-                                       ar->v2d.min[1] = ar->v2d.max[1] = 20.0;
-                               }
+                       {
+                               SpaceTime *stime = (SpaceTime *)sl;
+                               memcpy(&ar->v2d, &stime->v2d, sizeof(View2D));
+
+                               ar->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL);
+                               ar->v2d.align |= V2D_ALIGN_NO_NEG_Y;
+                               ar->v2d.keepofs |= V2D_LOCKOFS_Y;
+                               ar->v2d.keepzoom |= V2D_LOCKZOOM_Y;
+                               ar->v2d.tot.ymin = ar->v2d.cur.ymin = -10.0;
+                               ar->v2d.min[1] = ar->v2d.max[1] = 20.0;
                                break;
+                       }
                        case SPACE_IPO:
-                               {
-                                       SpaceIpo *sipo = (SpaceIpo *)sl;
-                                       memcpy(&ar->v2d, &sipo->v2d, sizeof(View2D));
+                       {
+                               SpaceIpo *sipo = (SpaceIpo *)sl;
+                               memcpy(&ar->v2d, &sipo->v2d, sizeof(View2D));
 
-                                       /* init mainarea view2d */
-                                       ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
-                                       ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL);
+                               /* init mainarea view2d */
+                               ar->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL);
+                               ar->v2d.scroll |= (V2D_SCROLL_LEFT | V2D_SCROLL_SCALE_VERTICAL);
 
-                                       ar->v2d.min[0] = FLT_MIN;
-                                       ar->v2d.min[1] = FLT_MIN;
+                               ar->v2d.min[0] = FLT_MIN;
+                               ar->v2d.min[1] = FLT_MIN;
 
-                                       ar->v2d.max[0] = MAXFRAMEF;
-                                       ar->v2d.max[1] = FLT_MAX;
+                               ar->v2d.max[0] = MAXFRAMEF;
+                               ar->v2d.max[1] = FLT_MAX;
 
-                                       //ar->v2d.flag |= V2D_IS_INITIALISED;
-                                       break;
-                               }
+                               //ar->v2d.flag |= V2D_IS_INITIALISED;
+                               break;
+                       }
                        case SPACE_NLA:
-                               {
-                                       SpaceNla *snla = (SpaceNla *)sl;
-                                       memcpy(&ar->v2d, &snla->v2d, sizeof(View2D));
+                       {
+                               SpaceNla *snla = (SpaceNla *)sl;
+                               memcpy(&ar->v2d, &snla->v2d, sizeof(View2D));
 
-                                       ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
-                                       ar->v2d.tot.ymax = 0.0f;
+                               ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
+                               ar->v2d.tot.ymax = 0.0f;
 
-                                       ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
-                                       ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
-                                       ar->v2d.align = V2D_ALIGN_NO_POS_Y;
-                                       ar->v2d.flag |= V2D_VIEWSYNC_AREA_VERTICAL;
-                                       break;
-                               }
+                               ar->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL);
+                               ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
+                               ar->v2d.align = V2D_ALIGN_NO_POS_Y;
+                               ar->v2d.flag |= V2D_VIEWSYNC_AREA_VERTICAL;
+                               break;
+                       }
                        case SPACE_ACTION:
-                               {
-                                       SpaceAction *saction = (SpaceAction *) sl;
-
-                                       /* we totally reinit the view for the Action Editor, as some old instances had some weird cruft set */
-                                       ar->v2d.tot.xmin = -20.0f;
-                                       ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
-                                       ar->v2d.tot.xmax = (float)((sa->winx > 120) ? (sa->winx) : 120);
-                                       ar->v2d.tot.ymax = 0.0f;
-
-                                       ar->v2d.cur = ar->v2d.tot;
-
-                                       ar->v2d.min[0] = 0.0f;
-                                       ar->v2d.min[1] = 0.0f;
-
-                                       ar->v2d.max[0] = MAXFRAMEF;
-                                       ar->v2d.max[1] = FLT_MAX;
-
-                                       ar->v2d.minzoom = 0.01f;
-                                       ar->v2d.maxzoom = 50;
-                                       ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
-                                       ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
-                                       ar->v2d.keepzoom = V2D_LOCKZOOM_Y;
-                                       ar->v2d.align = V2D_ALIGN_NO_POS_Y;
-                                       ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
-
-                                       /* for old files with ShapeKey editors open + an action set, clear the action as
-                                        * it doesn't make sense in the new system (i.e. violates concept that ShapeKey edit
-                                        * only shows ShapeKey-rooted actions only)
-                                        */
-                                       if (saction->mode == SACTCONT_SHAPEKEY)
-                                               saction->action = NULL;
-                                       break;
-                               }
+                       {
+                               SpaceAction *saction = (SpaceAction *)sl;
+
+                               /* we totally reinit the view for the Action Editor, as some old instances had some weird cruft set */
+                               ar->v2d.tot.xmin = -20.0f;
+                               ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
+                               ar->v2d.tot.xmax = (float)((sa->winx > 120) ? (sa->winx) : 120);
+                               ar->v2d.tot.ymax = 0.0f;
+
+                               ar->v2d.cur = ar->v2d.tot;
+
+                               ar->v2d.min[0] = 0.0f;
+                               ar->v2d.min[1] = 0.0f;
+
+                               ar->v2d.max[0] = MAXFRAMEF;
+                               ar->v2d.max[1] = FLT_MAX;
+
+                               ar->v2d.minzoom = 0.01f;
+                               ar->v2d.maxzoom = 50;
+                               ar->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL);
+                               ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
+                               ar->v2d.keepzoom = V2D_LOCKZOOM_Y;
+                               ar->v2d.align = V2D_ALIGN_NO_POS_Y;
+                               ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
+
+                               /* for old files with ShapeKey editors open + an action set, clear the action as
+                                * it doesn't make sense in the new system (i.e. violates concept that ShapeKey edit
+                                * only shows ShapeKey-rooted actions only)
+                                */
+                               if (saction->mode == SACTCONT_SHAPEKEY)
+                                       saction->action = NULL;
+                               break;
+                       }
                        case SPACE_SEQ:
-                               {
-                                       SpaceSeq *sseq = (SpaceSeq *)sl;
-                                       memcpy(&ar->v2d, &sseq->v2d, sizeof(View2D));
+                       {
+                               SpaceSeq *sseq = (SpaceSeq *)sl;
+                               memcpy(&ar->v2d, &sseq->v2d, sizeof(View2D));
 
-                                       ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
-                                       ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL);
-                                       ar->v2d.align = V2D_ALIGN_NO_NEG_Y;
-                                       ar->v2d.flag |= V2D_IS_INITIALISED;
-                                       break;
-                               }
+                               ar->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL);
+                               ar->v2d.scroll |= (V2D_SCROLL_LEFT | V2D_SCROLL_SCALE_VERTICAL);
+                               ar->v2d.align = V2D_ALIGN_NO_NEG_Y;
+                               ar->v2d.flag |= V2D_IS_INITIALISED;
+                               break;
+                       }
                        case SPACE_NODE:
-                               {
-                                       SpaceNode *snode = (SpaceNode *)sl;
-                                       memcpy(&ar->v2d, &snode->v2d, sizeof(View2D));
+                       {
+                               SpaceNode *snode = (SpaceNode *)sl;
+                               memcpy(&ar->v2d, &snode->v2d, sizeof(View2D));
 
-                                       ar->v2d.scroll = (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
-                                       ar->v2d.keepzoom = V2D_LIMITZOOM|V2D_KEEPASPECT;
-                                       break;
-                               }
+                               ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
+                               ar->v2d.keepzoom = V2D_LIMITZOOM | V2D_KEEPASPECT;
+                               break;
+                       }
                        case SPACE_BUTS:
-                               {
-                                       SpaceButs *sbuts = (SpaceButs *)sl;
-                                       memcpy(&ar->v2d, &sbuts->v2d, sizeof(View2D));
+                       {
+                               SpaceButs *sbuts = (SpaceButs *)sl;
+                               memcpy(&ar->v2d, &sbuts->v2d, sizeof(View2D));
 
-                                       ar->v2d.scroll |= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
-                                       break;
-                               }
+                               ar->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
+                               break;
+                       }
                        case SPACE_FILE:
-                               {
-                                       // SpaceFile *sfile = (SpaceFile *)sl;
-                                       ar->v2d.tot.xmin = ar->v2d.tot.ymin = 0;
-                                       ar->v2d.tot.xmax = ar->winx;
-                                       ar->v2d.tot.ymax = ar->winy;
-                                       ar->v2d.cur = ar->v2d.tot;
-                                       ar->regiontype = RGN_TYPE_WINDOW;
-                                       ar->v2d.scroll = (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
-                                       ar->v2d.align = (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y);
-                                       ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_LIMITZOOM|V2D_KEEPASPECT);
-                                       break;
-                               }
+                       {
+                               // SpaceFile *sfile = (SpaceFile *)sl;
+                               ar->v2d.tot.xmin = ar->v2d.tot.ymin = 0;
+                               ar->v2d.tot.xmax = ar->winx;
+                               ar->v2d.tot.ymax = ar->winy;
+                               ar->v2d.cur = ar->v2d.tot;
+                               ar->regiontype = RGN_TYPE_WINDOW;
+                               ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
+                               ar->v2d.align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y);
+                               ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
+                               break;
+                       }
                        case SPACE_TEXT:
-                               {
-                                       SpaceText *st = (SpaceText *)sl;
-                                       st->flags |= ST_FIND_WRAP;
-                               }
+                       {
+                               SpaceText *st = (SpaceText *)sl;
+                               st->flags |= ST_FIND_WRAP;
+                       }
                                //case SPACE_XXX: // FIXME... add other ones
                                //      memcpy(&ar->v2d, &((SpaceXxx *)sl)->v2d, sizeof(View2D));
                                //      break;
@@ -435,13 +435,13 @@ static void do_versions_windowmanager_2_50(bScreen *screen)
                /* space imageselect is deprecated */
                for (sl = sa->spacedata.first; sl; sl = sl->next) {
                        if (sl->spacetype == SPACE_IMASEL)
-                               sl->spacetype = SPACE_EMPTY;    /* spacedata then matches */
+                               sl->spacetype = SPACE_EMPTY;    /* spacedata then matches */
                }
 
                /* space sound is deprecated */
                for (sl = sa->spacedata.first; sl; sl = sl->next) {
                        if (sl->spacetype == SPACE_SOUND)
-                               sl->spacetype = SPACE_EMPTY;    /* spacedata then matches */
+                               sl->spacetype = SPACE_EMPTY;    /* spacedata then matches */
                }
 
                /* it seems to be possible in 2.5 to have this saved, filewindow probably */
@@ -464,7 +464,7 @@ static void versions_gpencil_add_main(ListBase *lb, ID *id, const char *name)
        BLI_addtail(lb, id);
        id->us = 1;
        id->flag = LIB_FAKEUSER;
-       *( (short *)id->name )= ID_GD;
+       *( (short *)id->name= ID_GD;
 
        new_id(lb, id, name);
        /* alphabetic insertion: is in new_id */
@@ -482,29 +482,29 @@ static void do_versions_gpencil_2_50(Main *main, bScreen *screen)
        for (sa = screen->areabase.first; sa; sa = sa->next) {
                for (sl = sa->spacedata.first; sl; sl = sl->next) {
                        if (sl->spacetype == SPACE_VIEW3D) {
-                               View3D *v3d = (View3D*) sl;
+                               View3D *v3d = (View3D *)sl;
                                if (v3d->gpd) {
                                        versions_gpencil_add_main(&main->gpencil, (ID *)v3d->gpd, "GPencil View3D");
                                        v3d->gpd = NULL;
                                }
                        }
                        else if (sl->spacetype == SPACE_NODE) {
-                               SpaceNode *snode = (SpaceNode *) sl;
+                               SpaceNode *snode = (SpaceNode *)sl;
                                if (snode->gpd) {
                                        versions_gpencil_add_main(&main->gpencil, (ID *)snode->gpd, "GPencil Node");
                                        snode->gpd = NULL;
                                }
                        }
                        else if (sl->spacetype == SPACE_SEQ) {
-                               SpaceSeq *sseq = (SpaceSeq *) sl;
+                               SpaceSeq *sseq = (SpaceSeq *)sl;
                                if (sseq->gpd) {
                                        versions_gpencil_add_main(&main->gpencil, (ID *)sseq->gpd, "GPencil Node");
                                        sseq->gpd = NULL;
                                }
                        }
                        else if (sl->spacetype == SPACE_IMAGE) {
-                               SpaceImage *sima = (SpaceImage *) sl;
-#if 0                  /* see comment on r28002 */
+                               SpaceImage *sima = (SpaceImage *)sl;
+#if 0           /* see comment on r28002 */
                                if (sima->gpd) {
                                        versions_gpencil_add_main(&main->gpencil, (ID *)sima->gpd, "GPencil Image");
                                        sima->gpd = NULL;
@@ -538,45 +538,45 @@ static void do_version_mtex_factor_2_50(MTex **mtex_array, short idtype)
                        if (neg & MAP_NORM) mtex->norfac = -mtex->norfac;
                        if (neg & MAP_WARP) mtex->warpfac = -mtex->warpfac;
 
-                       mtex->colspecfac = (neg & MAP_COLSPEC)? -colfac: colfac;
-                       mtex->mirrfac = (neg & MAP_COLMIR)? -colfac: colfac;
-                       mtex->alphafac = (neg & MAP_ALPHA)? -varfac: varfac;
-                       mtex->difffac = (neg & MAP_REF)? -varfac: varfac;
-                       mtex->specfac = (neg & MAP_SPEC)? -varfac: varfac;
-                       mtex->emitfac = (neg & MAP_EMIT)? -varfac: varfac;
-                       mtex->hardfac = (neg & MAP_HAR)? -varfac: varfac;
-                       mtex->raymirrfac = (neg & MAP_RAYMIRR)? -varfac: varfac;
-                       mtex->translfac = (neg & MAP_TRANSLU)? -varfac: varfac;
-                       mtex->ambfac = (neg & MAP_AMB)? -varfac: varfac;
-                       mtex->colemitfac = (neg & MAP_EMISSION_COL)? -colfac: colfac;
-                       mtex->colreflfac = (neg & MAP_REFLECTION_COL)? -colfac: colfac;
-                       mtex->coltransfac = (neg & MAP_TRANSMISSION_COL)? -colfac: colfac;
-                       mtex->densfac = (neg & MAP_DENSITY)? -varfac: varfac;
-                       mtex->scatterfac = (neg & MAP_SCATTERING)? -varfac: varfac;
-                       mtex->reflfac = (neg & MAP_REFLECTION)? -varfac: varfac;
-
-                       mtex->timefac = (neg & MAP_PA_TIME)? -varfac: varfac;
-                       mtex->lengthfac = (neg & MAP_PA_LENGTH)? -varfac: varfac;
-                       mtex->clumpfac = (neg & MAP_PA_CLUMP)? -varfac: varfac;
-                       mtex->kinkfac = (neg & MAP_PA_KINK)? -varfac: varfac;
-                       mtex->roughfac = (neg & MAP_PA_ROUGH)? -varfac: varfac;
-                       mtex->padensfac = (neg & MAP_PA_DENS)? -varfac: varfac;
-                       mtex->lifefac = (neg & MAP_PA_LIFE)? -varfac: varfac;
-                       mtex->sizefac = (neg & MAP_PA_SIZE)? -varfac: varfac;
-                       mtex->ivelfac = (neg & MAP_PA_IVEL)? -varfac: varfac;
-
-                       mtex->shadowfac = (neg & LAMAP_SHAD)? -colfac: colfac;
-
-                       mtex->zenupfac = (neg & WOMAP_ZENUP)? -colfac: colfac;
-                       mtex->zendownfac = (neg & WOMAP_ZENDOWN)? -colfac: colfac;
-                       mtex->blendfac = (neg & WOMAP_BLEND)? -varfac: varfac;
+                       mtex->colspecfac = (neg & MAP_COLSPEC) ? -colfac : colfac;
+                       mtex->mirrfac = (neg & MAP_COLMIR) ? -colfac : colfac;
+                       mtex->alphafac = (neg & MAP_ALPHA) ? -varfac : varfac;
+                       mtex->difffac = (neg & MAP_REF) ? -varfac : varfac;
+                       mtex->specfac = (neg & MAP_SPEC) ? -varfac : varfac;
+                       mtex->emitfac = (neg & MAP_EMIT) ? -varfac : varfac;
+                       mtex->hardfac = (neg & MAP_HAR) ? -varfac : varfac;
+                       mtex->raymirrfac = (neg & MAP_RAYMIRR) ? -varfac : varfac;
+                       mtex->translfac = (neg & MAP_TRANSLU) ? -varfac : varfac;
+                       mtex->ambfac = (neg & MAP_AMB) ? -varfac : varfac;
+                       mtex->colemitfac = (neg & MAP_EMISSION_COL) ? -colfac : colfac;
+                       mtex->colreflfac = (neg & MAP_REFLECTION_COL) ? -colfac : colfac;
+                       mtex->coltransfac = (neg & MAP_TRANSMISSION_COL) ? -colfac : colfac;
+                       mtex->densfac = (neg & MAP_DENSITY) ? -varfac : varfac;
+                       mtex->scatterfac = (neg & MAP_SCATTERING) ? -varfac : varfac;
+                       mtex->reflfac = (neg & MAP_REFLECTION) ? -varfac : varfac;
+
+                       mtex->timefac = (neg & MAP_PA_TIME) ? -varfac : varfac;
+                       mtex->lengthfac = (neg & MAP_PA_LENGTH) ? -varfac : varfac;
+                       mtex->clumpfac = (neg & MAP_PA_CLUMP) ? -varfac : varfac;
+                       mtex->kinkfac = (neg & MAP_PA_KINK) ? -varfac : varfac;
+                       mtex->roughfac = (neg & MAP_PA_ROUGH) ? -varfac : varfac;
+                       mtex->padensfac = (neg & MAP_PA_DENS) ? -varfac : varfac;
+                       mtex->lifefac = (neg & MAP_PA_LIFE) ? -varfac : varfac;
+                       mtex->sizefac = (neg & MAP_PA_SIZE) ? -varfac : varfac;
+                       mtex->ivelfac = (neg & MAP_PA_IVEL) ? -varfac : varfac;
+
+                       mtex->shadowfac = (neg & LAMAP_SHAD) ? -colfac : colfac;
+
+                       mtex->zenupfac = (neg & WOMAP_ZENUP) ? -colfac : colfac;
+                       mtex->zendownfac = (neg & WOMAP_ZENDOWN) ? -colfac : colfac;
+                       mtex->blendfac = (neg & WOMAP_BLEND) ? -varfac : varfac;
 
                        if (idtype == ID_MA)
-                               mtex->colfac = (neg & MAP_COL)? -colfac: colfac;
+                               mtex->colfac = (neg & MAP_COL) ? -colfac : colfac;
                        else if (idtype == ID_LA)
-                               mtex->colfac = (neg & LAMAP_COL)? -colfac: colfac;
+                               mtex->colfac = (neg & LAMAP_COL) ? -colfac : colfac;
                        else if (idtype == ID_WO)
-                               mtex->colfac = (neg & WOMAP_HORIZ)? -colfac: colfac;
+                               mtex->colfac = (neg & WOMAP_HORIZ) ? -colfac : colfac;
                }
        }
 }
@@ -590,7 +590,7 @@ static void do_version_mdef_250(Main *main)
        for (ob = main->object.first; ob; ob = ob->id.next) {
                for (md = ob->modifiers.first; md; md = md->next) {
                        if (md->type == eModifierType_MeshDeform) {
-                               mmd = (MeshDeformModifierData*) md;
+                               mmd = (MeshDeformModifierData *)md;
 
                                if (mmd->bindcos) {
                                        /* make bindcos NULL in order to trick older versions
@@ -665,14 +665,14 @@ static bNodeSocket *do_versions_node_group_add_socket_2_56_2(bNodeTree *ngroup,
        gsock->link = NULL;
        /* assign new unique index */
        gsock->own_index = ngroup->cur_index++;
-       gsock->limit = (in_out==SOCK_IN ? 0xFFF : 1);
+       gsock->limit = (in_out == SOCK_IN ? 0xFFF : 1);
 
 //     if (stype->value_structsize > 0)
 //             gsock->default_value = MEM_callocN(stype->value_structsize, "default socket value");
 
-       BLI_addtail(in_out==SOCK_IN ? &ngroup->inputs : &ngroup->outputs, gsock);
+       BLI_addtail(in_out == SOCK_IN ? &ngroup->inputs : &ngroup->outputs, gsock);
 
-       ngroup->update |= (in_out==SOCK_IN ? NTREE_UPDATE_GROUP_IN : NTREE_UPDATE_GROUP_OUT);
+       ngroup->update |= (in_out == SOCK_IN ? NTREE_UPDATE_GROUP_IN : NTREE_UPDATE_GROUP_OUT);
 
        return gsock;
 }
@@ -749,7 +749,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                for (ob = bmain->object.first; ob; ob = ob->id.next) {
                        for (act = ob->actuators.first; act; act = act->next) {
                                if (act->type == ACT_SOUND) {
-                                       bSoundActuator *sAct = (bSoundActuator*) act->data;
+                                       bSoundActuator *sAct = (bSoundActuator *)act->data;
                                        if (sAct->sound) {
                                                sound = blo_do_versions_newlibadr(fd, lib, sAct->sound);
                                                sAct->flag = (sound->flags & SOUND_FLAGS_3D) ? ACT_SND_3D_SOUND : 0;
@@ -775,7 +775,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
 
                for (scene = bmain->scene.first; scene; scene = scene->id.next) {
                        if (scene->ed && scene->ed->seqbasep) {
-                               SEQ_BEGIN (scene->ed, seq)
+                               SEQ_BEGIN(scene->ed, seq)
                                {
                                        if (seq->type == SEQ_TYPE_SOUND_HD) {
                                                char str[FILE_MAX];
@@ -787,7 +787,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
 #define SEQ_USE_PROXY_CUSTOM_FILE (1 << 21)
                                        /* don't know, if anybody used that this way, but just in case, upgrade to new way... */
                                        if ((seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) &&
-                                          !(seq->flag & SEQ_USE_PROXY_CUSTOM_DIR))
+                                           !(seq->flag & SEQ_USE_PROXY_CUSTOM_DIR))
                                        {
                                                BLI_snprintf(seq->strip->proxy->dir, FILE_MAXDIR, "%s/BL_proxy", seq->strip->dir);
                                        }
@@ -857,7 +857,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
 
                /* copy standard draw flag to meshes(used to be global, is not available here) */
                for (me = bmain->mesh.first; me; me = me->id.next) {
-                       me->drawflag = ME_DRAWEDGES|ME_DRAWFACES|ME_DRAWCREASES;
+                       me->drawflag = ME_DRAWEDGES | ME_DRAWFACES | ME_DRAWCREASES;
                }
 
                /* particle draw and render types */
@@ -939,7 +939,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
 
                                ob->matbits = MEM_calloc_arrayN(ob->totcol, sizeof(char), "ob->matbits");
                                for (a = 0; a < ob->totcol; a++)
-                                       ob->matbits[a] = (ob->colbits & (1<<a)) != 0;
+                                       ob->matbits[a] = (ob->colbits & (1 << a)) != 0;
                        }
                }
 
@@ -962,7 +962,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                                ma->mode &= ~MA_HALO;
                        }
 
-                       if (ma->mode & (MA_ZTRANSP|MA_RAYTRANSP)) {
+                       if (ma->mode & (MA_ZTRANSP | MA_RAYTRANSP)) {
                                ma->mode |= MA_TRANSP;
                        }
                        else {
@@ -979,7 +979,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                                                ma->mtex[a]->texflag |= MTEX_BUMP_OBJECTSPACE;
                                        }
                                        else {
-                                               tex = (Tex*) blo_do_versions_newlibadr(fd, ma->id.lib, tex);
+                                               tex = (Tex *)blo_do_versions_newlibadr(fd, ma->id.lib, tex);
                                                if (tex && tex->type == 0) { /* invalid type */
                                                        ma->mtex[a]->texflag |= MTEX_3TAP_BUMP;
                                                        ma->mtex[a]->texflag |= MTEX_BUMP_OBJECTSPACE;
@@ -1060,9 +1060,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                        sce->gm.depth = sce->r.depth;
 
                        /* Physic (previously stored in world) */
-                       sce->gm.gravity =9.8f;
+                       sce->gm.gravity = 9.8f;
                        sce->gm.physicsEngine = WOPHY_BULLET; /* Bullet by default */
-                       sce->gm.mode = WO_DBVT_CULLING; /* DBVT culling by default */
+                       sce->gm.mode = WO_DBVT_CULLING; /* DBVT culling by default */
                        sce->gm.occlusionRes = 128;
                        sce->gm.ticrate = 60;
                        sce->gm.maxlogicstep = 5;
@@ -1131,7 +1131,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
 
                for (ob = bmain->object.first; ob; ob = ob->id.next) {
                        /* fluid-sim stuff */
-                       FluidsimModifierData *fluidmd = (FluidsimModifierData *) modifiers_findByType(ob, eModifierType_Fluidsim);
+                       FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
                        if (fluidmd)
                                fluidmd->fss->fmd = fluidmd;
 
@@ -1186,7 +1186,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                /* Assign proper global gravity weights for dynamics (only z-coordinate is taken into account) */
                if (do_gravity) {
                        for (part = bmain->particle.first; part; part = part->id.next)
-                               part->effector_weights->global_gravity = part->acc[2]/-9.81f;
+                               part->effector_weights->global_gravity = part->acc[2] / -9.81f;
                }
 
                for (ob = bmain->object.first; ob; ob = ob->id.next) {
@@ -1194,13 +1194,13 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
 
                        if (do_gravity) {
                                for (md = ob->modifiers.first; md; md = md->next) {
-                                       ClothModifierData *clmd = (ClothModifierData *) modifiers_findByType(ob, eModifierType_Cloth);
+                                       ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth);
                                        if (clmd)
-                                               clmd->sim_parms->effector_weights->global_gravity = clmd->sim_parms->gravity[2]/-9.81f;
+                                               clmd->sim_parms->effector_weights->global_gravity = clmd->sim_parms->gravity[2] / -9.81f;
                                }
 
                                if (ob->soft)
-                                       ob->soft->effector_weights->global_gravity = ob->soft->grav/9.81f;
+                                       ob->soft->effector_weights->global_gravity = ob->soft->grav / 9.81f;
                        }
 
                        /* Normal wind shape is plane */
@@ -1268,7 +1268,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                for (lt = bmain->latt.first; lt; lt = lt->id.next) {
                        if ((key = blo_do_versions_newlibadr(fd, lib, lt->key)) && key->refkey) {
                                data = key->refkey->data;
-                               tot = MIN2(lt->pntsu*lt->pntsv*lt->pntsw, key->refkey->totelem);
+                               tot = MIN2(lt->pntsu * lt->pntsv * lt->pntsw, key->refkey->totelem);
 
                                for (a = 0; a < tot; a++, data += 3)
                                        copy_v3_v3(lt->def[a].vec, data);
@@ -1284,16 +1284,16 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                                                BezTriple *bezt = nu->bezt;
 
                                                for (a = 0; a < nu->pntsu; a++, bezt++) {
-                                                       copy_v3_v3(bezt->vec[0], data); data+=3;
-                                                       copy_v3_v3(bezt->vec[1], data); data+=3;
-                                                       copy_v3_v3(bezt->vec[2], data); data+=3;
+                                                       copy_v3_v3(bezt->vec[0], data); data += 3;
+                                                       copy_v3_v3(bezt->vec[1], data); data += 3;
+                                                       copy_v3_v3(bezt->vec[2], data); data += 3;
                                                        bezt->alfa = *data; data++;
                                                }
                                        }
                                        else if (nu->bp) {
                                                BPoint *bp = nu->bp;
 
-                                               for (a = 0; a < nu->pntsu*nu->pntsv; a++, bp++) {
+                                               for (a = 0; a < nu->pntsu * nu->pntsv; a++, bp++) {
                                                        copy_v3_v3(bp->vec, data); data += 3;
                                                        bp->alfa = *data; data++;
                                                }
@@ -1350,7 +1350,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                                for (sa = screen->areabase.first; sa; sa = sa->next) {
                                        for (sl = sa->spacedata.first; sl; sl = sl->next) {
                                                if (sl->spacetype == SPACE_VIEW3D) {
-                                                       View3D *v3d = (View3D *) sl;
+                                                       View3D *v3d = (View3D *)sl;
                                                        if (v3d->drawtype == OB_MATERIAL)
                                                                v3d->drawtype = OB_SOLID;
                                                }
@@ -1439,7 +1439,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                                multires_load_old_250(me);
 
                        for (ob = bmain->object.first; ob; ob = ob->id.next) {
-                               MultiresModifierData *mmd = (MultiresModifierData *) modifiers_findByType(ob, eModifierType_Multires);
+                               MultiresModifierData *mmd = (MultiresModifierData *)modifiers_findByType(ob, eModifierType_Multires);
 
                                if (mmd) {
                                        mmd->totlvl--;
@@ -1533,7 +1533,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                                                        if (sseq->mainb == 0)
                                                                sseq->mainb = SEQ_DRAW_IMG_IMBUF;
 
-                                                       ar_main = (ARegion*)regionbase->first;
+                                                       ar_main = (ARegion *)regionbase->first;
                                                        for (; ar_main; ar_main = ar_main->next) {
                                                                if (ar_main->regiontype == RGN_TYPE_WINDOW)
                                                                        break;
@@ -1693,7 +1693,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                                                regionbase = &sl->regionbase;
 
                                        if (ELEM(sl->spacetype, SPACE_ACTION, SPACE_NLA)) {
-                                               for (ar = (ARegion*) regionbase->first; ar; ar = ar->next) {
+                                               for (ar = (ARegion *)regionbase->first; ar; ar = ar->next) {
                                                        if (ar->regiontype == RGN_TYPE_WINDOW) {
                                                                ar->v2d.cur.ymax = ar->v2d.tot.ymax = 0.0f;
                                                                ar->v2d.cur.ymin = ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
@@ -1795,7 +1795,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                                                                regionbase = &sl->regionbase;
                                                        }
 
-                                                       ar_preview = (ARegion*) regionbase->first;
+                                                       ar_preview = (ARegion *)regionbase->first;
                                                        for (; ar_preview; ar_preview = ar_preview->next) {
                                                                if (ar_preview->regiontype == RGN_TYPE_PREVIEW)
                                                                        break;
@@ -1810,7 +1810,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                } /* sequencer changes */
        }
 
-       if (bmain->versionfile <= 251) {        /* 2.5.1 had no subversions */
+       if (bmain->versionfile <= 251) {    /* 2.5.1 had no subversions */
                bScreen *sc;
 
                /* Blender 2.5.2 - subversion 0 introduced a new setting: V3D_RENDER_OVERRIDE.
@@ -1847,7 +1847,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                        ModifierData *md;
                        for (md = ob->modifiers.first; md; md = md->next) {
                                if (md->type == eModifierType_Fluidsim) {
-                                       FluidsimModifierData *fmd = (FluidsimModifierData *) md;
+                                       FluidsimModifierData *fmd = (FluidsimModifierData *)md;
                                        fmd->fss->flag |= OB_FLUIDSIM_ACTIVE;
                                        fmd->fss->flag |= OB_FLUIDSIM_OVERRIDE_TIME;
                                }
@@ -1861,7 +1861,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
 
                                while (node) {
                                        if (node->type == CMP_NODE_COLORBALANCE) {
-                                               NodeColorBalance *n = (NodeColorBalance *) node->storage;
+                                               NodeColorBalance *n = (NodeColorBalance *)node->storage;
                                                n->lift[0] += 1.f;
                                                n->lift[1] += 1.f;
                                                n->lift[2] += 1.f;
@@ -1876,7 +1876,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
 
                        while (node) {
                                if (node->type == CMP_NODE_COLORBALANCE) {
-                                       NodeColorBalance *n = (NodeColorBalance *) node->storage;
+                                       NodeColorBalance *n = (NodeColorBalance *)node->storage;
                                        n->lift[0] += 1.f;
                                        n->lift[1] += 1.f;
                                        n->lift[2] += 1.f;
@@ -1907,7 +1907,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
 
                                for (sl = sa->spacedata.first; sl; sl = sl->next) {
                                        if (sl->spacetype == SPACE_IMAGE) {
-                                               SpaceImage *sima = (SpaceImage *) sl;
+                                               SpaceImage *sima = (SpaceImage *)sl;
                                                scopes_new(&sima->scopes);
                                        }
                                }
@@ -1929,7 +1929,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
 
                                for (sl = sa->spacedata.first; sl; sl = sl->next) {
                                        if (sl->spacetype == SPACE_NODE) {
-                                               SpaceNode *snode = (SpaceNode *) sl;
+                                               SpaceNode *snode = (SpaceNode *)sl;
                                                ListBase *regionbase;
                                                ARegion *ar;
 
@@ -1953,12 +1953,12 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                                                }
                                        }
                                        else if (sl->spacetype == SPACE_TIME) {
-                                               SpaceTime *stime = (SpaceTime *) sl;
+                                               SpaceTime *stime = (SpaceTime *)sl;
 
                                                /* enable all cache display */
                                                stime->cache_display |= TIME_CACHE_DISPLAY;
-                                               stime->cache_display |= (TIME_CACHE_SOFTBODY|TIME_CACHE_PARTICLES);
-                                               stime->cache_display |= (TIME_CACHE_CLOTH|TIME_CACHE_SMOKE|TIME_CACHE_DYNAMICPAINT);
+                                               stime->cache_display |= (TIME_CACHE_SOFTBODY | TIME_CACHE_PARTICLES);
+                                               stime->cache_display |= (TIME_CACHE_CLOTH | TIME_CACHE_SMOKE | TIME_CACHE_DYNAMICPAINT);
                                        }
                                }
                        }
@@ -1969,32 +1969,32 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                /* parent type to modifier */
                for (ob = bmain->object.first; ob; ob = ob->id.next) {
                        if (ob->parent) {
-                               Object *parent = (Object *) blo_do_versions_newlibadr(fd, lib, ob->parent);
+                               Object *parent = (Object *)blo_do_versions_newlibadr(fd, lib, ob->parent);
                                if (parent) { /* parent may not be in group */
                                        if (parent->type == OB_ARMATURE && ob->partype == PARSKEL) {
                                                ArmatureModifierData *amd;
-                                               bArmature *arm = (bArmature *) blo_do_versions_newlibadr(fd, lib, parent->data);
+                                               bArmature *arm = (bArmature *)blo_do_versions_newlibadr(fd, lib, parent->data);
 
-                                               amd = (ArmatureModifierData*) modifier_new(eModifierType_Armature);
+                                               amd = (ArmatureModifierData *)modifier_new(eModifierType_Armature);
                                                amd->object = ob->parent;
-                                               BLI_addtail((ListBase*)&ob->modifiers, amd);
+                                               BLI_addtail((ListBase *)&ob->modifiers, amd);
                                                amd->deformflag = arm->deformflag;
                                                ob->partype = PAROBJECT;
                                        }
                                        else if (parent->type == OB_LATTICE && ob->partype == PARSKEL) {
                                                LatticeModifierData *lmd;
 
-                                               lmd = (LatticeModifierData*) modifier_new(eModifierType_Lattice);
+                                               lmd = (LatticeModifierData *)modifier_new(eModifierType_Lattice);
                                                lmd->object = ob->parent;
-                                               BLI_addtail((ListBase*)&ob->modifiers, lmd);
+                                               BLI_addtail((ListBase *)&ob->modifiers, lmd);
                                                ob->partype = PAROBJECT;
                                        }
                                        else if (parent->type == OB_CURVE && ob->partype == PARCURVE) {
                                                CurveModifierData *cmd;
 
-                                               cmd = (CurveModifierData*) modifier_new(eModifierType_Curve);
+                                               cmd = (CurveModifierData *)modifier_new(eModifierType_Curve);
                                                cmd->object = ob->parent;
-                                               BLI_addtail((ListBase*)&ob->modifiers, cmd);
+                                               BLI_addtail((ListBase *)&ob->modifiers, cmd);
                                                ob->partype = PAROBJECT;
                                        }
                                }
@@ -2005,8 +2005,8 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                for (scene = bmain->scene.first; scene; scene = scene->id.next) {
                        int i;
                        for (i = 0; i < 20; i++) {
-                               if (scene->lay & (1<<i)) {
-                                       scene->layact = 1<<i;
+                               if (scene->lay & (1 << i)) {
+                                       scene->layact = 1 << i;
                                        break;
                                }
                        }
@@ -2029,7 +2029,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                for (scene = bmain->scene.first; scene; scene = scene->id.next) {
                        if (scene) {
                                Sequence *seq;
-                               SEQ_BEGIN (scene->ed, seq)
+                               SEQ_BEGIN(scene->ed, seq)
                                {
                                        if (seq->sat == 0.0f) {
                                                seq->sat = 1.0f;
@@ -2091,11 +2091,11 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                                /* spacing was originally in pixels, convert it to percentage for new version
                                 * size should not be zero due to sanity check above
                                 */
-                               brush->spacing = (int)(100 * ((float)brush->spacing) / ((float) brush->size));
+                               brush->spacing = (int)(100 * ((float)brush->spacing) / ((float)brush->size));
 
                                if (brush->add_col[0] == 0 &&
-                                       brush->add_col[1] == 0 &&
-                                       brush->add_col[2] == 0)
+                                   brush->add_col[1] == 0 &&
+                                   brush->add_col[2] == 0)
                                {
                                        brush->add_col[0] = 1.00f;
                                        brush->add_col[1] = 0.39f;
@@ -2103,8 +2103,8 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                                }
 
                                if (brush->sub_col[0] == 0 &&
-                                       brush->sub_col[1] == 0 &&
-                                       brush->sub_col[2] == 0)
+                                   brush->sub_col[1] == 0 &&
+                                   brush->sub_col[2] == 0)
                                {
                                        brush->sub_col[0] = 0.39f;
                                        brush->sub_col[1] = 0.39f;
@@ -2143,11 +2143,11 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                                                smd->domain->vorticity = 2.0f;
                                                smd->domain->time_scale = 1.0f;
 
-                                               if (!(smd->domain->flags & (1<<4)))
+                                               if (!(smd->domain->flags & (1 << 4)))
                                                        continue;
 
                                                /* delete old MOD_SMOKE_INITVELOCITY flag */
-                                               smd->domain->flags &= ~(1<<4);
+                                               smd->domain->flags &= ~(1 << 4);
 
                                                /* for now just add it to all flow objects in the scene */
                                                {
@@ -2200,7 +2200,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                                SpaceLink *sl;
                                for (sl = sa->spacedata.first; sl; sl = sl->next) {
                                        if (sl->spacetype == SPACE_INFO) {
-                                               SpaceInfo *sinfo = (SpaceInfo *) sl;
+                                               SpaceInfo *sinfo = (SpaceInfo *)sl;
                                                ARegion *ar;
 
                                                sinfo->rpt_mask = INFO_RPT_OP;
@@ -2208,9 +2208,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                                                for (ar = sa->regionbase.first; ar; ar = ar->next) {
                                                        if (ar->regiontype == RGN_TYPE_WINDOW) {
                                                                ar->v2d.scroll = (V2D_SCROLL_RIGHT);
-                                                               ar->v2d.align = V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y; /* align bottom left */
+                                                               ar->v2d.align = V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y; /* align bottom left */
                                                                ar->v2d.keepofs = V2D_LOCKOFS_X;
-                                                               ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_LIMITZOOM|V2D_KEEPASPECT);
+                                                               ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
                                                                ar->v2d.keeptot = V2D_KEEPTOT_BOUNDS;
                                                                ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f;
                                                        }
@@ -2284,7 +2284,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                                SpaceLink *sl;
                                for (sl = sa->spacedata.first; sl; sl = sl->next) {
                                        if (sl->spacetype == SPACE_IMAGE) {
-                                               SpaceImage *sima = (SpaceImage *) sl;
+                                               SpaceImage *sima = (SpaceImage *)sl;
                                                if (sima->sample_line_hist.height == 0)
                                                        sima->sample_line_hist.height = 100;
                                        }
@@ -2338,21 +2338,21 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                /* node sockets are not exposed automatically any more,
                 * this mimics the old behavior by adding all unlinked sockets to groups.
                 */
-               for (ntree=bmain->nodetree.first; ntree; ntree=ntree->id.next) {
+               for (ntree = bmain->nodetree.first; ntree; ntree = ntree->id.next) {
                        /* this adds copies and links from all unlinked internal sockets to group inputs/outputs. */
 
                        /* first make sure the own_index for new sockets is valid */
-                       for (node=ntree->nodes.first; node; node=node->next) {
+                       for (node = ntree->nodes.first; node; node = node->next) {
                                for (sock = node->inputs.first; sock; sock = sock->next)
                                        if (sock->own_index >= ntree->cur_index)
-                                               ntree->cur_index = sock->own_index+1;
+                                               ntree->cur_index = sock->own_index + 1;
                                for (sock = node->outputs.first; sock; sock = sock->next)
                                        if (sock->own_index >= ntree->cur_index)
-                                               ntree->cur_index = sock->own_index+1;
+                                               ntree->cur_index = sock->own_index + 1;
                        }
 
                        /* add ntree->inputs/ntree->outputs sockets for all unlinked sockets in the group tree. */
-                       for (node=ntree->nodes.first; node; node=node->next) {
+                       for (node = ntree->nodes.first; node; node = node->next) {
                                for (sock = node->inputs.first; sock; sock = sock->next) {
                                        if (!sock->link && !nodeSocketIsHidden(sock)) {
 
@@ -2376,7 +2376,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                                        }
                                }
                                for (sock = node->outputs.first; sock; sock = sock->next) {
-                                       if (nodeCountSocketLinks(ntree, sock)==0 && !nodeSocketIsHidden(sock)) {
+                                       if (nodeCountSocketLinks(ntree, sock) == 0 && !nodeSocketIsHidden(sock)) {
                                                gsock = do_versions_node_group_add_socket_2_56_2(ntree, sock->name, sock->type, SOCK_OUT);
 
                                                /* initialize the default socket value */
@@ -2429,7 +2429,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                                /* weak! material alpha could be animated */
                                if (mat->alpha < 1.0f || mat->fresnel_tra > 0.0f || transp_tex) {
                                        mat->mode |= MA_TRANSP;
-                                       mat->mode &= ~(MA_ZTRANSP|MA_RAYTRANSP);
+                                       mat->mode &= ~(MA_ZTRANSP | MA_RAYTRANSP);
                                }
                        }
                }
@@ -2439,7 +2439,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                        if (sc->redraws_flag == 0) {
                                /* just initialize to default? */
                                /* XXX: we could also have iterated through areas, and taken them from the first timeline available... */
-                               sc->redraws_flag = TIME_ALL_3D_WIN|TIME_ALL_ANIM_WIN;
+                               sc->redraws_flag = TIME_ALL_3D_WIN | TIME_ALL_ANIM_WIN;
                        }
                }
 
@@ -2453,7 +2453,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                        ModifierData *md;
                        for (md = ob->modifiers.first; md; md = md->next) {
                                if (md->type == eModifierType_Solidify) {
-                                       SolidifyModifierData *smd = (SolidifyModifierData *) md;
+                                       SolidifyModifierData *smd = (SolidifyModifierData *)md;
                                        if (smd->flag & MOD_SOLIDIFY_RIM_MATERIAL) {
                                                smd->mat_ofs_rim = 1;
                                                smd->flag &= ~MOD_SOLIDIFY_RIM_MATERIAL;
@@ -2554,7 +2554,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                                        if (act->type == ACT_CAMERA) {
                                                bCameraActuator *ba = act->data;
 
-                                               ba->damping = 1.0/32.0;
+                                               ba->damping = 1.0 / 32.0;
                                        }
                                }
                        }
@@ -2577,7 +2577,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                        for (scene = bmain->scene.first; scene; scene = scene->id.next) {
                                scene->r.ffcodecdata.audio_channels = 2;
                                scene->audio.volume = 1.0f;
-                               SEQ_BEGIN (scene->ed, seq)
+                               SEQ_BEGIN(scene->ed, seq)
                                {
                                        seq->pitch = 1.0f;
                                }
@@ -2631,7 +2631,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                        for (act = bmain->action.first; act; act = act->id.next) {
                                for (fcu = act->curves.first; fcu; fcu = fcu->next) {
                                        BezTriple *bezt;
-                                       unsigned int i = 0;
+                                       uint i = 0;
 
                                        /* only need to touch curves that had this flag set */
                                        if ((fcu->flag & FCURVE_AUTO_HANDLES) == 0)
@@ -2704,7 +2704,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                                bNode *node;
                                bNodeSocket *sock;
 
-                               for (node=ntree->nodes.first; node; node=node->next) {
+                               for (node = ntree->nodes.first; node; node = node->next) {
                                        for (sock = node->inputs.first; sock; sock = sock->next)
                                                do_versions_socket_default_value_259(sock);
                                        for (sock = node->outputs.first; sock; sock = sock->next)
@@ -2755,7 +2755,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                                if (sce->gm.recastData.cellheight == 0.0f)
                                        sce->gm.recastData.cellheight = 0.2f;
                                if (sce->gm.recastData.agentmaxslope == 0.0f)
-                                       sce->gm.recastData.agentmaxslope = (float)M_PI/4;
+                                       sce->gm.recastData.agentmaxslope = (float)M_PI / 4;
                                if (sce->gm.recastData.agentmaxclimb == 0.0f)
                                        sce->gm.recastData.agentmaxclimb = 0.9f;
                                if (sce->gm.recastData.agentheight == 0.0f)
@@ -2770,7 +2770,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
                                        sce->gm.recastData.regionminsize = 8.f;
                                if (sce->gm.recastData.regionmergesize == 0.0f)
                                        sce->gm.recastData.regionmergesize = 20.f;
-                               if (sce->gm.recastData.vertsperpoly<3)
+                               if (sce->gm.recastData.vertsperpoly < 3)
                                        sce->gm.recastData.vertsperpoly = 6;
                                if (sce->gm.recastData.detailsampledist == 0.0f)
                                        sce->gm.recastData.detailsampledist = 6.0f;
index c5062ed1e16aad8b3a62837a88fb883f8741b3b2..35fcb11e5a57f3d8df1e45e32a88ce259ec0ad0d 100644 (file)
@@ -344,7 +344,7 @@ static void do_versions_mesh_mloopcol_swap_2_62_1(Mesh *me)
                if (layer->type == CD_MLOOPCOL) {
                        mloopcol = (MLoopCol *)layer->data;
                        for (i = 0; i < me->totloop; i++, mloopcol++) {
-                               SWAP(unsigned char, mloopcol->r, mloopcol->b);
+                               SWAP(uchar, mloopcol->r, mloopcol->b);
                        }
                }
        }
@@ -428,7 +428,7 @@ static void do_versions_nodetree_frame_2_64_6(bNodeTree *ntree)
                }
 
                /* initialize custom node color */
-               node->color[0] = node->color[1] = node->color[2] = 0.608f;      /* default theme color */
+               node->color[0] = node->color[1] = node->color[2] = 0.608f;  /* default theme color */
        }
 }
 
@@ -972,7 +972,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
                                        if (act->type == ACT_CAMERA) {
                                                bCameraActuator *ba = act->data;
 
-                                               if (ba->axis == (float) 'x') ba->axis = OB_POSX;
+                                               if (ba->axis == (float)'x') ba->axis = OB_POSX;
                                                else if (ba->axis == (float)'y') ba->axis = OB_POSY;
                                                /* don't do an if/else to avoid imediate subversion bump*/
 //                                             ba->axis=((ba->axis == (float)'x') ? OB_POSX_X : OB_POSY);
@@ -1045,7 +1045,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
 
                        for (md = ob->modifiers.first; md; md = md->next) {
                                if (md->type == eModifierType_Cloth) {
-                                       ClothModifierData *clmd = (ClothModifierData *) md;
+                                       ClothModifierData *clmd = (ClothModifierData *)md;
                                        if (clmd->sim_parms)
                                                clmd->sim_parms->vel_damping = 1.0f;
                                }
@@ -1506,7 +1506,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
                                                ColorBalanceModifierData *cbmd;
 
                                                smd = BKE_sequence_modifier_new(seq, NULL, seqModifierType_ColorBalance);
-                                               cbmd = (ColorBalanceModifierData *) smd;
+                                               cbmd = (ColorBalanceModifierData *)smd;
 
                                                cbmd->color_balance = *strip->color_balance;
 
@@ -1745,7 +1745,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
                        ScrArea *sa;
                        for (sa = sc->areabase.first; sa; sa = sa->next) {
                                SpaceLink *sl;
-                               if ( sa->spacetype == SPACE_LOGIC)
+                               if (sa->spacetype == SPACE_LOGIC)
                                        do_version_logic_264(&sa->regionbase);
 
                                for (sl = sa->spacedata.first; sl; sl = sl->next) {
@@ -1954,7 +1954,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
 
                for (cu = bmain->curve.first; cu; cu = cu->id.next) {
                        if (cu->flag & (CU_FRONT | CU_BACK)) {
-                               if ( cu->ext1 != 0.0f || cu->ext2 != 0.0f) {
+                               if (cu->ext1 != 0.0f || cu->ext2 != 0.0f) {
                                        Nurb *nu;
 
                                        for (nu = cu->nurb.first; nu; nu = nu->next) {
@@ -2085,7 +2085,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
                        bNode *node;
                        FOREACH_NODETREE(bmain, ntree, id) {
                                if (id == &ntree->id)
-                                       continue;       /* already fixed for node groups */
+                                       continue;   /* already fixed for node groups */
 
                                for (node = ntree->nodes.first; node; node = node->next)
                                        nodeUniqueName(ntree, node);
@@ -2454,8 +2454,8 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
                                                SpaceOops *so = (SpaceOops *)sl;
 
                                                if (!ELEM(so->outlinevis, SO_ALL_SCENES, SO_CUR_SCENE, SO_VISIBLE, SO_SELECTED, SO_ACTIVE,
-                                                                         SO_SAME_TYPE, SO_GROUPS, SO_LIBRARIES, SO_SEQUENCE, SO_DATABLOCKS,
-                                                                         SO_USERDEF))
+                                                         SO_SAME_TYPE, SO_GROUPS, SO_LIBRARIES, SO_SEQUENCE, SO_DATABLOCKS,
+                                                         SO_USERDEF))
                                                {
                                                        so->outlinevis = SO_ALL_SCENES;
                                                }
index 7b78772508473284390e0251bec80b8e240dc80a..13b3040f8df9468093bcc2f2c26225ec9f877d56 100644 (file)
@@ -399,7 +399,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
                                        SpaceLink *space_link;
                                        for (space_link = area->spacedata.first; space_link; space_link = space_link->next) {
                                                if (space_link->spacetype == SPACE_CLIP) {
-                                                       SpaceClip *space_clip = (SpaceClip *) space_link;
+                                                       SpaceClip *space_clip = (SpaceClip *)space_link;
                                                        if (space_clip->mode != SC_MODE_MASKEDIT) {
                                                                space_clip->mode = SC_MODE_TRACKING;
                                                        }
@@ -671,7 +671,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
        }
 
        if (!MAIN_VERSION_ATLEAST(bmain, 273, 1)) {
-#define        BRUSH_RAKE (1 << 7)
+#define BRUSH_RAKE (1 << 7)
 #define BRUSH_RANDOM_ROTATION (1 << 25)
 
                Brush *br;
@@ -962,7 +962,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
                                                }
                                                case SPACE_IMAGE:
                                                {
-                                                       SpaceImage *sima = (SpaceImage *) sl;
+                                                       SpaceImage *sima = (SpaceImage *)sl;
                                                        sima->iuser.flag |= IMA_SHOW_STEREO;
                                                        break;
                                                }
@@ -1067,7 +1067,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
 
                {
                        bScreen *screen;
-#define RV3D_VIEW_PERSPORTHO    7
+#define RV3D_VIEW_PERSPORTHO     7
                        for (screen = bmain->screen.first; screen; screen = screen->id.next) {
                                ScrArea *sa;
                                for (sa = screen->areabase.first; sa; sa = sa->next) {
@@ -1096,7 +1096,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
 
                {
                        Lamp *lamp;
-#define LA_YF_PHOTON   5
+#define LA_YF_PHOTON    5
                        for (lamp = bmain->lamp.first; lamp; lamp = lamp->id.next) {
                                if (lamp->type == LA_YF_PHOTON) {
                                        lamp->type = LA_LOCAL;
index 558c709d14cf5983621153065a3b58c63fd8f44d..7ea39053bc792633deb47e806ac35524d15140b4 100644 (file)
@@ -199,7 +199,7 @@ void BLO_update_defaults_startup_blend(Main *bmain)
 
                        for (space_link = area->spacedata.first; space_link; space_link = space_link->next) {
                                if (space_link->spacetype == SPACE_CLIP) {
-                                       SpaceClip *space_clip = (SpaceClip *) space_link;
+                                       SpaceClip *space_clip = (SpaceClip *)space_link;
                                        space_clip->flag &= ~SC_MANUAL_CALIBRATION;
                                }
                        }
index 3511aefc2a5675ca5070666e6dca87edeb2070b4..48d90787b517bd856035a9a7400c3aa36c4bd0d3 100644 (file)
 static void vcol_to_fcol(Mesh *me)
 {
        MFace *mface;
-       unsigned int *mcol, *mcoln, *mcolmain;
+       uint *mcol, *mcoln, *mcolmain;
        int a;
 
        if (me->totface == 0 || me->mcol == NULL)
                return;
 
        mcoln = mcolmain = MEM_malloc_arrayN(me->totface, 4 * sizeof(int), "mcoln");
-       mcol = (unsigned int *)me->mcol;
+       mcol = (uint *)me->mcol;
        mface = me->mface;
        for (a = me->totface; a > 0; a--, mface++) {
                mcoln[0] = mcol[mface->v1];
@@ -183,11 +183,11 @@ static void bone_version_238(ListBase *lb)
 
        for (bone = lb->first; bone; bone = bone->next) {
                if (bone->rad_tail == 0.0f && bone->rad_head == 0.0f) {
-                       bone->rad_head = 0.25f*bone->length;
-                       bone->rad_tail = 0.1f*bone->length;
+                       bone->rad_head = 0.25f * bone->length;
+                       bone->rad_tail = 0.1f * bone->length;
 
-                       bone->dist-= bone->rad_head;
-                       if (bone->dist<=0.0f)
+                       bone->dist -= bone->rad_head;
+                       if (bone->dist <= 0.0f)
                                bone->dist = 0.0f;
                }
                bone_version_238(&bone->childbase);
@@ -278,7 +278,7 @@ static void ntree_version_245(FileData *fd, Library *lib, bNodeTree *ntree)
                        /* fix for temporary flag changes during 245 cycle */
                        nodeid = blo_do_versions_newlibadr(fd, lib, node->id);
                        if (node->storage && nodeid && GS(nodeid->name) == ID_IM) {
-                               image = (Image*)nodeid;
+                               image = (Image *)nodeid;
                                iuser = node->storage;
                                if (iuser->flag & IMA_OLD_PREMUL) {
                                        iuser->flag &= ~IMA_OLD_PREMUL;
@@ -357,7 +357,7 @@ static void alphasort_version_246(FileData *fd, Library *lib, Mesh *me)
 
                for (b = 0; b < me->fdata.totlayer; b++) {
                        if (me->fdata.layers[b].type == CD_MTFACE) {
-                               tf = ((MTFace*)me->fdata.layers[b].data) + a;
+                               tf = ((MTFace *)me->fdata.layers[b].data) + a;
 
                                tf->mode &= ~TF_ALPHASORT;
                                if (ma && (ma->mode & MA_ZTRANSP))
@@ -476,7 +476,7 @@ static void do_version_ntree_242_2(bNodeTree *ntree)
 
                                        iuser->frames = nia->frames;
                                        iuser->sfra = nia->sfra;
-                                       iuser->offset = nia->nr-1;
+                                       iuser->offset = nia->nr - 1;
                                        iuser->cycl = nia->cyclic;
                                        iuser->fie_ima = 2;
                                        iuser->ok = 1;
@@ -635,7 +635,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                        if (ob->totcol) {
                                for (a = 0; a < ob->totcol; a++) {
                                        if (ob->mat[a])
-                                               ob->colbits |= (1<<a);
+                                               ob->colbits |= (1 << a);
                                }
                        }
                        ob = ob->id.next;
@@ -700,7 +700,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                                SpaceLink *sl = sa->spacedata.first;
                                while (sl) {
                                        if (sl->spacetype == SPACE_VIEW3D) {
-                                               View3D *v3d = (View3D*) sl;
+                                               View3D *v3d = (View3D *)sl;
 
                                                if (v3d->gridlines == 0)
                                                        v3d->gridlines = 20;
@@ -728,8 +728,8 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                Tex *tex = bmain->tex.first;
                while (tex) {
                        if ((tex->rfac == 0.0f) &&
-                               (tex->gfac == 0.0f) &&
-                               (tex->bfac == 0.0f))
+                           (tex->gfac == 0.0f) &&
+                           (tex->bfac == 0.0f))
                        {
                                tex->rfac = 1.0f;
                                tex->gfac = 1.0f;
@@ -745,8 +745,8 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                Tex *tex = bmain->tex.first;
                while (tex) {
                        if ((tex->rfac == 0.0f) &&
-                               (tex->gfac == 0.0f) &&
-                               (tex->bfac == 0.0f))
+                           (tex->gfac == 0.0f) &&
+                           (tex->bfac == 0.0f))
                        {
                                tex->rfac = 1.0f;
                                tex->gfac = 1.0f;
@@ -827,7 +827,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                                SpaceLink *sl = sa->spacedata.first;
                                while (sl) {
                                        if (sl->spacetype == SPACE_IPO) {
-                                               SpaceIpo *sipo = (SpaceIpo*) sl;
+                                               SpaceIpo *sipo = (SpaceIpo *)sl;
                                                sipo->v2d.max[0] = 15000.0;
                                        }
                                        sl = sl->next;
@@ -860,7 +860,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                                SpaceLink *sl = sa->spacedata.first;
                                while (sl) {
                                        if (sl->spacetype == SPACE_TEXT) {
-                                               SpaceText *st = (SpaceText*) sl;
+                                               SpaceText *st = (SpaceText *)sl;
                                                st->lheight = 12;
                                        }
                                        sl = sl->next;
@@ -936,9 +936,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
        if (bmain->versionfile <= 200) {
                Object *ob = bmain->object.first;
                while (ob) {
-                       ob->scaflag = ob->gameflag & (OB_DO_FH|OB_ROT_FH|OB_ANISOTROPIC_FRICTION|OB_GHOST|OB_RIGID_BODY|OB_BOUNDS);
-                               /* 64 is do_fh */
-                       ob->gameflag &= ~(OB_ROT_FH|OB_ANISOTROPIC_FRICTION|OB_GHOST|OB_RIGID_BODY|OB_BOUNDS);
+                       ob->scaflag = ob->gameflag & (OB_DO_FH | OB_ROT_FH | OB_ANISOTROPIC_FRICTION | OB_GHOST | OB_RIGID_BODY | OB_BOUNDS);
+                       /* 64 is do_fh */
+                       ob->gameflag &= ~(OB_ROT_FH | OB_ANISOTROPIC_FRICTION | OB_GHOST | OB_RIGID_BODY | OB_BOUNDS);
                        ob = ob->id.next;
                }
        }
@@ -994,7 +994,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                        while (act) {
                                if (act->type == ACT_OBJECT) {
                                        oa = act->data;
-                                       oa->flag &= ~(ACT_TORQUE_LOCAL|ACT_DROT_LOCAL);         /* this actuator didn't do local/glob rot before */
+                                       oa->flag &= ~(ACT_TORQUE_LOCAL | ACT_DROT_LOCAL);     /* this actuator didn't do local/glob rot before */
                                }
                                act = act->next;
                        }
@@ -1094,11 +1094,11 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                                 * on property. The material field can
                                 * remain empty. */
                                if (sens->type == SENS_COLLISION) {
-                                       cs = (bCollisionSensor*) sens->data;
+                                       cs = (bCollisionSensor *)sens->data;
                                        cs->mode = 0;
                                }
                                if (sens->type == SENS_RAY) {
-                                       rs = (bRaySensor*) sens->data;
+                                       rs = (bRaySensor *)sens->data;
                                        rs->mode = 0;
                                }
                                sens = sens->next;
@@ -1177,7 +1177,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                        while (prop) {
                                if (prop->type == GPROP_TIME) {
                                        // convert old GPROP_TIME values from int to float
-                                       *((float *)&prop->data) = (float) prop->data;
+                                       *((float *)&prop->data) = (float)prop->data;
                                }
 
                                prop = prop->next;
@@ -1247,10 +1247,10 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                                int i, j;
 
                                for (i = 0; i < me->totface; i++) {
-                                       TFace *tf = &((TFace*) me->tface)[i];
+                                       TFace *tf = &((TFace *)me->tface)[i];
 
                                        for (j = 0; j < 4; j++) {
-                                               char *col = (char *) &tf->col[j];
+                                               char *col = (char *)&tf->col[j];
 
                                                col[0] = 255;
                                        }
@@ -1349,7 +1349,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
 
                                for (sl = sa->spacedata.first; sl; sl = sl->next) {
                                        if (sl->spacetype == SPACE_IPO) {
-                                               SpaceSeq *sseq = (SpaceSeq*) sl;
+                                               SpaceSeq *sseq = (SpaceSeq *)sl;
                                                sseq->v2d.keeptot = 0;
                                        }
                                }
@@ -1442,11 +1442,11 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
 
                                for (sl = sa->spacedata.first; sl; sl = sl->next) {
                                        if (sl->spacetype == SPACE_ACTION) {
-                                               SpaceAction *sac = (SpaceAction *) sl;
+                                               SpaceAction *sac = (SpaceAction *)sl;
                                                sac->v2d.max[0] = 32000;
                                        }
                                        else if (sl->spacetype == SPACE_NLA) {
-                                               SpaceNla *sla = (SpaceNla *) sl;
+                                               SpaceNla *sla = (SpaceNla *)sl;
                                                sla->v2d.max[0] = 32000;
                                        }
                                }
@@ -1514,10 +1514,10 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
 
                                for (sl = sa->spacedata.first; sl; sl = sl->next) {
                                        if (sl->spacetype == SPACE_BUTS) {
-                                               SpaceButs *sbuts = (SpaceButs *) sl;
+                                               SpaceButs *sbuts = (SpaceButs *)sl;
 
                                                sbuts->v2d.maxzoom = 1.2f;
-                                               sbuts->align = 1;       /* horizontal default */
+                                               sbuts->align = 1;   /* horizontal default */
 
                                                if (sbuts->mainb == BUTS_LAMP) {
                                                        sbuts->mainb = CONTEXT_SHADING;
@@ -1658,7 +1658,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                                SpaceLink *sl = sa->spacedata.first;
                                while (sl) {
                                        if (sl->spacetype == SPACE_VIEW3D) {
-                                               View3D *v3d = (View3D*) sl;
+                                               View3D *v3d = (View3D *)sl;
 
                                                if (v3d->gridflag == 0) {
                                                        v3d->gridflag |= V3D_SHOW_X;
@@ -1682,7 +1682,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                Scene *sce;
 
                while (tex) {
-                       if ((tex->flag & (TEX_CHECKER_ODD+TEX_CHECKER_EVEN))==0) {
+                       if ((tex->flag & (TEX_CHECKER_ODD + TEX_CHECKER_EVEN)) == 0) {
                                tex->flag |= TEX_CHECKER_ODD;
                        }
                        /* copied from kernel texture.c */
@@ -1725,7 +1725,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                                for (sl = sa->spacedata.first; sl; sl = sl->next) {
                                        /* added: 5x better zoom in for nla */
                                        if (sl->spacetype == SPACE_NLA) {
-                                               SpaceNla *snla = (SpaceNla *) sl;
+                                               SpaceNla *snla = (SpaceNla *)sl;
                                                snla->v2d.maxzoom = 50;
                                        }
                                }
@@ -1761,7 +1761,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                                SpaceLink *sl;
                                for (sl = sa->spacedata.first; sl; sl = sl->next) {
                                        if (sl->spacetype == SPACE_VIEW3D) {
-                                               View3D *v3d = (View3D *) sl;
+                                               View3D *v3d = (View3D *)sl;
                                                v3d->flag |= V3D_SELECT_OUTLINE;
                                        }
                                }
@@ -1785,7 +1785,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                                SpaceLink *sl;
                                for (sl = sa->spacedata.first; sl; sl = sl->next) {
                                        if (sl->spacetype == SPACE_VIEW3D) {
-                                               View3D *v3d = (View3D *) sl;
+                                               View3D *v3d = (View3D *)sl;
                                                v3d->flag |= V3D_ZBUF_SELECT;
                                        }
                                        else if (sl->spacetype == SPACE_TEXT) {
@@ -1812,7 +1812,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                while (sce) {
                        ed = sce->ed;
                        if (ed) {
-                               SEQ_BEGIN (sce->ed, seq)
+                               SEQ_BEGIN(sce->ed, seq)
                                {
                                        if (seq->type == SEQ_TYPE_IMAGE || seq->type == SEQ_TYPE_MOVIE)
                                                seq->alpha_mode = SEQ_ALPHA_STRAIGHT;
@@ -1847,7 +1847,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                                SpaceLink *sl;
                                for (sl = sa->spacedata.first; sl; sl = sl->next) {
                                        if (sl->spacetype == SPACE_VIEW3D) {
-                                               View3D *v3d = (View3D *) sl;
+                                               View3D *v3d = (View3D *)sl;
                                                if (v3d->twtype == 0)
                                                        v3d->twtype = V3D_MANIP_TRANSLATE;
                                        }
@@ -1912,7 +1912,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                                        BKE_pose_tag_recalc(bmain, ob->pose);
 
                                /* cannot call stuff now (pointers!), done in setup_app_data */
-                               ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
+                               ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
 
                                /* new generic xray option */
                                arm = blo_do_versions_newlibadr(fd, lib, ob->data);
@@ -1923,8 +1923,8 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                        else if (ob->type == OB_MESH) {
                                Mesh *me = blo_do_versions_newlibadr(fd, lib, ob->data);
 
-                               if ((me->flag&ME_SUBSURF)) {
-                                       SubsurfModifierData *smd = (SubsurfModifierData*) modifier_new(eModifierType_Subsurf);
+                               if ((me->flag & ME_SUBSURF)) {
+                                       SubsurfModifierData *smd = (SubsurfModifierData *)modifier_new(eModifierType_Subsurf);
 
                                        smd->levels = MAX2(1, me->subdiv);
                                        smd->renderLevels = MAX2(1, me->subdivr);
@@ -1940,7 +1940,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
 
                                        BLI_addtail(&ob->modifiers, smd);
 
-                                       modifier_unique_name(&ob->modifiers, (ModifierData*)smd);
+                                       modifier_unique_name(&ob->modifiers, (ModifierData *)smd);
                                }
                        }
 
@@ -1990,9 +1990,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
 
                        for (md = ob->modifiers.first; md; md = md->next) {
                                if (md->type == eModifierType_Subsurf) {
-                                       SubsurfModifierData *smd = (SubsurfModifierData*) md;
+                                       SubsurfModifierData *smd = (SubsurfModifierData *)md;
 
-                                       smd->flags &= ~(eSubsurfModifierFlag_Incremental|eSubsurfModifierFlag_DebugIncr);
+                                       smd->flags &= ~(eSubsurfModifierFlag_Incremental | eSubsurfModifierFlag_DebugIncr);
                                }
                        }
 
@@ -2024,7 +2024,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
 
                                                for (con = pchan->constraints.first; con; con = con->next) {
                                                        if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
-                                                               bKinematicConstraint *data = (bKinematicConstraint*)con->data;
+                                                               bKinematicConstraint *data = (bKinematicConstraint *)con->data;
                                                                data->weight = 1.0f;
                                                                data->orientweight = 1.0f;
                                                                data->flag &= ~CONSTRAINT_IK_ROT;
@@ -2098,7 +2098,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
 
                        for (md = ob->modifiers.first; md; md = md->next) {
                                if (md->type == eModifierType_Armature) {
-                                       ArmatureModifierData *amd = (ArmatureModifierData*) md;
+                                       ArmatureModifierData *amd = (ArmatureModifierData *)md;
                                        if (amd->object && amd->deformflag == 0) {
                                                Object *oba = blo_do_versions_newlibadr(fd, lib, amd->object);
                                                arm = blo_do_versions_newlibadr(fd, lib, oba->data);
@@ -2181,7 +2181,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                        if (sce->audio.mixrate == 0)
                                sce->audio.mixrate = 48000;
 
-                       if (sce->r.xparts <)
+                       if (sce->r.xparts < 2)
                                sce->r.xparts = 4;
                        if (sce->r.yparts < 2)
                                sce->r.yparts = 4;
@@ -2196,7 +2196,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                                for (srl = sce->r.layers.first; srl; srl = srl->next) {
                                        if (srl->layflag & SCE_LAY_SOLID)
                                                srl->layflag |= SCE_LAY_SKY;
-                                       srl->passflag &= (SCE_PASS_COMBINED|SCE_PASS_Z|SCE_PASS_NORMAL|SCE_PASS_VECTOR);
+                                       srl->passflag &= (SCE_PASS_COMBINED | SCE_PASS_Z | SCE_PASS_NORMAL | SCE_PASS_VECTOR);
                                }
                        }
 
@@ -2253,7 +2253,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                                if (ma->mtex[a] && ma->mtex[a]->tex) {
                                        tex = blo_do_versions_newlibadr(fd, lib, ma->mtex[a]->tex);
                                        if (tex && tex->type == TEX_STUCCI)
-                                               ma->mtex[a]->mapto &= ~(MAP_COL|MAP_SPEC|MAP_REF);
+                                               ma->mtex[a]->mapto &= ~(MAP_COL | MAP_SPEC | MAP_REF);
                                }
                        }
                        /* transmissivity defaults */
@@ -2295,7 +2295,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
 
                                for (sl = sa->spacedata.first; sl; sl = sl->next) {
                                        if (sl->spacetype == SPACE_VIEW3D) {
-                                               View3D *v3d = (View3D*) sl;
+                                               View3D *v3d = (View3D *)sl;
                                                if (v3d->gridsubdiv == 0)
                                                        v3d->gridsubdiv = 10;
                                        }
@@ -2369,7 +2369,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
 
                                                        /* version patch from buttons_object.c */
                                                        if (data->flag == 0)
-                                                               data->flag = ROTLIKE_X|ROTLIKE_Y|ROTLIKE_Z;
+                                                               data->flag = ROTLIKE_X | ROTLIKE_Y | ROTLIKE_Z;
 
                                                        break;
                                                }
@@ -2385,32 +2385,32 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                                                for (curcon = pchan->constraints.first; curcon; curcon = curcon->next) {
                                                        switch (curcon->type) {
                                                                case CONSTRAINT_TYPE_MINMAX:
-                                                                       {
-                                                                               bMinMaxConstraint *data = curcon->data;
-                                                                               if (data->sticky == 1)
-                                                                                       data->flag |= MINMAX_STICKY;
-                                                                               else
-                                                                                       data->flag &= ~MINMAX_STICKY;
-                                                                       }
+                                                               {
+                                                                       bMinMaxConstraint *data = curcon->data;
+                                                                       if (data->sticky == 1)
+                                                                               data->flag |= MINMAX_STICKY;
+                                                                       else
+                                                                               data->flag &= ~MINMAX_STICKY;
                                                                        break;
+                                                               }
                                                                case CONSTRAINT_TYPE_KINEMATIC:
-                                                                       {
-                                                                               bKinematicConstraint *data = curcon->data;
-                                                                               if (!(data->flag & CONSTRAINT_IK_POS)) {
-                                                                                       data->flag |= CONSTRAINT_IK_POS;
-                                                                                       data->flag |= CONSTRAINT_IK_STRETCH;
-                                                                               }
+                                                               {
+                                                                       bKinematicConstraint *data = curcon->data;
+                                                                       if (!(data->flag & CONSTRAINT_IK_POS)) {
+                                                                               data->flag |= CONSTRAINT_IK_POS;
+                                                                               data->flag |= CONSTRAINT_IK_STRETCH;
                                                                        }
                                                                        break;
+                                                               }
                                                                case CONSTRAINT_TYPE_ROTLIKE:
-                                                                       {
-                                                                               bRotateLikeConstraint *data = curcon->data;
+                                                               {
+                                                                       bRotateLikeConstraint *data = curcon->data;
 
-                                                                               /* version patch from buttons_object.c */
-                                                                               if (data->flag == 0)
-                                                                                       data->flag = ROTLIKE_X|ROTLIKE_Y|ROTLIKE_Z;
-                                                                       }
+                                                                       /* version patch from buttons_object.c */
+                                                                       if (data->flag == 0)
+                                                                               data->flag = ROTLIKE_X | ROTLIKE_Y | ROTLIKE_Z;
                                                                        break;
+                                                               }
                                                        }
                                                }
                                        }
@@ -2420,10 +2420,10 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                        /* copy old object level track settings to curve modifers */
                        for (md = ob->modifiers.first; md; md = md->next) {
                                if (md->type == eModifierType_Curve) {
-                                       CurveModifierData *cmd = (CurveModifierData*) md;
+                                       CurveModifierData *cmd = (CurveModifierData *)md;
 
                                        if (cmd->defaxis == 0)
-                                               cmd->defaxis = ob->trackflag+1;
+                                               cmd->defaxis = ob->trackflag + 1;
                                }
                        }
 
@@ -2480,7 +2480,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                                tex->iuser.fie_ima = (char)tex->fie_ima;
                                tex->iuser.offset = tex->offset;
                                tex->iuser.sfra = tex->sfra;
-                               tex->iuser.cycl = (tex->imaflag & TEX_ANIMCYCLIC_)!=0;
+                               tex->iuser.cycl = (tex->imaflag & TEX_ANIMCYCLIC_) != 0;
                        }
                        for (sce = bmain->scene.first; sce; sce = sce->id.next) {
                                if (sce->nodetree)
@@ -2512,7 +2512,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
 
                if (bmain->subversionfile < 4) {
                        for (sce = bmain->scene.first; sce; sce = sce->id.next) {
-                               sce->r.bake_mode = 1;   /* prevent to include render stuff here */
+                               sce->r.bake_mode = 1;   /* prevent to include render stuff here */
                                sce->r.bake_filter = 16;
                                sce->r.bake_osa = 5;
                                sce->r.bake_flag = R_BAKE_CLEAR;
@@ -2565,7 +2565,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                                /* translate old mirror modifier axis values to new flags */
                                for (md = ob->modifiers.first; md; md = md->next) {
                                        if (md->type == eModifierType_Mirror) {
-                                               MirrorModifierData *mmd = (MirrorModifierData*) md;
+                                               MirrorModifierData *mmd = (MirrorModifierData *)md;
 
                                                switch (mmd->axis) {
                                                        case 0:
@@ -2613,7 +2613,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
 
                                        for (sl = sa->spacedata.first; sl; sl = sl->next) {
                                                if (sl->spacetype == SPACE_ACTION) {
-                                                       SpaceAction *saction = (SpaceAction*) sl;
+                                                       SpaceAction *saction = (SpaceAction *)sl;
 
                                                        saction->v2d.tot.ymin = -1000.0;
                                                        saction->v2d.tot.ymax = 0.0;
@@ -2666,7 +2666,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
 
                /* unless the file was created 2.44.3 but not 2.45, update the constraints */
                if (!(bmain->versionfile == 244 && bmain->subversionfile == 3) &&
-                       ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile == 0)) )
+                   ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile == 0)) )
                {
                        for (ob = bmain->object.first; ob; ob = ob->id.next) {
                                ListBase *list;
@@ -2685,13 +2685,13 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                                                switch (curcon->type) {
                                                        case CONSTRAINT_TYPE_LOCLIMIT:
                                                        {
-                                                               bLocLimitConstraint *data = (bLocLimitConstraint *) curcon->data;
+                                                               bLocLimitConstraint *data = (bLocLimitConstraint *)curcon->data;
 
                                                                /* old limit without parent option for objects */
                                                                if (data->flag2)
                                                                        curcon->ownspace = CONSTRAINT_SPACE_LOCAL;
+                                                               break;
                                                        }
-                                                       break;
                                                }
                                        }
                                }
@@ -2716,13 +2716,13 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
                                                                switch (curcon->type) {
                                                                        case CONSTRAINT_TYPE_ACTION: