diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-04-12 18:22:51 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-04-12 18:22:51 +0400 |
commit | 332032fb9925091da49efa2e9c3653bdb3e68cba (patch) | |
tree | b482f26a2fe9fa953fbc501ddf39cb927ac0c2a6 /source/gameengine/Expressions/PyObjectPlus.h | |
parent | ee24c829b56ebddb47ae2bcfe30db5d857610450 (diff) |
BGE Python API
Support for assigning any Type to a KX_GameObject
so you can do...
gameOb.follow = otherGameOb
gameOb[otherGameOb] = distanceTo
gameOb["path"] = [(x,y,x), (x,y,x)]
del gameOb[mesh]
* types that cannot be converted into CValue types are written into the KX_GameObject dict
* the KX_GameObject dict is only initialized when needed
* Python properties in this dict cannot be accessed by logic bricks
* dir(ob) and ob.getPropertyNames() return items from both CValue and Py dictionary properties.
Also found that CType was converting python lists to CType Lists but very buggy, would crash after printing the list most times.
Use python lists instead since logic bricks dont deal with lists.
Diffstat (limited to 'source/gameengine/Expressions/PyObjectPlus.h')
-rw-r--r-- | source/gameengine/Expressions/PyObjectPlus.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h index f61b9f8d0b8..ea26ea1d201 100644 --- a/source/gameengine/Expressions/PyObjectPlus.h +++ b/source/gameengine/Expressions/PyObjectPlus.h @@ -130,9 +130,10 @@ static inline void Py_Fatal(const char *M) { * was because the attribute didnt exits of if there was some problem setting the value */ +#define PY_SET_ATTR_COERCE_FAIL 2 #define PY_SET_ATTR_FAIL 1 -#define PY_SET_ATTR_MISSING -1 -#define PY_SET_ATTR_SUCCESS 0 +#define PY_SET_ATTR_MISSING -1 +#define PY_SET_ATTR_SUCCESS 0 #define py_setattro_up(Parent) \ PyObject *descr = PyDict_GetItem(Type.tp_dict, attr); \ |