diff options
author | Ton Roosendaal <ton@blender.org> | 2005-06-02 21:38:42 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2005-06-02 21:38:42 +0400 |
commit | 7654d1a711d4802c53267c00f9432be902010871 (patch) | |
tree | 87f543eb067c848bff7c34ba54f4a2129dd8bd51 /source/blender/blenloader/intern | |
parent | 01d0b5eba83b938edc4b8af0af1ebd7cf3c78a2e (diff) |
Fix for #2657
Appending from files also set the string for "last loaded file". That's
a real bad one... so you can save over accidentally libraries.
Another fix: appending from files that have dynamic other files linked
with relative paths didn't work. (Yah, now it should all work!)
renderconverter change is just a more clear comment.
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 16 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.h | 4 |
2 files changed, 16 insertions, 4 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 8602092405f..5f0d684695d 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -871,6 +871,7 @@ FileData *blo_openblenderfile(char *name) } else { FileData *fd = filedata_new(); fd->filedes = file; + BLI_strncpy(fd->filename, name, sizeof(fd->filename)); // now only in use by library append fd->buffersize = BLI_filesize(file); fd->read = fd_read_from_file; @@ -5506,10 +5507,11 @@ void BLO_library_append(SpaceFile *sfile, char *dir, int idcode) { FileData *fd= (FileData*) sfile->libfiledata; Main *mainl; - int a, totsel=0,count=0; - float *curs,centerloc[3],vec[3],min[3],max[3]; Base *centerbase; Object *ob; + float *curs,centerloc[3],vec[3],min[3],max[3]; + int a, totsel=0,count=0; + char filename[FILE_MAXDIR+FILE_MAXFILE]; INIT_MINMAX(min, max); @@ -5538,6 +5540,11 @@ void BLO_library_append(SpaceFile *sfile, char *dir, int idcode) } /* now we have or selected, or an indicated file */ + /* make copy of the 'last loaded filename', we need to restore it */ + BLI_strncpy(filename, G.sce, sizeof(filename)); + BLI_strncpy(G.sce, fd->filename, sizeof(filename)); // already opened file, to reconstruct relative paths + + if(sfile->flag & FILE_AUTOSELECT) scene_deselect_all(G.scene); fd->mainlist.first= fd->mainlist.last= G.main; @@ -5614,8 +5621,11 @@ void BLO_library_append(SpaceFile *sfile, char *dir, int idcode) centerbase= centerbase->next; } } - } + + /* restore the 'last loaded filename' */ + BLI_strncpy(G.sce, filename, sizeof(filename)); + } /* ************* READ LIBRARY ************** */ diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h index e198752f130..19534095f98 100644 --- a/source/blender/blenloader/intern/readfile.h +++ b/source/blender/blenloader/intern/readfile.h @@ -52,7 +52,9 @@ typedef struct FileData { // variables needed for reading from file int filedes; - + // now only in use for library appending + char filename[FILE_MAXDIR+FILE_MAXFILE]; + // variables needed for reading from stream char headerdone; int inbuffer; |