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
diff options
context:
space:
mode:
authorKen Hughes <khughes@pacific.edu>2005-12-01 08:30:15 +0300
committerKen Hughes <khughes@pacific.edu>2005-12-01 08:30:15 +0300
commit8a7242ff16286a5f2c1ef075c07d588aa59c7fd7 (patch)
tree9fb91f603ef5a894b703ccd5b3595a0b98c9ef7f /source/blender/python/api2_2x/Library.c
parent95e94b4630b1ac7ca4369db626bcfbc02964bf90 (diff)
-- Bugfix #3139: Blender.Library.Open() was changing current .blend
filename. We now save and restore file before opening library.
Diffstat (limited to 'source/blender/python/api2_2x/Library.c')
-rw-r--r--source/blender/python/api2_2x/Library.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/python/api2_2x/Library.c b/source/blender/python/api2_2x/Library.c
index 54f4676306b..a4b97bfeef6 100644
--- a/source/blender/python/api2_2x/Library.c
+++ b/source/blender/python/api2_2x/Library.c
@@ -39,6 +39,7 @@
#include "DNA_object_types.h"
#include "BKE_library.h" /* for all_local */
#include "BKE_font.h" /* for text_to_curve */
+#include "BKE_utildefines.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BLO_readfile.h"
@@ -137,6 +138,8 @@ struct PyMethodDef M_Library_methods[] = {
PyObject *M_Library_Open( PyObject * self, PyObject * args )
{
char *fname = NULL;
+ char filename[FILE_MAXDIR+FILE_MAXFILE];
+
int len = 0;
if( !PyArg_ParseTuple( args, "s", &fname ) ) {
@@ -149,7 +152,10 @@ PyObject *M_Library_Open( PyObject * self, PyObject * args )
Py_DECREF( Py_None ); /* incref'ed by above function */
}
+ /* G.sce = last file loaded, save for UI and restore after opening file */
+ BLI_strncpy(filename, G.sce, sizeof(filename));
bpy_openlib = BLO_blendhandle_from_file( fname );
+ BLI_strncpy(G.sce, filename, sizeof(filename));
if( !bpy_openlib )
return Py_BuildValue( "i", 0 );