diff options
author | Kester Maddock <Christopher.Maddock.1@uni.massey.ac.nz> | 2004-05-21 13:18:42 +0400 |
---|---|---|
committer | Kester Maddock <Christopher.Maddock.1@uni.massey.ac.nz> | 2004-05-21 13:18:42 +0400 |
commit | 1217928e662bd74980dc17c8d32797b0bc6f7002 (patch) | |
tree | 1d46e362c2e3e114ebc2f30f5a942646d0f3bfc4 /source/gameengine/Ketsji/KX_PythonInit.cpp | |
parent | 22883f9232da3df2bcba995bb0d84d4cf95803e8 (diff) |
Fixes for Camera objects and python:
Normalise clip planes for sphere testing.
Do a frustum-sphere <-> sphere test
Reference count all python objects (!)
Diffstat (limited to 'source/gameengine/Ketsji/KX_PythonInit.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_PythonInit.cpp | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index ee6a9f4a6cd..f4736f4c423 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -594,19 +594,40 @@ void setSandbox(TPythonSecurityLevel level) } } +/** + * Python is not initialised. + */ +PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecurityLevel level) +{ + STR_String pname = progname; + Py_SetProgramName(pname.Ptr()); + Py_NoSiteFlag=1; + Py_FrozenFlag=1; + Py_Initialize(); + //importBlenderModules() + + setSandbox(level); + PyObject* moduleobj = PyImport_AddModule("__main__"); + return PyModule_GetDict(moduleobj); +} + +void exitGamePlayerPythonScripting() +{ + Py_Finalize(); +} + +/** + * Python is already initialized. + */ PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLevel level) { STR_String pname = progname; Py_SetProgramName(pname.Ptr()); Py_NoSiteFlag=1; Py_FrozenFlag=1; -#ifndef USE_BLENDER_PYTHON - Py_Initialize(); -#else - BPY_start_python(); -#endif + setSandbox(level); PyObject* moduleobj = PyImport_AddModule("__main__"); @@ -617,11 +638,6 @@ PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLev void exitGamePythonScripting() { -#ifndef USE_BLENDER_PYTHON - Py_Finalize(); -#else - BPY_end_python(); -#endif } |