From 5d64dd019e7e8150db40505097d1b4048f4e0153 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 7 Apr 2009 11:06:35 +0000 Subject: 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. --- source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp | 8 +------- source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp | 6 ------ 2 files changed, 1 insertion(+), 13 deletions(-) (limited to 'source/gameengine/Ketsji/KXNetwork') diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp index a5fd8ebab6b..72edde6ef24 100644 --- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp +++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp @@ -154,17 +154,11 @@ PyAttributeDef KX_NetworkMessageActuator::Attributes[] = { }; PyObject* KX_NetworkMessageActuator::py_getattro(PyObject *attr) { - PyObject* object = py_getattro_self(Attributes, this, attr); - if (object != NULL) - return object; py_getattro_up(SCA_IActuator); } int KX_NetworkMessageActuator::py_setattro(PyObject *attr, PyObject *value) { - int ret = py_setattro_self(Attributes, this, attr, value); - if (ret >= 0) - return ret; - return SCA_IActuator::py_setattro(attr, value); + py_setattro_up(SCA_IActuator); } // Deprecated -----> diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp index 7922c341659..65600856377 100644 --- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp +++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp @@ -224,16 +224,10 @@ PyAttributeDef KX_NetworkMessageSensor::Attributes[] = { }; PyObject* KX_NetworkMessageSensor::py_getattro(PyObject *attr) { - PyObject* object = py_getattro_self(Attributes, this, attr); - if (object != NULL) - return object; py_getattro_up(SCA_ISensor); } int KX_NetworkMessageSensor::py_setattro(PyObject *attr, PyObject *value) { - int ret = py_setattro_self(Attributes, this, attr, value); - if (ret >= 0) - return ret; return SCA_ISensor::py_setattro(attr, value); } -- cgit v1.2.3