diff options
Diffstat (limited to 'source/gameengine/GameLogic/SCA_DelaySensor.cpp')
-rw-r--r-- | source/gameengine/GameLogic/SCA_DelaySensor.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/source/gameengine/GameLogic/SCA_DelaySensor.cpp b/source/gameengine/GameLogic/SCA_DelaySensor.cpp index f15d4c7249f..4c97ca98d72 100644 --- a/source/gameengine/GameLogic/SCA_DelaySensor.cpp +++ b/source/gameengine/GameLogic/SCA_DelaySensor.cpp @@ -158,6 +158,7 @@ PyParentObject SCA_DelaySensor::Parents[] = { }; PyMethodDef SCA_DelaySensor::Methods[] = { + //Deprecated functions ------> /* setProperty */ {"setDelay", (PyCFunction) SCA_DelaySensor::sPySetDelay, METH_VARARGS, (PY_METHODCHAR)SetDelay_doc}, {"setDuration", (PyCFunction) SCA_DelaySensor::sPySetDuration, METH_VARARGS, (PY_METHODCHAR)SetDuration_doc}, @@ -166,13 +167,32 @@ PyMethodDef SCA_DelaySensor::Methods[] = { {"getDelay", (PyCFunction) SCA_DelaySensor::sPyGetDelay, METH_NOARGS, (PY_METHODCHAR)GetDelay_doc}, {"getDuration", (PyCFunction) SCA_DelaySensor::sPyGetDuration, METH_NOARGS, (PY_METHODCHAR)GetDuration_doc}, {"getRepeat", (PyCFunction) SCA_DelaySensor::sPyGetRepeat, METH_NOARGS, (PY_METHODCHAR)GetRepeat_doc}, + //<----- Deprecated {NULL,NULL} //Sentinel }; +PyAttributeDef SCA_DelaySensor::Attributes[] = { + KX_PYATTRIBUTE_INT_RW("delay",0,100000,true,SCA_DelaySensor,m_delay), + KX_PYATTRIBUTE_INT_RW("duration",0,100000,true,SCA_DelaySensor,m_duration), + KX_PYATTRIBUTE_BOOL_RW("repeat",SCA_DelaySensor,m_repeat), + { NULL } //Sentinel +}; + PyObject* SCA_DelaySensor::_getattr(const STR_String& attr) { + PyObject* object = _getattr_self(Attributes, this, attr); + if (object != NULL) + return object; _getattr_up(SCA_ISensor); } +int SCA_DelaySensor::_setattr(const STR_String& attr, PyObject *value) { + int ret = _setattr_self(Attributes, this, attr, value); + if (ret >= 0) + return ret; + return SCA_ISensor::_setattr(attr, value); +} + + const char SCA_DelaySensor::SetDelay_doc[] = "setDelay(delay)\n" "\t- delay: length of the initial OFF period as number of frame\n" @@ -180,6 +200,7 @@ const char SCA_DelaySensor::SetDelay_doc[] = "\tSet the initial delay before the positive trigger\n"; PyObject* SCA_DelaySensor::PySetDelay(PyObject* self, PyObject* args, PyObject* kwds) { + ShowDeprecationWarning("setDelay()", "the delay property"); int delay; if(!PyArg_ParseTuple(args, "i", &delay)) { @@ -201,6 +222,7 @@ const char SCA_DelaySensor::SetDuration_doc[] = "\tIf > 0, a negative trigger is fired at the end of the ON pulse.\n"; PyObject* SCA_DelaySensor::PySetDuration(PyObject* self, PyObject* args, PyObject* kwds) { + ShowDeprecationWarning("setDuration()", "the duration property"); int duration; if(!PyArg_ParseTuple(args, "i", &duration)) { @@ -221,6 +243,7 @@ const char SCA_DelaySensor::SetRepeat_doc[] = "\tSet the sensor repeat mode\n"; PyObject* SCA_DelaySensor::PySetRepeat(PyObject* self, PyObject* args, PyObject* kwds) { + ShowDeprecationWarning("setRepeat()", "the repeat property"); int repeat; if(!PyArg_ParseTuple(args, "i", &repeat)) { @@ -235,6 +258,7 @@ const char SCA_DelaySensor::GetDelay_doc[] = "\tReturn the delay parameter value\n"; PyObject* SCA_DelaySensor::PyGetDelay(PyObject* self) { + ShowDeprecationWarning("getDelay()", "the delay property"); return PyInt_FromLong(m_delay); } @@ -243,6 +267,7 @@ const char SCA_DelaySensor::GetDuration_doc[] = "\tReturn the duration parameter value\n"; PyObject* SCA_DelaySensor::PyGetDuration(PyObject* self) { + ShowDeprecationWarning("getDuration()", "the duration property"); return PyInt_FromLong(m_duration); } @@ -251,6 +276,7 @@ const char SCA_DelaySensor::GetRepeat_doc[] = "\tReturn the repeat parameter value\n"; PyObject* SCA_DelaySensor::PyGetRepeat(PyObject* self) { + ShowDeprecationWarning("getRepeat()", "the repeat property"); return BoolToPyArg(m_repeat); } |