From e5eea31629777dc0ca2fbd797ef1b5d6bf2fa5f0 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Tue, 4 Oct 2005 14:53:55 +0000 Subject: [PATCH] Thought I committed it before... this is the fix for Python API version of "library append", which keeps the current .blend file name. --- source/blender/blenloader/intern/readfile.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 3213ac6cc49..d294fac91dc 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -5749,10 +5749,16 @@ void BLO_script_library_append(BlendHandle *bh, char *dir, char *name, int idcod ListBase mainlist; Main *mainl; FileData *fd = (FileData *)bh; + char filename[FILE_MAXDIR+FILE_MAXFILE]; mainlist.first= mainlist.last= G.main; G.main->next= NULL; + /* make copy of the 'last loaded filename', we need to restore it */ + BLI_strncpy(filename, G.sce, sizeof(filename)); + /* already opened file, to reconstruct relative paths */ + BLI_strncpy(G.sce, fd->filename, sizeof(filename)); + /* make mains */ blo_split_main(&mainlist); @@ -5772,6 +5778,8 @@ void BLO_script_library_append(BlendHandle *bh, char *dir, char *name, int idcod lib_link_all(fd, G.main); + /* restore the 'last loaded filename' */ + BLI_strncpy(G.sce, filename, sizeof(filename)); DAG_scene_sort(G.scene); }