Cleanup: trailing space for blenloader
authorCampbell Barton <ideasman42@gmail.com>
Sun, 17 Jun 2018 15:06:07 +0000 (17:06 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 17 Jun 2018 15:06:07 +0000 (17:06 +0200)
source/blender/blenloader/BLO_readfile.h
source/blender/blenloader/CMakeLists.txt
source/blender/blenloader/intern/readblenentry.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/readfile.h
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

index 0b4ff13c7bd76e9759ebc6bd54dc774f7c74b6b6..11f34732cfc762e977bf139ab9911e3ba6399cad 100644 (file)
@@ -64,10 +64,10 @@ typedef struct BlendFileData {
        int fileflags;
        int globalf;
        char filename[1024];    /* 1024 = FILE_MAX */
-       
+
        struct bScreen *curscreen;
        struct Scene *curscene;
-       
+
        eBlenFileType type;
 } BlendFileData;
 
@@ -150,7 +150,7 @@ struct BlendThumbnail *BLO_thumbnail_from_file(const char *filepath);
 struct Main *BLO_main_from_memfile(struct MemFile *memfile, struct Main *bmain, struct Scene **r_scene);
 
 #ifdef __cplusplus
-} 
+}
 #endif
 
 #endif  /* __BLO_READFILE_H__ */
index 420f651ee7ffce118bd240761452041632062f94..dd0a8543b9f9415703916c99454c8e2c166f1f75 100644 (file)
@@ -23,7 +23,7 @@
 #
 # ***** END GPL LICENSE BLOCK *****
 
