diff options
author | Arystanbek Dyussenov <arystan.d@gmail.com> | 2009-09-15 22:01:18 +0400 |
---|---|---|
committer | Arystanbek Dyussenov <arystan.d@gmail.com> | 2009-09-15 22:01:18 +0400 |
commit | 816377cc02fe5dd4be945c0f3d415861114b4980 (patch) | |
tree | 306e9d1363aa66bc919e43b80b3380fab9f60ea9 /source/gameengine/Ketsji/KX_ParentActuator.cpp | |
parent | c8af263e5d8d9d41a757e8438cdcf3b64d57e0c0 (diff) | |
parent | ee768ada680ce0a8aa184c882005c0ef1c0140fb (diff) |
Undo revision 23130 which was a merge with 2.5, a messy one because I did something wrong (`svn status` output: http://www.pasteall.org/7887).soc-2009-kazanbas
The command: svn merge -r 23130:23129 https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-kazanbas
Diffstat (limited to 'source/gameengine/Ketsji/KX_ParentActuator.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_ParentActuator.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_ParentActuator.cpp b/source/gameengine/Ketsji/KX_ParentActuator.cpp index 20e982f03e0..621aeea87be 100644 --- a/source/gameengine/Ketsji/KX_ParentActuator.cpp +++ b/source/gameengine/Ketsji/KX_ParentActuator.cpp @@ -162,6 +162,10 @@ PyTypeObject KX_ParentActuator::Type = { }; PyMethodDef KX_ParentActuator::Methods[] = { + // Deprecated -----> + {"setObject", (PyCFunction) KX_ParentActuator::sPySetObject, METH_O, (const char *)SetObject_doc}, + {"getObject", (PyCFunction) KX_ParentActuator::sPyGetObject, METH_VARARGS, (const char *)GetObject_doc}, + // <----- {NULL,NULL} //Sentinel }; @@ -201,4 +205,55 @@ int KX_ParentActuator::pyattr_set_object(void *self, const struct KX_PYATTRIBUTE return PY_SET_ATTR_SUCCESS; } + +/* Deprecated -----> */ +/* 1. setObject */ +const char KX_ParentActuator::SetObject_doc[] = +"setObject(object)\n" +"\t- object: KX_GameObject, string or None\n" +"\tSet the object to set as parent.\n"; +PyObject* KX_ParentActuator::PySetObject(PyObject* value) { + KX_GameObject *gameobj; + + ShowDeprecationWarning("setObject()", "the object property"); + + if (!ConvertPythonToGameObject(value, &gameobj, true, "actuator.setObject(value): KX_ParentActuator")) + return NULL; // ConvertPythonToGameObject sets the error + + if (m_ob != NULL) + m_ob->UnregisterActuator(this); + + m_ob = (SCA_IObject*)gameobj; + if (m_ob) + m_ob->RegisterActuator(this); + + Py_RETURN_NONE; +} + +/* 2. getObject */ + +/* get obj ---------------------------------------------------------- */ +const char KX_ParentActuator::GetObject_doc[] = +"getObject(name_only = 1)\n" +"name_only - optional arg, when true will return the KX_GameObject rather then its name\n" +"\tReturns the object that is set to.\n"; +PyObject* KX_ParentActuator::PyGetObject(PyObject* args) +{ + int ret_name_only = 1; + + ShowDeprecationWarning("getObject()", "the object property"); + + if (!PyArg_ParseTuple(args, "|i:getObject", &ret_name_only)) + return NULL; + + if (!m_ob) + Py_RETURN_NONE; + + if (ret_name_only) + return PyUnicode_FromString(m_ob->GetName().ReadPtr()); + else + return m_ob->GetProxy(); +} +/* <----- */ + /* eof */ |