Fix for sounds with relative paths not being loaded correctly.
authorJoerg Mueller <nexyon@gmail.com>
Thu, 27 Aug 2009 09:52:41 +0000 (09:52 +0000)
committerJoerg Mueller <nexyon@gmail.com>
Thu, 27 Aug 2009 09:52:41 +0000 (09:52 +0000)
source/blender/blenloader/intern/readblenentry.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/readfile.h

index 1f276913ea81dd88cc109568ed785ce150c41339..ac561eb6186dea1ab1dc30d4d56c52065c9f6356 100644 (file)
@@ -331,11 +331,7 @@ BlendFileData *BLO_read_from_file(char *file, ReportList *reports)
        fd = blo_openblenderfile(file, reports);
        if (fd) {
                fd->reports= reports;
-               bfd= blo_read_file_internal(fd);
-               if (bfd) {
-                       bfd->type= BLENFILETYPE_BLEND;
-                       strncpy(bfd->main->name, file, sizeof(bfd->main->name)-1);
-               }
+               bfd= blo_read_file_internal(fd, file);
                blo_freefiledata(fd);                   
        }
 
@@ -350,11 +346,7 @@ BlendFileData *BLO_read_from_memory(void *mem, int memsize, ReportList *reports)
        fd = blo_openblendermemory(mem, memsize,  reports);
        if (fd) {
                fd->reports= reports;
-               bfd= blo_read_file_internal(fd);
-               if (bfd) {
-                       bfd->type= BLENFILETYPE_BLEND;
-                       strcpy(bfd->main->name, "");
-               }
+               bfd= blo_read_file_internal(fd, "");
                blo_freefiledata(fd);                   
        }
 
@@ -383,11 +375,7 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain, const char *filename, MemFil
                /* makes lookup of existing images in old main */
                blo_make_image_pointer_map(fd, oldmain);
                
-               bfd= blo_read_file_internal(fd);
-               if (bfd) {
-                       bfd->type= BLENFILETYPE_BLEND;
-                       strcpy(bfd->main->name, "");
-               }
+               bfd= blo_read_file_internal(fd, "");
                
                /* ensures relinked images are not freed */
                blo_end_image_pointer_map(fd, oldmain);
index 6771135a77242a423c3380ef6bf9395c569ecd56..5d61e3d305ec4750eb3b6a800d3249dff4c7f540 100644 (file)
@@ -9700,7 +9700,7 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
        return bhead;
 }
 
-BlendFileData *blo_read_file_internal(FileData *fd)
+BlendFileData *blo_read_file_internal(FileData *fd, char *file)
 {
        BHead *bhead= blo_firstbhead(fd);
        BlendFileData *bfd;
@@ -9711,6 +9711,9 @@ BlendFileData *blo_read_file_internal(FileData *fd)
 
        bfd->main->versionfile= fd->fileversion;
        
+       bfd->type= BLENFILETYPE_BLEND;
+       strncpy(bfd->main->name, file, sizeof(bfd->main->name)-1);
+
        while(bhead) {
                switch(bhead->code) {
                case DATA:
@@ -11131,7 +11134,7 @@ BlendFileData *blo_read_blendafterruntime(int file, char *name, int actualsize,
                return NULL;
 
        fd->reports= reports;
-       bfd= blo_read_file_internal(fd);
+       bfd= blo_read_file_internal(fd, "");
        blo_freefiledata(fd);
 
        return bfd;
index e39fefa82057e478e5b90775980b4eb2d7abce44..2a0b6c327d37fc32320a6ab224e65264939aeac3 100644 (file)
@@ -108,7 +108,7 @@ struct Main;
 void blo_join_main(ListBase *mainlist);
 void blo_split_main(ListBase *mainlist, struct Main *main);
 
-BlendFileData *blo_read_file_internal(FileData *fd);
+BlendFileData *blo_read_file_internal(FileData *fd, char *file);
 
 FileData *blo_openblenderfile(char *name, struct ReportList *reports);
 FileData *blo_openblendermemory(void *buffer, int buffersize, struct ReportList *reports);