diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-04-12 00:58:09 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-04-12 00:58:09 +0400 |
commit | 4cd088b1059afa2e7b998c184b2c9deecd4be4a9 (patch) | |
tree | 48483da057f8a56a99db81e3dfbf5f1086d46374 /source/gameengine/Ketsji/KX_Scene.h | |
parent | 37e53b2e1f8107cb8ddbee2d67bf984a70a71276 (diff) |
BGE Py API
- setting the scene attributes would always add to the scenes custom dictionary.
- new CListValue method from_id(id)
so you can store a Game Objects id and use it to get the game object back.
ob_id = id(gameOb)
...
gameOb = scene.objects.from_id(ob_id)
This is useful because names are not always unique.
Diffstat (limited to 'source/gameengine/Ketsji/KX_Scene.h')
-rw-r--r-- | source/gameengine/Ketsji/KX_Scene.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_Scene.h b/source/gameengine/Ketsji/KX_Scene.h index 9f05ddf70c2..1bdfbd45d20 100644 --- a/source/gameengine/Ketsji/KX_Scene.h +++ b/source/gameengine/Ketsji/KX_Scene.h @@ -590,6 +590,27 @@ public: /* for dir(), python3 uses __dir__() */ static PyObject* pyattr_get_dir_dict(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static int py_base_setattro_scene(PyObject * self, PyObject *attr, PyObject *value) + { + if (value==NULL) + return ((PyObjectPlus*) self)->py_delattro(attr); + + int ret= ((PyObjectPlus*) self)->py_setattro(attr, value); + + if (ret) { + if (!PyDict_SetItem(((KX_Scene *) self)->m_attrlist, attr, value)) { + PyErr_Clear(); + ret= 0; + } + else { + ret= -1; + } + } + + return ret; + } + + virtual PyObject* py_getattro(PyObject *attr); /* name, active_camera, gravity, suspended, viewport, framing, activity_culling, activity_culling_radius */ virtual int py_setattro(PyObject *attr, PyObject *pyvalue); |