BGE Python API

- initialize pythons sys.argv in the blenderplayer
- ignore all arguments after a single " - " in the blenderplayer (like in blender), so args can be passed to the game.
- add a utility function PyOrientationTo() - to take a Py euler, quat or 3x3 matrix and convert into a C++ MT_Matrix3x3.
- add utility function ConvertPythonToMesh to get a RAS_MeshObject from a KX_MeshProxy or a name.
- Added error prefix arguments to ConvertPythonToGameObject, ConvertPythonToMesh and PyOrientationTo so the error messages can include what function they came from.
- deprecated brick.getOwner() for the "owner" attribute.
This commit is contained in:
2009-04-20 09:13:59 +00:00
parent 9078ce5da2
commit dee32d0b3f
23 changed files with 215 additions and 171 deletions

View File

@@ -1357,14 +1357,17 @@ void setSandbox(TPythonSecurityLevel level)
/**
* Python is not initialised.
*/
PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecurityLevel level, Main *maggie)
PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecurityLevel level, Main *maggie, int argc, char** argv)
{
STR_String pname = progname;
Py_SetProgramName(pname.Ptr());
Py_NoSiteFlag=1;
Py_FrozenFlag=1;
Py_Initialize();
if(argv) /* browser plugins dont currently set this */
PySys_SetArgv(argc, argv);
//importBlenderModules()
setSandbox(level);