From 12a0f2c0987688b2fcf8daf44d9462b524fe139a Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Thu, 27 Aug 2009 09:52:41 +0000 Subject: Fix for sounds with relative paths not being loaded correctly. --- source/blender/blenloader/intern/readblenentry.c | 18 +++--------------- source/blender/blenloader/intern/readfile.c | 7 +++++-- source/blender/blenloader/intern/readfile.h | 2 +- 3 files changed, 9 insertions(+), 18 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index 1f276913ea8..ac561eb6186 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -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); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 6771135a772..5d61e3d305e 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -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; diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h index e39fefa8205..2a0b6c327d3 100644 --- a/source/blender/blenloader/intern/readfile.h +++ b/source/blender/blenloader/intern/readfile.h @@ -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); -- cgit v1.2.3