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:
Diffstat (limited to 'source/gameengine/GameLogic/SCA_ISensor.cpp')
-rw-r--r--source/gameengine/GameLogic/SCA_ISensor.cpp76
1 files changed, 27 insertions, 49 deletions
diff --git a/source/gameengine/GameLogic/SCA_ISensor.cpp b/source/gameengine/GameLogic/SCA_ISensor.cpp
index 2783bf14600..b018124dcca 100644
--- a/source/gameengine/GameLogic/SCA_ISensor.cpp
+++ b/source/gameengine/GameLogic/SCA_ISensor.cpp
@@ -50,9 +50,8 @@ void SCA_ISensor::ReParent(SCA_IObject* parent)
SCA_ISensor::SCA_ISensor(SCA_IObject* gameobj,
- class SCA_EventManager* eventmgr,
- PyTypeObject* T ) :
- SCA_ILogicBrick(gameobj,T)
+ class SCA_EventManager* eventmgr) :
+ SCA_ILogicBrick(gameobj)
{
m_links = 0;
m_suspended = false;
@@ -301,7 +300,7 @@ PyObject* SCA_ISensor::PyIsPositive()
{
ShowDeprecationWarning("isPositive()", "the read-only positive property");
int retval = GetState();
- return PyInt_FromLong(retval);
+ return PyLong_FromSsize_t(retval);
}
const char SCA_ISensor::IsTriggered_doc[] =
@@ -314,7 +313,7 @@ PyObject* SCA_ISensor::PyIsTriggered()
int retval = 0;
if (SCA_PythonController::m_sCurrentController)
retval = SCA_PythonController::m_sCurrentController->IsTriggered(this);
- return PyInt_FromLong(retval);
+ return PyLong_FromSsize_t(retval);
}
/**
@@ -355,7 +354,7 @@ const char SCA_ISensor::GetFrequency_doc[] =
PyObject* SCA_ISensor::PyGetFrequency()
{
ShowDeprecationWarning("getFrequency()", "the frequency property");
- return PyInt_FromLong(m_pulse_frequency);
+ return PyLong_FromSsize_t(m_pulse_frequency);
}
/**
@@ -473,13 +472,7 @@ KX_PYMETHODDEF_DOC_NOARGS(SCA_ISensor, reset,
/* ----------------------------------------------- */
PyTypeObject SCA_ISensor::Type = {
-#if (PY_VERSION_HEX >= 0x02060000)
PyVarObject_HEAD_INIT(NULL, 0)
-#else
- /* python 2.5 and below */
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
-#endif
"SCA_ISensor",
sizeof(PyObjectPlus_Proxy),
0,
@@ -489,45 +482,43 @@ PyTypeObject SCA_ISensor::Type = {
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_ISensor::Parents[] = {
- &SCA_ISensor::Type,
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+ 0,0,0,0,0,0,0,
+ Methods,
+ 0,
+ 0,
&SCA_ILogicBrick::Type,
- &CValue::Type,
- NULL
+ 0,0,0,0,0,0,
+ py_base_new
};
+
PyMethodDef SCA_ISensor::Methods[] = {
//Deprecated functions ----->
{"isPositive", (PyCFunction) SCA_ISensor::sPyIsPositive,
- METH_NOARGS, (PY_METHODCHAR)IsPositive_doc},
+ METH_NOARGS, (const char *)IsPositive_doc},
{"isTriggered", (PyCFunction) SCA_ISensor::sPyIsTriggered,
- METH_VARARGS, (PY_METHODCHAR)IsTriggered_doc},
+ METH_VARARGS, (const char *)IsTriggered_doc},
{"getUsePosPulseMode", (PyCFunction) SCA_ISensor::sPyGetUsePosPulseMode,
- METH_NOARGS, (PY_METHODCHAR)GetUsePosPulseMode_doc},
+ METH_NOARGS, (const char *)GetUsePosPulseMode_doc},
{"setUsePosPulseMode", (PyCFunction) SCA_ISensor::sPySetUsePosPulseMode,
- METH_VARARGS, (PY_METHODCHAR)SetUsePosPulseMode_doc},
+ METH_VARARGS, (const char *)SetUsePosPulseMode_doc},
{"getFrequency", (PyCFunction) SCA_ISensor::sPyGetFrequency,
- METH_NOARGS, (PY_METHODCHAR)GetFrequency_doc},
+ METH_NOARGS, (const char *)GetFrequency_doc},
{"setFrequency", (PyCFunction) SCA_ISensor::sPySetFrequency,
- METH_VARARGS, (PY_METHODCHAR)SetFrequency_doc},
+ METH_VARARGS, (const char *)SetFrequency_doc},
{"getUseNegPulseMode", (PyCFunction) SCA_ISensor::sPyGetUseNegPulseMode,
- METH_NOARGS, (PY_METHODCHAR)GetUseNegPulseMode_doc},
+ METH_NOARGS, (const char *)GetUseNegPulseMode_doc},
{"setUseNegPulseMode", (PyCFunction) SCA_ISensor::sPySetUseNegPulseMode,
- METH_VARARGS, (PY_METHODCHAR)SetUseNegPulseMode_doc},
+ METH_VARARGS, (const char *)SetUseNegPulseMode_doc},
{"getInvert", (PyCFunction) SCA_ISensor::sPyGetInvert,
- METH_NOARGS, (PY_METHODCHAR)GetInvert_doc},
+ METH_NOARGS, (const char *)GetInvert_doc},
{"setInvert", (PyCFunction) SCA_ISensor::sPySetInvert,
- METH_VARARGS, (PY_METHODCHAR)SetInvert_doc},
+ METH_VARARGS, (const char *)SetInvert_doc},
{"getLevel", (PyCFunction) SCA_ISensor::sPyGetLevel,
- METH_NOARGS, (PY_METHODCHAR)GetLevel_doc},
+ METH_NOARGS, (const char *)GetLevel_doc},
{"setLevel", (PyCFunction) SCA_ISensor::sPySetLevel,
- METH_VARARGS, (PY_METHODCHAR)SetLevel_doc},
+ METH_VARARGS, (const char *)SetLevel_doc},
//<----- Deprecated
KX_PYMETHODTABLE_NOARGS(SCA_ISensor, reset),
{NULL,NULL} //Sentinel
@@ -548,19 +539,6 @@ PyAttributeDef SCA_ISensor::Attributes[] = {
{ NULL } //Sentinel
};
-PyObject* SCA_ISensor::py_getattro(PyObject *attr)
-{
- py_getattro_up(SCA_ILogicBrick);
-}
-
-PyObject* SCA_ISensor::py_getattro_dict() {
- py_getattro_dict_up(SCA_ILogicBrick);
-}
-
-int SCA_ISensor::py_setattro(PyObject *attr, PyObject *value)
-{
- py_setattro_up(SCA_ILogicBrick);
-}
PyObject* SCA_ISensor::pyattr_get_triggered(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
@@ -568,13 +546,13 @@ PyObject* SCA_ISensor::pyattr_get_triggered(void *self_v, const KX_PYATTRIBUTE_D
int retval = 0;
if (SCA_PythonController::m_sCurrentController)
retval = SCA_PythonController::m_sCurrentController->IsTriggered(self);
- return PyInt_FromLong(retval);
+ return PyLong_FromSsize_t(retval);
}
PyObject* SCA_ISensor::pyattr_get_positive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v);
- return PyInt_FromLong(self->GetState());
+ return PyLong_FromSsize_t(self->GetState());
}
int SCA_ISensor::pyattr_check_level(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)