diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2012-12-22 09:38:32 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2012-12-22 09:38:32 +0400 |
commit | 84966c3d0ae2d39fa4e691ed0131d8b94f8785e4 (patch) | |
tree | 96f1fbaac1e4b2f151c7726c90b8491a718666c1 /source/gameengine/Ketsji/KX_PythonInitTypes.cpp | |
parent | 8062bcd16f9e91d76dbd074f32b889ce2e0cba84 (diff) |
BGE: Committing async LibLoad from Swiss. This does the lib loading in a separate thread to keep the BGE from freezing. Here is an example from the docs:
# Print a message when an async LibLoad is done
import bge
def finished_cb(status):
print("Library (%s) loaded in %.2fms." % (status.libraryName, status.timeTaken))
bge.logic.LibLoad('myblend.blend', 'Scene', async=True).onFinish = finished_cb
LibLoad() now returns a KX_LibLoadStatus object for information on the library loading. LibNew() and LibFree() are unaffected by this commit. In other words, the async option only works for LibLoad(). Furthermore it only works for Scenes, not Actions or Meshes.
Diffstat (limited to 'source/gameengine/Ketsji/KX_PythonInitTypes.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_PythonInitTypes.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp index 10c210cf16e..c6aa436537a 100644 --- a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp +++ b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp @@ -47,6 +47,7 @@ #include "KX_ConstraintActuator.h" #include "KX_ConstraintWrapper.h" #include "KX_GameActuator.h" +#include "KX_LibLoadStatus.h" #include "KX_Light.h" #include "KX_FontObject.h" #include "KX_MeshProxy.h" @@ -199,6 +200,7 @@ void initPyTypes(void) PyType_Ready_Attr(dict, KX_GameActuator, init_getset); PyType_Ready_Attr(dict, KX_GameObject, init_getset); PyType_Ready_Attr(dict, KX_IpoActuator, init_getset); + PyType_Ready_Attr(dict, KX_LibLoadStatus, init_getset); PyType_Ready_Attr(dict, KX_LightObject, init_getset); PyType_Ready_Attr(dict, KX_FontObject, init_getset); PyType_Ready_Attr(dict, KX_MeshProxy, init_getset); |