diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-06-26 16:39:06 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-06-26 16:39:06 +0400 |
commit | 11cdc2a002c5baf1a1405e7dc246cacbd2d9392d (patch) | |
tree | 7a816d48b63e57320ce4ff7716c760091cb17912 /source/gameengine/Expressions | |
parent | ac25593479b2b45908312f83d255cd7d225b4ba2 (diff) |
Python API/Game engine fixes, dosn't affect 2.47
* Action FrameProp was checking if the string was true, not that it contained any text.
* Added GameObject.getVisible() since there is already a getVisible
* Added GameObject.getPropertyNames() Needed in apricot so Franky can collect and throw items in the level without having the names defined elsewhere or modifying his game logic which is stored in a separate blend file.
Diffstat (limited to 'source/gameengine/Expressions')
-rw-r--r-- | source/gameengine/Expressions/Value.cpp | 24 | ||||
-rw-r--r-- | source/gameengine/Expressions/Value.h | 2 |
2 files changed, 21 insertions, 5 deletions
diff --git a/source/gameengine/Expressions/Value.cpp b/source/gameengine/Expressions/Value.cpp index 56208ab4ad5..f0195d5df82 100644 --- a/source/gameengine/Expressions/Value.cpp +++ b/source/gameengine/Expressions/Value.cpp @@ -520,11 +520,6 @@ void CValue::CloneProperties(CValue *replica) } - - - - - double* CValue::GetVector3(bool bGetTransformedVec) { assertd(false); // don;t get vector from me @@ -775,6 +770,25 @@ int CValue::_setattr(const STR_String& attr,PyObject* pyobj) //PyObjectPlus::_setattr(attr,value); return 0; }; + +PyObject* CValue::ConvertKeysToPython( void ) +{ + PyObject *pylist = PyList_New( 0 ); + PyObject *pystr; + + if (m_pNamedPropertyArray) + { + for ( std::map<STR_String,CValue*>::iterator it = m_pNamedPropertyArray->begin(); + !(it == m_pNamedPropertyArray->end());it++) + { + pystr = PyString_FromString( (*it).first ); + PyList_Append(pylist, pystr); + Py_DECREF( pystr ); + } + } + return pylist; +} + /* PyObject* CValue::PyMake(PyObject* ignored,PyObject* args) { diff --git a/source/gameengine/Expressions/Value.h b/source/gameengine/Expressions/Value.h index ccb9c34749d..561e5521d60 100644 --- a/source/gameengine/Expressions/Value.h +++ b/source/gameengine/Expressions/Value.h @@ -253,6 +253,8 @@ public: virtual int _delattr(const STR_String& attr); virtual int _setattr(const STR_String& attr,PyObject* value); + virtual PyObject* ConvertKeysToPython( void ); + KX_PYMETHOD(CValue,GetName); #else |