diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-06-09 00:08:19 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-06-09 00:08:19 +0400 |
commit | c8b4cf92067ffeb625aa39003baf5d8f7c3f0025 (patch) | |
tree | c6c50dbc3d90a65fca6c1ca56a93e4a57cf7e154 /source/gameengine/Ketsji/KX_ConstraintWrapper.cpp | |
parent | e93db433a086a3e739c0f4026cd500f0b595b0f1 (diff) | |
parent | d76a6f5231c015c35123d22e1f5c3ffcdfbf9bbd (diff) |
2.50:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r19820:HEAD
Notes:
* Game and sequencer RNA, and sequencer header are now out of date
a bit after changes in trunk.
* I didn't know how to port these bugfixes, most likely they are
not needed anymore.
* Fix "duplicate strip" always increase the user count for ipo.
* IPO pinning on sequencer strips was lost during Undo.
Diffstat (limited to 'source/gameengine/Ketsji/KX_ConstraintWrapper.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_ConstraintWrapper.cpp | 82 |
1 files changed, 47 insertions, 35 deletions
diff --git a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp index 7c3abb49159..c5cf67af67d 100644 --- a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp +++ b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp @@ -48,24 +48,48 @@ KX_ConstraintWrapper::KX_ConstraintWrapper( KX_ConstraintWrapper::~KX_ConstraintWrapper() { } -//python integration methods -PyObject* KX_ConstraintWrapper::PyTestMethod(PyObject* args, PyObject* kwds) -{ - Py_RETURN_NONE; -} -PyObject* KX_ConstraintWrapper::PyGetConstraintId(PyObject* args, PyObject* kwds) +PyObject* KX_ConstraintWrapper::PyGetConstraintId() { return PyInt_FromLong(m_constraintId); } +PyObject* KX_ConstraintWrapper::PyGetParam(PyObject* args, PyObject* kwds) +{ + int dof; + float value; + + if (!PyArg_ParseTuple(args,"i:getParam",&dof)) + return NULL; + + value = m_physenv->getConstraintParam(m_constraintId,dof); + return PyFloat_FromDouble(value); + +} + +PyObject* KX_ConstraintWrapper::PySetParam(PyObject* args, PyObject* kwds) +{ + int dof; + float minLimit,maxLimit; + + if (!PyArg_ParseTuple(args,"iff:setParam",&dof,&minLimit,&maxLimit)) + return NULL; + + m_physenv->setConstraintParam(m_constraintId,dof,minLimit,maxLimit); + Py_RETURN_NONE; +} //python specific stuff PyTypeObject KX_ConstraintWrapper::Type = { - PyObject_HEAD_INIT(NULL) - 0, +#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 "KX_ConstraintWrapper", sizeof(PyObjectPlus_Proxy), 0, @@ -87,45 +111,33 @@ PyParentObject KX_ConstraintWrapper::Parents[] = { NULL }; -PyObject* KX_ConstraintWrapper::py_getattro(PyObject *attr) +//here you can search for existing data members (like mass,friction etc.) +PyObject* KX_ConstraintWrapper::py_getattro(PyObject *attr) { - //here you can search for existing data members (like mass,friction etc.) py_getattro_up(PyObjectPlus); } -int KX_ConstraintWrapper::py_setattro(PyObject *attr,PyObject* pyobj) +PyObject* KX_ConstraintWrapper::py_getattro_dict() { + py_getattro_dict_up(PyObjectPlus); +} + +int KX_ConstraintWrapper::py_setattro(PyObject *attr,PyObject* value) { - int result = 1; - /* what the heck is this supposed to do?, needs attention */ - if (PyList_Check(pyobj)) - { - result = 0; - } - if (PyFloat_Check(pyobj)) - { - result = 0; - - } - if (PyInt_Check(pyobj)) - { - result = 0; - } - if (PyString_Check(pyobj)) - { - result = 0; - } - if (result) - result = PyObjectPlus::py_setattro(attr,pyobj); - return result; + py_setattro_up(PyObjectPlus); }; + + + PyMethodDef KX_ConstraintWrapper::Methods[] = { - {"testMethod",(PyCFunction) KX_ConstraintWrapper::sPyTestMethod, METH_VARARGS}, - {"getConstraintId",(PyCFunction) KX_ConstraintWrapper::sPyGetConstraintId, METH_VARARGS}, + {"getConstraintId",(PyCFunction) KX_ConstraintWrapper::sPyGetConstraintId, METH_NOARGS}, + {"setParam",(PyCFunction) KX_ConstraintWrapper::sPySetParam, METH_VARARGS}, + {"getParam",(PyCFunction) KX_ConstraintWrapper::sPyGetParam, METH_VARARGS}, {NULL,NULL} //Sentinel }; PyAttributeDef KX_ConstraintWrapper::Attributes[] = { + //KX_PYATTRIBUTE_TODO("constraintId"), { NULL } //Sentinel }; |