BGE Python API

Use 'const char *' rather then the C++ 'STR_String' type for the attribute identifier of python attributes.

Each attribute and method access from python was allocating and freeing the string.
A simple test with getting an attribute a loop shows this speeds up attribute lookups a bit over 2x.
This commit is contained in:
Campbell Barton
2009-02-19 13:42:07 +00:00
parent c597863783
commit cdec2b3d15
127 changed files with 392 additions and 403 deletions

View File

@@ -76,8 +76,8 @@ class SCA_PythonController : public SCA_IController
static const char* sPyAddActiveActuator__doc__;
static PyObject* sPyAddActiveActuator(PyObject* self,
PyObject* args);
virtual PyObject* _getattr(const STR_String& attr);
virtual int _setattr(const STR_String& attr, PyObject *value);
virtual PyObject* _getattr(const char *attr);
virtual int _setattr(const char *attr, PyObject *value);
KX_PYMETHOD_DOC_NOARGS(SCA_PythonController,GetSensors);
KX_PYMETHOD_DOC_NOARGS(SCA_PythonController,GetActuators);