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:
authorBenoit Bolsee <benoit.bolsee@online.be>2014-08-23 14:31:32 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2014-08-23 14:31:32 +0400
commitfb49c5aa5662da3c2434c75ea6283408c01d6c23 (patch)
tree9be1358b54142ff50fe884fb4b9fc4b1b4b76e43 /source/gameengine/Ketsji/KX_Scene.cpp
parenta0600debda8cd9ec93cd8e10f5d7ecd5be9a1a9a (diff)
BGE: fix crash and return boolean on scene.replace()
Scene replacement with invalid scene name was crashing blender, now it's a no-op. KS_Scene.replace() to return a boolean to indicate if the scene is valid and is scheduled for replacement. This allows more robust game management.
Diffstat (limited to 'source/gameengine/Ketsji/KX_Scene.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_Scene.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index 5745e3adbc5..625bbee2c8e 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -2501,16 +2501,18 @@ KX_PYMETHODDEF_DOC(KX_Scene, restart,
KX_PYMETHODDEF_DOC(KX_Scene, replace,
"replace(newScene)\n"
- "Replaces this scene with another one.\n")
+ "Replaces this scene with another one.\n"
+ "Return True if the new scene exists and scheduled for replacement, False otherwise.\n")
{
char* name;
if (!PyArg_ParseTuple(args, "s:replace", &name))
return NULL;
- KX_GetActiveEngine()->ReplaceScene(m_sceneName, name);
+ if (KX_GetActiveEngine()->ReplaceScene(m_sceneName, name))
+ Py_RETURN_TRUE;
- Py_RETURN_NONE;
+ Py_RETURN_FALSE;
}
KX_PYMETHODDEF_DOC(KX_Scene, suspend,