Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2005-10-04 18:53:55 +0400
committerTon Roosendaal <ton@blender.org>2005-10-04 18:53:55 +0400
commite5eea31629777dc0ca2fbd797ef1b5d6bf2fa5f0 (patch)
tree62228b2c06c406e4e760020ce3bbe6840bca3787 /source
parent583ebd75be3773d0c1132a87ef131d4a977e3dc9 (diff)
Thought I committed it before... this is the fix for Python API version
of "library append", which keeps the current .blend file name.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenloader/intern/readfile.c8
1 files changed, 8 insertions, 0 deletions
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);
}