[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20394] trunk/blender/source/gameengine/ Ketsji/KX_PythonInit.cpp: [#18819] save and load globalDictionary actuators don't load the proper files in 2. 49 RC3
Campbell Barton
ideasman42 at gmail.com
Mon May 25 04:39:08 CEST 2009
Revision: 20394
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20394
Author: campbellbarton
Date: 2009-05-25 04:39:05 +0200 (Mon, 25 May 2009)
Log Message:
-----------
[#18819] save and load globalDictionary actuators don't load the proper files in 2.49 RC3
For this actuator to be useful it needs to use the first opened blendfile as the base name for the configuration file.
A recent fix that made the gp_GamePythonPath always match the current loaded blend file made this actuator work differently.
keep the original filename to use for making the config name so you can load the config between loading blendfiles.
Modified Paths:
--------------
trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp
Modified: trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp 2009-05-25 02:11:18 UTC (rev 20393)
+++ trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp 2009-05-25 02:39:05 UTC (rev 20394)
@@ -120,6 +120,7 @@
static KX_KetsjiEngine* gp_KetsjiEngine = NULL;
static RAS_IRasterizer* gp_Rasterizer = NULL;
static char gp_GamePythonPath[FILE_MAXDIR + FILE_MAXFILE] = "";
+static char gp_GamePythonPathOrig[FILE_MAXDIR + FILE_MAXFILE] = ""; // not super happy about this, but we need to remember the first loaded file for the global/dict load save
static PyObject *gp_OrigPythonSysPath= NULL;
void KX_RasterizerDrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,const MT_Vector3& color)
@@ -2096,9 +2097,9 @@
void pathGamePythonConfig( char *path )
{
- int len = strlen(gp_GamePythonPath);
+ int len = strlen(gp_GamePythonPathOrig); // Always use the first loaded blend filename
- BLI_strncpy(path, gp_GamePythonPath, sizeof(gp_GamePythonPath));
+ BLI_strncpy(path, gp_GamePythonPathOrig, sizeof(gp_GamePythonPathOrig));
/* replace extension */
if (BLI_testextensie(path, ".blend")) {
@@ -2111,5 +2112,8 @@
void setGamePythonPath(char *path)
{
BLI_strncpy(gp_GamePythonPath, path, sizeof(gp_GamePythonPath));
+
+ if (gp_GamePythonPathOrig[0] == '\0')
+ BLI_strncpy(gp_GamePythonPathOrig, path, sizeof(gp_GamePythonPathOrig));
}
More information about the Bf-blender-cvs
mailing list