diff options
Diffstat (limited to 'source/gameengine/GameLogic/SCA_PropertySensor.cpp')
-rw-r--r-- | source/gameengine/GameLogic/SCA_PropertySensor.cpp | 58 |
1 files changed, 26 insertions, 32 deletions
diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.cpp b/source/gameengine/GameLogic/SCA_PropertySensor.cpp index d683c8bb3e7..de8a9fcf03e 100644 --- a/source/gameengine/GameLogic/SCA_PropertySensor.cpp +++ b/source/gameengine/GameLogic/SCA_PropertySensor.cpp @@ -306,22 +306,22 @@ int SCA_PropertySensor::validValueForProperty(void *self, const PyAttributeDef*) /* Integration hooks ------------------------------------------------------- */ PyTypeObject SCA_PropertySensor::Type = { - PyObject_HEAD_INIT(&PyType_Type) + PyObject_HEAD_INIT(NULL) 0, "SCA_PropertySensor", - sizeof(SCA_PropertySensor), + sizeof(PyObjectPlus_Proxy), 0, - PyDestructor, + py_base_dealloc, 0, - __getattr, - __setattr, - 0, //&MyPyCompare, - __repr, - 0, //&cvalue_as_number, 0, 0, 0, - 0 + py_base_repr, + 0,0,0,0,0,0, + py_base_getattro, + py_base_setattro, + 0,0,0,0,0,0,0,0,0, + Methods }; PyParentObject SCA_PropertySensor::Parents[] = { @@ -334,11 +334,11 @@ PyParentObject SCA_PropertySensor::Parents[] = { PyMethodDef SCA_PropertySensor::Methods[] = { //Deprecated functions ------> - {"getType", (PyCFunction) SCA_PropertySensor::sPyGetType, METH_VARARGS, (PY_METHODCHAR)GetType_doc}, + {"getType", (PyCFunction) SCA_PropertySensor::sPyGetType, METH_NOARGS, (PY_METHODCHAR)GetType_doc}, {"setType", (PyCFunction) SCA_PropertySensor::sPySetType, METH_VARARGS, (PY_METHODCHAR)SetType_doc}, - {"getProperty", (PyCFunction) SCA_PropertySensor::sPyGetProperty, METH_VARARGS, (PY_METHODCHAR)GetProperty_doc}, + {"getProperty", (PyCFunction) SCA_PropertySensor::sPyGetProperty, METH_NOARGS, (PY_METHODCHAR)GetProperty_doc}, {"setProperty", (PyCFunction) SCA_PropertySensor::sPySetProperty, METH_VARARGS, (PY_METHODCHAR)SetProperty_doc}, - {"getValue", (PyCFunction) SCA_PropertySensor::sPyGetValue, METH_VARARGS, (PY_METHODCHAR)GetValue_doc}, + {"getValue", (PyCFunction) SCA_PropertySensor::sPyGetValue, METH_NOARGS, (PY_METHODCHAR)GetValue_doc}, {"setValue", (PyCFunction) SCA_PropertySensor::sPySetValue, METH_VARARGS, (PY_METHODCHAR)SetValue_doc}, //<----- Deprecated {NULL,NULL} //Sentinel @@ -352,25 +352,19 @@ PyAttributeDef SCA_PropertySensor::Attributes[] = { }; -PyObject* SCA_PropertySensor::_getattr(const char *attr) { - PyObject* object = _getattr_self(Attributes, this, attr); - if (object != NULL) - return object; - _getattr_up(SCA_ISensor); /* implicit return! */ +PyObject* SCA_PropertySensor::py_getattro(PyObject *attr) { + py_getattro_up(SCA_ISensor); } -int SCA_PropertySensor::_setattr(const char *attr, PyObject *value) { - int ret = _setattr_self(Attributes, this, attr, value); - if (ret >= 0) - return ret; - return SCA_ISensor::_setattr(attr, value); +int SCA_PropertySensor::py_setattro(PyObject *attr, PyObject *value) { + py_setattro_up(SCA_ISensor); } /* 1. getType */ const char SCA_PropertySensor::GetType_doc[] = "getType()\n" "\tReturns the type of check this sensor performs.\n"; -PyObject* SCA_PropertySensor::PyGetType(PyObject* self, PyObject* args, PyObject* kwds) +PyObject* SCA_PropertySensor::PyGetType() { ShowDeprecationWarning("getType()", "the type property"); return PyInt_FromLong(m_checktype); @@ -383,12 +377,12 @@ const char SCA_PropertySensor::SetType_doc[] = "\t KX_PROPSENSOR_INTERVAL, KX_PROPSENSOR_CHANGED,\n" "\t or KX_PROPSENSOR_EXPRESSION.\n" "\tSet the type of check to perform.\n"; -PyObject* SCA_PropertySensor::PySetType(PyObject* self, PyObject* args, PyObject* kwds) +PyObject* SCA_PropertySensor::PySetType(PyObject* args) { ShowDeprecationWarning("setType()", "the type property"); int typeArg; - if (!PyArg_ParseTuple(args, "i", &typeArg)) { + if (!PyArg_ParseTuple(args, "i:setType", &typeArg)) { return NULL; } @@ -404,7 +398,7 @@ PyObject* SCA_PropertySensor::PySetType(PyObject* self, PyObject* args, PyObject const char SCA_PropertySensor::GetProperty_doc[] = "getProperty()\n" "\tReturn the property with which the sensor operates.\n"; -PyObject* SCA_PropertySensor::PyGetProperty(PyObject* self, PyObject* args, PyObject* kwds) +PyObject* SCA_PropertySensor::PyGetProperty() { ShowDeprecationWarning("getProperty()", "the 'property' property"); return PyString_FromString(m_checkpropname); @@ -416,14 +410,14 @@ const char SCA_PropertySensor::SetProperty_doc[] = "\t- name: string\n" "\tSets the property with which to operate. If there is no property\n" "\tof this name, the call is ignored.\n"; -PyObject* SCA_PropertySensor::PySetProperty(PyObject* self, PyObject* args, PyObject* kwds) +PyObject* SCA_PropertySensor::PySetProperty(PyObject* args) { ShowDeprecationWarning("setProperty()", "the 'property' property"); /* We should query whether the name exists. Or should we create a prop */ /* on the fly? */ char *propNameArg = NULL; - if (!PyArg_ParseTuple(args, "s", &propNameArg)) { + if (!PyArg_ParseTuple(args, "s:setProperty", &propNameArg)) { return NULL; } @@ -441,7 +435,7 @@ PyObject* SCA_PropertySensor::PySetProperty(PyObject* self, PyObject* args, PyOb const char SCA_PropertySensor::GetValue_doc[] = "getValue()\n" "\tReturns the value with which the sensor operates.\n"; -PyObject* SCA_PropertySensor::PyGetValue(PyObject* self, PyObject* args, PyObject* kwds) +PyObject* SCA_PropertySensor::PyGetValue() { ShowDeprecationWarning("getValue()", "the value property"); return PyString_FromString(m_checkpropval); @@ -454,19 +448,19 @@ const char SCA_PropertySensor::SetValue_doc[] = "\tSet the value with which the sensor operates. If the value\n" "\tis not compatible with the type of the property, the subsequent\n" "\t action is ignored.\n"; -PyObject* SCA_PropertySensor::PySetValue(PyObject* self, PyObject* args, PyObject* kwds) +PyObject* SCA_PropertySensor::PySetValue(PyObject* args) { ShowDeprecationWarning("setValue()", "the value property"); /* Here, we need to check whether the value is 'valid' for this property.*/ /* We know that the property exists, or is NULL. */ char *propValArg = NULL; - if(!PyArg_ParseTuple(args, "s", &propValArg)) { + if(!PyArg_ParseTuple(args, "s:setValue", &propValArg)) { return NULL; } STR_String oldval = m_checkpropval; m_checkpropval = propValArg; - if (validValueForProperty(self, NULL)) { + if (validValueForProperty(m_proxy, NULL)) { m_checkpropval = oldval; return NULL; } |