diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-04-09 20:00:45 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-04-09 20:00:45 +0400 |
commit | 4669fa48a82f5f1070cf885cd1714e0a8ff8db3a (patch) | |
tree | b68263e635075298f9585b9ea479a7280e99b66c /source/gameengine/Expressions/PyObjectPlus.h | |
parent | e14e66f041104c87033ec0b58596fb49c591908c (diff) |
Added GameKeys.EventToCharacter(event, is_shift) so you can get the character that would be types when pressing a key.
Last commit was made in the pydocs folder only, so this includes changes mentioned in rev 19620.
Diffstat (limited to 'source/gameengine/Expressions/PyObjectPlus.h')
-rw-r--r-- | source/gameengine/Expressions/PyObjectPlus.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h index d549be6ef60..786ca1fdc4f 100644 --- a/source/gameengine/Expressions/PyObjectPlus.h +++ b/source/gameengine/Expressions/PyObjectPlus.h @@ -129,7 +129,14 @@ static inline void Py_Fatal(const char *M) { \ if(descr) { \ if (PyCObject_Check(descr)) { \ - return py_set_attrdef((void *)this, (const PyAttributeDef*)PyCObject_AsVoidPtr(descr), value); \ + const PyAttributeDef* attrdef= reinterpret_cast<const PyAttributeDef *>(PyCObject_AsVoidPtr(descr)); \ + if (attrdef->m_access == KX_PYATTRIBUTE_RO) { \ + PyErr_Format(PyExc_AttributeError, "\"%s\" is read only", PyString_AsString(attr)); \ + return -1; \ + } \ + else { \ + return py_set_attrdef((void *)this, attrdef, value); \ + } \ } else { \ PyErr_Format(PyExc_AttributeError, "\"%s\" cannot be set", PyString_AsString(attr)); \ return -1; \ |