-set(INC 
+set(INC
        .
        ../blenfont
        ../blenkernel
index 7310941327146e0bb1b9cb2d7e05c1d22842096b..4ccdbd9e8e1716befde0624620f5f9cbfe0d029a 100644 (file)
 #endif
 
 /* local prototypes --------------------- */
-void BLO_blendhandle_print_sizes(BlendHandle *, void *); 
+void BLO_blendhandle_print_sizes(BlendHandle *, void *);
 
 /* Access routines used by filesel. */
-        
+
 /**
  * Open a blendhandle from a file path.
  *
@@ -104,7 +104,7 @@ BlendHandle *BLO_blendhandle_from_memory(const void *mem, int memsize)
        return bh;
 }
 
-void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp) 
+void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp)
 {
        FileData *fd = (FileData *) bh;
        BHead *bhead;
@@ -117,7 +117,7 @@ void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp)
                        const short *sp = fd->filesdna->structs[bhead->SDNAnr];
                        const char *name = fd->filesdna->types[sp[0]];
                        char buf[4];
-                       
+
                        buf[0] = (bhead->code >> 24) & 0xFF;
                        buf[1] = (bhead->code >> 16) & 0xFF;
                        buf[2] = (bhead->code >> 8) & 0xFF;
@@ -127,7 +127,7 @@ void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp)
                        buf[1] = buf[1] ? buf[1] : ' ';
                        buf[2] = buf[2] ? buf[2] : ' ';
                        buf[3] = buf[3] ? buf[3] : ' ';
-                       
+
                        fprintf(fp, "['%.4s', '%s', %d, %ld ],\n", buf, name, bhead->nr, (long int)(bhead->len + sizeof(BHead)));
                }
        }
@@ -225,7 +225,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
                                                        new_prv->rect[0] = NULL;
                                                        new_prv->w[0] = new_prv->h[0] = 0;
                                                }
-                                               
+
                                                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);
@@ -255,7 +255,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
                        new_prv = NULL;
                        prv = NULL;
                }
-               
+
        }
 
        *tot_prev = tot;
@@ -274,7 +274,7 @@ LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh)
        GSet *gathered = BLI_gset_ptr_new("linkable_groups gh");
        LinkNode *names = NULL;
        BHead *bhead;
-       
+
        for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
                if (bhead->code == ENDB) {
                        break;
@@ -282,18 +282,18 @@ LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh)
                else if (BKE_idcode_is_valid(bhead->code)) {
                        if (BKE_idcode_is_linkable(bhead->code)) {
                                const char *str = BKE_idcode_to_name(bhead->code);
-                               
+
                                if (BLI_gset_add(gathered, (void *)str)) {
                                        BLI_linklist_prepend(&names, strdup(str));
                                }
                        }
                }
        }
-       
+
        BLI_gset_free(gathered, NULL);
-       
+
        return names;
-}              
+}
 
 /**
  * Close and free a blendhandle. The handle becomes invalid after this call.
@@ -303,7 +303,7 @@ LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh)
 void BLO_blendhandle_close(BlendHandle *bh)
 {
        FileData *fd = (FileData *) bh;
-       
+
        blo_freefiledata(fd);
 }
 
@@ -323,7 +323,7 @@ BlendFileData *BLO_read_from_file(
 {
        BlendFileData *bfd = NULL;
        FileData *fd;
-               
+
        fd = blo_openblenderfile(filepath, reports);
        if (fd) {
                fd->reports = reports;
@@ -350,7 +350,7 @@ BlendFileData *BLO_read_from_memory(
 {
        BlendFileData *bfd = NULL;
        FileData *fd;
-               
+
        fd = blo_openblendermemory(mem, memsize,  reports);
        if (fd) {
                fd->reports = reports;
@@ -375,13 +375,13 @@ BlendFileData *BLO_read_from_memfile(
        BlendFileData *bfd = NULL;
        FileData *fd;
        ListBase old_mainlist;
-       
+
        fd = blo_openblendermemfile(memfile, reports);
        if (fd) {
                fd->reports = reports;
                fd->skip_flags = skip_flags;
                BLI_strncpy(fd->relabase, filename, sizeof(fd->relabase));
-               
+
                /* clear ob->proxy_from pointers in old main */
                blo_clear_proxy_pointers_from_lib(oldmain);
 
@@ -389,26 +389,26 @@ BlendFileData *BLO_read_from_memfile(
                blo_split_main(&old_mainlist, oldmain);
                /* add the library pointers in oldmap lookup */
                blo_add_library_pointer_map(&old_mainlist, fd);
-               
+
                /* makes lookup of existing images in old main */
                blo_make_image_pointer_map(fd, oldmain);
-               
+
                /* makes lookup of existing video clips in old main */
                blo_make_movieclip_pointer_map(fd, oldmain);
 
                /* make lookups of existing sound data in old main */
                blo_make_sound_pointer_map(fd, oldmain);
-               
+
                /* removed packed data from this trick - it's internal data that needs saves */
-               
+
                bfd = blo_read_file_internal(fd, filename);
-               
+
                /* ensures relinked images are not freed */
                blo_end_image_pointer_map(fd, oldmain);
-               
+
                /* ensures relinked movie clips are not freed */
                blo_end_movieclip_pointer_map(fd, oldmain);
-               
+
                /* ensures relinked sounds are not freed */
                blo_end_sound_pointer_map(fd, oldmain);
 
@@ -467,7 +467,7 @@ void BLO_blendfiledata_free(BlendFileData *bfd)
        if (bfd->main) {
                BKE_main_free(bfd->main);
        }
-       
+
        if (bfd->user) {
                MEM_freeN(bfd->user);
        }
index 842132d554cddffa3f4e2acd8cc016d0192f3bda..c57817c275ae85199d006089490722fabc433edd 100644 (file)
@@ -262,17 +262,17 @@ static BHead *find_bhead_from_idname(FileData *fd, const char *idname);
 void blo_reportf_wrap(ReportList *reports, ReportType type, const char *format, ...)
 {
        char fixed_buf[1024]; /* should be long enough */
-       
+
        va_list args;
-       
+
        va_start(args, format);
        vsnprintf(fixed_buf, sizeof(fixed_buf), format, args);
        va_end(args);
-       
+
        fixed_buf[sizeof(fixed_buf) - 1] = '\0';
-       
+
        BKE_report(reports, type, fixed_buf);
-       
+
        if (G.background == 0) {
                printf("%s: %s\n", BKE_report_type_str(type), fixed_buf);
        }
@@ -284,27 +284,27 @@ static const char *library_parent_filepath(Library *lib)
        return lib->parent ? lib->parent->filepath : "<direct>";
 }
 
-static OldNewMap *oldnewmap_new(void) 
+static OldNewMap *oldnewmap_new(void)
 {
        OldNewMap *onm= MEM_callocN(sizeof(*onm), "OldNewMap");
-       
+
        onm->entriessize = 1024;
        onm->entries = MEM_malloc_arrayN(onm->entriessize, sizeof(*onm->entries), "OldNewMap.entries");
-       
+
        return onm;
 }
 
 static int verg_oldnewmap(const void *v1, const void *v2)
 {
        const struct OldNew *x1=v1, *x2=v2;
-       
+
        if (x1->old > x2->old) return 1;
        else if (x1->old < x2->old) return -1;
        return 0;
 }
 
 
-static void oldnewmap_sort(FileData *fd) 
+static void oldnewmap_sort(FileData *fd)
 {
        BLI_assert(fd->libmap->sorted == false);
        qsort(fd->libmap->entries, fd->libmap->nentries, sizeof(OldNew), verg_oldnewmap);
@@ -315,9 +315,9 @@ static void oldnewmap_sort(FileData *fd)
 static void oldnewmap_insert(OldNewMap *onm, const void *oldaddr, void *newaddr, int nr)
 {
        OldNew *entry;
-       
+
        if (oldaddr==NULL || newaddr==NULL) return;
-       
+
        if (UNLIKELY(onm->nentries == onm->entriessize)) {
                onm->entriessize *= 2;
                onm->entries = MEM_reallocN(onm->entries, sizeof(*onm->entries) * onm->entriessize);
@@ -387,19 +387,19 @@ static int oldnewmap_lookup_entry_full(const OldNewMap *onm, const void *addr, i
 static void *oldnewmap_lookup_and_inc(OldNewMap *onm, const void *addr, bool increase_users)
 {
        int i;
-       
+
        if (addr == NULL) return NULL;
-       
+
        if (onm->lasthit < onm->nentries-1) {
                OldNew *entry = &onm->entries[++onm->lasthit];
-               
+
                if (entry->old == addr) {
                        if (increase_users)
                                entry->nr++;
                        return entry->newp;
                }
        }
-       
+
        i = oldnewmap_lookup_entry_full(onm, addr, onm->lasthit);
        if (i != -1) {
                OldNew *entry = &onm->entries[i];
@@ -409,7 +409,7 @@ static void *oldnewmap_lookup_and_inc(OldNewMap *onm, const void *addr, bool inc
                        entry->nr++;
                return entry->newp;
        }
-       
+
        return NULL;
 }
 
@@ -448,7 +448,7 @@ static void *oldnewmap_liblookup(OldNewMap *onm, const void *addr, const void *l
        return NULL;
 }
 
-static void oldnewmap_free_unused(OldNewMap *onm) 
+static void oldnewmap_free_unused(OldNewMap *onm)
 {
        int i;
 
@@ -461,13 +461,13 @@ static void oldnewmap_free_unused(OldNewMap *onm)
        }
 }
 
-static void oldnewmap_clear(OldNewMap *onm) 
+static void oldnewmap_clear(OldNewMap *onm)
 {
        onm->nentries = 0;
        onm->lasthit = 0;
 }
 
-static void oldnewmap_free(OldNewMap *onm) 
+static void oldnewmap_free(OldNewMap *onm)
 {
        MEM_freeN(onm->entries);
        MEM_freeN(onm);
@@ -483,7 +483,7 @@ static void add_main_to_main(Main *mainvar, Main *from)
 {
        ListBase *lbarray[MAX_LIBARRAY], *fromarray[MAX_LIBARRAY];
        int a;
-       
+
        set_listbasepointers(mainvar, lbarray);
        a = set_listbasepointers(from, fromarray);
        while (a--) {
@@ -494,7 +494,7 @@ static void add_main_to_main(Main *mainvar, Main *from)
 void blo_join_main(ListBase *mainlist)
 {
        Main *tojoin, *mainl;
-       
+
        mainl = mainlist->first;
        while ((tojoin = mainl->next)) {
                add_main_to_main(mainl, tojoin);
@@ -530,10 +530,10 @@ void blo_split_main(ListBase *mainlist, Main *main)
 {
        mainlist->first = mainlist->last = main;
        main->next = NULL;
-       
+
        if (BLI_listbase_is_empty(&main->library))
                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__);
@@ -548,7 +548,7 @@ void blo_split_main(ListBase *mainlist, Main *main)
                lib->temp_index = i;
                lib_main_array[i] = libmain;
        }
-       
+
        ListBase *lbarray[MAX_LIBARRAY];
        i = set_listbasepointers(main, lbarray);
        while (i--) {
@@ -565,7 +565,7 @@ void blo_split_main(ListBase *mainlist, Main *main)
 static void read_file_version(FileData *fd, Main *main)
 {
        BHead *bhead;
-       
+
        for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
                if (bhead->code == GLOB) {
                        FileGlobal *fg= read_struct(fd, bhead, "Global");
@@ -630,37 +630,37 @@ static Main *blo_find_main(FileData *fd, const char *filepath, const char *relab
        Main *m;
        Library *lib;
        char name1[FILE_MAX];
-       
+
        BLI_strncpy(name1, filepath, sizeof(name1));
        BLI_cleanup_path(relabase, name1);
-       
+
 //     printf("blo_find_main: relabase  %s\n", relabase);
 //     printf("blo_find_main: original in  %s\n", filepath);
 //     printf("blo_find_main: converted to %s\n", name1);
-       
+
        for (m = mainlist->first; m; m = m->next) {
                const char *libname = (m->curlib) ? m->curlib->filepath : m->name;
-               
+
                if (BLI_path_cmp(name1, libname) == 0) {
                        if (G.debug & G_DEBUG) printf("blo_find_main: found library %s\n", libname);
                        return m;
                }
        }
-       
+
        m = BKE_main_new();
        BLI_addtail(mainlist, m);
-       
+
        /* Add library datablock itself to 'main' Main, since libraries are **never** linked data.
         * Fixes bug where you could end with all ID_LI datablocks having the same name... */
        lib = BKE_libblock_alloc(mainlist->first, ID_LI, "Lib", 0);
        lib->id.us = ID_FAKE_USERS(lib);  /* Important, consistency with main ID reading code from read_libblock(). */
        BLI_strncpy(lib->name, filepath, sizeof(lib->name));
        BLI_strncpy(lib->filepath, name1, sizeof(lib->filepath));
-       
+
        m->curlib = lib;
-       
+
        read_file_version(fd, m);
-       
+
        if (G.debug & G_DEBUG) printf("blo_find_main: added new lib %s\n", filepath);
        return m;
 }
@@ -672,7 +672,7 @@ static void switch_endian_bh4(BHead4 *bhead)
 {
        /* the ID_.. codes */
        if ((bhead->code & 0xFFFF)==0) bhead->code >>= 16;
-       
+
        if (bhead->code != ENDB) {
                BLI_endian_switch_int32(&bhead->len);
                BLI_endian_switch_int32(&bhead->SDNAnr);
@@ -684,7 +684,7 @@ static void switch_endian_bh8(BHead8 *bhead)
 {
        /* the ID_.. codes */
        if ((bhead->code & 0xFFFF)==0) bhead->code >>= 16;
-       
+
        if (bhead->code != ENDB) {
                BLI_endian_switch_int32(&bhead->len);
                BLI_endian_switch_int32(&bhead->SDNAnr);
@@ -707,12 +707,12 @@ static void bh4_from_bh8(BHead *bhead, BHead8 *bhead8, int do_endian_swap)
                if (do_endian_swap) {
                        BLI_endian_switch_int64(&bhead8->old);
                }
-               
+
                /* 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->SDNAnr = bhead8->SDNAnr;
                bhead4->nr = bhead8->nr;
        }
@@ -721,10 +721,10 @@ 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->code = bhead4->code;
        bhead8->len = bhead4->len;
-       
+
        if (bhead8->code != ENDB) {
                bhead8->old = bhead4->old;
                bhead8->SDNAnr = bhead4->SDNAnr;
@@ -736,7 +736,7 @@ static BHeadN *get_bhead(FileData *fd)
 {
        BHeadN *new_bhead = NULL;
        int readsize;
-       
+
        if (fd) {
                if (!fd->eof) {
                        /* initializing to zero isn't strictly needed but shuts valgrind up
@@ -744,7 +744,7 @@ static BHeadN *get_bhead(FileData *fd)
                        BHead8 bhead8 = {0};
                        BHead4 bhead4 = {0};
                        BHead  bhead = {0};
-                       
+
                        /* First read the bhead structure.
                         * Depending on the platform the file was written on this can
                         * be a big or little endian BHead4 or BHead8 structure.
@@ -755,12 +755,12 @@ static BHeadN *get_bhead(FileData *fd)
                        if (fd->flags & FD_FLAGS_FILE_POINTSIZE_IS_4) {
                                bhead4.code = DATA;
                                readsize = fd->read(fd, &bhead4, sizeof(bhead4));
-                               
+
                                if (readsize == sizeof(bhead4) || bhead4.code == ENDB) {
                                        if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
                                                switch_endian_bh4(&bhead4);
                                        }
-                                       
+
                                        if (fd->flags & FD_FLAGS_POINTSIZE_DIFFERS) {
                                                bh8_from_bh4(&bhead, &bhead4);
                                        }
@@ -778,12 +778,12 @@ static BHeadN *get_bhead(FileData *fd)
                        else {
                                bhead8.code = DATA;
                                readsize = fd->read(fd, &bhead8, sizeof(bhead8));
-                               
+
                                if (readsize == sizeof(bhead8) || bhead8.code == ENDB) {
                                        if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
                                                switch_endian_bh8(&bhead8);
                                        }
-                                       
+
                                        if (fd->flags & FD_FLAGS_POINTSIZE_DIFFERS) {
                                                bh4_from_bh8(&bhead, &bhead8, (fd->flags & FD_FLAGS_SWITCH_ENDIAN));
                                        }
@@ -798,10 +798,10 @@ static BHeadN *get_bhead(FileData *fd)
                                        bhead.len= 0;
                                }
                        }
-                       
+
                        /* make sure people are not trying to pass bad blend files */
                        if (bhead.len < 0) fd->eof = 1;
-                       
+
                        /* bhead now contains the (converted) bhead structure. Now read
                         * the associated data and put everything in a BHeadN (creative naming !)
                         */
@@ -810,9 +810,9 @@ static BHeadN *get_bhead(FileData *fd)
                                if (new_bhead) {
                                        new_bhead->next = new_bhead->prev = NULL;
                                        new_bhead->bhead = bhead;
-                                       
+
                                        readsize = fd->read(fd, new_bhead + 1, bhead.len);
-                                       
+
                                        if (readsize != bhead.len) {
                                                fd->eof = 1;
                                                MEM_freeN(new_bhead);
@@ -832,7 +832,7 @@ static BHeadN *get_bhead(FileData *fd)
        if (new_bhead) {
                BLI_addtail(&fd->listbase, new_bhead);
        }
-       
+
        return(new_bhead);
 }
 
@@ -840,7 +840,7 @@ BHead *blo_firstbhead(FileData *fd)
 {
        BHeadN *new_bhead;
        BHead *bhead = NULL;
-       
+
        /* Rewind the file
         * Read in a new block if necessary
         */
@@ -848,11 +848,11 @@ BHead *blo_firstbhead(FileData *fd)
        if (new_bhead == NULL) {
                new_bhead = get_bhead(fd);
        }
-       
+
        if (new_bhead) {
                bhead = &new_bhead->bhead;
        }
-       
+
        return(bhead);
 }
 
@@ -860,7 +860,7 @@ BHead *blo_prevbhead(FileData *UNUSED(fd), BHead *thisblock)
 {
        BHeadN *bheadn = (BHeadN *)POINTER_OFFSET(thisblock, -offsetof(BHeadN, bhead));
        BHeadN *prev = bheadn->prev;
-       
+
        return (prev) ? &prev->bhead : NULL;
 }
 
@@ -868,25 +868,25 @@ BHead *blo_nextbhead(FileData *fd, BHead *thisblock)
 {
        BHeadN *new_bhead = NULL;
        BHead *bhead = NULL;
-       
+
        if (thisblock) {
                /* bhead is actually a sub part of BHeadN
                 * We calculate the BHeadN pointer from the BHead pointer below */
                new_bhead = (BHeadN *)POINTER_OFFSET(thisblock, -offsetof(BHeadN, bhead));
-               
+
                /* get the next BHeadN. If it doesn't exist we read in the next one */
                new_bhead = new_bhead->next;
                if (new_bhead == NULL) {
                        new_bhead = get_bhead(fd);
                }
        }
-       
+
        if (new_bhead) {
                /* here we do the reverse:
                 * go from the BHeadN pointer to the BHead pointer */
                bhead = &new_bhead->bhead;
        }
-       
+
        return(bhead);
 }
 
@@ -945,11 +945,11 @@ static void decode_blender_header(FileData *fd)
 static bool read_file_dna(FileData *fd, const char **r_error_message)
 {
        BHead *bhead;
-       
+
        for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
                if (bhead->code == DNA1) {
                        const bool do_endian_swap = (fd->flags & FD_FLAGS_SWITCH_ENDIAN) != 0;
-                       
+
                        fd->filesdna = DNA_sdna_from_data(&bhead[1], bhead->len, do_endian_swap, true, r_error_message);
                        if (fd->filesdna) {
                                fd->compflags = DNA_struct_get_compareflags(fd->filesdna, fd->memsdna);
@@ -961,12 +961,12 @@ static bool read_file_dna(FileData *fd, const char **r_error_message)
                        else {
                                return false;
                        }
-                       
+
                }
                else if (bhead->code == ENDB)
                        break;
        }
-       
+
        *r_error_message = "Missing DNA block";
        return false;
 }
@@ -1015,28 +1015,28 @@ static int *read_file_thumbnail(FileData *fd)
 static int fd_read_from_file(FileData *filedata, void *buffer, unsigned int size)
 {
        int readsize = read(filedata->filedes, buffer, size);
-       
+
        if (readsize < 0) {
                readsize = EOF;
        }
        else {
                filedata->seek += readsize;
        }
-       
+
        return readsize;
 }
 
 static int fd_read_gzip_from_file(FileData *filedata, void *buffer, unsigned int size)
 {
        int readsize = gzread(filedata->gzfiledes, buffer, size);
-       
+
        if (readsize < 0) {
                readsize = EOF;
        }
        else {
                filedata->seek += readsize;
        }
-       
+
        return (readsize);
 }
 
@@ -1044,10 +1044,10 @@ static int fd_read_from_memory(FileData *filedata, void *buffer, unsigned int si
 {
        /* don't read more bytes then there are available in the buffer */
        int readsize = (int)MIN2(size, (unsigned int)(filedata->buffersize - filedata->seek));
-       
+
        memcpy(buffer, filedata->buffer + filedata->seek, readsize);
        filedata->seek += readsize;
-       
+
        return (readsize);
 }
 
@@ -1057,13 +1057,13 @@ static int fd_read_from_memfile(FileData *filedata, void *buffer, unsigned int s
        static unsigned int offset = 0;         /* size of previous chunks */
        static MemFileChunk *chunk = NULL;
        unsigned int chunkoffset, readsize, totread;
-       
+
        if (size == 0) return 0;
-       
+
        if (seek != (unsigned int)filedata->seek) {
                chunk = filedata->memfile->chunks.first;
                seek = 0;
-               
+
                while (chunk) {
                        if (seek + chunk->size > (unsigned) filedata->seek) break;
                        seek += chunk->size;
@@ -1072,48 +1072,48 @@ static int fd_read_from_memfile(FileData *filedata, void *buffer, unsigned int s
                offset = seek;
                seek = filedata->seek;
        }
-       
+
        if (chunk) {
                totread = 0;
-               
+
                do {
                        /* first check if it's on the end if current chunk */
                        if (seek-offset == chunk->size) {
                                offset += chunk->size;
                                chunk = chunk->next;
                        }
-                       
+
                        /* debug, should never happen */
                        if (chunk == NULL) {
                                printf("illegal read, chunk zero\n");
                                return 0;
                        }
-                       
+
                        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;
-                       
+
                        memcpy(POINTER_OFFSET(buffer, totread), chunk->buf + chunkoffset, readsize);
                        totread += readsize;
                        filedata->seek += readsize;
                        seek += readsize;
                } while (totread < size);
-               
+
                return totread;
        }
-       
+
        return 0;
 }
 
 static FileData *filedata_new(void)
 {
        FileData *fd = MEM_callocN(sizeof(FileData), "FileData");
-       
+
        fd->filedes = -1;
        fd->gzfiledes = NULL;
 
@@ -1122,14 +1122,14 @@ static FileData *filedata_new(void)
        fd->datamap = oldnewmap_new();
        fd->globmap = oldnewmap_new();
        fd->libmap = oldnewmap_new();
-       
+
        return fd;
 }
 
 static FileData *blo_decode_and_check(FileData *fd, ReportList *reports)
 {
        decode_blender_header(fd);
-       
+
        if (fd->flags & FD_FLAGS_FILE_OK) {
                const char *error_message = NULL;
                if (read_file_dna(fd, &error_message) == false) {
@@ -1145,7 +1145,7 @@ static FileData *blo_decode_and_check(FileData *fd, ReportList *reports)
                blo_freefiledata(fd);
                fd = NULL;
        }
-       
+
        return fd;
 }
 
@@ -1156,7 +1156,7 @@ FileData *blo_openblenderfile(const char *filepath, ReportList *reports)
        gzFile gzfile;
        errno = 0;
        gzfile = BLI_gzopen(filepath, "rb");
-       
+
        if (gzfile == (gzFile)Z_NULL) {
                BKE_reportf(reports, RPT_WARNING, "Unable to open '%s': %s",
                            filepath, errno ? strerror(errno) : TIP_("unknown error reading file"));
@@ -1166,10 +1166,10 @@ FileData *blo_openblenderfile(const char *filepath, ReportList *reports)
                FileData *fd = filedata_new();
                fd->gzfiledes = gzfile;
                fd->read = fd_read_gzip_from_file;
-               
+
                /* needed for library_append and read_libraries */
                BLI_strncpy(fd->relabase, filepath, sizeof(fd->relabase));
-               
+
                return blo_decode_and_check(fd, reports);
        }
 }
@@ -1232,12 +1232,12 @@ static int fd_read_gzip_from_memory_init(FileData *fd)
        fd->strm.total_out = 0;
        fd->strm.zalloc = Z_NULL;
        fd->strm.zfree = Z_NULL;
-       
+
        if (inflateInit2(&fd->strm, (16+MAX_WBITS)) != Z_OK)
                return 0;
 
        fd->read = fd_read_gzip_from_memory;
-       
+
        return 1;
 }
 
@@ -1250,10 +1250,10 @@ FileData *blo_openblendermemory(const void *mem, int memsize, ReportList *report
        else {
                FileData *fd = filedata_new();
                const char *cp = mem;
-               
+
                fd->buffer = mem;
                fd->buffersize = memsize;
-               
+
                /* test if gzip */
                if (cp[0] == 0x1f && cp[1] == 0x8b) {
                        if (0 == fd_read_gzip_from_memory_init(fd)) {
@@ -1263,7 +1263,7 @@ FileData *blo_openblendermemory(const void *mem, int memsize, ReportList *report
                }
                else
                        fd->read = fd_read_from_memory;
-                       
+
                fd->flags |= FD_FLAGS_NOT_MY_BUFFER;
 
                return blo_decode_and_check(fd, reports);
@@ -1279,10 +1279,10 @@ FileData *blo_openblendermemfile(MemFile *memfile, ReportList *reports)
        else {
                FileData *fd = filedata_new();
                fd->memfile = memfile;
-               
+
                fd->read = fd_read_from_memfile;
                fd->flags |= FD_FLAGS_NOT_MY_BUFFER;
-               
+
                return blo_decode_and_check(fd, reports);
        }
 }
@@ -1294,22 +1294,22 @@ void blo_freefiledata(FileData *fd)
                if (fd->filedes != -1) {
                        close(fd->filedes);
                }
-               
+
                if (fd->gzfiledes != NULL) {
                        gzclose(fd->gzfiledes);
                }
-               
+
                if (fd->strm.next_in) {
                        if (inflateEnd(&fd->strm) != Z_OK) {
                                printf("close gzip stream error\n");
                        }
                }
-               
+
                if (fd->buffer && !(fd->flags & FD_FLAGS_NOT_MY_BUFFER)) {
                        MEM_freeN((void *)fd->buffer);
                        fd->buffer = NULL;
                }
-               
+
                // Free all BHeadN data blocks
                BLI_freelistN(&fd->listbase);
 
@@ -1317,7 +1317,7 @@ void blo_freefiledata(FileData *fd)
                        DNA_sdna_free(fd->filesdna);
                if (fd->compflags)
                        MEM_freeN((void *)fd->compflags);
-               
+
                if (fd->datamap)
                        oldnewmap_free(fd->datamap);
                if (fd->globmap)
@@ -1334,7 +1334,7 @@ void blo_freefiledata(FileData *fd)
                        oldnewmap_free(fd->libmap);
                if (fd->bheadmap)
                        MEM_freeN(fd->bheadmap);
-               
+
 #ifdef USE_GHASH_BHEAD
                if (fd->bhead_idname_hash) {
                        BLI_ghash_free(fd->bhead_idname_hash, NULL, NULL);
@@ -1531,7 +1531,7 @@ static void *newpackedadr(FileData *fd, const void *adr)      /* used to restore
 {
        if (fd->packedmap && adr)
                return oldnewmap_lookup_and_inc(fd->packedmap, adr, true);
-       
+
        return oldnewmap_lookup_and_inc(fd->datamap, adr, true);
 }
 
@@ -1549,9 +1549,9 @@ void *blo_do_versions_newlibadr(FileData *fd, const void *lib, const void *adr)
 static void *newlibadr_us(FileData *fd, const void *lib, const void *adr)      /* increases user number */
 {
        ID *id = newlibadr(fd, lib, adr);
-       
+
        id_us_plus_no_lib(id);
-       
+
        return id;
 }
 
@@ -1572,13 +1572,13 @@ static void *newlibadr_real_us(FileData *fd, const void *lib, const void *adr)  /
 static void change_idid_adr_fd(FileData *fd, const void *old, void *new)
 {
        int i;
-       
+
        /* use a binary search if we have a sorted libmap, for now it's not needed. */
        BLI_assert(fd->libmap->sorted == false);
 
        for (i = 0; i < fd->libmap->nentries; i++) {
                OldNew *entry = &fd->libmap->entries[i];
-               
+
                if (old==entry->newp && entry->nr==ID_ID) {
                        entry->newp = new;
                        if (new) entry->nr = GS( ((ID *)new)->name );
@@ -1589,15 +1589,15 @@ static void change_idid_adr_fd(FileData *fd, const void *old, void *new)
 static void change_idid_adr(ListBase *mainlist, FileData *basefd, void *old, void *new)
 {
        Main *mainptr;
-       
+
        for (mainptr = mainlist->first; mainptr; mainptr = mainptr->next) {
                FileData *fd;
-               
+
                if (mainptr->curlib)
                        fd = mainptr->curlib->filedata;
                else
                        fd = basefd;
-               
+
                if (fd) {
                        change_idid_adr_fd(fd, old, new);
                }
@@ -1611,7 +1611,7 @@ static void change_idid_adr(ListBase *mainlist, FileData *basefd, void *old, voi
 void blo_clear_proxy_pointers_from_lib(Main *oldmain)
 {
        Object *ob = oldmain->object.first;
-       
+
        for (; ob; ob= ob->id.next) {
                if (ob->id.lib)
                        ob->proxy_from = NULL;
@@ -1623,9 +1623,9 @@ void blo_make_image_pointer_map(FileData *fd, Main *oldmain)
        Image *ima = oldmain->image.first;
        Scene *sce = oldmain->scene.first;
        int a;
-       
+
        fd->imamap = oldnewmap_new();
-       
+
        for (; ima; ima = ima->id.next) {
                if (ima->cache)
                        oldnewmap_insert(fd->imamap, ima->cache, ima->cache, 0);
@@ -1657,13 +1657,13 @@ void blo_end_image_pointer_map(FileData *fd, Main *oldmain)
        Image *ima = oldmain->image.first;
        Scene *sce = oldmain->scene.first;
        int i;
-       
+
        /* used entries were restored, so we put them to zero */
        for (i = 0; i < fd->imamap->nentries; i++, entry++) {
                if (entry->nr > 0)
                        entry->newp = NULL;
        }
-       
+
        for (; ima; ima = ima->id.next) {
                ima->cache = newimaadr(fd, ima->cache);
                if (ima->cache == NULL) {
@@ -1676,7 +1676,7 @@ void blo_end_image_pointer_map(FileData *fd, Main *oldmain)
                }
                for (i = 0; i < IMA_MAX_RENDER_SLOT; i++)
                        ima->renders[i] = newimaadr(fd, ima->renders[i]);
-               
+
                for (i = 0; i < TEXTARGET_COUNT; i++)
                        ima->gputexture[i] = newimaadr(fd, ima->gputexture[i]);
                ima->rr = newimaadr(fd, ima->rr);
@@ -1685,7 +1685,7 @@ void blo_end_image_pointer_map(FileData *fd, Main *oldmain)
                if (sce->nodetree && sce->nodetree->previews) {
                        bNodeInstanceHash *new_previews = BKE_node_instance_hash_new("node previews");
                        bNodeInstanceHashIterator iter;
-                       
+
                        /* reconstruct the preview hash, only using remaining pointers */
                        NODE_INSTANCE_HASH_ITER(iter, sce->nodetree->previews) {
                                bNodePreview *preview = BKE_node_instance_hash_iterator_get_value(&iter);
@@ -1707,17 +1707,17 @@ void blo_make_movieclip_pointer_map(FileData *fd, Main *oldmain)
 {
        MovieClip *clip = oldmain->movieclip.first;
        Scene *sce = oldmain->scene.first;
-       
+
        fd->movieclipmap = oldnewmap_new();
-       
+
        for (; clip; clip = clip->id.next) {
                if (clip->cache)
                        oldnewmap_insert(fd->movieclipmap, clip->cache, clip->cache, 0);
-               
+
                if (clip->tracking.camera.intrinsics)
                        oldnewmap_insert(fd->movieclipmap, clip->tracking.camera.intrinsics, clip->tracking.camera.intrinsics, 0);
        }
-       
+
        for (; sce; sce = sce->id.next) {
                if (sce->nodetree) {
                        bNode *node;
@@ -1736,18 +1736,18 @@ void blo_end_movieclip_pointer_map(FileData *fd, Main *oldmain)
        MovieClip *clip = oldmain->movieclip.first;
        Scene *sce = oldmain->scene.first;
        int i;
-       
+
        /* used entries were restored, so we put them to zero */
        for (i=0; i < fd->movieclipmap->nentries; i++, entry++) {
                if (entry->nr > 0)
                        entry->newp = NULL;
        }
-       
+
        for (; clip; clip = clip->id.next) {
                clip->cache = newmclipadr(fd, clip->cache);
                clip->tracking.camera.intrinsics = newmclipadr(fd, clip->tracking.camera.intrinsics);
        }
-       
+
        for (; sce; sce = sce->id.next) {
                if (sce->nodetree) {
                        bNode *node;
@@ -1761,12 +1761,12 @@ void blo_end_movieclip_pointer_map(FileData *fd, Main *oldmain)
 void blo_make_sound_pointer_map(FileData *fd, Main *oldmain)
 {
        bSound *sound = oldmain->sound.first;
-       
+
        fd->soundmap = oldnewmap_new();
-       
+
        for (; sound; sound = sound->id.next) {
                if (sound->waveform)
-                       oldnewmap_insert(fd->soundmap, sound->waveform, sound->waveform, 0);                    
+                       oldnewmap_insert(fd->soundmap, sound->waveform, sound->waveform, 0);
        }
 }
 
@@ -1777,13 +1777,13 @@ void blo_end_sound_pointer_map(FileData *fd, Main *oldmain)
        OldNew *entry = fd->soundmap->entries;
        bSound *sound = oldmain->sound.first;
        int i;
-       
+
        /* used entries were restored, so we put them to zero */
        for (i = 0; i < fd->soundmap->nentries; i++, entry++) {
                if (entry->nr > 0)
                        entry->newp = NULL;
        }
-       
+
        for (; sound; sound = sound->id.next) {
                sound->waveform = newsoundadr(fd, sound->waveform);
        }
@@ -1803,9 +1803,9 @@ void blo_make_packed_pointer_map(FileData *fd, Main *oldmain)
        VFont *vfont;
        bSound *sound;
        Library *lib;
-       
+
        fd->packedmap = oldnewmap_new();
-       
+
        for (ima = oldmain->image.first; ima; ima = ima->id.next) {
                ImagePackedFile *imapf;
 
@@ -1816,15 +1816,15 @@ void blo_make_packed_pointer_map(FileData *fd, Main *oldmain)
                        if (imapf->packedfile)
                                insert_packedmap(fd, imapf->packedfile);
        }
-                       
+
        for (vfont = oldmain->vfont.first; vfont; vfont = vfont->id.next)
                if (vfont->packedfile)
                        insert_packedmap(fd, vfont->packedfile);
-       
+
        for (sound = oldmain->sound.first; sound; sound = sound->id.next)
                if (sound->packedfile)
                        insert_packedmap(fd, sound->packedfile);
-       
+
        for (lib = oldmain->library.first; lib; lib = lib->id.next)
                if (lib->packedfile)
                        insert_packedmap(fd, lib->packedfile);
@@ -1841,13 +1841,13 @@ void blo_end_packed_pointer_map(FileData *fd, Main *oldmain)
        Library *lib;
        OldNew *entry = fd->packedmap->entries;
        int i;
-       
+
        /* used entries were restored, so we put them to zero */
        for (i=0; i < fd->packedmap->nentries; i++, entry++) {
                if (entry->nr > 0)
                        entry->newp = NULL;
        }
-       
+
        for (ima = oldmain->image.first; ima; ima = ima->id.next) {
                ImagePackedFile *imapf;
 
@@ -1856,13 +1856,13 @@ void blo_end_packed_pointer_map(FileData *fd, Main *oldmain)
                for (imapf = ima->packedfiles.first; imapf; imapf = imapf->next)
                        imapf->packedfile = newpackedadr(fd, imapf->packedfile);
        }
-       
+
        for (vfont = oldmain->vfont.first; vfont; vfont = vfont->id.next)
                vfont->packedfile = newpackedadr(fd, vfont->packedfile);
 
        for (sound = oldmain->sound.first; sound; sound = sound->id.next)
                sound->packedfile = newpackedadr(fd, sound->packedfile);
-               
+
        for (lib = oldmain->library.first; lib; lib = lib->id.next)
                lib->packedfile = newpackedadr(fd, lib->packedfile);
 }
@@ -1873,7 +1873,7 @@ void blo_add_library_pointer_map(ListBase *old_mainlist, FileData *fd)
 {
        Main *ptr = old_mainlist->first;
        ListBase *lbarray[MAX_LIBARRAY];
-       
+
        for (ptr = ptr->next; ptr; ptr = ptr->next) {
                int i = set_listbasepointers(ptr, lbarray);
                while (i--) {
@@ -1894,14 +1894,14 @@ 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] ];
-       
+
        nblocks = bhead->nr;
        while (nblocks--) {
                DNA_struct_switch_endian(filesdna, bhead->SDNAnr, data);
-               
+
                data += blocksize;
        }
 }
@@ -1909,12 +1909,12 @@ static void switch_endian_structs(const struct SDNA *filesdna, BHead *bhead)
 static void *read_struct(FileData *fd, BHead *bh, const char *blockname)
 {
        void *temp = NULL;
-       
+
        if (bh->len) {
                /* switch is based on file dna */
                if (bh->SDNAnr && (fd->flags & FD_FLAGS_SWITCH_ENDIAN))
                        switch_endian_structs(fd->filesdna, bh);
-               
+
                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));
@@ -1935,9 +1935,9 @@ 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 */
 {
        Link *ln, *prev;
-       
+
        if (BLI_listbase_is_empty(lb)) return;
-       
+
        lb->first = newdataadr(fd, lb->first);
        if (callback != NULL) {
                callback(fd, lb->first);
@@ -1972,7 +1972,7 @@ static void link_glob_list(FileData *fd, ListBase *lb)            /* for glob data */
                oldnewmap_insert(fd->globmap, lb->first, poin, 0);
        }
        lb->first = poin;
-       
+
        ln = lb->first;
        prev = NULL;
        while (ln) {
@@ -2000,11 +2000,11 @@ static void test_pointer_array(FileData *fd, void **mat)
                 */
        if (*mat) {
                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;
-                       
+
                        while (len-- > 0) {
                                if ((fd->flags & FD_FLAGS_SWITCH_ENDIAN))
                                        BLI_endian_switch_int64(lpoin);
@@ -2015,11 +2015,11 @@ static void test_pointer_array(FileData *fd, void **mat)
                        MEM_freeN(*mat);
                        *mat = imat;
                }
-               
+
                if (fd->filesdna->pointerlen==4 && fd->memsdna->pointerlen==8) {
                        lpoin = lmat = MEM_malloc_arrayN(len, 8, "newmatar");
                        ipoin = *mat;
-                       
+
                        while (len-- > 0) {
                                *lpoin = *ipoin;
                                ipoin++;
@@ -2040,21 +2040,21 @@ static void IDP_DirectLinkIDPArray(IDProperty *prop, int switch_endian, FileData
 {
        IDProperty *array;
        int i;
-       
+
        /* since we didn't save the extra buffer, set totallen to len */
        prop->totallen = prop->len;
        prop->data.pointer = newdataadr(fd, prop->data.pointer);
 
        array = (IDProperty *)prop->data.pointer;
-       
+
        /* note!, idp-arrays didn't exist in 2.4x, so the pointer will be cleared
         * theres not really anything we can do to correct this, at least don't crash */
        if (array == NULL) {
                prop->len = 0;
                prop->totallen = 0;
        }
-       
-       
+
+
        for (i = 0; i < prop->len; i++)
                IDP_DirectLinkProperty(&array[i], switch_endian, fd);
 }
@@ -2063,15 +2063,15 @@ static void IDP_DirectLinkArray(IDProperty *prop, int switch_endian, FileData *f
 {
        IDProperty **array;
        int i;
-       
+
        /* since we didn't save the extra buffer, set totallen to len */
        prop->totallen = prop->len;
        prop->data.pointer = newdataadr(fd, prop->data.pointer);
-       
+
        if (prop->subtype == IDP_GROUP) {
                test_pointer_array(fd, prop->data.pointer);
                array = prop->data.pointer;
-               
+
                for (i = 0; i < prop->len; i++)
                        IDP_DirectLinkProperty(array[i], switch_endian, fd);
        }
@@ -2099,9 +2099,9 @@ static void IDP_DirectLinkGroup(IDProperty *prop, int switch_endian, FileData *f
 {
        ListBase *lb = &prop->data.group;
        IDProperty *loop;
-       
+
        link_list(fd, lb);
-       
+
        /*Link child id properties now*/
        for (loop=prop->data.group.first; loop; loop=loop->next) {
                IDP_DirectLinkProperty(loop, switch_endian, fd);
@@ -2133,7 +2133,7 @@ static void IDP_DirectLinkProperty(IDProperty *prop, int switch_endian, FileData
                         * if switch_endian is true, so we have to first unswap
                         * them then reswap them as a single 64-bit entity.
                         */
-                       
+
                        if (switch_endian) {
                                BLI_endian_switch_int32(&prop->data.val);
                                BLI_endian_switch_int32(&prop->data.val2);
@@ -2216,7 +2216,7 @@ static void IDP_LibLinkProperty(IDProperty *prop, FileData *fd)
 static PreviewImage *direct_link_preview_image(FileData *fd, PreviewImage *old_prv)
 {
        PreviewImage *prv = newdataadr(fd, old_prv);
-       
+
        if (prv) {
                int i;
                for (i = 0; i < NUM_ICON_SIZES; ++i) {
@@ -2228,7 +2228,7 @@ static PreviewImage *direct_link_preview_image(FileData *fd, PreviewImage *old_p
                prv->icon_id = 0;
                prv->tag = 0;
        }
-       
+
        return prv;
 }
 
@@ -2255,10 +2255,10 @@ static void direct_link_id(FileData *fd, ID *id)
 static void direct_link_curvemapping(FileData *fd, CurveMapping *cumap)
 {
        int a;
-       
+
        /* flag seems to be able to hang? Maybe old files... not bad to clear anyway */
        cumap->flag &= ~CUMA_PREMULLED;
-       
+
        for (a = 0; a < CM_TOT; a++) {
                cumap->cm[a].curve = newdataadr(fd, cumap->cm[a].curve);
                cumap->cm[a].table = NULL;
@@ -2349,7 +2349,7 @@ static PackedFile *direct_link_packedfile(FileData *fd, PackedFile *oldpf)
        if (pf) {
                pf->data = newpackedadr(fd, pf->data);
        }
-       
+
        return pf;
 }
 
@@ -2361,7 +2361,7 @@ static PackedFile *direct_link_packedfile(FileData *fd, PackedFile *oldpf)
 static void lib_link_ipo(FileData *fd, Main *main)
 {
        Ipo *ipo;
-       
+
        for (ipo = main->ipo.first; ipo; ipo = ipo->id.next) {
                if (ipo->id.tag & LIB_TAG_NEED_LINK) {
                        IpoCurve *icu;
@@ -2380,7 +2380,7 @@ static void direct_link_ipo(FileData *fd, Ipo *ipo)
        IpoCurve *icu;
 
        link_list(fd, &(ipo->curve));
-       
+
        for (icu = ipo->curve.first; icu; icu = icu->next) {
                icu->bezt = newdataadr(fd, icu->bezt);
                icu->bp = newdataadr(fd, icu->bp);
@@ -2393,7 +2393,7 @@ static void lib_link_nlastrips(FileData *fd, ID *id, ListBase *striplist)
 {
        bActionStrip *strip;
        bActionModifier *amod;
-       
+
        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);
@@ -2407,9 +2407,9 @@ static void lib_link_nlastrips(FileData *fd, ID *id, ListBase *striplist)
 static void direct_link_nlastrips(FileData *fd, ListBase *strips)
 {
        bActionStrip *strip;
-       
+
        link_list(fd, strips);
-       
+
        for (strip = strips->first; strip; strip = strip->next)
                link_list(fd, &strip->modifiers);
 }
@@ -2429,7 +2429,7 @@ static void lib_link_constraint_channels(FileData *fd, ID *id, ListBase *chanbas
 static void lib_link_fmodifiers(FileData *fd, ID *id, ListBase *list)
 {
        FModifier *fcm;
-       
+
        for (fcm = list->first; fcm; fcm = fcm->next) {
                /* data for specific modifiers */
                switch (fcm->type) {
@@ -2444,33 +2444,33 @@ static void lib_link_fmodifiers(FileData *fd, ID *id, ListBase *list)
        }
 }
 
-static void lib_link_fcurves(FileData *fd, ID *id, ListBase *list) 
+static void lib_link_fcurves(FileData *fd, ID *id, ListBase *list)
 {
        FCurve *fcu;
-       
+
        if (list == NULL)
                return;
-       
+
        /* relink ID-block references... */
        for (fcu = list->first; fcu; fcu = fcu->next) {
                /* driver data */
                if (fcu->driver) {
                        ChannelDriver *driver = fcu->driver;
                        DriverVar *dvar;
-                       
+
                        for (dvar= driver->variables.first; dvar; dvar= dvar->next) {
                                DRIVER_TARGETS_LOOPER(dvar)
                                {
                                        /* only relink if still used */
                                        if (tarIndex < dvar->num_targets)
-                                               dtar->id = newlibadr(fd, id->lib, dtar->id); 
+                                               dtar->id = newlibadr(fd, id->lib, dtar->id);
                                        else
                                                dtar->id = NULL;
                                }
                                DRIVER_TARGETS_LOOPER_END
                        }
                }
-               
+
                /* modifiers */
                lib_link_fmodifiers(fd, id, &fcu->modifiers);
        }
@@ -2481,20 +2481,20 @@ static void lib_link_fcurves(FileData *fd, ID *id, ListBase *list)
 static void direct_link_fmodifiers(FileData *fd, ListBase *list, FCurve *curve)
 {
        FModifier *fcm;
-       
+
        for (fcm = list->first; fcm; fcm = fcm->next) {
                /* relink general data */
                fcm->data  = newdataadr(fd, fcm->data);
                fcm->curve = curve;
-               
+
                /* do relinking of data for specific types */
                switch (fcm->type) {
                        case FMODIFIER_TYPE_GENERATOR:
                        {
                                FMod_Generator *data = (FMod_Generator *)fcm->data;
-                               
+
                                data->coefficients = newdataadr(fd, data->coefficients);
-                               
+
                                if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
                                        BLI_endian_switch_float_array(data->coefficients, data->arraysize);
                                }
@@ -2504,7 +2504,7 @@ static void direct_link_fmodifiers(FileData *fd, ListBase *list, FCurve *curve)
                        case FMODIFIER_TYPE_ENVELOPE:
                        {
                                FMod_Envelope *data=  (FMod_Envelope *)fcm->data;
-                               
+
                                data->data= newdataadr(fd, data->data);
 
                                break;
@@ -2512,7 +2512,7 @@ static void direct_link_fmodifiers(FileData *fd, ListBase *list, FCurve *curve)
                        case FMODIFIER_TYPE_PYTHON:
                        {
                                FMod_Python *data = (FMod_Python *)fcm->data;
-                               
+
                                data->prop = newdataadr(fd, data->prop);
                                IDP_DirectLinkGroup_OrFree(&data->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
 
@@ -2526,38 +2526,38 @@ static void direct_link_fmodifiers(FileData *fd, ListBase *list, FCurve *curve)
 static void direct_link_fcurves(FileData *fd, ListBase *list)
 {
        FCurve *fcu;
-       
+
        /* link F-Curve data to F-Curve again (non ID-libs) */
        for (fcu = list->first; fcu; fcu = fcu->next) {
                /* curve data */
                fcu->bezt = newdataadr(fd, fcu->bezt);
                fcu->fpt = newdataadr(fd, fcu->fpt);
-               
+
                /* rna path */
                fcu->rna_path = newdataadr(fd, fcu->rna_path);
-               
+
                /* group */
                fcu->grp = newdataadr_ex(fd, fcu->grp, false);
-               
+
                /* clear disabled flag - allows disabled drivers to be tried again ([#32155]),
                 * but also means that another method for "reviving disabled F-Curves" exists
                 */
                fcu->flag &= ~FCURVE_DISABLED;
-               
+
                /* driver */
                fcu->driver= newdataadr(fd, fcu->driver);
                if (fcu->driver) {
                        ChannelDriver *driver= fcu->driver;
                        DriverVar *dvar;
-                       
+
                        /* compiled expression data will need to be regenerated (old pointer may still be set here) */
                        driver->expr_comp = NULL;
-                       
-                       /* give the driver a fresh chance - the operating environment may be different now 
+
+                       /* give the driver a fresh chance - the operating environment may be different now
                         * (addons, etc. may be different) so the driver namespace may be sane now [#32155]
                         */
                        driver->flag &= ~DRIVER_FLAG_INVALID;
-                       
+
                        /* relink variables, targets and their paths */
                        link_list(fd, &driver->variables);
                        for (dvar= driver->variables.first; dvar; dvar= dvar->next) {
@@ -2572,7 +2572,7 @@ static void direct_link_fcurves(FileData *fd, ListBase *list)
                                DRIVER_TARGETS_LOOPER_END
                        }
                }
-               
+
                /* modifiers */
                link_list(fd, &fcu->modifiers);
                direct_link_fmodifiers(fd, &fcu->modifiers, fcu);
@@ -2585,14 +2585,14 @@ static void lib_link_action(FileData *fd, Main *main)
        for (bAction *act = main->action.first; act; act = act->id.next) {
                if (act->id.tag & LIB_TAG_NEED_LINK) {
                        IDP_LibLinkProperty(act->id.properties, fd);
-                       
+
 // XXX deprecated - old animation system <<<
                        for (bActionChannel *chan = act->chanbase.first; chan; chan = chan->next) {
                                chan->ipo = newlibadr_us(fd, act->id.lib, chan->ipo);
                                lib_link_constraint_channels(fd, &act->id, &chan->constraintChannels);
                        }
 // >>> XXX deprecated - old animation system
-                       
+
                        lib_link_fcurves(fd, &act->id, &act->curves);
 
                        for (TimeMarker *marker = act->markers.first; marker; marker = marker->next) {
@@ -2619,13 +2619,13 @@ static void direct_link_action(FileData *fd, bAction *act)
 // XXX deprecated - old animation system <<<
        for (achan = act->chanbase.first; achan; achan=achan->next) {
                achan->grp = newdataadr(fd, achan->grp);
-               
+
                link_list(fd, &achan->constraintChannels);
        }
 // >>> XXX deprecated - old animation system
 
        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);
@@ -2635,17 +2635,17 @@ static void direct_link_action(FileData *fd, bAction *act)
 static void lib_link_nladata_strips(FileData *fd, ID *id, ListBase *list)
 {
        NlaStrip *strip;
-       
+
        for (strip = list->first; strip; strip = strip->next) {
                /* check strip's children */
                lib_link_nladata_strips(fd, id, &strip->strips);
-               
+
                /* check strip's F-Curves */
                lib_link_fcurves(fd, id, &strip->fcurves);
-               
+
                /* reassign the counted-reference to action */
                strip->act = newlibadr_us(fd, id->lib, strip->act);
-               
+
                /* fix action id-root (i.e. if it comes from a pre 2.57 .blend file) */
                if ((strip->act) && (strip->act->idroot == 0))
                        strip->act->idroot = GS(id->name);
@@ -2655,29 +2655,29 @@ static void lib_link_nladata_strips(FileData *fd, ID *id, ListBase *list)
 static void lib_link_nladata(FileData *fd, ID *id, ListBase *list)
 {
        NlaTrack *nlt;
-       
+
        /* we only care about the NLA strips inside the tracks */
        for (nlt = list->first; nlt; nlt = nlt->next) {
                lib_link_nladata_strips(fd, id, &nlt->strips);
        }
 }
 
-/* This handles Animato NLA-Strips linking 
+/* This handles Animato NLA-Strips linking
  * NOTE: this assumes that link_list has already been called on the list
  */
 static void direct_link_nladata_strips(FileData *fd, ListBase *list)
 {
        NlaStrip *strip;
-       
+
        for (strip = list->first; strip; strip = strip->next) {
                /* strip's child strips */
                link_list(fd, &strip->strips);
                direct_link_nladata_strips(fd, &strip->strips);
-               
+
                /* strip's F-Curves */
                link_list(fd, &strip->fcurves);
                direct_link_fcurves(fd, &strip->fcurves);
-               
+
                /* strip's F-Modifiers */
                link_list(fd, &strip->modifiers);
                direct_link_fmodifiers(fd, &strip->modifiers, NULL);
@@ -2688,11 +2688,11 @@ static void direct_link_nladata_strips(FileData *fd, ListBase *list)
 static void direct_link_nladata(FileData *fd, ListBase *list)
 {
        NlaTrack *nlt;
-       
+
        for (nlt = list->first; nlt; nlt = nlt->next) {
                /* relink list of strips */
                link_list(fd, &nlt->strips);
-               
+
                /* relink strip data */
                direct_link_nladata_strips(fd, &nlt->strips);
        }
@@ -2704,11 +2704,11 @@ static void lib_link_keyingsets(FileData *fd, ID *id, ListBase *list)
 {
        KeyingSet *ks;
        KS_Path *ksp;
-       
+
        /* 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);
                }
        }
 }
@@ -2718,12 +2718,12 @@ static void direct_link_keyingsets(FileData *fd, ListBase *list)
 {
        KeyingSet *ks;
        KS_Path *ksp;
-       
+
        /* link KeyingSet data to KeyingSet again (non ID-libs) */
        for (ks = list->first; ks; ks = ks->next) {
                /* paths */
                link_list(fd, &ks->paths);
-               
+
                for (ksp = ks->paths.first; ksp; ksp = ksp->next) {
                        /* rna path */
                        ksp->rna_path= newdataadr(fd, ksp->rna_path);
@@ -2737,22 +2737,22 @@ static void lib_link_animdata(FileData *fd, ID *id, AnimData *adt)
 {
        if (adt == NULL)
                return;
-       
+
        /* link action data */
        adt->action= newlibadr_us(fd, id->lib, adt->action);
        adt->tmpact= newlibadr_us(fd, id->lib, adt->tmpact);
-       
+
        /* fix action id-roots (i.e. if they come from a pre 2.57 .blend file) */
        if ((adt->action) && (adt->action->idroot == 0))
                adt->action->idroot = GS(id->name);
        if ((adt->tmpact) && (adt->tmpact->idroot == 0))
                adt->tmpact->idroot = GS(id->name);
-       
+
        /* link drivers */
        lib_link_fcurves(fd, id, &adt->drivers);
-       
+
        /* overrides don't have lib-link for now, so no need to do anything */
-       
+
        /* link NLA-data */
        lib_link_nladata(fd, id, &adt->nla_tracks);
 }
@@ -2762,18 +2762,18 @@ static void direct_link_animdata(FileData *fd, AnimData *adt)
        /* NOTE: must have called newdataadr already before doing this... */
        if (adt == NULL)
                return;
-       
+
        /* link drivers */
        link_list(fd, &adt->drivers);
        direct_link_fcurves(fd, &adt->drivers);
-       
+
        /* link overrides */
        // TODO...
-       
+
        /* link NLA-data */
        link_list(fd, &adt->nla_tracks);
        direct_link_nladata(fd, &adt->nla_tracks);
-       
+
        /* relink active track/strip - even though strictly speaking this should only be used
         * if we're in 'tweaking mode', we need to be able to have this loaded back for
         * undo, but also since users may not exit tweakmode before saving (#24535)
@@ -2782,7 +2782,7 @@ static void direct_link_animdata(FileData *fd, AnimData *adt)
        //              state, but it's going to be too hard to enforce this single case...
        adt->act_track = newdataadr(fd, adt->act_track);
        adt->actstrip = newdataadr(fd, adt->actstrip);
-}      
+}
 
 /* ************ READ CACHEFILES *************** */
 
@@ -2818,7 +2818,7 @@ static void direct_link_motionpath(FileData *fd, bMotionPath *mpath)
        /* sanity check */
        if (mpath == NULL)
                return;
-       
+
        /* relink points cache */
        mpath->points = newdataadr(fd, mpath->points);
 }
@@ -2830,17 +2830,17 @@ static void lib_link_ntree(FileData *fd, ID *id, bNodeTree *ntree)
 {
        bNode *node;
        bNodeSocket *sock;
-       
+
        IDP_LibLinkProperty(ntree->id.properties, fd);
        lib_link_animdata(fd, &ntree->id, ntree->adt);
-       
+
        ntree->gpd = newlibadr_us(fd, id->lib, ntree->gpd);
-       
+
        for (node = ntree->nodes.first; node; node = node->next) {
                /* Link ID Properties -- and copy this comment EXACTLY for easy finding
                 * of library blocks that implement this.*/
                IDP_LibLinkProperty(node->prop, fd);
-               
+
                node->id = newlibadr_us(fd, id->lib, node->id);
 
                for (sock = node->inputs.first; sock; sock = sock->next) {
@@ -2850,7 +2850,7 @@ static void lib_link_ntree(FileData *fd, ID *id, bNodeTree *ntree)
                        IDP_LibLinkProperty(sock->prop, fd);
                }
        }
-       
+
        for (sock = ntree->inputs.first; sock; sock = sock->next) {
                IDP_LibLinkProperty(sock->prop, fd);
        }
@@ -2880,10 +2880,10 @@ static void lib_node_do_versions_group_indices(bNode *gnode)
        bNodeTree *ngroup = (bNodeTree*)gnode->id;
        bNodeSocket *sock;
        bNodeLink *link;
-       
+
        for (sock=gnode->outputs.first; sock; sock = sock->next) {
                int old_index = sock->to_index;
-               
+
                for (link = ngroup->links.first; link; link = link->next) {
                        if (link->tonode == NULL && link->fromsock->own_index == old_index) {
                                strcpy(sock->identifier, link->fromsock->identifier);
@@ -2896,7 +2896,7 @@ static void lib_node_do_versions_group_indices(bNode *gnode)
        }
        for (sock=gnode->inputs.first; sock; sock = sock->next) {
                int old_index = sock->to_index;
-               
+
                for (link = ngroup->links.first; link; link = link->next) {
                        if (link->fromnode == NULL && link->tosock->own_index == old_index) {
                                strcpy(sock->identifier, link->tosock->identifier);
@@ -2920,19 +2920,19 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
                        reinit_nodesystem();
                }
 #endif
-       
+
        /* set node->typeinfo pointers */
        FOREACH_NODETREE(main, ntree, id) {
                ntreeSetTypes(NULL, ntree);
        } FOREACH_NODETREE_END
-       
+
        /* verify static socket templates */
        FOREACH_NODETREE(main, ntree, id) {
                bNode *node;
                for (node=ntree->nodes.first; node; node=node->next)
                        node_verify_socket_templates(ntree, node);
        } FOREACH_NODETREE_END
-       
+
        {
                bool has_old_groups = false;
                /* XXX this should actually be part of do_versions, but since we need
@@ -2945,7 +2945,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
                                has_old_groups = 1;
                        }
                }
-               
+
                if (has_old_groups) {
                        FOREACH_NODETREE(main, ntree, id) {
                                /* updates external links for all group nodes in a tree */
@@ -2959,12 +2959,12 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
                                }
                        } FOREACH_NODETREE_END
                }
-               
+
                for (bNodeTree *ntree = main->nodetree.first; ntree; ntree = ntree->id.next) {
                        ntree->flag &= ~NTREE_DO_VERSIONS_GROUP_EXPOSE_2_56_2;
                }
        }
-       
+
        {
                /* Convert the previously used ntree->inputs/ntree->outputs lists to interface nodes.
                 * Pre 2.56.2 node trees automatically have all unlinked sockets exposed already
@@ -2977,7 +2977,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
                 * but due to a temporary bug such links could have been added in all trees,
                 * so have to clean up all of them ...
                 */
-               
+
                FOREACH_NODETREE(main, ntree, id) {
                        if (ntree->flag & NTREE_DO_VERSIONS_CUSTOMNODES_GROUP) {
                                bNode *input_node = NULL, *output_node = NULL;
@@ -2988,21 +2988,21 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
                                 * in that case just remove the invalid links.
                                 */
                                const bool create_io_nodes = (ntree->flag & NTREE_DO_VERSIONS_CUSTOMNODES_GROUP_CREATE_INTERFACE) != 0;
-                               
+
                                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 offsety = 0.0f;*/
-                               
+
                                if (create_io_nodes) {
                                        if (ntree->inputs.first)
                                                input_node = nodeAddStaticNode(NULL, ntree, NODE_GROUP_INPUT);
-                                       
+
                                        if (ntree->outputs.first)
                                                output_node = nodeAddStaticNode(NULL, ntree, NODE_GROUP_OUTPUT);
                                }
-                               
+
                                /* Redirect links from/to the node tree interface to input/output node.
                                 * If the fromnode/tonode pointers are NULL, this means a link from/to
                                 * the ntree interface sockets, which need to be redirected to new interface nodes.
@@ -3010,13 +3010,13 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
                                for (link = ntree->links.first; link; link = next_link) {
                                        bool free_link = false;
                                        next_link = link->next;
-                                       
+
                                        if (link->fromnode == NULL) {
                                                if (input_node) {
                                                        link->fromnode = input_node;
                                                        link->fromsock = node_group_input_find_socket(input_node, link->fromsock->identifier);
                                                        ++num_inputs;
-                                                       
+
                                                        if (link->tonode) {
                                                                if (input_locx > link->tonode->locx - offsetx)
                                                                        input_locx = link->tonode->locx - offsetx;
@@ -3027,13 +3027,13 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
                                                        free_link = true;
                                                }
                                        }
-                                       
+
                                        if (link->tonode == NULL) {
                                                if (output_node) {
                                                        link->tonode = output_node;
                                                        link->tosock = node_group_output_find_socket(output_node, link->tosock->identifier);
                                                        ++num_outputs;
-                                                       
+
                                                        if (link->fromnode) {
                                                                if (output_locx < link->fromnode->locx + offsetx)
                                                                        output_locx = link->fromnode->locx + offsetx;
@@ -3044,11 +3044,11 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
                                                        free_link = true;
                                                }
                                        }
-                                       
+
                                        if (free_link)
                                                nodeRemLink(ntree, link);
                                }
-                               
+
                                if (num_inputs > 0) {
                                        input_locy /= num_inputs;
                                        input_node->locx = input_locx;
@@ -3059,19 +3059,19 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
                                        output_node->locx = output_locx;
                                        output_node->locy = output_locy;
                                }
-                               
+
                                /* clear do_versions flags */
                                ntree->flag &= ~(NTREE_DO_VERSIONS_CUSTOMNODES_GROUP | NTREE_DO_VERSIONS_CUSTOMNODES_GROUP_CREATE_INTERFACE);
                        }
                }
                FOREACH_NODETREE_END
        }
-       
+
        /* verify all group user nodes */
        for (bNodeTree *ntree = main->nodetree.first; ntree; ntree = ntree->id.next) {
                ntreeVerifyNodes(main, &ntree->id);
        }
-       
+
        /* make update calls where necessary */
        {
                FOREACH_NODETREE(main, ntree, id) {
@@ -3085,7 +3085,7 @@ static void direct_link_node_socket(FileData *fd, bNodeSocket *sock)
 {
        sock->prop = newdataadr(fd, sock->prop);
        IDP_DirectLinkGroup_OrFree(&sock->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
-       
+
        sock->link = newdataadr(fd, sock->link);
        sock->typeinfo = NULL;
        sock->storage = newdataadr(fd, sock->storage);
@@ -3100,31 +3100,31 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
        bNode *node;
        bNodeSocket *sock;
        bNodeLink *link;
-       
+
        ntree->init = 0;                /* to set callbacks and force setting types */
        ntree->is_updating = false;
        ntree->typeinfo= NULL;
        ntree->interface_type = NULL;
-       
+
        ntree->progress = NULL;
        ntree->execdata = NULL;
        ntree->duplilock = NULL;
 
        ntree->adt = newdataadr(fd, ntree->adt);
        direct_link_animdata(fd, ntree->adt);
-       
+
        ntree->id.recalc &= ~ID_RECALC_ALL;
 
        link_list(fd, &ntree->nodes);
        for (node = ntree->nodes.first; node; node = node->next) {
                node->typeinfo = NULL;
-               
+
                link_list(fd, &node->inputs);
                link_list(fd, &node->outputs);
-               
+
                node->prop = newdataadr(fd, node->prop);
                IDP_DirectLinkGroup_OrFree(&node->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
-               
+
                link_list(fd, &node->internal_links);
                for (link = node->internal_links.first; link; link = link->next) {
                        link->fromnode = newdataadr(fd, link->fromnode);
@@ -3132,14 +3132,14 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
                        link->tonode = newdataadr(fd, link->tonode);
                        link->tosock = newdataadr(fd, link->tosock);
                }
-               
+
                if (node->type == CMP_NODE_MOVIEDISTORTION) {
                        node->storage = newmclipadr(fd, node->storage);
                }
                else {
                        node->storage = newdataadr(fd, node->storage);
                }
-               
+
                if (node->storage) {
                        /* could be handlerized at some point */
                        if (ntree->type==NTREE_SHADER) {
@@ -3170,18 +3170,18 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
                }
        }
        link_list(fd, &ntree->links);
-       
+
        /* and we connect the rest */
        for (node = ntree->nodes.first; node; node = node->next) {
                node->parent = newdataadr(fd, node->parent);
                node->lasty = 0;
-               
+
                for (sock = node->inputs.first; sock; sock = sock->next)
                        direct_link_node_socket(fd, sock);
                for (sock = node->outputs.first; sock; sock = sock->next)
                        direct_link_node_socket(fd, sock);
        }
-       
+
        /* interface socket lists */
        link_list(fd, &ntree->inputs);
        link_list(fd, &ntree->outputs);
@@ -3189,19 +3189,19 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
                direct_link_node_socket(fd, sock);
        for (sock = ntree->outputs.first; sock; sock = sock->next)
                direct_link_node_socket(fd, sock);
-       
+
        for (link = ntree->links.first; link; link= link->next) {
                link->fromnode = newdataadr(fd, link->fromnode);
                link->tonode = newdataadr(fd, link->tonode);
                link->fromsock = newdataadr(fd, link->fromsock);
                link->tosock = newdataadr(fd, link->tosock);
        }
-       
+
 #if 0
        if (ntree->previews) {
                bNodeInstanceHash *new_previews = BKE_node_instance_hash_new("node previews");
                bNodeInstanceHashIterator iter;
-               
+
                NODE_INSTANCE_HASH_ITER(iter, ntree->previews) {
                        bNodePreview *preview = BKE_node_instance_hash_iterator_get_value(&iter);
                        if (preview) {
@@ -3219,7 +3219,7 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
        /* XXX TODO */
        ntree->previews = NULL;
 #endif
-       
+
        /* type verification is in lib-link */
 }
 
@@ -3234,7 +3234,7 @@ typedef struct tConstraintLinkData {
 static void lib_link_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, bool is_reference, void *userdata)
 {
        tConstraintLinkData *cld= (tConstraintLinkData *)userdata;
-       
+
        /* for reference types, we need to increment the usercounts on load... */
        if (is_reference) {
                /* reference type - with usercount */
@@ -3250,7 +3250,7 @@ static void lib_link_constraints(FileData *fd, ID *id, ListBase *conlist)
 {
        tConstraintLinkData cld;
        bConstraint *con;
-       
+
        /* legacy fixes */
        for (con = conlist->first; con; con=con->next) {
                /* patch for error introduced by changing constraints (dunno how) */
@@ -3261,29 +3261,29 @@ static void lib_link_constraints(FileData *fd, ID *id, ListBase *conlist)
                /* own ipo, all constraints have it */
                con->ipo = newlibadr_us(fd, id->lib, con->ipo); // XXX deprecated - old animation system
        }
-       
+
        /* relink all ID-blocks used by the constraints */
        cld.fd = fd;
        cld.id = id;
-       
+
        BKE_constraints_id_loop(conlist, lib_link_constraint_cb, &cld);
 }
 
 static void direct_link_constraints(FileData *fd, ListBase *lb)
 {
        bConstraint *con;
-       
+
        link_list(fd, lb);
        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;
-                               
+
                                link_list(fd, &data->targets);
-                               
+
                                data->prop = newdataadr(fd, data->prop);
                                IDP_DirectLinkGroup_OrFree(&data->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
                                break;
@@ -3325,10 +3325,10 @@ static void direct_link_constraints(FileData *fd, ListBase *lb)
 static void lib_link_pose(FileData *fd, Main *bmain, Object *ob, bPose *pose)
 {
        bArmature *arm = ob->data;
-       
+
        if (!pose || !arm)
                return;
-       
+
        /* always rebuild to match proxy or lib changes, but on Undo */
        bool rebuild = false;
 
@@ -3345,7 +3345,7 @@ static void lib_link_pose(FileData *fd, Main *bmain, Object *ob, bPose *pose)
                /* sync proxy layer */
                if (pose->proxy_layer)
                        arm->layer = pose->proxy_layer;
-               
+
                /* sync proxy active bone */
                if (pose->proxy_act_bone[0]) {
                        Bone *bone = BLI_ghash_lookup(bone_hash, pose->proxy_act_bone);
@@ -3359,7 +3359,7 @@ static void lib_link_pose(FileData *fd, Main *bmain, Object *ob, bPose *pose)
                lib_link_constraints(fd, (ID *)ob, &pchan->constraints);
 
                pchan->bone = BLI_ghash_lookup(bone_hash, pchan->name);
-               
+
                IDP_LibLinkProperty(pchan->prop, fd);
 
                pchan->custom = newlibadr_us(fd, arm->id.lib, pchan->custom);
@@ -3374,7 +3374,7 @@ static void lib_link_pose(FileData *fd, Main *bmain, Object *ob, bPose *pose)
        }
 
        BLI_ghash_free(bone_hash, NULL, NULL);
-       
+
 
        if (rebuild) {
                DAG_id_tag_update_ex(bmain, &ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
@@ -3410,15 +3410,15 @@ static void lib_link_armature(FileData *fd, Main *main)
 static void direct_link_bones(FileData *fd, Bone *bone)
 {
        Bone *child;
-       
+
        bone->parent = newdataadr(fd, bone->parent);
        bone->prop = newdataadr(fd, bone->prop);
        IDP_DirectLinkGroup_OrFree(&bone->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
-               
+
        bone->flag &= ~BONE_DRAW_ACTIVE;
-       
+
        link_list(fd, &bone->childbase);
-       
+
        for (child=bone->childbase.first; child; child=child->next)
                direct_link_bones(fd, child);
 }
@@ -3426,18 +3426,18 @@ static void direct_link_bones(FileData *fd, Bone *bone)
 static void direct_link_armature(FileData *fd, bArmature *arm)
 {
        Bone *bone;
-       
+
        link_list(fd, &arm->bonebase);
        arm->edbo = NULL;
        arm->sketch = NULL;
-       
+
        arm->adt = newdataadr(fd, arm->adt);
        direct_link_animdata(fd, arm->adt);
-       
+
        for (bone = arm->bonebase.first; bone; bone = bone->next) {
                direct_link_bones(fd, bone);
        }
-       
+
        arm->act_bone = newdataadr(fd, arm->act_bone);
        arm->act_edbone = NULL;
 }
@@ -3450,11 +3450,11 @@ static void lib_link_camera(FileData *fd, Main *main)
                if (ca->id.tag & LIB_TAG_NEED_LINK) {
                        IDP_LibLinkProperty(ca->id.properties, fd);
                        lib_link_animdata(fd, &ca->id, ca->adt);
-                       
+
                        ca->ipo = newlibadr_us(fd, ca->id.lib, ca->ipo); // XXX deprecated - old animation system
 
                        ca->dof_ob = newlibadr(fd, ca->id.lib, ca->dof_ob);
-                       
+
                        ca->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
@@ -3475,7 +3475,7 @@ static void lib_link_lamp(FileData *fd, Main *main)
                if (la->id.tag & LIB_TAG_NEED_LINK) {
                        IDP_LibLinkProperty(la->id.properties, fd);
                        lib_link_animdata(fd, &la->id, la->adt);
-                       
+
                        for (int a = 0; a < MAX_MTEX; a++) {
                                MTex *mtex = la->mtex[a];
                                if (mtex) {
@@ -3483,14 +3483,14 @@ static void lib_link_lamp(FileData *fd, Main *main)
                                        mtex->object = newlibadr(fd, la->id.lib, mtex->object);
                                }
                        }
-                       
+
                        la->ipo = newlibadr_us(fd, la->id.lib, la->ipo); // XXX deprecated - old animation system
-                       
+
                        if (la->nodetree) {
                                lib_link_ntree(fd, &la->id, la->nodetree);
                                la->nodetree->id.lib = la->id.lib;
                        }
-                       
+
                        la->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
@@ -3499,14 +3499,14 @@ static void lib_link_lamp(FileData *fd, Main *main)
 static void direct_link_lamp(FileData *fd, Lamp *la)
 {
        int a;
-       
+
        la->adt = newdataadr(fd, la->adt);
        direct_link_animdata(fd, la->adt);
-       
+
        for (a=0; a<MAX_MTEX; a++) {
                la->mtex[a] = newdataadr(fd, la->mtex[a]);
        }
-       
+
        la->curfalloff = newdataadr(fd, la->curfalloff);
        if (la->curfalloff)
                direct_link_curvemapping(fd, la->curfalloff);
@@ -3516,7 +3516,7 @@ static void direct_link_lamp(FileData *fd, Lamp *la)
                direct_link_id(fd, &la->nodetree->id);
                direct_link_nodetree(fd, la->nodetree);
        }
-       
+
        la->preview = direct_link_preview_image(fd, la->preview);
 }
 
@@ -3540,10 +3540,10 @@ static void lib_link_key(FileData *fd, Main *main)
                if (key->id.tag & LIB_TAG_NEED_LINK) {
                        IDP_LibLinkProperty(key->id.properties, fd);
                        lib_link_animdata(fd, &key->id, key->adt);
-                       
+
                        key->ipo = newlibadr_us(fd, key->id.lib, key->ipo); // XXX deprecated - old animation system
                        key->from = newlibadr(fd, key->id.lib, key->from);
-                       
+
                        key->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
@@ -3553,14 +3553,14 @@ static void switch_endian_keyblock(Key *key, KeyBlock *kb)
 {
        int elemsize, a, b;
        char *data;
-       
+
        elemsize = key->elemsize;
        data = kb->data;
-       
+
        for (a = 0; a < kb->totelem; a++) {
                const char *cp = key->elemstr;
                char *poin = data;
-               
+
                while (cp[0]) {  /* cp[0] == amount */
                        switch (cp[1]) {  /* cp[1] = type */
                                case IPO_FLOAT:
@@ -3571,7 +3571,7 @@ static void switch_endian_keyblock(Key *key, KeyBlock *kb)
                                        poin += sizeof(float) * b;
                                        break;
                        }
-                       
+
                        cp += 2;
                }
                data += elemsize;
@@ -3581,17 +3581,17 @@ static void switch_endian_keyblock(Key *key, KeyBlock *kb)
 static void direct_link_key(FileData *fd, Key *key)
 {
        KeyBlock *kb;
-       
+
        link_list(fd, &(key->block));
-       
+
        key->adt = newdataadr(fd, key->adt);
        direct_link_animdata(fd, key->adt);
-               
+
        key->refkey= newdataadr(fd, key->refkey);
-       
+
        for (kb = key->block.first; kb; kb = kb->next) {
                kb->data = newdataadr(fd, kb->data);
-               
+
                if (fd->flags & FD_FLAGS_SWITCH_ENDIAN)
                        switch_endian_keyblock(key, kb);
        }
@@ -3605,13 +3605,13 @@ static void lib_link_mball(FileData *fd, Main *main)
                if (mb->id.tag & LIB_TAG_NEED_LINK) {
                        IDP_LibLinkProperty(mb->id.properties, fd);
                        lib_link_animdata(fd, &mb->id, mb->adt);
-                       
+
                        for (int a = 0; a < mb->totcol; a++) {
                                mb->mat[a] = newlibadr_us(fd, mb->id.lib, mb->mat[a]);
                        }
-                       
+
                        mb->ipo = newlibadr_us(fd, mb->id.lib, mb->ipo); // XXX deprecated - old animation system
-                       
+
                        mb->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
@@ -3621,12 +3621,12 @@ static void direct_link_mball(FileData *fd, MetaBall *mb)
 {
        mb->adt = newdataadr(fd, mb->adt);
        direct_link_animdata(fd, mb->adt);
-       
+
        mb->mat = newdataadr(fd, mb->mat);
        test_pointer_array(fd, (void **)&mb->mat);
-       
+
        link_list(fd, &(mb->elems));
-       
+
        BLI_listbase_clear(&mb->disp);
        mb->editelems = NULL;
 /*     mb->edit_elems.first= mb->edit_elems.last= NULL;*/
@@ -3641,9 +3641,9 @@ static void lib_link_world(FileData *fd, Main *main)
                if (wrld->id.tag & LIB_TAG_NEED_LINK) {
                        IDP_LibLinkProperty(wrld->id.properties, fd);
                        lib_link_animdata(fd, &wrld->id, wrld->adt);
-                       
+
                        wrld->ipo = newlibadr_us(fd, wrld->id.lib, wrld->ipo); // XXX deprecated - old animation system
-                       
+
                        for (int a = 0; a < MAX_MTEX; a++) {
                                MTex *mtex = wrld->mtex[a];
                                if (mtex) {
@@ -3651,12 +3651,12 @@ static void lib_link_world(FileData *fd, Main *main)
                                        mtex->object = newlibadr(fd, wrld->id.lib, mtex->object);
                                }
                        }
-                       
+
                        if (wrld->nodetree) {
                                lib_link_ntree(fd, &wrld->id, wrld->nodetree);
                                wrld->nodetree->id.lib = wrld->id.lib;
                        }
-                       
+
                        wrld->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
@@ -3665,20 +3665,20 @@ static void lib_link_world(FileData *fd, Main *main)
 static void direct_link_world(FileData *fd, World *wrld)
 {
        int a;
-       
+
        wrld->adt = newdataadr(fd, wrld->adt);
        direct_link_animdata(fd, wrld->adt);
-       
+
        for (a = 0; a < MAX_MTEX; a++) {
                wrld->mtex[a] = newdataadr(fd, wrld->mtex[a]);
        }
-       
+
        wrld->nodetree = newdataadr(fd, wrld->nodetree);
        if (wrld->nodetree) {
                direct_link_id(fd, &wrld->nodetree->id);
                direct_link_nodetree(fd, wrld->nodetree);
        }
-       
+
        wrld->preview = direct_link_preview_image(fd, wrld->preview);
        BLI_listbase_clear(&wrld->gpumaterial);
 }
@@ -3731,24 +3731,24 @@ static void direct_link_text(FileData *fd, Text *text)
        }
        /* else { */
 #endif
-       
+
        link_list(fd, &text->lines);
-       
+
        text->curl = newdataadr(fd, text->curl);
        text->sell = newdataadr(fd, text->sell);
-       
+
        for (ln = text->lines.first; ln; ln = ln->next) {
                ln->line = newdataadr(fd, ln->line);
                ln->format = NULL;
-               
+
                if (ln->len != (int) strlen(ln->line)) {
                        printf("Error loading text, line lengths differ\n");
                        ln->len = strlen(ln->line);
                }
        }
-       
+
        text->flags = (text->flags) & ~TXT_ISEXT;
-       
+
        id_us_ensure_real(&text->id);
 }
 
@@ -3759,7 +3759,7 @@ static void lib_link_image(FileData *fd, Main *main)
        for (Image *ima = main->image.first; ima; ima = ima->id.next) {
                if (ima->id.tag & LIB_TAG_NEED_LINK) {
                        IDP_LibLinkProperty(ima->id.properties, fd);
-                       
+
                        ima->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
@@ -3786,11 +3786,11 @@ static void direct_link_image(FileData *fd, Image *ima)
        }
 
        ima->repbind = NULL;
-       
+
        /* undo system, try to restore render buffers */
        if (fd->imamap) {
                int a;
-               
+
                for (a = 0; a < IMA_MAX_RENDER_SLOT; a++)
                        ima->renders[a] = newimaadr(fd, ima->renders[a]);
        }
@@ -3827,11 +3827,11 @@ static void lib_link_curve(FileData *fd, Main *main)
                if (cu->id.tag & LIB_TAG_NEED_LINK) {
                        IDP_LibLinkProperty(cu->id.properties, fd);
                        lib_link_animdata(fd, &cu->id, cu->adt);
-                       
+
                        for (int a = 0; a < cu->totcol; a++) {
                                cu->mat[a] = newlibadr_us(fd, cu->id.lib, cu->mat[a]);
                        }
-                       
+
                        cu->bevobj = newlibadr(fd, cu->id.lib, cu->bevobj);
                        cu->taperobj = newlibadr(fd, cu->id.lib, cu->taperobj);
                        cu->textoncurve = newlibadr(fd, cu->id.lib, cu->textoncurve);
@@ -3839,10 +3839,10 @@ static void lib_link_curve(FileData *fd, Main *main)
                        cu->vfontb = newlibadr_us(fd, cu->id.lib, cu->vfontb);
                        cu->vfonti = newlibadr_us(fd, cu->id.lib, cu->vfonti);
                        cu->vfontbi = newlibadr_us(fd, cu->id.lib, cu->vfontbi);
-                       
+
                        cu->ipo = newlibadr_us(fd, cu->id.lib, cu->ipo); // XXX deprecated - old animation system
                        cu->key = newlibadr_us(fd, cu->id.lib, cu->key);
-                       
+
                        cu->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
@@ -3863,10 +3863,10 @@ static void direct_link_curve(FileData *fd, Curve *cu)
 {
        Nurb *nu;
        TextBox *tb;
-       
+
        cu->adt= newdataadr(fd, cu->adt);
        direct_link_animdata(fd, cu->adt);
-       
+
        /* Protect against integer overflow vulnerability. */
        CLAMP(cu->len_wchar, 0, INT_MAX - 4);
 
@@ -3881,7 +3881,7 @@ static void direct_link_curve(FileData *fd, Curve *cu)
        }
        else {
                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));
@@ -3899,14 +3899,14 @@ static void direct_link_curve(FileData *fd, Curve *cu)
 
        cu->editnurb = NULL;
        cu->editfont = NULL;
-       
+
        for (nu = cu->nurb.first; nu; nu = nu->next) {
                nu->bezt = newdataadr(fd, nu->bezt);
                nu->bp = newdataadr(fd, nu->bp);
                nu->knotsu = newdataadr(fd, nu->knotsu);
                nu->knotsv = newdataadr(fd, nu->knotsv);
                if (cu->vfont == NULL) nu->charidx = 0;
-               
+
                if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
                        switch_endian_knots(nu);
                }
@@ -3922,7 +3922,7 @@ static void lib_link_texture(FileData *fd, Main *main)
                if (tex->id.tag & LIB_TAG_NEED_LINK) {
                        IDP_LibLinkProperty(tex->id.properties, fd);
                        lib_link_animdata(fd, &tex->id, tex->adt);
-                       
+
                        tex->ima = newlibadr_us(fd, tex->id.lib, tex->ima);
                        tex->ipo = newlibadr_us(fd, tex->id.lib, tex->ipo);  // XXX deprecated - old animation system
                        if (tex->env)
@@ -3933,12 +3933,12 @@ static void lib_link_texture(FileData *fd, Main *main)
                                tex->vd->object = newlibadr(fd, tex->id.lib, tex->vd->object);
                        if (tex->ot)
                                tex->ot->object = newlibadr(fd, tex->id.lib, tex->ot->object);
-                       
+
                        if (tex->nodetree) {
                                lib_link_ntree(fd, &tex->id, tex->nodetree);
                                tex->nodetree->id.lib = tex->id.lib;
                        }
-                       
+
                        tex->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
@@ -3966,7 +3966,7 @@ static void direct_link_texture(FileData *fd, Tex *tex)
                }
                tex->pd->point_data = NULL; /* runtime data */
        }
-       
+
        tex->vd = newdataadr(fd, tex->vd);
        if (tex->vd) {
                tex->vd->dataset = NULL;
@@ -3976,17 +3976,17 @@ static void direct_link_texture(FileData *fd, Tex *tex)
                if (tex->type == TEX_VOXELDATA)
                        tex->vd = MEM_callocN(sizeof(VoxelData), "direct_link_texture VoxelData");
        }
-       
+
        tex->ot = newdataadr(fd, tex->ot);
-       
+
        tex->nodetree = newdataadr(fd, tex->nodetree);
        if (tex->nodetree) {
                direct_link_id(fd, &tex->nodetree->id);
                direct_link_nodetree(fd, tex->nodetree);
        }
-       
+
        tex->preview = direct_link_preview_image(fd, tex->preview);
-       
+
        tex->iuser.ok = 1;
 }
 
@@ -4000,10 +4000,10 @@ static void lib_link_material(FileData *fd, Main *main)
                if (ma->id.tag & LIB_TAG_NEED_LINK) {
                        IDP_LibLinkProperty(ma->id.properties, fd);
                        lib_link_animdata(fd, &ma->id, ma->adt);
-                       
+
                        ma->ipo = newlibadr_us(fd, ma->id.lib, ma->ipo);  // XXX deprecated - old animation system
                        ma->group = newlibadr_us(fd, ma->id.lib, ma->group);
-                       
+
                        for (int a = 0; a < MAX_MTEX; a++) {
                                MTex *mtex = ma->mtex[a];
                                if (mtex) {
@@ -4011,12 +4011,12 @@ static void lib_link_material(FileData *fd, Main *main)
                                        mtex->object = newlibadr(fd, ma->id.lib, mtex->object);
                                }
                        }
-                       
+
                        if (ma->nodetree) {
                                lib_link_ntree(fd, &ma->id, ma->nodetree);
                                ma->nodetree->id.lib = ma->id.lib;
                        }
-                       
+
                        ma->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
@@ -4025,10 +4025,10 @@ static void lib_link_material(FileData *fd, Main *main)
 static void direct_link_material(FileData *fd, Material *ma)
 {
        int a;
-       
+
        ma->adt = newdataadr(fd, ma->adt);
        direct_link_animdata(fd, ma->adt);
-       
+
        for (a = 0; a < MAX_MTEX; a++) {
                ma->mtex[a] = newdataadr(fd, ma->mtex[a]);
        }
@@ -4036,13 +4036,13 @@ static void direct_link_material(FileData *fd, Material *ma)
 
        ma->ramp_col = newdataadr(fd, ma->ramp_col);
        ma->ramp_spec = newdataadr(fd, ma->ramp_spec);
-       
+
        ma->nodetree = newdataadr(fd, ma->nodetree);
        if (ma->nodetree) {
                direct_link_id(fd, &ma->nodetree->id);
                direct_link_nodetree(fd, ma->nodetree);
        }
-       
+
        ma->preview = direct_link_preview_image(fd, ma->preview);
        BLI_listbase_clear(&ma->gpumaterial);
 }
@@ -4090,7 +4090,7 @@ static void direct_link_pointcache(FileData *fd, PointCache *cache)
        }
        else
                BLI_listbase_clear(&cache->mem_cache);
-       
+
        cache->flag &= ~PTCACHE_SIMULATION_VALID;
        cache->simframe = 0;
        cache->edit = NULL;
@@ -4110,7 +4110,7 @@ static void direct_link_pointcache_list(FileData *fd, ListBase *ptcaches, PointC
                                cache->step = 1;
                        }
                }
-               
+
                *ocache = newdataadr(fd, *ocache);
        }
        else if (*ocache) {
@@ -4121,7 +4121,7 @@ static void direct_link_pointcache_list(FileData *fd, ListBase *ptcaches, PointC
                        (*ocache)->flag |= PTCACHE_DISK_CACHE;
                        (*ocache)->step = 1;
                }
-               
+
                ptcaches->first = ptcaches->last = *ocache;
        }
 }
@@ -4142,16 +4142,16 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
                        lib_link_animdata(fd, &part->id, part->adt);
 
                        part->ipo = newlibadr_us(fd, part->id.lib, part->ipo); // XXX deprecated - old animation system
-                       
+
                        part->dup_ob = newlibadr(fd, part->id.lib, part->dup_ob);
                        part->dup_group = newlibadr(fd, part->id.lib, part->dup_group);
                        part->eff_group = newlibadr(fd, part->id.lib, part->eff_group);
                        part->bb_ob = newlibadr(fd, part->id.lib, part->bb_ob);
                        part->collision_group = newlibadr(fd, part->id.lib, part->collision_group);
-                       
+
                        lib_link_partdeflect(fd, &part->id, part->pd);
                        lib_link_partdeflect(fd, &part->id, part->pd2);
-                       
+
                        if (part->effector_weights) {
                                part->effector_weights->group = newlibadr(fd, part->id.lib, part->effector_weights->group);
                        }
@@ -4199,7 +4199,7 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
                        else {
                                BLI_listbase_clear(&part->dupliweights);
                        }
-                       
+
                        if (part->boids) {
                                BoidState *state = part->boids->states.first;
                                BoidRule *rule;
@@ -4232,7 +4232,7 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
                                        mtex->object = newlibadr(fd, part->id.lib, mtex->object);
                                }
                        }
-                       
+
                        part->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
@@ -4246,7 +4246,7 @@ static void direct_link_partdeflect(PartDeflect *pd)
 static void direct_link_particlesettings(FileData *fd, ParticleSettings *part)
 {
        int a;
-       
+
        part->adt = newdataadr(fd, part->adt);
        part->pd = newdataadr(fd, part->pd);
        part->pd2 = newdataadr(fd, part->pd2);
@@ -4277,7 +4277,7 @@ static void direct_link_particlesettings(FileData *fd, ParticleSettings *part)
        if (part->boids) {
                BoidState *state;
                link_list(fd, &part->boids->states);
-               
+
                for (state=part->boids->states.first; state; state=state->next) {
                        link_list(fd, &state->rules);
                        link_list(fd, &state->conditions);
@@ -4298,17 +4298,17 @@ static void lib_link_particlesystems(FileData *fd, Object *ob, ID *id, ListBase
 
        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);
-                       
+
                        psys->parent = newlibadr(fd, id->lib, psys->parent);
                        psys->target_ob = newlibadr(fd, id->lib, psys->target_ob);
-                       
+
                        if (psys->clmd) {
                                /* XXX - from reading existing code this seems correct but intended usage of
                                 * pointcache /w cloth should be added in 'ParticleSystem' - campbell */
@@ -4323,7 +4323,7 @@ static void lib_link_particlesystems(FileData *fd, Object *ob, ID *id, ListBase
                        ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys);
                        BLI_remlink(&ob->modifiers, psmd);
                        modifier_free((ModifierData *)psmd);
-                       
+
                        BLI_remlink(particles, psys);
                        MEM_freeN(psys);
                }
@@ -4334,21 +4334,21 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
        ParticleSystem *psys;
        ParticleData *pa;
        int a;
-       
+
        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);
                }
-               
+
                if (psys->particles && psys->particles->keys) {
                        for (a=0, pa=psys->particles; a<psys->totpart; a++, pa++) {
                                pa->keys= NULL;
                                pa->totkey= 0;
                        }
-                       
+
                        psys->flag &= ~PSYS_KEYED;
                }
 
@@ -4365,14 +4365,14 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
                        for (a=0, pa=psys->particles; a<psys->totpart; a++, pa++)
                                pa->boid = NULL;
                }
-               
+
                psys->fluid_springs = newdataadr(fd, psys->fluid_springs);
-               
+
                psys->child = newdataadr(fd, psys->child);
                psys->effectors = NULL;
-               
+
                link_list(fd, &psys->targets);
-               
+
                psys->edit = NULL;
                psys->free_edit = NULL;
                psys->pathcache = NULL;
@@ -4381,21 +4381,21 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
                BLI_listbase_clear(&psys->childcachebufs);
                psys->pdd = NULL;
                psys->renderdata = NULL;
-               
+
                if (psys->clmd) {
                        psys->clmd = newdataadr(fd, psys->clmd);
                        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);
-                       
+
                        if (psys->clmd->sim_parms) {
                                psys->clmd->sim_parms->effector_weights = NULL;
                                if (psys->clmd->sim_parms->presets > 10)
                                        psys->clmd->sim_parms->presets = 0;
                        }
-                       
+
                        psys->hair_in_dm = psys->hair_out_dm = NULL;
                        psys->clmd->solver_result = NULL;
                }
@@ -4417,7 +4417,7 @@ static void lib_link_mtface(FileData *fd, Mesh *me, MTFace *mtface, int totface)
 {
        MTFace *tf= mtface;
        int i;
-       
+
        /* Add pseudo-references (not fake users!) to images used by texface. A
         * little bogus; it would be better if each mesh consistently added one ref
         * to each image it used. - z0r */
@@ -4431,7 +4431,7 @@ static void lib_link_customdata_mtface(FileData *fd, Mesh *me, CustomData *fdata
        int i;
        for (i = 0; i < fdata->totlayer; i++) {
                CustomDataLayer *layer = &fdata->layers[i];
-               
+
                if (layer->type == CD_MTFACE)
                        lib_link_mtface(fd, me, layer->data, totface);
        }
@@ -4444,11 +4444,11 @@ static void lib_link_customdata_mtpoly(FileData *fd, Mesh *me, CustomData *pdata
 
        for (i=0; i < pdata->totlayer; i++) {
                CustomDataLayer *layer = &pdata->layers[i];
-               
+
                if (layer->type == CD_MTEXPOLY) {
                        MTexPoly *tf= layer->data;
                        int j;
-                       
+
                        for (j = 0; j < totface; j++, tf++) {
                                tf->tpage = newlibadr_real_us(fd, me->id.lib, tf->tpage);
                        }
@@ -4459,16 +4459,16 @@ static void lib_link_customdata_mtpoly(FileData *fd, Mesh *me, CustomData *pdata
 static void lib_link_mesh(FileData *fd, Main *main)
 {
        Mesh *me;
-       
+
        for (me = main->mesh.first; me; me = me->id.next) {
                if (me->id.tag & LIB_TAG_NEED_LINK) {
                        int i;
-                       
+
                        /* Link ID Properties -- and copy this comment EXACTLY for easy finding
                         * of library blocks that implement this.*/
                        IDP_LibLinkProperty(me->id.properties, fd);
                        lib_link_animdata(fd, &me->id, me->adt);
-                       
+
                        /* this check added for python created meshes */
                        if (me->mat) {
                                for (i = 0; i < me->totcol; i++) {
@@ -4482,7 +4482,7 @@ static void lib_link_mesh(FileData *fd, Main *main)
                        me->ipo = newlibadr_us(fd, me->id.lib, me->ipo); // XXX: deprecated: old anim sys
                        me->key = newlibadr_us(fd, me->id.lib, me->key);
                        me->texcomesh = newlibadr_us(fd, me->id.lib, me->texcomesh);
-                       
+
                        lib_link_customdata_mtface(fd, me, &me->fdata, me->totface);
                        lib_link_customdata_mtpoly(fd, me, &me->pdata, me->totpoly);
                        if (me->mr && me->mr->levels.first) {
@@ -4503,9 +4503,9 @@ static void lib_link_mesh(FileData *fd, Main *main)
                                 * external CustomData works */
                                Main *gmain = G_MAIN;
                                G_MAIN = main;
-                               
+
                                BKE_mesh_do_versions_convert_mfaces_to_mpolys(me);
-                               
+
                                G_MAIN = gmain;
                        }
 
@@ -4533,11 +4533,11 @@ static void lib_link_mesh(FileData *fd, Main *main)
 static void direct_link_dverts(FileData *fd, int count, MDeformVert *mdverts)
 {
        int i;
-       
+
        if (mdverts == NULL) {
                return;
        }
-       
+
        for (i = count; i > 0; i--, mdverts++) {
                /*convert to vgroup allocation system*/
                MDeformWeight *dw;
@@ -4559,11 +4559,11 @@ static void direct_link_mdisps(FileData *fd, int count, MDisps *mdisps, int exte
 {
        if (mdisps) {
                int i;
-               
+
                for (i = 0; i < count; ++i) {
                        mdisps[i].disps = newdataadr(fd, mdisps[i].disps);
                        mdisps[i].hidden = newdataadr(fd, mdisps[i].hidden);
-                       
+
                        if (mdisps[i].totdisp && !mdisps[i].level) {
                                /* this calculation is only correct for loop mdisps;
                                 * if loading pre-BMesh face mdisps this will be
@@ -4572,7 +4572,7 @@ static void direct_link_mdisps(FileData *fd, int count, MDisps *mdisps, int exte
                                float gridsize = sqrtf(mdisps[i].totdisp);
                                mdisps[i].level = (int)(logf(gridsize - 1.0f) / (float)M_LN2) + 1;
                        }
-                       
+
                        if ((fd->flags & FD_FLAGS_SWITCH_ENDIAN) && (mdisps[i].disps)) {
                                /* DNA_struct_switch_endian doesn't do endian swap for (*disps)[] */
                                /* this does swap for data written at write_mdisps() - readfile.c */
@@ -4588,7 +4588,7 @@ static void direct_link_grid_paint_mask(FileData *fd, int count, GridPaintMask *
 {
        if (grid_paint_mask) {
                int i;
-               
+
                for (i = 0; i < count; ++i) {
                        GridPaintMask *gpm = &grid_paint_mask[i];
                        if (gpm->data)
@@ -4601,26 +4601,26 @@ static void direct_link_grid_paint_mask(FileData *fd, int count, GridPaintMask *
 static void direct_link_customdata(FileData *fd, CustomData *data, int count)
 {
        int i = 0;
-       
+
        data->layers = newdataadr(fd, data->layers);
-       
+
        /* annoying workaround for bug [#31079] loading legacy files with
         * no polygons _but_ have stale customdata */
        if (UNLIKELY(count == 0 && data->layers == NULL && data->totlayer != 0)) {
                CustomData_reset(data);
                return;
        }
-       
+
        data->external = newdataadr(fd, data->external);
-       
+
        while (i < data->totlayer) {
                CustomDataLayer *layer = &data->layers[i];
-               
+
                if (layer->flag & CD_FLAG_EXTERNAL)
                        layer->flag &= ~CD_FLAG_IN_MEMORY;
 
                layer->flag &= ~CD_FLAG_NOFREE;
-               
+
                if (CustomData_verify_versions(data, i)) {
                        layer->data = newdataadr(fd, layer->data);
                        if (layer->type == CD_MDISPS)
@@ -4630,7 +4630,7 @@ static void direct_link_customdata(FileData *fd, CustomData *data, int count)
                        i++;
                }
        }
-       
+
        CustomData_update_typemap(data);
 }
 
@@ -4638,7 +4638,7 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
 {
        mesh->mat= newdataadr(fd, mesh->mat);
        test_pointer_array(fd, (void **)&mesh->mat);
-       
+
        mesh->mvert = newdataadr(fd, mesh->mvert);
        mesh->medge = newdataadr(fd, mesh->medge);
        mesh->mface = newdataadr(fd, mesh->mface);
@@ -4652,15 +4652,15 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
        mesh->mloopuv = newdataadr(fd, mesh->mloopuv);
        mesh->mtpoly = newdataadr(fd, mesh->mtpoly);
        mesh->mselect = newdataadr(fd, mesh->mselect);
-       
+
        /* animdata */
        mesh->adt = newdataadr(fd, mesh->adt);
        direct_link_animdata(fd, mesh->adt);
-       
+
        /* normally direct_link_dverts should be called in direct_link_customdata,
         * but for backwards compat in do_versions to work we do it here */
        direct_link_dverts(fd, mesh->totvert, mesh->dvert);
-       
+
        direct_link_customdata(fd, &mesh->vdata, mesh->totvert);
        direct_link_customdata(fd, &mesh->edata, mesh->totedge);
        direct_link_customdata(fd, &mesh->fdata, mesh->totface);
@@ -4669,7 +4669,7 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
 
        mesh->bb = NULL;
        mesh->edit_btmesh = NULL;
-       
+
        /* happens with old files */
        if (mesh->mselect == NULL) {
                mesh->totselect = 0;
@@ -4685,19 +4685,19 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
        mesh->mr= newdataadr(fd, mesh->mr);
        if (mesh->mr) {
                MultiresLevel *lvl;
-               
+
                link_list(fd, &mesh->mr->levels);
                lvl = mesh->mr->levels.first;
-               
+
                direct_link_customdata(fd, &mesh->mr->vdata, lvl->totvert);
                direct_link_dverts(fd, lvl->totvert, CustomData_get(&mesh->mr->vdata, 0, CD_MDEFORMVERT));
                direct_link_customdata(fd, &mesh->mr->fdata, lvl->totface);
-               
+
                mesh->mr->edge_flags = newdataadr(fd, mesh->mr->edge_flags);
                mesh->mr->edge_creases = newdataadr(fd, mesh->mr->edge_creases);
-               
+
                mesh->mr->verts = newdataadr(fd, mesh->mr->verts);
-               
+
                /* If mesh has the same number of vertices as the
                 * highest multires level, load the current mesh verts
                 * into multires and discard the old data. Needed
@@ -4709,7 +4709,7 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
                                MEM_freeN(mesh->mr->verts);
                        mesh->mr->verts = MEM_dupallocN(mesh->mvert);
                }
-                       
+
                for (; lvl; lvl = lvl->next) {
                        lvl->verts = newdataadr(fd, lvl->verts);
                        lvl->faces = newdataadr(fd, lvl->faces);
@@ -4724,11 +4724,11 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
                multires_free(mesh->mr);
                mesh->mr = NULL;
        }
-       
+
        if ((fd->flags & FD_FLAGS_SWITCH_ENDIAN) && mesh->tface) {
                TFace *tf = mesh->tface;
                int i;
-               
+
                for (i = 0; i < mesh->totface; i++, tf++) {
                        BLI_endian_switch_uint32_array(tf->col, 4);
                }
@@ -4743,10 +4743,10 @@ static void lib_link_latt(FileData *fd, Main *main)
                if (lt->id.tag & LIB_TAG_NEED_LINK) {
                        IDP_LibLinkProperty(lt->id.properties, fd);
                        lib_link_animdata(fd, &lt->id, lt->adt);
-                       
+
                        lt->ipo = newlibadr_us(fd, lt->id.lib, lt->ipo); // XXX deprecated - old animation system
                        lt->key = newlibadr_us(fd, lt->id.lib, lt->key);
-                       
+
                        lt->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
@@ -4755,12 +4755,12 @@ static void lib_link_latt(FileData *fd, Main *main)
 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);
-       
+
        lt->editlatt = NULL;
-       
+
        lt->adt = newdataadr(fd, lt->adt);
        direct_link_animdata(fd, lt->adt);
 }
@@ -4793,7 +4793,7 @@ static void lib_link_object(FileData *fd, Main *main)
 
                        IDP_LibLinkProperty(ob->id.properties, fd);
                        lib_link_animdata(fd, &ob->id, ob->adt);
-                       
+
 // XXX deprecated - old animation system <<<
                        ob->ipo = newlibadr_us(fd, ob->id.lib, ob->ipo);
                        ob->action = newlibadr_us(fd, ob->id.lib, ob->action);
@@ -4803,14 +4803,14 @@ static void lib_link_object(FileData *fd, Main *main)
                        ob->track = newlibadr(fd, ob->id.lib, ob->track);
                        ob->poselib = newlibadr_us(fd, ob->id.lib, ob->poselib);
                        ob->dup_group = newlibadr_us(fd, ob->id.lib, ob->dup_group);
-                       
+
                        ob->proxy = newlibadr_us(fd, ob->id.lib, ob->proxy);
                        if (ob->proxy) {
                                /* paranoia check, actually a proxy_from pointer should never be written... */
                                if (ob->proxy->id.lib == NULL) {
                                        ob->proxy->proxy_from = NULL;
                                        ob->proxy = NULL;
-                                       
+
                                        if (ob->id.lib)
                                                printf("Proxy lost from  object %s lib %s\n", ob->id.name + 2, ob->id.lib->name);
                                        else
@@ -4822,19 +4822,19 @@ static void lib_link_object(FileData *fd, Main *main)
                                }
                        }
                        ob->proxy_group = newlibadr(fd, ob->id.lib, ob->proxy_group);
-                       
+
                        void *poin = ob->data;
                        ob->data = newlibadr_us(fd, ob->id.lib, ob->data);
-                       
+
                        if (ob->data == NULL && poin != NULL) {
                                if (ob->id.lib)
                                        printf("Can't find obdata of %s lib %s\n", ob->id.name + 2, ob->id.lib->name);
                                else
                                        printf("Object %s lost data.\n", ob->id.name + 2);
-                               
+
                                ob->type = OB_EMPTY;
                                warn = true;
-                               
+
                                if (ob->pose) {
                                        /* we can't call #BKE_pose_free() here because of library linking
                                         * freeing will recurse down into every pose constraints ID pointers
@@ -4850,9 +4850,9 @@ static void lib_link_object(FileData *fd, Main *main)
                                        ob->mode &= ~OB_MODE_POSE;
                                }
                        }
-                       for (a=0; a < ob->totcol; a++) 
+                       for (a=0; a < ob->totcol; a++)
                                ob->mat[a] = newlibadr_us(fd, ob->id.lib, ob->mat[a]);
-                       
+
                        /* When the object is local and the data is library its possible
                         * the material list size gets out of sync. [#22663] */
                        if (ob->data && ob->id.lib != ((ID *)ob->data)->lib) {
@@ -4863,28 +4863,28 @@ static void lib_link_object(FileData *fd, Main *main)
                                        BKE_material_resize_object(main, ob, *totcol_data, false);
                                }
                        }
-                       
+
                        ob->gpd = newlibadr_us(fd, ob->id.lib, ob->gpd);
                        ob->duplilist = NULL;
-                       
+
                        ob->id.tag &= ~LIB_TAG_NEED_LINK;
                        /* if id.us==0 a new base will be created later on */
-                       
+
                        /* WARNING! Also check expand_object(), should reflect the stuff below. */
                        lib_link_pose(fd, main, ob, ob->pose);
                        lib_link_constraints(fd, &ob->id, &ob->constraints);
-                       
+
 // XXX deprecated - old animation system <<<
                        lib_link_constraint_channels(fd, &ob->id, &ob->constraintChannels);
                        lib_link_nlastrips(fd, &ob->id, &ob->nlastrips);
 // >>> XXX deprecated - old animation system
-                       
+
                        for (PartEff *paf = ob->effect.first; paf; paf = paf->next) {
                                if (paf->type == EFF_PARTICLE) {
                                        paf->group = newlibadr_us(fd, ob->id.lib, paf->group);
                                }
                        }
-                       
+
                        for (bSensor *sens = ob->sensors.first; sens; sens = sens->next) {
                                for (a = 0; a < sens->totlinks; a++)
                                        sens->links[a] = newglobadr(fd, sens->links[a]);
@@ -4895,11 +4895,11 @@ static void lib_link_object(FileData *fd, Main *main)
                                                newlibadr(fd, ob->id.lib, ms->fromObject);
                                }
                        }
-                       
+
                        for (bController *cont = ob->controllers.first; cont; cont = cont->next) {
                                for (a=0; a < cont->totlinks; a++)
                                        cont->links[a] = newglobadr(fd, cont->links[a]);
-                               
+
                                if (cont->type == CONT_PYTHON) {
                                        bPythonCont *pc = cont->data;
                                        pc->text = newlibadr(fd, ob->id.lib, pc->text);
@@ -4907,7 +4907,7 @@ static void lib_link_object(FileData *fd, Main *main)
                                cont->slinks = NULL;
                                cont->totslinks = 0;
                        }
-                       
+
                        for (bActuator *act = ob->actuators.first; act; act = act->next) {
                                switch (act->type) {
                                        case ACT_SOUND:
@@ -5021,32 +5021,32 @@ static void lib_link_object(FileData *fd, Main *main)
                                                break;
                                }
                        }
-                       
+
                        {
                                FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
-                               
+
                                if (fluidmd && fluidmd->fss)
                                        fluidmd->fss->ipo = newlibadr_us(fd, ob->id.lib, fluidmd->fss->ipo);  // XXX deprecated - old animation system
                        }
-                       
+
                        {
                                SmokeModifierData *smd = (SmokeModifierData *)modifiers_findByType(ob, eModifierType_Smoke);
-                               
+
                                if (smd && (smd->type == MOD_SMOKE_TYPE_DOMAIN) && smd->domain) {
                                        smd->domain->flags |= MOD_SMOKE_FILE_LOAD; /* flag for refreshing the simulation after loading */
                                }
                        }
-                       
+
                        /* texture field */
                        if (ob->pd)
                                lib_link_partdeflect(fd, &ob->id, ob->pd);
-                       
+
                        if (ob->soft) {
                                ob->soft->collision_group = newlibadr(fd, ob->id.lib, ob->soft->collision_group);
 
                                ob->soft->effector_weights->group = newlibadr(fd, ob->id.lib, ob->soft->effector_weights->group);
                        }
-                       
+
                        lib_link_particlesystems(fd, ob, &ob->id, &ob->particlesystem);
                        lib_link_modifiers(fd, ob);
 
@@ -5066,7 +5066,7 @@ static void lib_link_object(FileData *fd, Main *main)
                        }
                }
        }
-       
+
        if (warn) {
                BKE_report(fd->reports, RPT_WARNING, "Warning in console");
        }
@@ -5091,22 +5091,22 @@ static void direct_link_pose(FileData *fd, bPose *pose)
                pchan->parent = newdataadr(fd, pchan->parent);
                pchan->child = newdataadr(fd, pchan->child);
                pchan->custom_tx = newdataadr(fd, pchan->custom_tx);
-               
+
                pchan->bbone_prev = newdataadr(fd, pchan->bbone_prev);
                pchan->bbone_next = newdataadr(fd, pchan->bbone_next);
-               
+
                direct_link_constraints(fd, &pchan->constraints);
-               
+
                pchan->prop = newdataadr(fd, pchan->prop);
                IDP_DirectLinkGroup_OrFree(&pchan->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
-               
+
                pchan->mpath = newdataadr(fd, pchan->mpath);
                if (pchan->mpath)
                        direct_link_motionpath(fd, pchan->mpath);
-               
+
                BLI_listbase_clear(&pchan->iktree);
                BLI_listbase_clear(&pchan->siktree);
-               
+
                /* in case this value changes in future, clamp else we get undefined behavior */
                CLAMP(pchan->rotmode, ROT_MODE_MIN, ROT_MODE_MAX);
        }
@@ -5119,56 +5119,56 @@ static void direct_link_pose(FileData *fd, bPose *pose)
 static void direct_link_modifiers(FileData *fd, ListBase *lb)
 {
        ModifierData *md;
-       
+
        link_list(fd, lb);
-       
+
        for (md=lb->first; md; md=md->next) {
                md->error = NULL;
                md->scene = NULL;
-               
+
                /* if modifiers disappear, or for upward compatibility */
                if (NULL == modifierType_getInfo(md->type))
                        md->type = eModifierType_None;
-                       
+
                if (md->type == eModifierType_Subsurf) {
                        SubsurfModifierData *smd = (SubsurfModifierData *)md;
-                       
+
                        smd->emCache = smd->mCache = NULL;
                }
                else if (md->type == eModifierType_Armature) {
                        ArmatureModifierData *amd = (ArmatureModifierData *)md;
-                       
+
                        amd->prevCos = NULL;
                }
                else if (md->type == eModifierType_Cloth) {
                        ClothModifierData *clmd = (ClothModifierData *)md;
-                       
+
                        clmd->clothObject = NULL;
                        clmd->hairdata = NULL;
-                       
+
                        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);
-                       
+
                        if (clmd->sim_parms) {
                                if (clmd->sim_parms->presets > 10)
                                        clmd->sim_parms->presets = 0;
-                               
+
                                clmd->sim_parms->reset = 0;
-                               
+
                                clmd->sim_parms->effector_weights = newdataadr(fd, clmd->sim_parms->effector_weights);
-                               
+
                                if (!clmd->sim_parms->effector_weights) {
                                        clmd->sim_parms->effector_weights = BKE_add_effector_weights(NULL);
                                }
                        }
-                       
+
                        clmd->solver_result = NULL;
                }
                else if (md->type == eModifierType_Fluidsim) {
                        FluidsimModifierData *fluidmd = (FluidsimModifierData *)md;
-                       
+
                        fluidmd->fss = newdataadr(fd, fluidmd->fss);
                        if (fluidmd->fss) {
                                fluidmd->fss->fmd = fluidmd;
@@ -5177,13 +5177,13 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
                }
                else if (md->type == eModifierType_Smoke) {
                        SmokeModifierData *smd = (SmokeModifierData *)md;
-                       
+
                        if (smd->type == MOD_SMOKE_TYPE_DOMAIN) {
                                smd->flow = NULL;
                                smd->coll = NULL;
                                smd->domain = newdataadr(fd, smd->domain);
                                smd->domain->smd = smd;
-                               
+
                                smd->domain->fluid = NULL;
                                smd->domain->fluid_mutex = BLI_rw_mutex_alloc();
                                smd->domain->wt = NULL;
@@ -5192,13 +5192,13 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
                                smd->domain->tex_shadow = NULL;
                                smd->domain->tex_wt = NULL;
                                smd->domain->coba = newdataadr(fd, smd->domain->coba);
-                               
+
                                smd->domain->effector_weights = newdataadr(fd, smd->domain->effector_weights);
                                if (!smd->domain->effector_weights)
                                        smd->domain->effector_weights = BKE_add_effector_weights(NULL);
-                               
+
                                direct_link_pointcache_list(fd, &(smd->domain->ptcaches[0]), &(smd->domain->point_cache[0]), 1);
-                               
+
                                /* Smoke uses only one cache from now on, so store pointer convert */
                                if (smd->domain->ptcaches[1].first || smd->domain->point_cache[1]) {
                                        if (smd->domain->point_cache[1]) {
@@ -5245,22 +5245,22 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
                }
                else if (md->type == eModifierType_DynamicPaint) {
                        DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
-                       
+
                        if (pmd->canvas) {
                                pmd->canvas = newdataadr(fd, pmd->canvas);
                                pmd->canvas->pmd = pmd;
                                pmd->canvas->dm = NULL;
                                pmd->canvas->flags &= ~MOD_DPAINT_BAKING; /* just in case */
-                               
+
                                if (pmd->canvas->surfaces.first) {
                                        DynamicPaintSurface *surface;
                                        link_list(fd, &pmd->canvas->surfaces);
-                                       
+
                                        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);
-                                               
+
                                                if (!(surface->effector_weights = newdataadr(fd, surface->effector_weights)))
                                                        surface->effector_weights = BKE_add_effector_weights(NULL);
                                        }
@@ -5278,17 +5278,17 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
                else if (md->type == eModifierType_Collision) {
                        CollisionModifierData *collmd = (CollisionModifierData *)md;
 #if 0
-                       // TODO: CollisionModifier should use pointcache 
+                       // TODO: CollisionModifier should use pointcache
                        // + have proper reset events before enabling this
                        collmd->x = newdataadr(fd, collmd->x);
                        collmd->xnew = newdataadr(fd, collmd->xnew);
                        collmd->mfaces = newdataadr(fd, collmd->mfaces);
-                       
+
                        collmd->current_x = MEM_calloc_arrayN(collmd->numverts, sizeof(MVert), "current_x");
                        collmd->current_xnew = MEM_calloc_arrayN(collmd->numverts, sizeof(MVert), "current_xnew");
                        collmd->current_v = MEM_calloc_arrayN(collmd->numverts, sizeof(MVert), "current_v");
 #endif
-                       
+
                        collmd->x = NULL;
                        collmd->xnew = NULL;
                        collmd->current_x = NULL;
@@ -5300,11 +5300,11 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
                        collmd->is_static = false;
                        collmd->bvhtree = NULL;
                        collmd->tri = NULL;
-                       
+
                }
                else if (md->type == eModifierType_Surface) {
                        SurfaceModifierData *surmd = (SurfaceModifierData *)md;
-                       
+
                        surmd->dm = NULL;
                        surmd->bvhtree = NULL;
                        surmd->x = NULL;
@@ -5313,7 +5313,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
                }
                else if (md->type == eModifierType_Hook) {
                        HookModifierData *hmd = (HookModifierData *)md;
-                       
+
                        hmd->indexar = newdataadr(fd, hmd->indexar);
                        if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
                                BLI_endian_switch_int32_array(hmd->indexar, hmd->totindex);
@@ -5326,7 +5326,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
                }
                else if (md->type == eModifierType_ParticleSystem) {
                        ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md;
-                       
+
                        psmd->dm_final = NULL;
                        psmd->dm_deformed = NULL;
                        psmd->psys= newdataadr(fd, psmd->psys);
@@ -5335,22 +5335,22 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
                }
                else if (md->type == eModifierType_Explode) {
                        ExplodeModifierData *psmd = (ExplodeModifierData *)md;
-                       
+
                        psmd->facepa = NULL;
                }
                else if (md->type == eModifierType_MeshDeform) {
                        MeshDeformModifierData *mmd = (MeshDeformModifierData *)md;
-                       
+
                        mmd->bindinfluences = newdataadr(fd, mmd->bindinfluences);
                        mmd->bindoffsets = newdataadr(fd, mmd->bindoffsets);
                        mmd->bindcagecos = newdataadr(fd, mmd->bindcagecos);
                        mmd->dyngrid = newdataadr(fd, mmd->dyngrid);
                        mmd->dyninfluences = newdataadr(fd, mmd->dyninfluences);
                        mmd->dynverts = newdataadr(fd, mmd->dynverts);
-                       
+
                        mmd->bindweights = newdataadr(fd, mmd->bindweights);
                        mmd->bindcos = newdataadr(fd, mmd->bindcos);
-                       
+
                        if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
                                if (mmd->bindoffsets)  BLI_endian_switch_int32_array(mmd->bindoffsets, mmd->totvert + 1);
                                if (mmd->bindcagecos)  BLI_endian_switch_float_array(mmd->bindcagecos, mmd->totcagevert * 3);
@@ -5367,14 +5367,14 @@ 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);
                        if (tmd->curfalloff)
                                direct_link_curvemapping(fd, tmd->curfalloff);
                }
                else if (md->type == eModifierType_WeightVGEdit) {
                        WeightVGEditModifierData *wmd = (WeightVGEditModifierData *)md;
-                       
+
                        wmd->cmap_curve = newdataadr(fd, wmd->cmap_curve);
                        if (wmd->cmap_curve)
                                direct_link_curvemapping(fd, wmd->cmap_curve);
@@ -5447,7 +5447,7 @@ static void direct_link_object(FileData *fd, Object *ob)
        bSensor *sens;
        bController *cont;
        bActuator *act;
-       
+
        /* weak weak... this was only meant as draw flag, now is used in give_base_to_objects too */
        ob->flag &= ~OB_FROMGROUP;
 
@@ -5471,30 +5471,30 @@ static void direct_link_object(FileData *fd, Object *ob)
                        ob->mode &= ~OB_MODE_POSE;
                }
        }
-       
+
        ob->adt = newdataadr(fd, ob->adt);
        direct_link_animdata(fd, ob->adt);
-       
+
        ob->pose = newdataadr(fd, ob->pose);
        direct_link_pose(fd, ob->pose);
-       
+
        ob->mpath = newdataadr(fd, ob->mpath);
        if (ob->mpath)
                direct_link_motionpath(fd, ob->mpath);
-       
+
        link_list(fd, &ob->defbase);
 // XXX deprecated - old animation system <<<
        direct_link_nlastrips(fd, &ob->nlastrips);
        link_list(fd, &ob->constraintChannels);
 // >>> XXX deprecated - old animation system
-       
+
        ob->mat= newdataadr(fd, ob->mat);
        test_pointer_array(fd, (void **)&ob->mat);
        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;
        while (paf) {
@@ -5505,7 +5505,7 @@ static void direct_link_object(FileData *fd, Object *ob)
                        WaveEff *wav = (WaveEff*) paf;
                        PartEff *next = paf->next;
                        WaveModifierData *wmd = (WaveModifierData*) modifier_new(eModifierType_Wave);
-                       
+
                        wmd->damp = wav->damp;
                        wmd->flag = wav->flag;
                        wmd->height = wav->height;
@@ -5516,12 +5516,12 @@ static void direct_link_object(FileData *fd, Object *ob)
                        wmd->starty = wav->startx;
                        wmd->timeoffs = wav->timeoffs;
                        wmd->width = wav->width;
-                       
+
                        BLI_addtail(&ob->modifiers, wmd);
-                       
+
                        BLI_remlink(&ob->effect, paf);
                        MEM_freeN(paf);
-                       
+
                        paf = next;
                        continue;
                }
@@ -5529,29 +5529,29 @@ static void direct_link_object(FileData *fd, Object *ob)
                        BuildEff *baf = (BuildEff*) paf;
                        PartEff *next = paf->next;
                        BuildModifierData *bmd = (BuildModifierData*) modifier_new(eModifierType_Build);
-                       
+
                        bmd->start = baf->sfra;
                        bmd->length = baf->len;
                        bmd->randomize = 0;
                        bmd->seed = 1;
-                       
+
                        BLI_addtail(&ob->modifiers, bmd);
-                       
+
                        BLI_remlink(&ob->effect, paf);
                        MEM_freeN(paf);
-                       
+
                        paf = next;
                        continue;
                }
                paf = paf->next;
        }
-       
+
        ob->pd= newdataadr(fd, ob->pd);
        direct_link_partdeflect(ob->pd);
        ob->soft= newdataadr(fd, ob->soft);
        if (ob->soft) {
                SoftBody *sb = ob->soft;
-               
+
                sb->bpoint = NULL;      // init pointers so it gets rebuilt nicely
                sb->bspring = NULL;
                sb->scratch = NULL;
@@ -5565,22 +5565,22 @@ static void direct_link_object(FileData *fd, Object *ob)
                                sb->keys[a] = newdataadr(fd, sb->keys[a]);
                        }
                }
-               
+
                sb->effector_weights = newdataadr(fd, sb->effector_weights);
                if (!sb->effector_weights)
                        sb->effector_weights = BKE_add_effector_weights(NULL);
-               
+
                direct_link_pointcache_list(fd, &sb->ptcaches, &sb->pointcache, 0);
        }
        ob->bsoft = newdataadr(fd, ob->bsoft);
        ob->fluidsimSettings= newdataadr(fd, ob->fluidsimSettings); /* NT */
-       
+
        ob->rigidbody_object = newdataadr(fd, ob->rigidbody_object);
        if (ob->rigidbody_object) {
                RigidBodyOb *rbo = ob->rigidbody_object;
-               
-               /* must nullify the references to physics sim objects, since they no-longer exist 
-                * (and will need to be recalculated) 
+
+               /* must nullify the references to physics sim objects, since they no-longer exist
+                * (and will need to be recalculated)
                 */
                rbo->physics_object = NULL;
                rbo->physics_shape = NULL;
@@ -5591,11 +5591,11 @@ static void direct_link_object(FileData *fd, Object *ob)
 
        link_list(fd, &ob->particlesystem);
        direct_link_particlesystems(fd, &ob->particlesystem);
-       
+
        link_list(fd, &ob->prop);
        for (prop = ob->prop.first; prop; prop = prop->next) {
                prop->poin = newdataadr(fd, prop->poin);
-               if (prop->poin == NULL) 
+               if (prop->poin == NULL)
                        prop->poin = &prop->data;
        }
 
@@ -5633,12 +5633,12 @@ static void direct_link_object(FileData *fd, Object *ob)
        while (ob->hooks.first) {
                ObHook *hook = ob->hooks.first;
                HookModifierData *hmd = (HookModifierData *)modifier_new(eModifierType_Hook);
-               
+
                hook->indexar= newdataadr(fd, hook->indexar);
                if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
                        BLI_endian_switch_int32_array(hook->indexar, hook->totindex);
                }
-               
+
                /* Do conversion here because if we have loaded
                 * a hook we need to make sure it gets converted
                 * and freed, regardless of version.
@@ -5650,15 +5650,15 @@ static void direct_link_object(FileData *fd, Object *ob)
                hmd->object = hook->parent;
                memcpy(hmd->parentinv, hook->parentinv, sizeof(hmd->parentinv));
                hmd->totindex = hook->totindex;
-               
+
                BLI_addhead(&ob->modifiers, hmd);
                BLI_remlink(&ob->hooks, hook);
-               
+
                modifier_unique_name(&ob->modifiers, (ModifierData*)hmd);
-               
+
                MEM_freeN(hook);
        }
-       
+
        ob->iuser = newdataadr(fd, ob->iuser);
        if (ob->type == OB_EMPTY && ob->empty_drawtype == OB_EMPTY_IMAGE && !ob->iuser) {
                BKE_object_empty_draw_type_set(ob, ob->empty_drawtype);
@@ -5693,7 +5693,7 @@ static void direct_link_object(FileData *fd, Object *ob)
 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)
                        node->id = &scene->id;
@@ -5755,21 +5755,21 @@ static void lib_link_scene(FileData *fd, Main *main)
        bool need_check_set = false;
        int totscene = 0;
 #endif
-       
+
        for (Scene *sce = main->scene.first; sce; sce = sce->id.next) {
                if (sce->id.tag & LIB_TAG_NEED_LINK) {
                        /* Link ID Properties -- and copy this comment EXACTLY for easy finding
                         * of library blocks that implement this.*/
                        IDP_LibLinkProperty(sce->id.properties, fd);
                        lib_link_animdata(fd, &sce->id, sce->adt);
-                       
+
                        lib_link_keyingsets(fd, &sce->id, &sce->keyingsets);
-                       
+
                        sce->camera = newlibadr(fd, sce->id.lib, sce->camera);
                        sce->world = newlibadr_us(fd, sce->id.lib, sce->world);
                        sce->set = newlibadr(fd, sce->id.lib, sce->set);
                        sce->gpd = newlibadr_us(fd, sce->id.lib, sce->gpd);
-                       
+
                        link_paint(fd, sce, &sce->toolsettings->sculpt->paint);
                        link_paint(fd, sce, &sce->toolsettings->vpaint->paint);
                        link_paint(fd, sce, &sce->toolsettings->wpaint->paint);
@@ -5791,16 +5791,16 @@ static void lib_link_scene(FileData *fd, Main *main)
                        if (sce->toolsettings->imapaint.canvas)
                                sce->toolsettings->imapaint.canvas =
                                        newlibadr_us(fd, sce->id.lib, sce->toolsettings->imapaint.canvas);
-                       
+
                        sce->toolsettings->skgen_template = newlibadr(fd, sce->id.lib, sce->toolsettings->skgen_template);
-                       
+
                        sce->toolsettings->particle.shape_object = newlibadr(fd, sce->id.lib, sce->toolsettings->particle.shape_object);
-                       
+
                        for (Base *next, *base = sce->base.first; base; base = next) {
                                next = base->next;
-                               
+
                                base->object = newlibadr_us(fd, sce->id.lib, base->object);
-                               
+
                                if (base->object == NULL) {
                                        blo_reportf_wrap(fd->reports, RPT_WARNING, TIP_("LIB: object lost from scene: '%s'"),
                                                         sce->id.name + 2);
@@ -5809,7 +5809,7 @@ static void lib_link_scene(FileData *fd, Main *main)
                                        MEM_freeN(base);
                                }
                        }
-                       
+
                        Sequence *seq;
                        SEQ_BEGIN (sce->ed, seq)
                        {
@@ -5856,11 +5856,11 @@ static void lib_link_scene(FileData *fd, Main *main)
                                        marker->camera = newlibadr(fd, sce->id.lib, marker->camera);
                                }
                        }
-                       
+
                        BKE_sequencer_update_muting(sce->ed);
                        BKE_sequencer_update_sound_bounds_all(sce);
-                       
-                       
+
+
                        /* rigidbody world relies on it's linked groups */
                        if (sce->rigidbody_world) {
                                RigidBodyWorld *rbw = sce->rigidbody_world;
@@ -5871,13 +5871,13 @@ static void lib_link_scene(FileData *fd, Main *main)
                                if (rbw->effector_weights)
                                        rbw->effector_weights->group = newlibadr(fd, sce->id.lib, rbw->effector_weights->group);
                        }
-                       
+
                        if (sce->nodetree) {
                                lib_link_ntree(fd, &sce->id, sce->nodetree);
                                sce->nodetree->id.lib = sce->id.lib;
                                composite_patch(sce->nodetree, sce);
                        }
-                       
+
                        for (SceneRenderLayer *srl = sce->r.layers.first; srl; srl = srl->next) {
                                srl->mat_override = newlibadr_us(fd, sce->id.lib, srl->mat_override);
                                srl->light_override = newlibadr_us(fd, sce->id.lib, srl->light_override);
@@ -5891,7 +5891,7 @@ static void lib_link_scene(FileData *fd, Main *main)
                        }
                        /*Game Settings: Dome Warp Text*/
                        sce->gm.dome.warptext = newlibadr(fd, sce->id.lib, sce->gm.dome.warptext);
-                       
+
                        /* Motion Tracking */
                        sce->clip = newlibadr_us(fd, sce->id.lib, sce->clip);
 
@@ -5936,9 +5936,9 @@ static void lib_link_scene(FileData *fd, Main *main)
 static void link_recurs_seq(FileData *fd, ListBase *lb)
 {
        Sequence *seq;
-       
+
        link_list(fd, lb);
-       
+
        for (seq = lb->first; seq; seq = seq->next) {
                if (seq->seqbase.first)
                        link_recurs_seq(fd, &seq->seqbase);
@@ -6005,7 +6005,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
        MetaStack *ms;
        RigidBodyWorld *rbw;
        SceneRenderLayer *srl;
-       
+
        sce->theDag = NULL;
        sce->depsgraph = NULL;
        sce->obedit = NULL;
@@ -6013,29 +6013,29 @@ static void direct_link_scene(FileData *fd, Scene *sce)
        sce->fps_info = NULL;
        sce->customdata_mask_modal = 0;
        sce->lay_updated = 0;
-       
+
        BKE_sound_create_scene(sce);
-       
+
        /* set users to one by default, not in lib-link, this will increase it for compo nodes */
        id_us_ensure_real(&sce->id);
-       
+
        link_list(fd, &(sce->base));
-       
+
        sce->adt = newdataadr(fd, sce->adt);
        direct_link_animdata(fd, sce->adt);
-       
+
        link_list(fd, &sce->keyingsets);
        direct_link_keyingsets(fd, &sce->keyingsets);
-       
+
        sce->basact = newdataadr(fd, sce->basact);
-       
+
        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(fd, &sce->toolsettings->imapaint.paint);
 
                sce->toolsettings->imapaint.paintcursor = NULL;
@@ -6043,7 +6043,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
                sce->toolsettings->particle.scene = NULL;
                sce->toolsettings->particle.object = NULL;
                sce->toolsettings->gp_sculpt.paintcursor = NULL;
-               
+
                /* relink grease pencil drawing brushes */
                link_list(fd, &sce->toolsettings->gp_brushes);
                for (bGPDbrush *brush = sce->toolsettings->gp_brushes.first; brush; brush = brush->next) {
@@ -6060,7 +6060,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
                                direct_link_curvemapping(fd, brush->cur_jitter);
                        }
                }
-               
+
                /* relink grease pencil interpolation curves */
                sce->toolsettings->gp_interpolate.custom_ipo = newdataadr(fd, sce->toolsettings->gp_interpolate.custom_ipo);
                if (sce->toolsettings->gp_interpolate.custom_ipo) {
@@ -6070,29 +6070,29 @@ static void direct_link_scene(FileData *fd, Scene *sce)
 
        if (sce->ed) {
                ListBase *old_seqbasep = &sce->ed->seqbase;
-               
+
                ed = sce->ed = newdataadr(fd, sce->ed);
-               
+
                ed->act_seq = newdataadr(fd, ed->act_seq);
-               
+
                /* recursive link sequences, lb will be correctly initialized */
                link_recurs_seq(fd, &ed->seqbase);
-               
+
                SEQ_BEGIN (ed, seq)
                {
                        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;
-                       
+
                        seq->effectdata = newdataadr(fd, seq->effectdata);
                        seq->stereo3d_format = newdataadr(fd, seq->stereo3d_format);
-                       
+
                        if (seq->type & SEQ_TYPE_EFFECT)
                                seq->flag |= SEQ_EFFECT_NOT_LOADED;
-                       
+
                        if (seq->type == SEQ_TYPE_SPEED) {
                                SpeedControlVars *s = seq->effectdata;
                                s->frameMap = NULL;
@@ -6104,7 +6104,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
                        seq->strip = newdataadr(fd, seq->strip);
                        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)) {
                                        seq->strip->stripdata = newdataadr(fd, seq->strip->stripdata);
                                }
@@ -6145,22 +6145,22 @@ static void direct_link_scene(FileData *fd, Scene *sce)
                        direct_link_sequence_modifiers(fd, &seq->modifiers);
                }
                SEQ_END
-               
+
                /* link metastack, slight abuse of structs here, have to restore pointer to internal part in struct */
                {
                        Sequence temp;
                        void *poin;
                        intptr_t offset;
-                       
+
                        offset = ((intptr_t)&(temp.seqbase)) - ((intptr_t)&temp);
-                       
+
                        /* root pointer */
                        if (ed->seqbasep == old_seqbasep) {
                                ed->seqbasep = &ed->seqbase;
                        }
                        else {
                                poin = POINTER_OFFSET(ed->seqbasep, -offset);
-                               
+
                                poin = newdataadr(fd, poin);
                                if (poin)
                                        ed->seqbasep = (ListBase *)POINTER_OFFSET(poin, offset);
@@ -6169,18 +6169,18 @@ static void direct_link_scene(FileData *fd, Scene *sce)
                        }
                        /* stack */
                        link_list(fd, &(ed->metastack));
-                       
+
                        for (ms = ed->metastack.first; ms; ms= ms->next) {
                                ms->parseq = newdataadr(fd, ms->parseq);
-                               
+
                                if (ms->oldbasep == old_seqbasep)
                                        ms->oldbasep= &ed->seqbase;
                                else {
                                        poin = POINTER_OFFSET(ms->oldbasep, -offset);
                                        poin = newdataadr(fd, poin);
-                                       if (poin) 
+                                       if (poin)
                                                ms->oldbasep = (ListBase *)POINTER_OFFSET(poin, offset);
-                                       else 
+                                       else
                                                ms->oldbasep = &ed->seqbase;
                                }
                        }
@@ -6201,7 +6201,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
                sce->r.ffcodecdata.properties = newdataadr(fd, sce->r.ffcodecdata.properties);
                IDP_DirectLinkGroup_OrFree(&sce->r.ffcodecdata.properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
        }
-       
+
        link_list(fd, &(sce->markers));
        link_list(fd, &(sce->transform_spaces));
        link_list(fd, &(sce->r.layers));
@@ -6218,7 +6218,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
        for (srl = sce->r.layers.first; srl; srl = srl->next) {
                link_list(fd, &(srl->freestyleConfig.linesets));
        }
-       
+
        sce->nodetree = newdataadr(fd, sce->nodetree);
        if (sce->nodetree) {
                direct_link_id(fd, &sce->nodetree->id);
@@ -6226,12 +6226,12 @@ static void direct_link_scene(FileData *fd, Scene *sce)
        }
 
        direct_link_view_settings(fd, &sce->view_settings);
-       
+
        sce->rigidbody_world = newdataadr(fd, sce->rigidbody_world);
        rbw = sce->rigidbody_world;
        if (rbw) {
-               /* must nullify the reference to physics sim object, since it no-longer exist 
-                * (and will need to be recalculated) 
+               /* must nullify the reference to physics sim object, since it no-longer exist
+                * (and will need to be recalculated)
                 */
                rbw->physics_world = NULL;
                rbw->objects = NULL;
@@ -6260,10 +6260,10 @@ static void direct_link_scene(FileData *fd, Scene *sce)
 static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm)
 {
        wmWindow *win;
-       
+
        id_us_ensure_real(&wm->id);
        link_list(fd, &wm->windows);
-       
+
        for (win = wm->windows.first; win; win = win->next) {
                win->ghostwin = NULL;
                win->eventstate = NULL;
@@ -6272,14 +6272,14 @@ static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm)
 #ifdef WIN32
                win->ime_data = NULL;
 #endif
-               
+
                BLI_listbase_clear(&win->queue);
                BLI_listbase_clear(&win->handlers);
                BLI_listbase_clear(&win->modalhandlers);
                BLI_listbase_clear(&win->subwindows);
                BLI_listbase_clear(&win->gesture);
                BLI_listbase_clear(&win->drawdata);
-               
+
                win->drawmethod = -1;
                win->drawfail = 0;
                win->active = 0;
@@ -6298,13 +6298,13 @@ static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm)
                        win->stereo3d_format->display_mode = S3D_DISPLAY_ANAGLYPH;
                }
        }
-       
+
        BLI_listbase_clear(&wm->timers);
        BLI_listbase_clear(&wm->operators);
        BLI_listbase_clear(&wm->paintcursors);
        BLI_listbase_clear(&wm->queue);
        BKE_reports_init(&wm->reports, RPT_STORE);
-       
+
        BLI_listbase_clear(&wm->keyconfigs);
        wm->defaultconf = NULL;
        wm->addonconf = NULL;
@@ -6313,7 +6313,7 @@ static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm)
 
        BLI_listbase_clear(&wm->jobs);
        BLI_listbase_clear(&wm->drags);
-       
+
        wm->windrawable = NULL;
        wm->winactive = NULL;
        wm->initialized = 0;
@@ -6325,14 +6325,14 @@ static void lib_link_windowmanager(FileData *fd, Main *main)
 {
        wmWindowManager *wm;
        wmWindow *win;
-       
+
        for (wm = main->wm.first; wm; wm = wm->id.next) {
                if (wm->id.tag & LIB_TAG_NEED_LINK) {
                        /* Note: WM IDProperties are never written to file, hence no need to read/link them here. */
                        for (win = wm->windows.first; win; win = win->next) {
                                win->screen = newlibadr(fd, NULL, win->screen);
                        }
-                       
+
                        wm->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
@@ -6364,7 +6364,7 @@ static void direct_link_gpencil(FileData *fd, bGPdata *gpd)
        /* we must firstly have some grease-pencil data to link! */
        if (gpd == NULL)
                return;
-       
+
        /* relink animdata */
        gpd->adt = newdataadr(fd, gpd->adt);
        direct_link_animdata(fd, gpd->adt);
@@ -6377,21 +6377,21 @@ static void direct_link_gpencil(FileData *fd, bGPdata *gpd)
 
        /* relink layers */
        link_list(fd, &gpd->layers);
-       
+
        for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
                /* parent */
                gpl->parent = newlibadr(fd, gpd->id.lib, gpl->parent);
                /* relink frames */
                link_list(fd, &gpl->frames);
                gpl->actframe = newdataadr(fd, gpl->actframe);
-               
+
                for (gpf = gpl->frames.first; gpf; gpf = gpf->next) {
                        /* relink strokes (and their points) */
                        link_list(fd, &gpf->strokes);
-                       
+
                        for (gps = gpf->strokes.first; gps; gps = gps->next) {
                                gps->points = newdataadr(fd, gps->points);
-                               
+
                                /* the triangulation is not saved, so need to be recalculated */
                                gps->triangles = NULL;
                                gps->tot_triangles = 0;
@@ -6406,7 +6406,7 @@ static void direct_link_gpencil(FileData *fd, bGPdata *gpd)
 
 /* ****************** READ SCREEN ***************** */
 
-/* note: file read without screens option G_FILE_NO_UI; 
+/* note: file read without screens option G_FILE_NO_UI;
  * check lib pointers in call below */
 static void lib_link_screen(FileData *fd, Main *main)
 {
@@ -6425,10 +6425,10 @@ static void lib_link_screen(FileData *fd, Main *main)
                        sc->animtimer = NULL; /* saved in rare cases */
                        sc->tool_tip = NULL;
                        sc->scrubbing = false;
-                       
+
                        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) {
                                        switch (sl->spacetype) {
                                                case SPACE_VIEW3D:
@@ -6746,34 +6746,34 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
        for (wm = newmain->wm.first; wm; wm = wm->id.next) {
                for (win= wm->windows.first; win; win= win->next) {
                        win->screen = restore_pointer_by_name(id_map, (ID *)win->screen, USER_REAL);
-                       
+
                        if (win->screen == NULL)
                                win->screen = curscreen;
-                       
+
                        win->screen->winid = win->winid;
                }
        }
-       
-       
+
+
        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);
                if (sc->scene == NULL)
                        sc->scene = curscene;
-               
+
                /* keep cursor location through undo */
                copy_v3_v3(sc->scene->cursor, oldscene->cursor);
-               
+
                for (sa = sc->areabase.first; sa; sa = sa->next) {
                        SpaceLink *sl;
-                       
+
                        for (sl = sa->spacedata.first; sl; sl = sl->next) {
                                if (sl->spacetype == SPACE_VIEW3D) {
                                        View3D *v3d = (View3D *)sl;
                                        BGpic *bgpic;
                                        ARegion *ar;
-                                       
+
                                        if (v3d->scenelock)
                                                v3d->camera = NULL; /* always get from scene */
                                        else
@@ -6781,7 +6781,7 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
                                        if (v3d->camera == NULL)
                                                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) {
                                                if ((bgpic->ima = restore_pointer_by_name(id_map, (ID *)bgpic->ima, USER_IGNORE))) {
                                                        id_us_plus((ID *)bgpic->ima);
@@ -6792,9 +6792,9 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
                                        }
                                        if (v3d->localvd) {
                                                /*Base *base;*/
-                                               
+
                                                v3d->localvd->camera = sc->scene->camera;
-                                               
+
                                                /* localview can become invalid during undo/redo steps, so we exit it when no could be found */
 #if 0                                  /* XXX  regionlocalview ? */
                                                for (base= sc->scene->base.first; base; base= base->next) {
@@ -6803,7 +6803,7 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
                                                if (base==NULL) {
                                                        v3d->lay= v3d->localvd->lay;
                                                        v3d->layact= v3d->localvd->layact;
-                                                       MEM_freeN(v3d->localvd); 
+                                                       MEM_freeN(v3d->localvd);
                                                        v3d->localvd= NULL;
                                                }
 #endif
@@ -6811,7 +6811,7 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
                                        else if (v3d->scenelock) {
                                                v3d->lay = sc->scene->lay;
                                        }
-                                       
+
                                        /* not very nice, but could help */
                                        if ((v3d->layact & v3d->lay) == 0) v3d->layact = v3d->lay;
 
@@ -6829,14 +6829,14 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
                                else if (sl->spacetype == SPACE_IPO) {
                                        SpaceIpo *sipo = (SpaceIpo *)sl;
                                        bDopeSheet *ads = sipo->ads;
-                                       
+
                                        if (ads) {
                                                ads->source = restore_pointer_by_name(id_map, (ID *)ads->source, USER_REAL);
-                                               
+
                                                if (ads->filter_grp)
                                                        ads->filter_grp = restore_pointer_by_name(id_map, (ID *)ads->filter_grp, USER_IGNORE);
                                        }
-                                       
+
                                        /* force recalc of list of channels (i.e. includes calculating F-Curve colors)
                                         * thus preventing the "black curves" problem post-undo
                                         */
@@ -6860,28 +6860,28 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
                                }
                                else if (sl->spacetype == SPACE_ACTION) {
                                        SpaceAction *saction = (SpaceAction *)sl;
-                                       
+
                                        saction->action = restore_pointer_by_name(id_map, (ID *)saction->action, USER_REAL);
                                        saction->ads.source = restore_pointer_by_name(id_map, (ID *)saction->ads.source, USER_REAL);
-                                       
+
                                        if (saction->ads.filter_grp)
                                                saction->ads.filter_grp = restore_pointer_by_name(id_map, (ID *)saction->ads.filter_grp, USER_IGNORE);
-                                               
-                                       
-                                       /* force recalc of list of channels, potentially updating the active action 
-                                        * while we're at it (as it can only be updated that way) [#28962] 
+
+
+                                       /* force recalc of list of channels, potentially updating the active action
+                                        * while we're at it (as it can only be updated that way) [#28962]
                                         */
                                        saction->flag |= SACTION_TEMP_NEEDCHANSYNC;
                                }
                                else if (sl->spacetype == SPACE_IMAGE) {
                                        SpaceImage *sima = (SpaceImage *)sl;
-                                       
+
                                        sima->image = restore_pointer_by_name(id_map, (ID *)sima->image, USER_REAL);
-                                       
+
                                        /* this will be freed, not worth attempting to find same scene,
                                         * since it gets initialized later */
                                        sima->iuser.scene = NULL;
-                                       
+
 #if 0
                                        /* Those are allocated and freed by space code, no need to handle them here. */
                                        MEM_SAFE_FREE(sima->scopes.waveform_1);
@@ -6890,7 +6890,7 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
                                        MEM_SAFE_FREE(sima->scopes.vecscope);
 #endif
                                        sima->scopes.ok = 0;
-                                       
+
                                        /* NOTE: pre-2.5, this was local data not lib data, but now we need this as lib data
                                         * so assume that here we're doing for undo only...
                                         */
@@ -6899,7 +6899,7 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
                                }
                                else if (sl->spacetype == SPACE_SEQ) {
                                        SpaceSeq *sseq = (SpaceSeq *)sl;
-                                       
+
                                        /* NOTE: pre-2.5, this was local data not lib data, but now we need this as lib data
                                         * so assume that here we're doing for undo only...
                                         */
@@ -6908,25 +6908,25 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
                                else if (sl->spacetype == SPACE_NLA) {
                                        SpaceNla *snla = (SpaceNla *)sl;
                                        bDopeSheet *ads = snla->ads;
-                                       
+
                                        if (ads) {
                                                ads->source = restore_pointer_by_name(id_map, (ID *)ads->source, USER_REAL);
-                                               
+
                                                if (ads->filter_grp)
                                                        ads->filter_grp = restore_pointer_by_name(id_map, (ID *)ads->filter_grp, USER_IGNORE);
                                        }
                                }
                                else if (sl->spacetype == SPACE_TEXT) {
                                        SpaceText *st = (SpaceText *)sl;
-                                       
+
                                        st->text = restore_pointer_by_name(id_map, (ID *)st->text, USER_REAL);
                                        if (st->text == NULL) st->text = newmain->text.first;
                                }
                                else if (sl->spacetype == SPACE_SCRIPT) {
                                        SpaceScript *scpt = (SpaceScript *)sl;
-                                       
+
                                        scpt->script = restore_pointer_by_name(id_map, (ID *)scpt->script, USER_REAL);
-                                       
+
                                        /*sc->script = NULL; - 2.45 set to null, better re-run the script */
                                        if (scpt->script) {
                                                SCRIPT_SET_NULL(scpt->script);
@@ -6934,9 +6934,9 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
                                }
                                else if (sl->spacetype == SPACE_OUTLINER) {
                                        SpaceOops *so= (SpaceOops *)sl;
-                                       
+
                                        so->search_tse.id = restore_pointer_by_name(id_map, so->search_tse.id, USER_IGNORE);
-                                       
+
                                        if (so->treestore) {
                                                TreeStoreElem *tselem;
                                                BLI_mempool_iter iter;
@@ -6961,14 +6961,14 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
                                        SpaceNode *snode= (SpaceNode *)sl;
                                        bNodeTreePath *path, *path_next;
                                        bNodeTree *ntree;
-                                       
+
                                        /* node tree can be stored locally in id too, link this first */
                                        snode->id = restore_pointer_by_name(id_map, snode->id, USER_REAL);
                                        snode->from = restore_pointer_by_name(id_map, snode->from, USER_IGNORE);
-                                       
+
                                        ntree = snode->id ? ntreeFromID(snode->id) : NULL;
                                        snode->nodetree = ntree ? ntree : restore_pointer_by_name(id_map, (ID *)snode->nodetree, USER_REAL);
-                                       
+
                                        for (path = snode->treepath.first; path; path = path->next) {
                                                if (path == snode->treepath.first) {
                                                        /* first nodetree in path is same as snode->nodetree */
@@ -6976,19 +6976,19 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
                                                }
                                                else
                                                        path->nodetree= restore_pointer_by_name(id_map, (ID*)path->nodetree, USER_REAL);
-                                               
+
                                                if (!path->nodetree)
                                                        break;
                                        }
-                                       
+
                                        /* remaining path entries are invalid, remove */
                                        for (; path; path = path_next) {
                                                path_next = path->next;
-                                               
+
                                                BLI_remlink(&snode->treepath, path);
                                                MEM_freeN(path);
                                        }
-                                       
+
                                        /* edittree is just the last in the path,
                                         * set this directly since the path may have been shortened above */
                                        if (snode->treepath.last) {
@@ -7000,15 +7000,15 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
                                }
                                else if (sl->spacetype == SPACE_CLIP) {
                                        SpaceClip *sclip = (SpaceClip *)sl;
-                                       
+
                                        sclip->clip = restore_pointer_by_name(id_map, (ID *)sclip->clip, USER_REAL);
                                        sclip->mask_info.mask = restore_pointer_by_name(id_map, (ID *)sclip->mask_info.mask, USER_REAL);
-                                       
+
                                        sclip->scopes.ok = 0;
                                }
                                else if (sl->spacetype == SPACE_LOGIC) {
                                        SpaceLogic *slogic = (SpaceLogic *)sl;
-                                       
+
                                        slogic->gpd = restore_pointer_by_name(id_map, (ID *)slogic->gpd, USER_REAL);
                                }
                        }
@@ -7074,7 +7074,7 @@ static void direct_link_region(FileData *fd, ARegion *ar, int spacetype)
                        }
                }
        }
-       
+
        ar->v2d.tab_offset = NULL;
        ar->v2d.tab_num = 0;
        ar->v2d.tab_cur = 0;
@@ -7096,11 +7096,11 @@ static void direct_link_region(FileData *fd, ARegion *ar, int spacetype)
 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) {
                        RegionView3D *rv3d;
-                       
+
                        rv3d = ar->regiondata = MEM_callocN(sizeof(RegionView3D), "region v3d patch");
                        rv3d->persp = (char)v3d->persp;
                        rv3d->view = (char)v3d->view;
@@ -7109,7 +7109,7 @@ void blo_do_versions_view3d_split_250(View3D *v3d, ListBase *regions)
                        copy_qt_qt(rv3d->viewquat, v3d->viewquat);
                }
        }
-       
+
        /* this was not initialized correct always */
        if (v3d->twtype == 0)
                v3d->twtype = V3D_MANIP_TRANSLATE;
@@ -7123,13 +7123,13 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
        ScrVert *sv;
        ScrEdge *se;
        bool wrong_id = false;
-       
+
        link_list(fd, &(sc->vertbase));
        link_list(fd, &(sc->edgebase));
        link_list(fd, &(sc->areabase));
        sc->regionbase.first = sc->regionbase.last= NULL;
        sc->context = NULL;
-       
+
        sc->mainwin = sc->subwinactive= 0;      /* indices */
        sc->swap = 0;
 
@@ -7142,22 +7142,22 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
                        se->v1 = se->v2;
                        se->v2 = sv;
                }
-               
+
                if (se->v1 == NULL) {
                        printf("Error reading Screen %s... removing it.\n", sc->id.name+2);
                        BLI_remlink(&sc->edgebase, se);
                        wrong_id = true;
                }
        }
-       
+
        /* areas */
        for (sa = sc->areabase.first; sa; sa = sa->next) {
                SpaceLink *sl;
                ARegion *ar;
-               
+
                link_list(fd, &(sa->spacedata));
                link_list(fd, &(sa->regionbase));
-               
+
                BLI_listbase_clear(&sa->handlers);
                sa->type = NULL;        /* spacetype callbacks */
                sa->region_active_win = -1;
@@ -7166,10 +7166,10 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
                 * free it, so don't allocate any new memory for such spacetypes. */
                if (!BKE_spacetype_exists(sa->spacetype))
                        sa->spacetype = SPACE_EMPTY;
-               
+
                for (ar = sa->regionbase.first; ar; ar = ar->next)
                        direct_link_region(fd, ar, sa->spacetype);
-               
+
                /* accident can happen when read/save new file with older version */
                /* 2.50: we now always add spacedata for info */
                if (sa->spacedata.first==NULL) {
@@ -7194,25 +7194,25 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
 
                        for (ar = sl->regionbase.first; ar; ar = ar->next)
                                direct_link_region(fd, ar, sl->spacetype);
-                       
+
                        if (sl->spacetype == SPACE_VIEW3D) {
                                View3D *v3d= (View3D*) sl;
                                BGpic *bgpic;
-                               
+
                                v3d->flag |= V3D_INVALID_BACKBUF;
-                               
+
                                link_list(fd, &v3d->bgpicbase);
-                               
+
                                /* should be do_versions except this doesnt fit well there */
                                if (v3d->bgpic) {
                                        bgpic = newdataadr(fd, v3d->bgpic);
                                        BLI_addtail(&v3d->bgpicbase, bgpic);
                                        v3d->bgpic = NULL;
                                }
-                       
+
                                for (bgpic = v3d->bgpicbase.first; bgpic; bgpic = bgpic->next)
                                        bgpic->iuser.ok = 1;
-                               
+
                                if (v3d->gpd) {
                                        v3d->gpd = newdataadr(fd, v3d->gpd);
                                        direct_link_gpencil(fd, v3d->gpd);
@@ -7223,7 +7223,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
                                BLI_listbase_clear(&v3d->afterdraw_xraytransp);
                                v3d->properties_storage = NULL;
                                v3d->defmaterial = NULL;
-                               
+
                                /* render can be quite heavy, set to solid on load */
                                if (v3d->drawtype == OB_RENDER)
                                        v3d->drawtype = OB_SOLID;
@@ -7233,23 +7233,23 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
                                        v3d->fx_settings.dof = newdataadr(fd, v3d->fx_settings.dof);
                                if (v3d->fx_settings.ssao)
                                        v3d->fx_settings.ssao = newdataadr(fd, v3d->fx_settings.ssao);
-                               
+
                                blo_do_versions_view3d_split_250(v3d, &sl->regionbase);
                        }
                        else if (sl->spacetype == SPACE_IPO) {
                                SpaceIpo *sipo = (SpaceIpo *)sl;
-                               
+
                                sipo->ads = newdataadr(fd, sipo->ads);
                                BLI_listbase_clear(&sipo->ghostCurves);
                        }
                        else if (sl->spacetype == SPACE_NLA) {
                                SpaceNla *snla = (SpaceNla *)sl;
-                               
+
                                snla->ads = newdataadr(fd, snla->ads);
                        }
                        else if (sl->spacetype == SPACE_OUTLINER) {
                                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
                                 * bug fixed in revision 58959 where the treestore memory address
@@ -7258,7 +7258,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
                                soops->treestore = NULL;
                                if (ts) {
                                        TreeStoreElem *elems = newdataadr_no_us(fd, ts->data);
-                                       
+
                                        soops->treestore = BLI_mempool_create(sizeof(TreeStoreElem), ts->usedelem,
                                                                              512, BLI_MEMPOOL_ALLOW_ITER);
                                        if (ts->usedelem && elems) {
@@ -7284,8 +7284,8 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
                                sima->scopes.waveform_3 = NULL;
                                sima->scopes.vecscope = NULL;
                                sima->scopes.ok = 0;
-                               
-                               /* WARNING: gpencil data is no longer stored directly in sima after 2.5 
+
+                               /* WARNING: gpencil data is no longer stored directly in sima after 2.5
                                 * so sacrifice a few old files for now to avoid crashes with new files!
                                 * committed: r28002 */
 #if 0
@@ -7296,12 +7296,12 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
                        }
                        else if (sl->spacetype == SPACE_NODE) {
                                SpaceNode *snode = (SpaceNode *)sl;
-                               
+
                                if (snode->gpd) {
                                        snode->gpd = newdataadr(fd, snode->gpd);
                                        direct_link_gpencil(fd, snode->gpd);
                                }
-                               
+
                                link_list(fd, &snode->treepath);
                                snode->edittree = NULL;
                                snode->iofsd = NULL;
@@ -7309,7 +7309,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
                        }
                        else if (sl->spacetype == SPACE_TEXT) {
                                SpaceText *st= (SpaceText *)sl;
-                               
+
                                st->drawcache = NULL;
                                st->scroll_accum[0] = 0.0f;
                                st->scroll_accum[1] = 0.0f;
@@ -7320,7 +7320,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
                        }
                        else if (sl->spacetype == SPACE_LOGIC) {
                                SpaceLogic *slogic = (SpaceLogic *)sl;
-                               
+
                                /* XXX: this is new stuff, which shouldn't be directly linking to gpd... */
                                if (slogic->gpd) {
                                        slogic->gpd = newdataadr(fd, slogic->gpd);
@@ -7329,7 +7329,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
                        }
                        else if (sl->spacetype == SPACE_SEQ) {
                                SpaceSeq *sseq = (SpaceSeq *)sl;
-                               
+
                                /* grease pencil data is not a direct data and can't be linked from direct_link*
                                 * functions, it should be linked from lib_link* functions instead
                                 *
@@ -7353,7 +7353,7 @@ 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->mainbo = sbuts->mainb;
@@ -7362,13 +7362,13 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
                        else if (sl->spacetype == SPACE_CONSOLE) {
                                SpaceConsole *sconsole = (SpaceConsole *)sl;
                                ConsoleLine *cl, *cl_next;
-                               
+
                                link_list(fd, &sconsole->scrollback);
                                link_list(fd, &sconsole->history);
-                               
+
                                //for (cl= sconsole->scrollback.first; cl; cl= cl->next)
                                //      cl->line= newdataadr(fd, cl->line);
-                               
+
                                /* comma expressions, (e.g. expr1, expr2, expr3) evaluate each expression,
                                 * from left to right.  the right-most expression sets the result of the comma
                                 * expression as a whole*/
@@ -7387,7 +7387,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
                        }
                        else if (sl->spacetype == SPACE_FILE) {
                                SpaceFile *sfile = (SpaceFile *)sl;
-                               
+
                                /* this sort of info is probably irrelevant for reloading...
                                 * plus, it isn't saved to files yet!
                                 */
@@ -7400,21 +7400,21 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
                        }
                        else if (sl->spacetype == SPACE_CLIP) {
                                SpaceClip *sclip = (SpaceClip *)sl;
-                               
+
                                sclip->scopes.track_search = NULL;
                                sclip->scopes.track_preview = NULL;
                                sclip->scopes.ok = 0;
                        }
                }
-               
+
                BLI_listbase_clear(&sa->actionzones);
-               
+
                sa->v1 = newdataadr(fd, sa->v1);
                sa->v2 = newdataadr(fd, sa->v2);
                sa->v3 = newdataadr(fd, sa->v3);
                sa->v4 = newdataadr(fd, sa->v4);
        }
-       
+
        return wrong_id;
 }
 
@@ -7424,7 +7424,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
 static void direct_link_library(FileData *fd, Library *lib, Main *main)
 {
        Main *newmain;
-       
+
        /* check if the library was already read */
        for (newmain = fd->mainlist->first; newmain; newmain = newmain->next) {
                if (newmain->curlib) {
@@ -7432,10 +7432,10 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main)
                                blo_reportf_wrap(fd->reports, RPT_WARNING,
                                                 TIP_("Library '%s', '%s' had multiple instances, save and reload!"),
                                                 lib->name, lib->filepath);
-                               
+
                                change_idid_adr(fd->mainlist, fd, lib, newmain->curlib);
 /*                             change_idid_adr_fd(fd, lib, newmain->curlib); */
-                               
+
                                BLI_remlink(&main->library, lib);
                                MEM_freeN(lib);
 
@@ -7455,17 +7455,17 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main)
        /* make sure we have full path in lib->filepath */
        BLI_strncpy(lib->filepath, lib->name, sizeof(lib->name));
        BLI_cleanup_path(fd->relabase, lib->filepath);
-       
+
 //     printf("direct_link_library: name %s\n", lib->name);
 //     printf("direct_link_library: filepath %s\n", lib->filepath);
-       
+
        lib->packedfile = direct_link_packedfile(fd, lib->packedfile);
-       
+
        /* new main */
        newmain = BKE_main_new();
        BLI_addtail(fd->mainlist, newmain);
        newmain->curlib = lib;
-       
+
        lib->parent = NULL;
 }
 
@@ -7514,7 +7514,7 @@ static void lib_link_speaker(FileData *fd, Main *main)
                if (spk->id.tag & LIB_TAG_NEED_LINK) {
                        IDP_LibLinkProperty(spk->id.properties, fd);
                        lib_link_animdata(fd, &spk->id, spk->adt);
-                       
+
                        spk->sound = newlibadr_us(fd, spk->id.lib, spk->sound);
 
                        spk->id.tag &= ~LIB_TAG_NEED_LINK;
@@ -7548,11 +7548,11 @@ static void direct_link_sound(FileData *fd, bSound *sound)
 
        if (fd->soundmap) {
                sound->waveform = newsoundadr(fd, sound->waveform);
-       }       
+       }
        else {
                sound->waveform = NULL;
        }
-               
+
        if (sound->spinlock) {
                sound->spinlock = MEM_mallocN(sizeof(SpinLock), "sound_spinlock");
                BLI_spin_init(sound->spinlock);
@@ -7571,7 +7571,7 @@ static void lib_link_sound(FileData *fd, Main *main)
                        IDP_LibLinkProperty(sound->id.properties, fd);
 
                        sound->ipo = newlibadr_us(fd, sound->id.lib, sound->ipo); // XXX deprecated - old animation system
-                       
+
                        BKE_sound_load(main, sound);
 
                        sound->id.tag &= ~LIB_TAG_NEED_LINK;
@@ -7592,9 +7592,9 @@ static void lib_link_group(FileData *fd, Main *bmain)
        for (Group *group = bmain->group.first; group; group = group->id.next) {
                if (group->id.tag & LIB_TAG_NEED_LINK) {
                        IDP_LibLinkProperty(group->id.properties, fd);
-                       
+
                        bool add_us = false;
-                       
+
                        for (GroupObject *go = group->gobject.first; go; go = go->next) {
                                go->ob = newlibadr_real_us(fd, group->id.lib, go->ob);
                                if (go->ob) {
@@ -7623,9 +7623,9 @@ static void direct_link_movieReconstruction(FileData *fd, MovieTrackingReconstru
 static void direct_link_movieTracks(FileData *fd, ListBase *tracksbase)
 {
        MovieTrackingTrack *track;
-       
+
        link_list(fd, tracksbase);
-       
+
        for (track = tracksbase->first; track; track = track->next) {
                track->markers = newdataadr(fd, track->markers);
        }
@@ -7685,7 +7685,7 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip)
        BLI_listbase_clear(&clip->tracking.dopesheet.coverage_segments);
 
        link_list(fd, &tracking->objects);
-       
+
        for (object = tracking->objects.first; object; object = object->next) {
                direct_link_movieTracks(fd, &object->tracks);
                direct_link_moviePlaneTracks(fd, &object->plane_tracks);
@@ -7719,9 +7719,9 @@ static void lib_link_movieclip(FileData *fd, Main *main)
 
                        IDP_LibLinkProperty(clip->id.properties, fd);
                        lib_link_animdata(fd, &clip->id, clip->adt);
-                       
+
                        clip->gpd = newlibadr_us(fd, clip->id.lib, clip->gpd);
-                       
+
                        lib_link_movieTracks(fd, clip, &tracking->tracks);
                        lib_link_moviePlaneTracks(fd, clip, &tracking->plane_tracks);
 
@@ -8135,13 +8135,13 @@ static const char *dataname(short id_code)
                case ID_CF: return "Data from CF";
        }
        return "Data from Lib Block";
-       
+
 }
 
 static BHead *read_data_into_oldnewmap(FileData *fd, BHead *bhead, const char *allocname)
 {
        bhead = blo_nextbhead(fd, bhead);
-       
+
        while (bhead && bhead->code==DATA) {
                void *data;
 #if 0
@@ -8154,14 +8154,14 @@ static BHead *read_data_into_oldnewmap(FileData *fd, BHead *bhead, const char *a
 #else
                data = read_struct(fd, bhead, allocname);
 #endif
-               
+
                if (data) {
                        oldnewmap_insert(fd->datamap, bhead->old, data, 0);
                }
-               
+
                bhead = blo_nextbhead(fd, bhead);
        }
-       
+
        return bhead;
 }
 
@@ -8250,13 +8250,13 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
                *r_id = id;
        if (!id)
                return blo_nextbhead(fd, bhead);
-       
+
        id->lib = main->curlib;
        id->us = ID_FAKE_USERS(id);
        id->icon_id = 0;
        id->newid = NULL;  /* Needed because .blend may have been saved with crap value here... */
        id->recalc = 0;
-       
+
        /* this case cannot be direct_linked: it's just the ID part */
        if (bhead->code == ID_ID) {
                /* That way, we know which datablock needs do_versions (required currently for linking). */
@@ -8267,10 +8267,10 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
 
        /* need a name for the mallocN, just for debugging and sane prints on leaks */
        allocname = dataname(GS(id->name));
-       
+
        /* read all data into fd->datamap */
        bhead = read_data_into_oldnewmap(fd, bhead, allocname);
-       
+
        /* init pointers direct data */
        direct_link_id(fd, id);
 
@@ -8382,14 +8382,14 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
                        direct_link_cachefile(fd, (CacheFile *)id);
                        break;
        }
-       
+
        oldnewmap_free_unused(fd->datamap);
        oldnewmap_clear(fd->datamap);
-       
+
        if (wrong_id) {
                BKE_libblock_free(main, id);
        }
-       
+
        return (bhead);
 }
 
@@ -8398,40 +8398,40 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
 static BHead *read_global(BlendFileData *bfd, FileData *fd, BHead *bhead)
 {
        FileGlobal *fg = read_struct(fd, bhead, "Global");
-       
+
        /* copy to bfd handle */
        bfd->main->subversionfile = fg->subversion;
        bfd->main->minversionfile = fg->minversion;
        bfd->main->minsubversionfile = fg->minsubversion;
        bfd->main->build_commit_timestamp = fg->build_commit_timestamp;
        BLI_strncpy(bfd->main->build_hash, fg->build_hash, sizeof(bfd->main->build_hash));
-       
+
        bfd->fileflags = fg->fileflags;
        bfd->globalf = fg->globalf;
        BLI_strncpy(bfd->filename, fg->filename, sizeof(bfd->filename));
-       
+
        /* 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)
                                BLI_strncpy(bfd->filename, BKE_main_blendfile_path(bfd->main), sizeof(bfd->filename));
-               
+
                /* early 2.50 version patch - filename not in FileGlobal struct at all */
                if (fd->fileversion <= 250)
                        BLI_strncpy(bfd->filename, BKE_main_blendfile_path(bfd->main), sizeof(bfd->filename));
        }
-       
+
        if (G.fileflags & G_FILE_RECOVER)
                BLI_strncpy(fd->relabase, fg->filename, sizeof(fd->relabase));
-       
+
        bfd->curscreen = fg->curscreen;
        bfd->curscene = fg->curscene;
-       
+
        MEM_freeN(fg);
-       
+
        fd->globalf = bfd->globalf;
        fd->fileflags = bfd->fileflags;
-       
+
        return blo_nextbhead(fd, bhead);
 }
 
@@ -8449,7 +8449,7 @@ static void link_global(FileData *fd, BlendFileData *bfd)
 static void convert_tface_mt(FileData *fd, Main *main)
 {
        Main *gmain;
-       
+
        /* this is a delayed do_version (so it can create new materials) */
        if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 3)) {
                //XXX hack, material.c uses G_MAIN all over the place, instead of main
@@ -8457,11 +8457,11 @@ static void convert_tface_mt(FileData *fd, Main *main)
                // temporarily set G_MAIN to the current main
                gmain = G_MAIN;
                G_MAIN = main;
-               
+
                if (!(do_version_tface(main))) {
                        BKE_report(fd->reports, RPT_WARNING, "Texface conversion problem (see error in console)");
                }
-               
+
                //XXX hack, material.c uses G_MAIN allover the place, instead of main
                G_MAIN = gmain;
        }
@@ -8473,12 +8473,12 @@ static void do_versions_userdef(FileData *fd, BlendFileData *bfd)
 {
        Main *bmain = bfd->main;
        UserDef *user = bfd->user;
-       
+
        if (user == NULL) return;
-       
+
        if (MAIN_VERSION_OLDER(bmain, 266, 4)) {
                bTheme *btheme;
-               
+
                /* themes for Node and Sequence editor were not using grid color, but back. we copy this over then */
                for (btheme = user->themes.first; btheme; btheme = btheme->next) {
                        copy_v4_v4_char(btheme->tnode.grid, btheme->tnode.back);
@@ -8499,7 +8499,7 @@ static void do_versions_userdef(FileData *fd, BlendFileData *bfd)
 static void do_versions(FileData *fd, Library *lib, Main *main)
 {
        /* WATCH IT!!!: pointers from libdata have not been converted */
-       
+
        if (G.debug & G_DEBUG) {
                char build_commit_datetime[32];
                time_t temp_time = main->build_commit_timestamp;
@@ -8515,7 +8515,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                       fd->relabase, main->versionfile, main->subversionfile,
                       build_commit_datetime, main->build_hash);
        }
-       
+
        blo_do_versions_pre250(fd, lib, main);
        blo_do_versions_250(fd, lib, main);
        blo_do_versions_260(fd, lib, main);
@@ -8538,7 +8538,7 @@ static void do_versions_after_linking(Main *main)
 static void lib_link_all(FileData *fd, Main *main)
 {
        oldnewmap_sort(fd);
-       
+
        /* No load UI for undo memfiles */
        if (fd->memfile == NULL) {
                lib_link_windowmanager(fd, main);
@@ -8595,22 +8595,22 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
        wmKeyMapItem *kmi;
        wmKeyMapDiffItem *kmdi;
        bAddon *addon;
-       
+
        bfd->user = user= read_struct(fd, bhead, "user def");
-       
+
        /* User struct has separate do-version handling */
        user->versionfile = bfd->main->versionfile;
        user->subversionfile = bfd->main->subversionfile;
-       
+
        /* read all data into fd->datamap */
        bhead = read_data_into_oldnewmap(fd, bhead, "user def");
-       
+
        if (user->keymaps.first) {
                /* backwards compatibility */
                user->user_keymaps= user->keymaps;
                user->keymaps.first= user->keymaps.last= NULL;
        }
-       
+
        link_list(fd, &user->themes);
        link_list(fd, &user->user_keymaps);
        link_list(fd, &user->addons);
@@ -8620,20 +8620,20 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
                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);
-                       
+
                        if (kmdi->remove_item)
                                direct_link_keymapitem(fd, kmdi->remove_item);
                        if (kmdi->add_item)
                                direct_link_keymapitem(fd, kmdi->add_item);
                }
-               
+
                for (kmi=keymap->items.first; kmi; kmi=kmi->next)
                        direct_link_keymapitem(fd, kmi);
        }
@@ -8645,13 +8645,13 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
 
        // XXX
        user->uifonts.first = user->uifonts.last= NULL;
-       
+
        link_list(fd, &user->uistyles);
-       
+
        /* free fd->datamap again */
        oldnewmap_free_unused(fd->datamap);
        oldnewmap_clear(fd->datamap);
-       
+
        return bhead;
 }
 
@@ -8660,14 +8660,14 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
        BHead *bhead = blo_firstbhead(fd);
        BlendFileData *bfd;
        ListBase mainlist = {NULL, NULL};
-       
+
        bfd = MEM_callocN(sizeof(BlendFileData), "blendfiledata");
        bfd->main = BKE_main_new();
        BLI_addtail(&mainlist, bfd->main);
        fd->mainlist = &mainlist;
-       
+
        bfd->main->versionfile = fd->fileversion;
-       
+
        bfd->type = BLENFILETYPE_BLEND;
        BLI_strncpy(bfd->main->name, filepath, sizeof(bfd->main->name));
 
@@ -8717,7 +8717,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
                case ENDB:
                        bhead = NULL;
                        break;
-               
+
                case ID_ID:
                        /* Always adds to the most recently loaded ID_LI block, see direct_link_library.
                         * This is part of the file format definition. */
@@ -8742,17 +8742,17 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
                        }
                }
        }
-       
+
        /* do before read_libraries, but skip undo case */
        if (fd->memfile == NULL) {
                do_versions(fd, NULL, bfd->main);
                do_versions_userdef(fd, bfd);
        }
-       
+
        read_libraries(fd, &mainlist);
-       
+
        blo_join_main(&mainlist);
-       
+
        lib_link_all(fd, bfd->main);
 
        /* Skip in undo case. */
@@ -8770,9 +8770,9 @@ 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 */
-       
+
        fd->mainlist = NULL;  /* Safety, this is local variable, shall not be used afterward. */
 
        return bfd;
@@ -8788,7 +8788,7 @@ struct BHeadSort {
 static int verg_bheadsort(const void *v1, const void *v2)
 {
        const struct BHeadSort *x1=v1, *x2=v2;
-       
+
        if (x1->old > x2->old) return 1;
        else if (x1->old < x2->old) return -1;
        return 0;
@@ -8799,20 +8799,20 @@ static void sort_bhead_old_map(FileData *fd)
        BHead *bhead;
        struct BHeadSort *bhs;
        int tot = 0;
-       
+
        for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead))
                tot++;
-       
+
        fd->tot_bheadmap = tot;
        if (tot == 0) return;
-       
+
        bhs = fd->bheadmap = MEM_malloc_arrayN(tot, sizeof(struct BHeadSort), "BHeadSort");
-       
+
        for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead), bhs++) {
                bhs->bhead = bhead;
                bhs->old = bhead->old;
        }
-       
+
        qsort(fd->bheadmap, tot, sizeof(struct BHeadSort), verg_bheadsort);
 }
 
@@ -8836,19 +8836,19 @@ static BHead *find_bhead(FileData *fd, void *old)
        BHead *bhead;
 #endif
        struct BHeadSort *bhs, bhs_s;
-       
+
        if (!old)
                return NULL;
 
        if (fd->bheadmap == NULL)
                sort_bhead_old_map(fd);
-       
+
        bhs_s.old = old;
        bhs = bsearch(&bhs_s, fd->bheadmap, fd->tot_bheadmap, sizeof(struct BHeadSort), verg_bheadsort);
 
        if (bhs)
                return bhs->bhead;
-       
+
 #if 0
        for (bhead = blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
                if (bhead->old == old)
@@ -8910,32 +8910,32 @@ static void expand_doit_library(void *fdhandle, Main *mainvar, void *old)
        BHead *bhead;
        FileData *fd = fdhandle;
        ID *id;
-       
+
        bhead = find_bhead(fd, old);
        if (bhead) {
                /* from another library? */
                if (bhead->code == ID_ID) {
                        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);
-                                       
+
                                        blo_reportf_wrap(fd->reports, RPT_WARNING, TIP_("LIB: Data refers to main .blend file: '%s' from %s"),
                                                         idname, mainvar->curlib->filepath);
                                        return;
                                }
                                else
                                        id = is_yet_read(fd, ptr, bhead);
-                               
+
                                if (id == NULL) {
                                        read_libblock(fd, ptr, bhead, LIB_TAG_READ | LIB_TAG_INDIRECT, NULL);
                                        // commented because this can print way too much
                                        // if (G.debug & G_DEBUG) printf("expand_doit: other lib %s\n", lib->name);
-                                       
+
                                        /* for outliner dependency only */
                                        ptr->curlib->parent = mainvar->curlib;
                                }
@@ -8946,10 +8946,10 @@ static void expand_doit_library(void *fdhandle, Main *mainvar, void *old)
                                         * lib_indirect.blend but lib.blend does too, linking in a Scene or Group from lib.blend can result in an
                                         * empty without the dupli group referenced. Once you save and reload the group would appear. - Campbell */
                                        /* This crashes files, must look further into it */
-                                       
+
                                        /* Update: the issue is that in file reading, the oldnewmap is OK, but for existing data, it has to be
                                         * inserted in the map to be found! */
-                                       
+
                                        /* Update: previously it was checking for id->tag & LIB_TAG_PRE_EXISTING, however that
                                         * does not affect file reading. For file reading we may need to insert it into the libmap as well,
                                         * because you might have two files indirectly linking the same datablock, and in that case
@@ -8959,11 +8959,11 @@ static void expand_doit_library(void *fdhandle, Main *mainvar, void *old)
                                         * change_idid_adr not detect the mapping was for an ID_ID datablock. */
                                        oldnewmap_insert(fd->libmap, bhead->old, id, bhead->code);
                                        change_idid_adr_fd(fd, bhead->old, id);
-                                       
+
                                        // commented because this can print way too much
                                        // if (G.debug & G_DEBUG) printf("expand_doit: already linked: %s lib: %s\n", id->name, lib->name);
                                }
-                               
+
                                MEM_freeN(lib);
                        }
                }
@@ -9032,14 +9032,14 @@ static void expand_idprops(FileData *fd, Main *mainvar, IDProperty *prop)
 static void expand_fmodifiers(FileData *fd, Main *mainvar, ListBase *list)
 {
        FModifier *fcm;
-       
+
        for (fcm = list->first; fcm; fcm = fcm->next) {
                /* library data for specific F-Modifier types */
                switch (fcm->type) {
                        case FMODIFIER_TYPE_PYTHON:
                        {
                                FMod_Python *data = (FMod_Python *)fcm->data;
-                               
+
                                expand_doit(fd, mainvar, data->script);
 
                                break;
@@ -9051,15 +9051,15 @@ static void expand_fmodifiers(FileData *fd, Main *mainvar, ListBase *list)
 static void expand_fcurves(FileData *fd, Main *mainvar, ListBase *list)
 {
        FCurve *fcu;
-       
+
        for (fcu = list->first; fcu; fcu = fcu->next) {
                /* Driver targets if there is a driver */
                if (fcu->driver) {
                        ChannelDriver *driver = fcu->driver;
                        DriverVar *dvar;
-                       
+
                        for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
-                               DRIVER_TARGETS_LOOPER(dvar) 
+                               DRIVER_TARGETS_LOOPER(dvar)
                                {
                                        // TODO: only expand those that are going to get used?
                                        expand_doit(fd, mainvar, dtar->id);
@@ -9067,7 +9067,7 @@ static void expand_fcurves(FileData *fd, Main *mainvar, ListBase *list)
                                DRIVER_TARGETS_LOOPER_END
                        }
                }
-               
+
                /* F-Curve Modifiers */
                expand_fmodifiers(fd, mainvar, &fcu->modifiers);
        }
@@ -9076,14 +9076,14 @@ static void expand_fcurves(FileData *fd, Main *mainvar, ListBase *list)
 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) {
                expand_doit(fd, mainvar, chan->ipo);
                expand_constraint_channels(fd, mainvar, &chan->constraintChannels);
        }
        // ---------------------------------------------------
-       
+
        /* F-Curves in Action */
        expand_fcurves(fd, mainvar, &act->curves);
 
@@ -9098,7 +9098,7 @@ static void expand_keyingsets(FileData *fd, Main *mainvar, ListBase *list)
 {
        KeyingSet *ks;
        KS_Path *ksp;
-       
+
        /* expand the ID-pointers in KeyingSets's paths */
        for (ks = list->first; ks; ks = ks->next) {
                for (ksp = ks->paths.first; ksp; ksp = ksp->next) {
@@ -9110,17 +9110,17 @@ static void expand_keyingsets(FileData *fd, Main *mainvar, ListBase *list)
 static void expand_animdata_nlastrips(FileData *fd, Main *mainvar, ListBase *list)
 {
        NlaStrip *strip;
-       
+
        for (strip= list->first; strip; strip= strip->next) {
                /* check child strips */
                expand_animdata_nlastrips(fd, mainvar, &strip->strips);
-               
+
                /* check F-Curves */
                expand_fcurves(fd, mainvar, &strip->fcurves);
-               
+
                /* check F-Modifiers */
                expand_fmodifiers(fd, mainvar, &strip->modifiers);
-               
+
                /* relink referenced action */
                expand_doit(fd, mainvar, strip->act);
        }
@@ -9129,32 +9129,32 @@ static void expand_animdata_nlastrips(FileData *fd, Main *mainvar, ListBase *lis
 static void expand_animdata(FileData *fd, Main *mainvar, AnimData *adt)
 {
        NlaTrack *nlt;
-       
+
        /* own action */
        expand_doit(fd, mainvar, adt->action);
        expand_doit(fd, mainvar, adt->tmpact);
-       
+
        /* drivers - assume that these F-Curves have driver data to be in this list... */
        expand_fcurves(fd, mainvar, &adt->drivers);
-       
+
        /* nla-data - referenced actions */
-       for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) 
+       for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next)
                expand_animdata_nlastrips(fd, mainvar, &nlt->strips);
-}      
+}
 
 static void expand_particlesettings(FileData *fd, Main *mainvar, ParticleSettings *part)
 {
        int a;
-       
+
        expand_doit(fd, mainvar, part->dup_ob);
        expand_doit(fd, mainvar, part->dup_group);
        expand_doit(fd, mainvar, part->eff_group);
        expand_doit(fd, mainvar, part->bb_ob);
        expand_doit(fd, mainvar, part->collision_group);
-       
+
        if (part->adt)
                expand_animdata(fd, mainvar, part->adt);
-       
+
        for (a = 0; a < MAX_MTEX; a++) {
                if (part->mtex[a]) {
                        expand_doit(fd, mainvar, part->mtex[a]->tex);
@@ -9197,7 +9197,7 @@ static void expand_particlesettings(FileData *fd, Main *mainvar, ParticleSetting
 static void expand_group(FileData *fd, Main *mainvar, Group *group)
 {
        GroupObject *go;
-       
+
        for (go = group->gobject.first; go; go = go->next) {
                expand_doit(fd, mainvar, go->ob);
        }
@@ -9206,7 +9206,7 @@ static void expand_group(FileData *fd, Main *mainvar, Group *group)
 static void expand_key(FileData *fd, Main *mainvar, Key *key)
 {
        expand_doit(fd, mainvar, key->ipo); // XXX deprecated - old animation system
-       
+
        if (key->adt)
                expand_animdata(fd, mainvar, key->adt);
 }
@@ -9215,13 +9215,13 @@ static void expand_nodetree(FileData *fd, Main *mainvar, bNodeTree *ntree)
 {
        bNode *node;
        bNodeSocket *sock;
-       
+
        if (ntree->adt)
                expand_animdata(fd, mainvar, ntree->adt);
-               
+
        if (ntree->gpd)
                expand_doit(fd, mainvar, ntree->gpd);
-       
+
        for (node = ntree->nodes.first; node; node = node->next) {
                if (node->id && node->type != CMP_NODE_R_LAYERS) {
                        expand_doit(fd, mainvar, node->id);
@@ -9245,10 +9245,10 @@ static void expand_texture(FileData *fd, Main *mainvar, Tex *tex)
 {
        expand_doit(fd, mainvar, tex->ima);
        expand_doit(fd, mainvar, tex->ipo); // XXX deprecated - old animation system
-       
+
        if (tex->adt)
                expand_animdata(fd, mainvar, tex->adt);
-       
+
        if (tex->nodetree)
                expand_nodetree(fd, mainvar, tex->nodetree);
 }
@@ -9264,22 +9264,22 @@ static void expand_brush(FileData *fd, Main *mainvar, Brush *brush)
 static void expand_material(FileData *fd, Main *mainvar, Material *ma)
 {
        int a;
-       
+
        for (a = 0; a < MAX_MTEX; a++) {
                if (ma->mtex[a]) {
                        expand_doit(fd, mainvar, ma->mtex[a]->tex);
                        expand_doit(fd, mainvar, ma->mtex[a]->object);
                }
        }
-       
+
        expand_doit(fd, mainvar, ma->ipo); // XXX deprecated - old animation system
-       
+
        if (ma->adt)
                expand_animdata(fd, mainvar, ma->adt);
-       
+
        if (ma->nodetree)
                expand_nodetree(fd, mainvar, ma->nodetree);
-       
+
        if (ma->group)
                expand_doit(fd, mainvar, ma->group);
 }
@@ -9287,19 +9287,19 @@ static void expand_material(FileData *fd, Main *mainvar, Material *ma)
 static void expand_lamp(FileData *fd, Main *mainvar, Lamp *la)
 {
        int a;
-       
+
        for (a = 0; a < MAX_MTEX; a++) {
                if (la->mtex[a]) {
                        expand_doit(fd, mainvar, la->mtex[a]->tex);
                        expand_doit(fd, mainvar, la->mtex[a]->object);
                }
        }
-       
+
        expand_doit(fd, mainvar, la->ipo); // XXX deprecated - old animation system
-       
+
        if (la->adt)
                expand_animdata(fd, mainvar, la->adt);
-       
+
        if (la->nodetree)
                expand_nodetree(fd, mainvar, la->nodetree);
 }
@@ -9308,7 +9308,7 @@ static void expand_lattice(FileData *fd, Main *mainvar, Lattice *lt)
 {
        expand_doit(fd, mainvar, lt->ipo); // XXX deprecated - old animation system
        expand_doit(fd, mainvar, lt->key);
-       
+
        if (lt->adt)
                expand_animdata(fd, mainvar, lt->adt);
 }
@@ -9317,19 +9317,19 @@ static void expand_lattice(FileData *fd, Main *mainvar, Lattice *lt)
 static void expand_world(FileData *fd, Main *mainvar, World *wrld)
 {
        int a;
-       
+
        for (a = 0; a < MAX_MTEX; a++) {
                if (wrld->mtex[a]) {
                        expand_doit(fd, mainvar, wrld->mtex[a]->tex);
                        expand_doit(fd, mainvar, wrld->mtex[a]->object);
                }
        }
-       
+
        expand_doit(fd, mainvar, wrld->ipo); // XXX deprecated - old animation system
-       
+
        if (wrld->adt)
                expand_animdata(fd, mainvar, wrld->adt);
-       
+
        if (wrld->nodetree)
                expand_nodetree(fd, mainvar, wrld->nodetree);
 }
@@ -9338,11 +9338,11 @@ static void expand_world(FileData *fd, Main *mainvar, World *wrld)
 static void expand_mball(FileData *fd, Main *mainvar, MetaBall *mb)
 {
        int a;
-       
+
        for (a = 0; a < mb->totcol; a++) {
                expand_doit(fd, mainvar, mb->mat[a]);
        }
-       
+
        if (mb->adt)
                expand_animdata(fd, mainvar, mb->adt);
 }
@@ -9350,11 +9350,11 @@ static void expand_mball(FileData *fd, Main *mainvar, MetaBall *mb)
 static void expand_curve(FileData *fd, Main *mainvar, Curve *cu)
 {
        int a;
-       
+
        for (a = 0; a < cu->totcol; a++) {
                expand_doit(fd, mainvar, cu->mat[a]);
        }
-       
+
        expand_doit(fd, mainvar, cu->vfont);
        expand_doit(fd, mainvar, cu->vfontb);
        expand_doit(fd, mainvar, cu->vfonti);
@@ -9364,7 +9364,7 @@ static void expand_curve(FileData *fd, Main *mainvar, Curve *cu)
        expand_doit(fd, mainvar, cu->bevobj);
        expand_doit(fd, mainvar, cu->taperobj);
        expand_doit(fd, mainvar, cu->textoncurve);
-       
+
        if (cu->adt)
                expand_animdata(fd, mainvar, cu->adt);
 }
@@ -9374,17 +9374,17 @@ static void expand_mesh(FileData *fd, Main *mainvar, Mesh *me)
        CustomDataLayer *layer;
        TFace *tf;
        int a, i;
-       
+
        if (me->adt)
                expand_animdata(fd, mainvar, me->adt);
-               
+
        for (a = 0; a < me->totcol; a++) {
                expand_doit(fd, mainvar, me->mat[a]);
        }
-       
+
        expand_doit(fd, mainvar, me->key);
        expand_doit(fd, mainvar, me->texcomesh);
-       
+
        if (me->tface) {
                tf = me->tface;
                for (i=0; i<me->totface; i++, tf++) {
@@ -9442,13 +9442,13 @@ static void expand_constraints(FileData *fd, Main *mainvar, ListBase *lb)
 {
        tConstraintExpandData ced;
        bConstraint *curcon;
-       
+
        /* relink all ID-blocks used by the constraints */
        ced.fd = fd;
        ced.mainvar = mainvar;
-       
+
        BKE_constraints_id_loop(lb, expand_constraint_cb, &ced);
-       
+
        /* deprecated manual expansion stuff */
        for (curcon = lb->first; curcon; curcon = curcon->next) {
                if (curcon->ipo)
@@ -9459,10 +9459,10 @@ static void expand_constraints(FileData *fd, Main *mainvar, ListBase *lb)
 static void expand_pose(FileData *fd, Main *mainvar, bPose *pose)
 {
        bPoseChannel *chan;
-       
+
        if (!pose)
                return;
-       
+
        for (chan = pose->chanbase.first; chan; chan = chan->next) {
                expand_constraints(fd, mainvar, &chan->constraints);
                expand_idprops(fd, mainvar, chan->prop);
@@ -9493,10 +9493,10 @@ static void expand_object_expandModifiers(
         void *userData, Object *UNUSED(ob), ID **idpoin, int UNUSED(cb_flag))
 {
        struct { FileData *fd; Main *mainvar; } *data= userData;
-       
+
        FileData *fd = data->fd;
        Main *mainvar = data->mainvar;
-       
+
        expand_doit(fd, mainvar, *idpoin);
 }
 
@@ -9509,56 +9509,56 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
        bActionStrip *strip;
        PartEff *paf;
        int a;
-       
+
        expand_doit(fd, mainvar, ob->data);
-       
+
        /* expand_object_expandModifier() */
        if (ob->modifiers.first) {
                struct { FileData *fd; Main *mainvar; } data;
                data.fd = fd;
                data.mainvar = mainvar;
-               
+
                modifiers_foreachIDLink(ob, expand_object_expandModifiers, (void *)&data);
        }
-       
+
        expand_pose(fd, mainvar, ob->pose);
        expand_doit(fd, mainvar, ob->poselib);
        expand_constraints(fd, mainvar, &ob->constraints);
-       
+
        expand_doit(fd, mainvar, ob->gpd);
-       
+
 // XXX deprecated - old animation system (for version patching only)
        expand_doit(fd, mainvar, ob->ipo);
        expand_doit(fd, mainvar, ob->action);
-       
+
        expand_constraint_channels(fd, mainvar, &ob->constraintChannels);
-       
+
        for (strip=ob->nlastrips.first; strip; strip=strip->next) {
                expand_doit(fd, mainvar, strip->object);
                expand_doit(fd, mainvar, strip->act);
                expand_doit(fd, mainvar, strip->ipo);
        }
 // XXX deprecated - old animation system (for version patching only)
-       
+
        if (ob->adt)
                expand_animdata(fd, mainvar, ob->adt);
-       
+
        for (a = 0; a < ob->totcol; a++) {
                expand_doit(fd, mainvar, ob->mat[a]);
        }
-       
+
        paf = blo_do_version_give_parteff_245(ob);
-       if (paf && paf->group) 
+       if (paf && paf->group)
                expand_doit(fd, mainvar, paf->group);
-       
+
        if (ob->dup_group)
                expand_doit(fd, mainvar, ob->dup_group);
-       
+
        if (ob->proxy)
                expand_doit(fd, mainvar, ob->proxy);
        if (ob->proxy_group)
                expand_doit(fd, mainvar, ob->proxy_group);
-       
+
        for (psys = ob->particlesystem.first; psys; psys = psys->next)
                expand_doit(fd, mainvar, psys->part);
 
@@ -9568,14 +9568,14 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
                        expand_doit(fd, mainvar, ms->fromObject);
                }
        }
-       
+
        for (cont = ob->controllers.first; cont; cont = cont->next) {
                if (cont->type == CONT_PYTHON) {
                        bPythonCont *pc = cont->data;
                        expand_doit(fd, mainvar, pc->text);
                }
        }
-       
+
        for (act = ob->actuators.first; act; act = act->next) {
                if (act->type == ACT_SOUND) {
                        bSoundActuator *sa = act->data;
@@ -9639,7 +9639,7 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
                        expand_doit(fd, mainvar, sta->navmesh);
                }
        }
-       
+
        if (ob->pd) {
                expand_doit(fd, mainvar, ob->pd->tex);
                expand_doit(fd, mainvar, ob->pd->f_source);
@@ -9672,23 +9672,23 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
        SceneRenderLayer *srl;
        FreestyleModuleConfig *module;
        FreestyleLineSet *lineset;
-       
+
        for (base = sce->base.first; base; base = base->next) {
                expand_doit(fd, mainvar, base->object);
        }
        expand_doit(fd, mainvar, sce->camera);
        expand_doit(fd, mainvar, sce->world);
-       
+
        if (sce->adt)
                expand_animdata(fd, mainvar, sce->adt);
        expand_keyingsets(fd, mainvar, &sce->keyingsets);
-       
+
        if (sce->set)
                expand_doit(fd, mainvar, sce->set);
-       
+
        if (sce->nodetree)
                expand_nodetree(fd, mainvar, sce->nodetree);
-       
+
        for (srl = sce->r.layers.first; srl; srl = srl->next) {
                expand_doit(fd, mainvar, srl->mat_override);
                expand_doit(fd, mainvar, srl->light_override);
@@ -9702,16 +9702,16 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
                        expand_doit(fd, mainvar, lineset->linestyle);
                }
        }
-       
+
        if (sce->r.dometext)
                expand_doit(fd, mainvar, sce->gm.dome.warptext);
-       
+
        if (sce->gpd)
                expand_doit(fd, mainvar, sce->gpd);
-               
+
        if (sce->ed) {
                Sequence *seq;
-               
+
                SEQ_BEGIN (sce->ed, seq)
                {
                        expand_idprops(fd, mainvar, seq->prop);
@@ -9724,7 +9724,7 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
                }
                SEQ_END
        }
-       
+
        if (sce->rigidbody_world) {
                expand_doit(fd, mainvar, sce->rigidbody_world->group);
                expand_doit(fd, mainvar, sce->rigidbody_world->constraints);
@@ -9742,7 +9742,7 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
 static void expand_camera(FileData *fd, Main *mainvar, Camera *ca)
 {
        expand_doit(fd, mainvar, ca->ipo); // XXX deprecated - old animation system
-       
+
        if (ca->adt)
                expand_animdata(fd, mainvar, ca->adt);
 }
@@ -9864,10 +9864,10 @@ void BLO_expand_main(void *fdhandle, Main *mainvar)
        ID *id;
        int a;
        bool do_it = true;
-       
+
        while (do_it) {
                do_it = false;
-               
+
                a = set_listbasepointers(mainvar, lbarray);
                while (a--) {
                        id = lbarray[a]->first;
@@ -9957,10 +9957,10 @@ void BLO_expand_main(void *fdhandle, Main *mainvar)
                                        default:
                                                break;
                                        }
-                                       
+
                                        do_it = true;
                                        id->tag &= ~LIB_TAG_NEED_EXPAND;
-                                       
+
                                }
                                id = id->next;
                        }
@@ -9970,17 +9970,17 @@ void BLO_expand_main(void *fdhandle, Main *mainvar)
 
 
 /* ***************************** */
-       
+
 static bool object_in_any_scene(Main *mainvar, Object *ob)
 {
        Scene *sce;
-       
+
        for (sce = mainvar->scene.first; sce; sce = sce->id.next) {
                if (BKE_scene_base_find(sce, ob)) {
                        return true;
                }
        }
-       
+
        return false;
 }
 
@@ -10131,10 +10131,10 @@ static ID *link_named_part(
        else {
                id = NULL;
        }
-       
+
        /* if we found the id but the id is NULL, this is really bad */
        BLI_assert(!((bhead != NULL) && (id == NULL)));
-       
+
        return id;
 }
 
@@ -10175,7 +10175,7 @@ void BLO_library_link_copypaste(Main *mainl, BlendHandle *bh)
 {
        FileData *fd = (FileData *)(bh);
        BHead *bhead;
-       
+
        for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
                ID *id = NULL;
 
@@ -10307,23 +10307,23 @@ static Main *library_link_begin(Main *mainvar, FileData **fd, const char *filepa
        Main *mainl;
 
        (*fd)->mainlist = MEM_callocN(sizeof(ListBase), "FileData.mainlist");
-       
+
        /* clear for group instantiating tag */
        BKE_main_id_tag_listbase(&(mainvar->group), LIB_TAG_DOIT, false);
 
        /* make mains */
        blo_split_main((*fd)->mainlist, mainvar);
-       
+
        /* which one do we need? */
        mainl = blo_find_main(*fd, filepath, BKE_main_blendfile_path(mainvar));
-       
+
        /* needed for do_version */
        mainl->versionfile = (*fd)->fileversion;
        read_file_version(*fd, mainl);
 #ifdef USE_GHASH_BHEAD
        read_file_bhead_idname_map_create(*fd);
 #endif
-       
+
        return mainl;
 }
 
@@ -10473,11 +10473,11 @@ static int mainvar_id_tag_any_check(Main *mainvar, const short tag)
 {
        ListBase *lbarray[MAX_LIBARRAY];
        int a;
-       
+
        a = set_listbasepointers(mainvar, lbarray);
        while (a--) {
                ID *id;
-               
+
                for (id = lbarray[a]->first; id; id = id->next) {
                        if (id->tag & tag) {
                                return true;
@@ -10495,13 +10495,13 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
        GHash *loaded_ids = BLI_ghash_str_new(__func__);
        int a;
        bool do_it = true;
-       
+
        /* expander now is callback function */
        BLO_main_expander(expand_doit_library);
-       
+
        while (do_it) {
                do_it = false;
-               
+
                /* test 1: read libdata */
                mainptr= mainl->next;
                while (mainptr) {
@@ -10509,22 +10509,22 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
                                // printf("found LIB_TAG_READ %s (%s)\n", mainptr->curlib->id.name, mainptr->curlib->name);
 
                                FileData *fd = mainptr->curlib->filedata;
-                               
+
                                if (fd == NULL) {
-                                       
+
                                        /* printf and reports for now... its important users know this */
-                                       
+
                                        /* if packed file... */
                                        if (mainptr->curlib->packedfile) {
                                                PackedFile *pf = mainptr->curlib->packedfile;
-                                               
+
                                                blo_reportf_wrap(
                                                        basefd->reports, RPT_INFO, TIP_("Read packed library:  '%s', parent '%s'"),
                                                        mainptr->curlib->name,
                                                        library_parent_filepath(mainptr->curlib));
                                                fd = blo_openblendermemory(pf->data, pf->size, basefd->reports);
-                                               
-                                               
+
+
                                                /* needed for library_append and read_libraries */
                                                BLI_strncpy(fd->relabase, mainptr->curlib->filepath, sizeof(fd->relabase));
                                        }
@@ -10545,12 +10545,12 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
                                                        printf("        absolute lib: %s\n", mainptr->curlib->filepath