diff options
Diffstat (limited to 'source/gameengine/GameLogic/SCA_IObject.cpp')
-rw-r--r-- | source/gameengine/GameLogic/SCA_IObject.cpp | 81 |
1 files changed, 69 insertions, 12 deletions
diff --git a/source/gameengine/GameLogic/SCA_IObject.cpp b/source/gameengine/GameLogic/SCA_IObject.cpp index 6cd11f9e553..9876f2512c0 100644 --- a/source/gameengine/GameLogic/SCA_IObject.cpp +++ b/source/gameengine/GameLogic/SCA_IObject.cpp @@ -41,11 +41,8 @@ MT_Point3 SCA_IObject::m_sDummy=MT_Point3(0,0,0); SG_QList SCA_IObject::m_activeBookmarkedControllers; -SCA_IObject::SCA_IObject(): - CValue(), - m_initState(0), - m_state(0), - m_firstState(NULL) +SCA_IObject::SCA_IObject(PyTypeObject* T): CValue(T), m_initState(0), m_state(0), m_firstState(NULL) + { m_suspended = false; } @@ -221,6 +218,51 @@ SCA_IActuator* SCA_IObject::FindActuator(const STR_String& actuatorname) } + +#if 0 +const MT_Point3& SCA_IObject::ConvertPythonPylist(PyObject* pylist) +{ + bool error = false; + m_sDummy = MT_Vector3(0,0,0); + if (pylist->ob_type == &CListValue::Type) + { + CListValue* listval = (CListValue*) pylist; + int numelem = listval->GetCount(); + if ( numelem <= 3) + { + int index; + for (index = 0;index<numelem;index++) + { + m_sDummy[index] = listval->GetValue(index)->GetNumber(); + } + } else + { + error = true; + } + + } else + { + + // assert the list is long enough... + int numitems = PyList_Size(pylist); + if (numitems <= 3) + { + int index; + for (index=0;index<numitems;index++) + { + m_sDummy[index] = PyFloat_AsDouble(PyList_GetItem(pylist,index)); + } + } + else + { + error = true; + } + + } + return m_sDummy; +} +#endif + void SCA_IObject::Suspend() { if ((!m_ignore_activity_culling) @@ -304,17 +346,23 @@ PyTypeObject SCA_IObject::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, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, + Methods +}; + + + +PyParentObject SCA_IObject::Parents[] = { + &SCA_IObject::Type, &CValue::Type, - 0,0,0,0,0,0, - py_base_new + NULL }; + + PyMethodDef SCA_IObject::Methods[] = { //{"setOrientation", (PyCFunction) SCA_IObject::sPySetOrientation, METH_VARARGS}, //{"getOrientation", (PyCFunction) SCA_IObject::sPyGetOrientation, METH_VARARGS}, @@ -324,3 +372,12 @@ PyMethodDef SCA_IObject::Methods[] = { PyAttributeDef SCA_IObject::Attributes[] = { { NULL } //Sentinel }; + + +PyObject* SCA_IObject::py_getattro(PyObject *attr) { + py_getattro_up(CValue); +} + +PyObject* SCA_IObject::py_getattro_dict() { + py_getattro_dict_up(CValue); +} |