diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-04-12 13:56:30 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-04-12 13:56:30 +0400 |
commit | 5b306b7541bfc60342b70bcc55456d5c453a294a (patch) | |
tree | 267232e135a123f3f75051a9732a9ab35370d769 /source/gameengine/Ketsji/KX_Scene.h | |
parent | 55d2b184ec1b2c1adfe182ead937cedae1a8208d (diff) |
BGE Python API
added defines PY_SET_ATTR_FAIL, PY_SET_ATTR_MISSING and PY_SET_ATTR_SUCCESS
This is useful when objects that have user defined attributes (GameObject and Scene)
When calling setattr on the parent, a return value of PY_SET_ATTR_FAIL means the attribute exists but failed to be set, so don't set the custom attribute.
Diffstat (limited to 'source/gameengine/Ketsji/KX_Scene.h')
-rw-r--r-- | source/gameengine/Ketsji/KX_Scene.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/gameengine/Ketsji/KX_Scene.h b/source/gameengine/Ketsji/KX_Scene.h index 1bdfbd45d20..b70c6d3e8d3 100644 --- a/source/gameengine/Ketsji/KX_Scene.h +++ b/source/gameengine/Ketsji/KX_Scene.h @@ -597,13 +597,13 @@ public: int ret= ((PyObjectPlus*) self)->py_setattro(attr, value); - if (ret) { - if (!PyDict_SetItem(((KX_Scene *) self)->m_attrlist, attr, value)) { + if (ret==PY_SET_ATTR_MISSING) { + if (PyDict_SetItem(((KX_Scene *) self)->m_attrlist, attr, value)==0) { PyErr_Clear(); - ret= 0; + ret= PY_SET_ATTR_SUCCESS; } else { - ret= -1; + ret= PY_SET_ATTR_FAIL; } } |