diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-05-17 20:30:18 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-05-17 20:30:18 +0400 |
commit | 41acd3b81cd2a7156b8c5ced4d4aa257e7575517 (patch) | |
tree | dcb2c099c3ed09f0d6b736000cb7cbf922118c45 /source/gameengine/Expressions/Value.cpp | |
parent | 65796e2c0712798606497dfb3f36ccbd6e7ab725 (diff) |
While testing YoFrankie with the new API attributes found some issues...
- corrections to docs
- disallow calling controller.activate(actuator) when the controller is not active. (Raise a SystemError)
- Added 2 new attributes, CValue.name - deprecates CValue.getName(), KX_GameObject.children deprecated KX_GameObject.getChildren(), (same for getChildrenRecursive()).
Diffstat (limited to 'source/gameengine/Expressions/Value.cpp')
-rw-r--r-- | source/gameengine/Expressions/Value.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/gameengine/Expressions/Value.cpp b/source/gameengine/Expressions/Value.cpp index 83deeef91a3..f61ef1455b4 100644 --- a/source/gameengine/Expressions/Value.cpp +++ b/source/gameengine/Expressions/Value.cpp @@ -66,13 +66,14 @@ PyParentObject CValue::Parents[] = { }; PyMethodDef CValue::Methods[] = { -// { "printHello", (PyCFunction) CValue::sPyPrintHello, METH_VARARGS}, { "getName", (PyCFunction) CValue::sPyGetName, METH_NOARGS}, {NULL,NULL} //Sentinel }; PyObject* CValue::PyGetName() { + ShowDeprecationWarning("getName()", "the name property"); + return PyString_FromString(this->GetName()); } @@ -550,6 +551,7 @@ static PyMethodDef CValueMethods[] = }; PyAttributeDef CValue::Attributes[] = { + KX_PYATTRIBUTE_RO_FUNCTION("name", CValue, pyattr_get_name), { NULL } //Sentinel }; @@ -574,6 +576,11 @@ PyObject* CValue::py_getattro_dict() { py_getattro_dict_up(PyObjectPlus); } +PyObject * CValue::pyattr_get_name(void * self_v, const KX_PYATTRIBUTE_DEF * attrdef) { + CValue * self = static_cast<CValue *> (self_v); + return PyString_FromString(self->GetName()); +} + CValue* CValue::ConvertPythonToValue(PyObject* pyobj, const char *error_prefix) { |