diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2009-09-25 01:22:24 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2009-09-25 01:22:24 +0400 |
commit | 1483fafd1372a3d3e025d08634e798adb7da512f (patch) | |
tree | 9191765749e29866339f4c31d892603f5f8b334d /source/gameengine/Ketsji/KX_PythonSeq.cpp | |
parent | c995c605f640d8d688e6e58e0fe247ca83f91696 (diff) | |
parent | 222fe6b1a5d49f67177cbb762f55a0e482145f5d (diff) |
Merge of itasc branch. Project files, scons and cmake should be working. Makefile updated but not tested. Comes with Eigen2 2.0.6 C++ matrix library.
Diffstat (limited to 'source/gameengine/Ketsji/KX_PythonSeq.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_PythonSeq.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_PythonSeq.cpp b/source/gameengine/Ketsji/KX_PythonSeq.cpp index 75a7c9b8aeb..f7ad7acb252 100644 --- a/source/gameengine/Ketsji/KX_PythonSeq.cpp +++ b/source/gameengine/Ketsji/KX_PythonSeq.cpp @@ -31,6 +31,7 @@ #include "KX_PythonSeq.h" #include "KX_GameObject.h" +#include "BL_ArmatureObject.h" #include "SCA_ISensor.h" #include "SCA_IController.h" #include "SCA_IActuator.h" @@ -72,6 +73,10 @@ static Py_ssize_t KX_PythonSeq_len( PyObject * self ) return ((KX_GameObject *)self_plus)->GetControllers().size(); case KX_PYGENSEQ_OB_TYPE_ACTUATORS: return ((KX_GameObject *)self_plus)->GetActuators().size(); + case KX_PYGENSEQ_OB_TYPE_CONSTRAINTS: + return ((BL_ArmatureObject *)self_plus)->GetConstraintNumber(); + case KX_PYGENSEQ_OB_TYPE_CHANNELS: + return ((BL_ArmatureObject *)self_plus)->GetChannelNumber(); default: /* Should never happen */ PyErr_SetString(PyExc_SystemError, "invalid type, internal error"); @@ -139,6 +144,29 @@ static PyObject *KX_PythonSeq_getIndex(PyObject* self, int index) } return linkedactuators[index]->GetProxy(); } + case KX_PYGENSEQ_OB_TYPE_CONSTRAINTS: + { + int nb_constraint = ((BL_ArmatureObject *)self_plus)->GetConstraintNumber(); + if(index<0) + index += nb_constraint; + if(index<0 || index>= nb_constraint) { + PyErr_SetString(PyExc_IndexError, "seq[i]: index out of range"); + return NULL; + } + return ((BL_ArmatureObject *)self_plus)->GetConstraint(index)->GetProxy(); + } + case KX_PYGENSEQ_OB_TYPE_CHANNELS: + { + int nb_channel = ((BL_ArmatureObject *)self_plus)->GetChannelNumber(); + if(index<0) + index += nb_channel; + if(index<0 || index>= nb_channel) { + PyErr_SetString(PyExc_IndexError, "seq[i]: index out of range"); + return NULL; + } + return ((BL_ArmatureObject *)self_plus)->GetChannel(index)->GetProxy(); + } + } PyErr_SetString(PyExc_SystemError, "invalid sequence type, this is a bug"); @@ -206,6 +234,14 @@ static PyObjectPlus * KX_PythonSeq_subscript__internal(PyObject *self, char *key } break; } + case KX_PYGENSEQ_OB_TYPE_CONSTRAINTS: + { + return ((BL_ArmatureObject*)self_plus)->GetConstraint(key); + } + case KX_PYGENSEQ_OB_TYPE_CHANNELS: + { + return ((BL_ArmatureObject*)self_plus)->GetChannel(key); + } } return NULL; |