diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-07-24 01:37:37 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-07-24 01:37:37 +0400 |
commit | 5eb14d70b9c70d155291446ad662ede658f69e6d (patch) | |
tree | 48b29a0951966c3ccfcb906ecbaf39f7ee7b7f3f /source/gameengine/Ketsji/KX_ConstraintActuator.cpp | |
parent | dcbe9ade7a8ca91258742e3ac3abefa1c8108e0f (diff) |
BGE patch: Add PyDoc for new logic bricks, set exception message on Py error, remove args on Py functions that don't take any to save CPU time
Diffstat (limited to 'source/gameengine/Ketsji/KX_ConstraintActuator.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_ConstraintActuator.cpp | 79 |
1 files changed, 35 insertions, 44 deletions
diff --git a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp index 800416b5f0a..2401d69d3a3 100644 --- a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp +++ b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp @@ -237,9 +237,9 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame) case KX_ACT_CONSTRAINT_DIRPX: case KX_ACT_CONSTRAINT_DIRPY: case KX_ACT_CONSTRAINT_DIRPZ: - case KX_ACT_CONSTRAINT_DIRMX: - case KX_ACT_CONSTRAINT_DIRMY: - case KX_ACT_CONSTRAINT_DIRMZ: + case KX_ACT_CONSTRAINT_DIRNX: + case KX_ACT_CONSTRAINT_DIRNY: + case KX_ACT_CONSTRAINT_DIRNZ: switch (m_locrot) { case KX_ACT_CONSTRAINT_DIRPX: direction[0] = rotation[0][0]; @@ -262,21 +262,21 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame) axis = 2; sign = 1; break; - case KX_ACT_CONSTRAINT_DIRMX: + case KX_ACT_CONSTRAINT_DIRNX: direction[0] = -rotation[0][0]; direction[1] = -rotation[1][0]; direction[2] = -rotation[2][0]; axis = 0; sign = 0; break; - case KX_ACT_CONSTRAINT_DIRMY: + case KX_ACT_CONSTRAINT_DIRNY: direction[0] = -rotation[0][1]; direction[1] = -rotation[1][1]; direction[2] = -rotation[2][1]; axis = 1; sign = 0; break; - case KX_ACT_CONSTRAINT_DIRMZ: + case KX_ACT_CONSTRAINT_DIRNZ: direction[0] = -rotation[0][2]; direction[1] = -rotation[1][2]; direction[2] = -rotation[2][2]; @@ -437,27 +437,27 @@ PyParentObject KX_ConstraintActuator::Parents[] = { PyMethodDef KX_ConstraintActuator::Methods[] = { {"setDamp", (PyCFunction) KX_ConstraintActuator::sPySetDamp, METH_VARARGS, SetDamp_doc}, - {"getDamp", (PyCFunction) KX_ConstraintActuator::sPyGetDamp, METH_VARARGS, GetDamp_doc}, + {"getDamp", (PyCFunction) KX_ConstraintActuator::sPyGetDamp, METH_NOARGS, GetDamp_doc}, {"setRotDamp", (PyCFunction) KX_ConstraintActuator::sPySetRotDamp, METH_VARARGS, SetRotDamp_doc}, - {"getRotDamp", (PyCFunction) KX_ConstraintActuator::sPyGetRotDamp, METH_VARARGS, GetRotDamp_doc}, + {"getRotDamp", (PyCFunction) KX_ConstraintActuator::sPyGetRotDamp, METH_NOARGS, GetRotDamp_doc}, {"setDirection", (PyCFunction) KX_ConstraintActuator::sPySetDirection, METH_VARARGS, SetDirection_doc}, - {"getDirection", (PyCFunction) KX_ConstraintActuator::sPyGetDirection, METH_VARARGS, GetDirection_doc}, + {"getDirection", (PyCFunction) KX_ConstraintActuator::sPyGetDirection, METH_NOARGS, GetDirection_doc}, {"setOption", (PyCFunction) KX_ConstraintActuator::sPySetOption, METH_VARARGS, SetOption_doc}, - {"getOption", (PyCFunction) KX_ConstraintActuator::sPyGetOption, METH_VARARGS, GetOption_doc}, + {"getOption", (PyCFunction) KX_ConstraintActuator::sPyGetOption, METH_NOARGS, GetOption_doc}, {"setTime", (PyCFunction) KX_ConstraintActuator::sPySetTime, METH_VARARGS, SetTime_doc}, - {"getTime", (PyCFunction) KX_ConstraintActuator::sPyGetTime, METH_VARARGS, GetTime_doc}, + {"getTime", (PyCFunction) KX_ConstraintActuator::sPyGetTime, METH_NOARGS, GetTime_doc}, {"setProperty", (PyCFunction) KX_ConstraintActuator::sPySetProperty, METH_VARARGS, SetProperty_doc}, - {"getProperty", (PyCFunction) KX_ConstraintActuator::sPyGetProperty, METH_VARARGS, GetProperty_doc}, + {"getProperty", (PyCFunction) KX_ConstraintActuator::sPyGetProperty, METH_NOARGS, GetProperty_doc}, {"setMin", (PyCFunction) KX_ConstraintActuator::sPySetMin, METH_VARARGS, SetMin_doc}, - {"getMin", (PyCFunction) KX_ConstraintActuator::sPyGetMin, METH_VARARGS, GetMin_doc}, + {"getMin", (PyCFunction) KX_ConstraintActuator::sPyGetMin, METH_NOARGS, GetMin_doc}, {"setDistance", (PyCFunction) KX_ConstraintActuator::sPySetMin, METH_VARARGS, SetDistance_doc}, - {"getDistance", (PyCFunction) KX_ConstraintActuator::sPyGetMin, METH_VARARGS, GetDistance_doc}, + {"getDistance", (PyCFunction) KX_ConstraintActuator::sPyGetMin, METH_NOARGS, GetDistance_doc}, {"setMax", (PyCFunction) KX_ConstraintActuator::sPySetMax, METH_VARARGS, SetMax_doc}, - {"getMax", (PyCFunction) KX_ConstraintActuator::sPyGetMax, METH_VARARGS, GetMax_doc}, + {"getMax", (PyCFunction) KX_ConstraintActuator::sPyGetMax, METH_NOARGS, GetMax_doc}, {"setRayLength", (PyCFunction) KX_ConstraintActuator::sPySetMax, METH_VARARGS, SetRayLength_doc}, - {"getRayLength", (PyCFunction) KX_ConstraintActuator::sPyGetMax, METH_VARARGS, GetRayLength_doc}, + {"getRayLength", (PyCFunction) KX_ConstraintActuator::sPyGetMax, METH_NOARGS, GetRayLength_doc}, {"setLimit", (PyCFunction) KX_ConstraintActuator::sPySetLimit, METH_VARARGS, SetLimit_doc}, - {"getLimit", (PyCFunction) KX_ConstraintActuator::sPyGetLimit, METH_VARARGS, GetLimit_doc}, + {"getLimit", (PyCFunction) KX_ConstraintActuator::sPyGetLimit, METH_NOARGS, GetLimit_doc}, {NULL,NULL} //Sentinel }; @@ -476,6 +476,7 @@ PyObject* KX_ConstraintActuator::PySetDamp(PyObject* self, PyObject* kwds) { int dampArg; if(!PyArg_ParseTuple(args, "i", &dampArg)) { + PyErr_SetString(PyExc_TypeError, "Invalid arguments"); return NULL; } @@ -488,9 +489,7 @@ PyObject* KX_ConstraintActuator::PySetDamp(PyObject* self, char KX_ConstraintActuator::GetDamp_doc[] = "getDamp()\n" "\tReturns the damping parameter.\n"; -PyObject* KX_ConstraintActuator::PyGetDamp(PyObject* self, - PyObject* args, - PyObject* kwds){ +PyObject* KX_ConstraintActuator::PyGetDamp(PyObject* self){ return PyInt_FromLong(m_posDampTime); } @@ -505,6 +504,7 @@ PyObject* KX_ConstraintActuator::PySetRotDamp(PyObject* self, PyObject* kwds) { int dampArg; if(!PyArg_ParseTuple(args, "i", &dampArg)) { + PyErr_SetString(PyExc_TypeError, "Invalid arguments"); return NULL; } @@ -517,9 +517,7 @@ PyObject* KX_ConstraintActuator::PySetRotDamp(PyObject* self, char KX_ConstraintActuator::GetRotDamp_doc[] = "getRotDamp()\n" "\tReturns the damping time for application of the constraint.\n"; -PyObject* KX_ConstraintActuator::PyGetRotDamp(PyObject* self, - PyObject* args, - PyObject* kwds){ +PyObject* KX_ConstraintActuator::PyGetRotDamp(PyObject* self){ return PyInt_FromLong(m_rotDampTime); } @@ -536,6 +534,7 @@ PyObject* KX_ConstraintActuator::PySetDirection(PyObject* self, MT_Vector3 dir; if(!PyArg_ParseTuple(args, "(fff)", &x, &y, &z)) { + PyErr_SetString(PyExc_TypeError, "Invalid arguments"); return NULL; } dir[0] = x; @@ -554,9 +553,7 @@ PyObject* KX_ConstraintActuator::PySetDirection(PyObject* self, char KX_ConstraintActuator::GetDirection_doc[] = "getDirection()\n" "\tReturns the reference direction of the orientation constraint as a 3-tuple.\n"; -PyObject* KX_ConstraintActuator::PyGetDirection(PyObject* self, - PyObject* args, - PyObject* kwds){ +PyObject* KX_ConstraintActuator::PyGetDirection(PyObject* self){ PyObject *retVal = PyList_New(3); PyList_SetItem(retVal, 0, PyFloat_FromDouble(m_refDirection[0])); @@ -580,6 +577,7 @@ PyObject* KX_ConstraintActuator::PySetOption(PyObject* self, PyObject* kwds) { int option; if(!PyArg_ParseTuple(args, "i", &option)) { + PyErr_SetString(PyExc_TypeError, "Invalid arguments"); return NULL; } @@ -591,9 +589,7 @@ PyObject* KX_ConstraintActuator::PySetOption(PyObject* self, char KX_ConstraintActuator::GetOption_doc[] = "getOption()\n" "\tReturns the option parameter.\n"; -PyObject* KX_ConstraintActuator::PyGetOption(PyObject* self, - PyObject* args, - PyObject* kwds){ +PyObject* KX_ConstraintActuator::PyGetOption(PyObject* self){ return PyInt_FromLong(m_option); } @@ -609,6 +605,7 @@ PyObject* KX_ConstraintActuator::PySetTime(PyObject* self, PyObject* kwds) { int t; if(!PyArg_ParseTuple(args, "i", &t)) { + PyErr_SetString(PyExc_TypeError, "Invalid arguments"); return NULL; } @@ -622,9 +619,7 @@ PyObject* KX_ConstraintActuator::PySetTime(PyObject* self, char KX_ConstraintActuator::GetTime_doc[] = "getTime()\n" "\tReturns the time parameter.\n"; -PyObject* KX_ConstraintActuator::PyGetTime(PyObject* self, - PyObject* args, - PyObject* kwds){ +PyObject* KX_ConstraintActuator::PyGetTime(PyObject* self){ return PyInt_FromLong(m_activeTime); } @@ -639,6 +634,7 @@ PyObject* KX_ConstraintActuator::PySetProperty(PyObject* self, PyObject* kwds) { char *property; if (!PyArg_ParseTuple(args, "s", &property)) { + PyErr_SetString(PyExc_TypeError, "Invalid arguments"); return NULL; } if (property == NULL) { @@ -654,9 +650,7 @@ PyObject* KX_ConstraintActuator::PySetProperty(PyObject* self, char KX_ConstraintActuator::GetProperty_doc[] = "getProperty()\n" "\tReturns the property parameter.\n"; -PyObject* KX_ConstraintActuator::PyGetProperty(PyObject* self, - PyObject* args, - PyObject* kwds){ +PyObject* KX_ConstraintActuator::PyGetProperty(PyObject* self){ return PyString_FromString(m_property); } @@ -676,6 +670,7 @@ PyObject* KX_ConstraintActuator::PySetMin(PyObject* self, PyObject* kwds) { float minArg; if(!PyArg_ParseTuple(args, "f", &minArg)) { + PyErr_SetString(PyExc_TypeError, "Invalid arguments"); return NULL; } @@ -701,9 +696,7 @@ char KX_ConstraintActuator::GetMin_doc[] = "getMin()\n" "\tReturns the lower value of the interval to which the value\n" "\tis clipped.\n"; -PyObject* KX_ConstraintActuator::PyGetMin(PyObject* self, - PyObject* args, - PyObject* kwds) { +PyObject* KX_ConstraintActuator::PyGetMin(PyObject* self) { return PyFloat_FromDouble(m_minimumBound); } @@ -723,6 +716,7 @@ PyObject* KX_ConstraintActuator::PySetMax(PyObject* self, PyObject* kwds){ float maxArg; if(!PyArg_ParseTuple(args, "f", &maxArg)) { + PyErr_SetString(PyExc_TypeError, "Invalid arguments"); return NULL; } @@ -748,9 +742,7 @@ char KX_ConstraintActuator::GetMax_doc[] = "getMax()\n" "\tReturns the upper value of the interval to which the value\n" "\tis clipped.\n"; -PyObject* KX_ConstraintActuator::PyGetMax(PyObject* self, - PyObject* args, - PyObject* kwds) { +PyObject* KX_ConstraintActuator::PyGetMax(PyObject* self) { return PyFloat_FromDouble(m_maximumBound); } @@ -778,6 +770,7 @@ PyObject* KX_ConstraintActuator::PySetLimit(PyObject* self, PyObject* kwds) { int locrotArg; if(!PyArg_ParseTuple(args, "i", &locrotArg)) { + PyErr_SetString(PyExc_TypeError, "Invalid arguments"); return NULL; } @@ -789,9 +782,7 @@ PyObject* KX_ConstraintActuator::PySetLimit(PyObject* self, char KX_ConstraintActuator::GetLimit_doc[] = "getLimit()\n" "\tReturns the type of constraint.\n"; -PyObject* KX_ConstraintActuator::PyGetLimit(PyObject* self, - PyObject* args, - PyObject* kwds) { +PyObject* KX_ConstraintActuator::PyGetLimit(PyObject* self) { return PyInt_FromLong(m_locrot); } |