Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-04-07 15:06:35 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-04-07 15:06:35 +0400
commit5d64dd019e7e8150db40505097d1b4048f4e0153 (patch)
tree65d3ac2f7d7d8a9e3aad5ba5331c43a5d1fca358 /source/gameengine/Ketsji
parentc054ea02039e9209095108c1b1f42250a7e85d8f (diff)
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.
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r--source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp8
-rw-r--r--source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_CDActuator.cpp8
-rw-r--r--source/gameengine/Ketsji/KX_Camera.cpp10
-rw-r--r--source/gameengine/Ketsji/KX_CameraActuator.cpp9
-rw-r--r--source/gameengine/Ketsji/KX_GameActuator.cpp8
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp10
-rw-r--r--source/gameengine/Ketsji/KX_IpoActuator.cpp10
-rw-r--r--source/gameengine/Ketsji/KX_MeshProxy.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_NearSensor.cpp10
-rw-r--r--source/gameengine/Ketsji/KX_ParentActuator.cpp10
-rw-r--r--source/gameengine/Ketsji/KX_PolygonMaterial.cpp12
-rw-r--r--source/gameengine/Ketsji/KX_PythonInitTypes.cpp139
-rw-r--r--source/gameengine/Ketsji/KX_RadarSensor.cpp10
-rw-r--r--source/gameengine/Ketsji/KX_RaySensor.cpp10
-rw-r--r--source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp8
-rw-r--r--source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp8
-rw-r--r--source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp8
-rw-r--r--source/gameengine/Ketsji/KX_Scene.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_SceneActuator.cpp8
-rw-r--r--source/gameengine/Ketsji/KX_TouchSensor.cpp11
-rw-r--r--source/gameengine/Ketsji/KX_TrackToActuator.cpp8
-rw-r--r--source/gameengine/Ketsji/KX_VisibilityActuator.cpp8
23 files changed, 99 insertions, 230 deletions
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);
}
diff --git a/source/gameengine/Ketsji/KX_CDActuator.cpp b/source/gameengine/Ketsji/KX_CDActuator.cpp
index 57c9d30e92e..8e889fb4129 100644
--- a/source/gameengine/Ketsji/KX_CDActuator.cpp
+++ b/source/gameengine/Ketsji/KX_CDActuator.cpp
@@ -217,18 +217,12 @@ int KX_CDActuator::pyattr_setGain(void *self, const struct KX_PYATTRIBUTE_DEF *a
PyObject* KX_CDActuator::py_getattro(PyObject *attr)
{
- PyObject* object = py_getattro_self(Attributes, this, attr);
- if (object != NULL)
- return object;
py_getattro_up(SCA_IActuator);
}
int KX_CDActuator::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);
}
diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp
index 1540db5c44f..339abb73531 100644
--- a/source/gameengine/Ketsji/KX_Camera.cpp
+++ b/source/gameengine/Ketsji/KX_Camera.cpp
@@ -534,20 +534,12 @@ PyParentObject KX_Camera::Parents[] = {
PyObject* KX_Camera::py_getattro(PyObject *attr)
{
- PyObject* object = py_getattro_self(Attributes, this, attr);
- if (object != NULL)
- return object;
-
py_getattro_up(KX_GameObject);
}
int KX_Camera::py_setattro(PyObject *attr, PyObject *value)
{
- int ret = py_setattro_self(Attributes, this, attr, value);
- if (ret >= 0)
- return ret;
-
- return KX_GameObject::py_setattro(attr, value);
+ py_setattro_up(KX_GameObject);
}
KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, sphereInsideFrustum,
diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp
index 526c2dc404b..4db24a6e365 100644
--- a/source/gameengine/Ketsji/KX_CameraActuator.cpp
+++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp
@@ -422,18 +422,11 @@ PyAttributeDef KX_CameraActuator::Attributes[] = {
};
PyObject* KX_CameraActuator::py_getattro(PyObject *attr) {
- PyObject* object = py_getattro_self(Attributes, this, attr);
- if (object != NULL)
- return object;
py_getattro_up(SCA_IActuator);
}
int KX_CameraActuator::py_setattro(PyObject *attr, PyObject* value) {
- int ret;
- 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);
}
/* get obj ---------------------------------------------------------- */
diff --git a/source/gameengine/Ketsji/KX_GameActuator.cpp b/source/gameengine/Ketsji/KX_GameActuator.cpp
index a2a3d486420..c9060486d44 100644
--- a/source/gameengine/Ketsji/KX_GameActuator.cpp
+++ b/source/gameengine/Ketsji/KX_GameActuator.cpp
@@ -256,18 +256,12 @@ PyAttributeDef KX_GameActuator::Attributes[] = {
PyObject*
KX_GameActuator::py_getattro(PyObject *attr)
{
- PyObject* object = py_getattro_self(Attributes, this, attr);
- if (object != NULL)
- return object;
py_getattro_up(SCA_IActuator);
}
int KX_GameActuator::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);
}
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index a788b12b121..af905114ee4 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -1511,20 +1511,12 @@ PyObject* KX_GameObject::pyattr_get_dir_dict(void *self_v, const KX_PYATTRIBUTE_
PyObject* KX_GameObject::py_getattro(PyObject *attr)
{
- PyObject* object = py_getattro_self(Attributes, this, attr);
- if (object != NULL)
- return object;
-
py_getattro_up(SCA_IObject);
}
int KX_GameObject::py_setattro(PyObject *attr, PyObject *value) // py_setattro method
{
- int ret = py_setattro_self(Attributes, this, attr, value);
- if (ret >= 0)
- return ret;
-
- return SCA_IObject::py_setattro(attr, value);
+ py_setattro_up(SCA_IObject);
}
PyObject* KX_GameObject::PyApplyForce(PyObject* self, PyObject* args)
diff --git a/source/gameengine/Ketsji/KX_IpoActuator.cpp b/source/gameengine/Ketsji/KX_IpoActuator.cpp
index adb9c284828..1dc5471e77a 100644
--- a/source/gameengine/Ketsji/KX_IpoActuator.cpp
+++ b/source/gameengine/Ketsji/KX_IpoActuator.cpp
@@ -474,20 +474,12 @@ PyAttributeDef KX_IpoActuator::Attributes[] = {
};
PyObject* KX_IpoActuator::py_getattro(PyObject *attr) {
- PyObject* object = py_getattro_self(Attributes, this, attr);
- if (object != NULL)
- return object;
-
py_getattro_up(SCA_IActuator);
}
int KX_IpoActuator::py_setattro(PyObject *attr, PyObject *value) // py_setattro method
{
- 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);
}
/* set --------------------------------------------------------------------- */
diff --git a/source/gameengine/Ketsji/KX_MeshProxy.cpp b/source/gameengine/Ketsji/KX_MeshProxy.cpp
index d9b1cc6df23..7b58c8b288a 100644
--- a/source/gameengine/Ketsji/KX_MeshProxy.cpp
+++ b/source/gameengine/Ketsji/KX_MeshProxy.cpp
@@ -99,10 +99,6 @@ void KX_MeshProxy::SetMeshModified(bool v)
PyObject* KX_MeshProxy::py_getattro(PyObject *attr)
{
- PyObject* object = py_getattro_self(Attributes, this, attr);
- if (object != NULL)
- return object;
-
py_getattro_up(SCA_IObject);
}
diff --git a/source/gameengine/Ketsji/KX_NearSensor.cpp b/source/gameengine/Ketsji/KX_NearSensor.cpp
index 2debfd793c1..cd753210184 100644
--- a/source/gameengine/Ketsji/KX_NearSensor.cpp
+++ b/source/gameengine/Ketsji/KX_NearSensor.cpp
@@ -332,18 +332,10 @@ PyAttributeDef KX_NearSensor::Attributes[] = {
PyObject* KX_NearSensor::py_getattro(PyObject *attr)
{
- PyObject* object = py_getattro_self(Attributes, this, attr);
- if (object != NULL)
- return object;
-
py_getattro_up(KX_TouchSensor);
}
int KX_NearSensor::py_setattro(PyObject*attr, PyObject* value)
{
- int ret = py_setattro_self(Attributes, this, attr, value);
- if (ret >= 0)
- return ret;
-
- return KX_TouchSensor::py_setattro(attr, value);
+ py_setattro_up(KX_TouchSensor);
}
diff --git a/source/gameengine/Ketsji/KX_ParentActuator.cpp b/source/gameengine/Ketsji/KX_ParentActuator.cpp
index 1baf581f8a0..32c279b2be1 100644
--- a/source/gameengine/Ketsji/KX_ParentActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ParentActuator.cpp
@@ -208,19 +208,11 @@ int KX_ParentActuator::pyattr_set_object(void *self, const struct KX_PYATTRIBUTE
PyObject* KX_ParentActuator::py_getattro(PyObject *attr) {
-
- PyObject* object = py_getattro_self(Attributes, this, attr);
- if (object != NULL)
- return object;
py_getattro_up(SCA_IActuator);
}
int KX_ParentActuator::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/KX_PolygonMaterial.cpp b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
index 3975189a9c2..e66d9d60db8 100644
--- a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
@@ -232,21 +232,13 @@ PyParentObject KX_PolygonMaterial::Parents[] = {
};
PyObject* KX_PolygonMaterial::py_getattro(PyObject *attr)
-{
- PyObject* object = py_getattro_self(Attributes, this, attr);
- if (object != NULL)
- return object;
-
+{
py_getattro_up(PyObjectPlus);
}
int KX_PolygonMaterial::py_setattro(PyObject *attr, PyObject *value)
{
- int ret = py_setattro_self(Attributes, this, attr, value);
- if (ret >= 0)
- return ret;
-
- return PyObjectPlus::py_setattro(attr, value);
+ py_setattro_up(PyObjectPlus);
}
KX_PYMETHODDEF_DOC(KX_PolygonMaterial, setCustomMaterial, "setCustomMaterial(material)")
diff --git a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
index 676033cb898..636814b9009 100644
--- a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
@@ -129,13 +129,26 @@ void initPyObjectPlusType(PyTypeObject **parents)
-static void PyType_Ready_ADD(PyObject *dict, PyTypeObject * tp)
+static void PyType_Ready_ADD(PyObject *dict, PyTypeObject *tp, PyAttributeDef *attributes)
{
+ PyAttributeDef *attr;
+ PyObject *item;
+
PyType_Ready(tp);
PyDict_SetItemString(dict, tp->tp_name, (PyObject *)tp);
+
+ /* store attr defs in the tp_dict for to avoid string lookups */
+ for(attr= attributes; attr->m_name; attr++) {
+ item= PyCObject_FromVoidPtr(attr, NULL);
+ PyDict_SetItemString(tp->tp_dict, attr->m_name, item);
+ Py_DECREF(item);
+ }
+
}
+#define PyType_Ready_Attr(d, n) PyType_Ready_ADD(d, &n::Type, n::Attributes)
+
void initPyTypes(void)
{
@@ -150,68 +163,68 @@ void initPyTypes(void)
PyDict_SetItemString(PySys_GetObject("modules"), "GameTypes", mod);
Py_DECREF(mod);
- PyType_Ready_ADD(dict, &BL_ActionActuator::Type);
- PyType_Ready_ADD(dict, &BL_Shader::Type);
- PyType_Ready_ADD(dict, &BL_ShapeActionActuator::Type);
- PyType_Ready_ADD(dict, &CListValue::Type);
- PyType_Ready_ADD(dict, &CValue::Type);
- PyType_Ready_ADD(dict, &KX_BlenderMaterial::Type);
- PyType_Ready_ADD(dict, &KX_CDActuator::Type);
- PyType_Ready_ADD(dict, &KX_Camera::Type);
- PyType_Ready_ADD(dict, &KX_CameraActuator::Type);
- PyType_Ready_ADD(dict, &KX_ConstraintActuator::Type);
- PyType_Ready_ADD(dict, &KX_ConstraintWrapper::Type);
- PyType_Ready_ADD(dict, &KX_GameActuator::Type);
- PyType_Ready_ADD(dict, &KX_GameObject::Type);
- PyType_Ready_ADD(dict, &KX_IpoActuator::Type);
- PyType_Ready_ADD(dict, &KX_LightObject::Type);
- PyType_Ready_ADD(dict, &KX_MeshProxy::Type);
- PyType_Ready_ADD(dict, &KX_MouseFocusSensor::Type);
- PyType_Ready_ADD(dict, &KX_NearSensor::Type);
- PyType_Ready_ADD(dict, &KX_NetworkMessageActuator::Type);
- PyType_Ready_ADD(dict, &KX_NetworkMessageSensor::Type);
- PyType_Ready_ADD(dict, &KX_ObjectActuator::Type);
- PyType_Ready_ADD(dict, &KX_ParentActuator::Type);
- PyType_Ready_ADD(dict, &KX_PhysicsObjectWrapper::Type);
- PyType_Ready_ADD(dict, &KX_PolyProxy::Type);
- PyType_Ready_ADD(dict, &KX_PolygonMaterial::Type);
- PyType_Ready_ADD(dict, &KX_RadarSensor::Type);
- PyType_Ready_ADD(dict, &KX_RaySensor::Type);
- PyType_Ready_ADD(dict, &KX_SCA_AddObjectActuator::Type);
- PyType_Ready_ADD(dict, &KX_SCA_DynamicActuator::Type);
- PyType_Ready_ADD(dict, &KX_SCA_EndObjectActuator::Type);
- PyType_Ready_ADD(dict, &KX_SCA_ReplaceMeshActuator::Type);
- PyType_Ready_ADD(dict, &KX_Scene::Type);
- PyType_Ready_ADD(dict, &KX_SceneActuator::Type);
- PyType_Ready_ADD(dict, &KX_SoundActuator::Type);
- PyType_Ready_ADD(dict, &KX_StateActuator::Type);
- PyType_Ready_ADD(dict, &KX_TouchSensor::Type);
- PyType_Ready_ADD(dict, &KX_TrackToActuator::Type);
- PyType_Ready_ADD(dict, &KX_VehicleWrapper::Type);
- PyType_Ready_ADD(dict, &KX_VertexProxy::Type);
- PyType_Ready_ADD(dict, &KX_VisibilityActuator::Type);
- PyType_Ready_ADD(dict, &PyObjectPlus::Type);
- PyType_Ready_ADD(dict, &SCA_2DFilterActuator::Type);
- PyType_Ready_ADD(dict, &SCA_ANDController::Type);
- PyType_Ready_ADD(dict, &SCA_ActuatorSensor::Type);
- PyType_Ready_ADD(dict, &SCA_AlwaysSensor::Type);
- PyType_Ready_ADD(dict, &SCA_DelaySensor::Type);
- PyType_Ready_ADD(dict, &SCA_ILogicBrick::Type);
- PyType_Ready_ADD(dict, &SCA_IObject::Type);
- PyType_Ready_ADD(dict, &SCA_ISensor::Type);
- PyType_Ready_ADD(dict, &SCA_JoystickSensor::Type);
- PyType_Ready_ADD(dict, &SCA_KeyboardSensor::Type);
- PyType_Ready_ADD(dict, &SCA_MouseSensor::Type);
- PyType_Ready_ADD(dict, &SCA_NANDController::Type);
- PyType_Ready_ADD(dict, &SCA_NORController::Type);
- PyType_Ready_ADD(dict, &SCA_ORController::Type);
- PyType_Ready_ADD(dict, &SCA_PropertyActuator::Type);
- PyType_Ready_ADD(dict, &SCA_PropertySensor::Type);
- PyType_Ready_ADD(dict, &SCA_PythonController::Type);
- PyType_Ready_ADD(dict, &SCA_RandomActuator::Type);
- PyType_Ready_ADD(dict, &SCA_RandomSensor::Type);
- PyType_Ready_ADD(dict, &SCA_XNORController::Type);
- PyType_Ready_ADD(dict, &SCA_XORController::Type);
+ PyType_Ready_Attr(dict, BL_ActionActuator);
+ PyType_Ready_Attr(dict, BL_Shader);
+ PyType_Ready_Attr(dict, BL_ShapeActionActuator);
+ PyType_Ready_Attr(dict, CListValue);
+ PyType_Ready_Attr(dict, CValue);
+ PyType_Ready_Attr(dict, KX_BlenderMaterial);
+ PyType_Ready_Attr(dict, KX_CDActuator);
+ PyType_Ready_Attr(dict, KX_Camera);
+ PyType_Ready_Attr(dict, KX_CameraActuator);
+ PyType_Ready_Attr(dict, KX_ConstraintActuator);
+ PyType_Ready_Attr(dict, KX_ConstraintWrapper);
+ PyType_Ready_Attr(dict, KX_GameActuator);
+ PyType_Ready_Attr(dict, KX_GameObject);
+ PyType_Ready_Attr(dict, KX_IpoActuator);
+ PyType_Ready_Attr(dict, KX_LightObject);
+ PyType_Ready_Attr(dict, KX_MeshProxy);
+ PyType_Ready_Attr(dict, KX_MouseFocusSensor);
+ PyType_Ready_Attr(dict, KX_NearSensor);
+ PyType_Ready_Attr(dict, KX_NetworkMessageActuator);
+ PyType_Ready_Attr(dict, KX_NetworkMessageSensor);
+ PyType_Ready_Attr(dict, KX_ObjectActuator);
+ PyType_Ready_Attr(dict, KX_ParentActuator);
+ PyType_Ready_Attr(dict, KX_PhysicsObjectWrapper);
+ PyType_Ready_Attr(dict, KX_PolyProxy);
+ PyType_Ready_Attr(dict, KX_PolygonMaterial);
+ PyType_Ready_Attr(dict, KX_RadarSensor);
+ PyType_Ready_Attr(dict, KX_RaySensor);
+ PyType_Ready_Attr(dict, KX_SCA_AddObjectActuator);
+ PyType_Ready_Attr(dict, KX_SCA_DynamicActuator);
+ PyType_Ready_Attr(dict, KX_SCA_EndObjectActuator);
+ PyType_Ready_Attr(dict, KX_SCA_ReplaceMeshActuator);
+ PyType_Ready_Attr(dict, KX_Scene);
+ PyType_Ready_Attr(dict, KX_SceneActuator);
+ PyType_Ready_Attr(dict, KX_SoundActuator);
+ PyType_Ready_Attr(dict, KX_StateActuator);
+ PyType_Ready_Attr(dict, KX_TouchSensor);
+ PyType_Ready_Attr(dict, KX_TrackToActuator);
+ PyType_Ready_Attr(dict, KX_VehicleWrapper);
+ PyType_Ready_Attr(dict, KX_VertexProxy);
+ PyType_Ready_Attr(dict, KX_VisibilityActuator);
+ PyType_Ready_Attr(dict, PyObjectPlus);
+ PyType_Ready_Attr(dict, SCA_2DFilterActuator);
+ PyType_Ready_Attr(dict, SCA_ANDController);
+ PyType_Ready_Attr(dict, SCA_ActuatorSensor);
+ PyType_Ready_Attr(dict, SCA_AlwaysSensor);
+ PyType_Ready_Attr(dict, SCA_DelaySensor);
+ PyType_Ready_Attr(dict, SCA_ILogicBrick);
+ PyType_Ready_Attr(dict, SCA_IObject);
+ PyType_Ready_Attr(dict, SCA_ISensor);
+ PyType_Ready_Attr(dict, SCA_JoystickSensor);
+ PyType_Ready_Attr(dict, SCA_KeyboardSensor);
+ PyType_Ready_Attr(dict, SCA_MouseSensor);
+ PyType_Ready_Attr(dict, SCA_NANDController);
+ PyType_Ready_Attr(dict, SCA_NORController);
+ PyType_Ready_Attr(dict, SCA_ORController);
+ PyType_Ready_Attr(dict, SCA_PropertyActuator);
+ PyType_Ready_Attr(dict, SCA_PropertySensor);
+ PyType_Ready_Attr(dict, SCA_PythonController);
+ PyType_Ready_Attr(dict, SCA_RandomActuator);
+ PyType_Ready_Attr(dict, SCA_RandomSensor);
+ PyType_Ready_Attr(dict, SCA_XNORController);
+ PyType_Ready_Attr(dict, SCA_XORController);
diff --git a/source/gameengine/Ketsji/KX_RadarSensor.cpp b/source/gameengine/Ketsji/KX_RadarSensor.cpp
index 77cde79b54d..355ac89a926 100644
--- a/source/gameengine/Ketsji/KX_RadarSensor.cpp
+++ b/source/gameengine/Ketsji/KX_RadarSensor.cpp
@@ -300,18 +300,10 @@ PyAttributeDef KX_RadarSensor::Attributes[] = {
PyObject* KX_RadarSensor::py_getattro(PyObject *attr)
{
- PyObject* object = py_getattro_self(Attributes, this, attr);
- if (object != NULL)
- return object;
-
py_getattro_up(KX_NearSensor);
}
int KX_RadarSensor::py_setattro(PyObject *attr, PyObject* value)
{
- int ret = py_setattro_self(Attributes, this, attr, value);
- if (ret >= 0)
- return ret;
-
- return KX_NearSensor::py_setattro(attr, value);
+ py_setattro_up(KX_NearSensor);
}
diff --git a/source/gameengine/Ketsji/KX_RaySensor.cpp b/source/gameengine/Ketsji/KX_RaySensor.cpp
index cdcb5d74f30..42e2fdc3e14 100644
--- a/source/gameengine/Ketsji/KX_RaySensor.cpp
+++ b/source/gameengine/Ketsji/KX_RaySensor.cpp
@@ -446,17 +446,11 @@ PyObject* KX_RaySensor::PyGetHitNormal(PyObject* self)
PyObject* KX_RaySensor::py_getattro(PyObject *attr) {
- PyObject* object = py_getattro_self(Attributes, this, attr);
- if (object != NULL)
- return object;
py_getattro_up(SCA_ISensor);
}
int KX_RaySensor::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);
+ py_setattro_up(SCA_ISensor);
}
-// <----- Deprecated \ No newline at end of file
+// <----- Deprecated
diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
index 1dd642e0966..a59d8417f26 100644
--- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
@@ -257,18 +257,12 @@ PyObject* KX_SCA_AddObjectActuator::pyattr_get_objectLastCreated(void *self, con
PyObject* KX_SCA_AddObjectActuator::py_getattro(PyObject *attr)
{
- PyObject* object = py_getattro_self(Attributes, this, attr);
- if (object != NULL)
- return object;
py_getattro_up(SCA_IActuator);
}
int KX_SCA_AddObjectActuator::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);
}
/* 1. setObject */
diff --git a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
index ae21209fc4e..aaa87e407ba 100644
--- a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
@@ -94,18 +94,12 @@ PyAttributeDef KX_SCA_DynamicActuator::Attributes[] = {
PyObject* KX_SCA_DynamicActuator::py_getattro(PyObject *attr)
{
- PyObject* object = py_getattro_self(Attributes, this, attr);
- if (object != NULL)
- return object;
py_getattro_up(SCA_IActuator);
}
int KX_SCA_DynamicActuator::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);
}
diff --git a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
index 0cac07b4585..9097ca6c85e 100644
--- a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
@@ -96,18 +96,12 @@ PyAttributeDef KX_SCA_ReplaceMeshActuator::Attributes[] = {
PyObject* KX_SCA_ReplaceMeshActuator::py_getattro(PyObject *attr)
{
- PyObject* object = py_getattro_self(Attributes, this, attr);
- if (object != NULL)
- return object;
py_getattro_up(SCA_IActuator);
}
int KX_SCA_ReplaceMeshActuator::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);
}
PyObject* KX_SCA_ReplaceMeshActuator::pyattr_get_mesh(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index 72f2fd9827f..493df31d982 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -1594,11 +1594,7 @@ PyAttributeDef KX_Scene::Attributes[] = {
PyObject* KX_Scene::py_getattro(PyObject *attr)
{
- PyObject* object = py_getattro_self(Attributes, this, attr);
- if (object != NULL)
- return object;
-
- object = PyDict_GetItem(m_attrlist, attr);
+ PyObject *object = PyDict_GetItem(m_attrlist, attr);
if (object)
{
Py_INCREF(object);
diff --git a/source/gameengine/Ketsji/KX_SceneActuator.cpp b/source/gameengine/Ketsji/KX_SceneActuator.cpp
index e1cd3d45503..1753c6570e9 100644
--- a/source/gameengine/Ketsji/KX_SceneActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SceneActuator.cpp
@@ -278,18 +278,12 @@ PyAttributeDef KX_SceneActuator::Attributes[] = {
PyObject* KX_SceneActuator::py_getattro(PyObject *attr)
{
- PyObject* object = py_getattro_self(Attributes, this, attr);
- if (object != NULL)
- return object;
py_getattro_up(SCA_IActuator);
}
int KX_SceneActuator::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);
}
PyObject* KX_SceneActuator::pyattr_get_camera(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
diff --git a/source/gameengine/Ketsji/KX_TouchSensor.cpp b/source/gameengine/Ketsji/KX_TouchSensor.cpp
index c22885f3664..70fa6326c19 100644
--- a/source/gameengine/Ketsji/KX_TouchSensor.cpp
+++ b/source/gameengine/Ketsji/KX_TouchSensor.cpp
@@ -292,20 +292,13 @@ PyAttributeDef KX_TouchSensor::Attributes[] = {
};
PyObject* KX_TouchSensor::py_getattro(PyObject *attr)
-{
- PyObject* object= py_getattro_self(Attributes, this, attr);
- if (object != NULL)
- return object;
+{
py_getattro_up(SCA_ISensor);
}
int KX_TouchSensor::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);
+ py_setattro_up(SCA_ISensor);
}
/* Python API */
diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.cpp b/source/gameengine/Ketsji/KX_TrackToActuator.cpp
index 58e17785b81..f8e2938bbe6 100644
--- a/source/gameengine/Ketsji/KX_TrackToActuator.cpp
+++ b/source/gameengine/Ketsji/KX_TrackToActuator.cpp
@@ -506,18 +506,12 @@ int KX_TrackToActuator::pyattr_set_object(void *self, const struct KX_PYATTRIBUT
PyObject* KX_TrackToActuator::py_getattro(PyObject *attr)
{
- PyObject* object = py_getattro_self(Attributes, this, attr);
- if (object != NULL)
- return object;
py_getattro_up(SCA_IActuator);
}
int KX_TrackToActuator::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);
}
/* 1. setObject */
diff --git a/source/gameengine/Ketsji/KX_VisibilityActuator.cpp b/source/gameengine/Ketsji/KX_VisibilityActuator.cpp
index 35edd84f994..18277245d17 100644
--- a/source/gameengine/Ketsji/KX_VisibilityActuator.cpp
+++ b/source/gameengine/Ketsji/KX_VisibilityActuator.cpp
@@ -136,18 +136,12 @@ PyAttributeDef KX_VisibilityActuator::Attributes[] = {
PyObject* KX_VisibilityActuator::py_getattro(PyObject *attr)
{
- PyObject* object = py_getattro_self(Attributes, this, attr);
- if (object != NULL)
- return object;
py_getattro_up(SCA_IActuator);
}
int KX_VisibilityActuator::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);
}