BGE Python API
Use each types dictionary to store attributes PyAttributeDef's so it uses pythons hash lookup (which it was already doing for methods) rather then doing a string lookup on the array each time. This also means attributes can be found in the type without having to do a dir() on the instance.
This commit is contained in:
@@ -462,18 +462,12 @@ PyAttributeDef SCA_ISensor::Attributes[] = {
|
||||
PyObject*
|
||||
SCA_ISensor::py_getattro(PyObject *attr)
|
||||
{
|
||||
PyObject* object = py_getattro_self(Attributes, this, attr);
|
||||
if (object != NULL)
|
||||
return object;
|
||||
py_getattro_up(SCA_ILogicBrick);
|
||||
}
|
||||
|
||||
int SCA_ISensor::py_setattro(PyObject *attr, PyObject *value)
|
||||
{
|
||||
int ret = py_setattro_self(Attributes, this, attr, value);
|
||||
if (ret >= 0)
|
||||
return ret;
|
||||
return SCA_ILogicBrick::py_setattro(attr, value);
|
||||
py_setattro_up(SCA_ILogicBrick);
|
||||
}
|
||||
|
||||
PyObject* SCA_ISensor::pyattr_get_triggered(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
||||
|
||||
Reference in New Issue
Block a user