Index: source/gameengine/Ketsji/KX_GameObject.cpp =================================================================== --- source/gameengine/Ketsji/KX_GameObject.cpp (revision 48135) +++ source/gameengine/Ketsji/KX_GameObject.cpp (working copy) @@ -1661,6 +1661,7 @@ KX_PYATTRIBUTE_RO_FUNCTION("childrenRecursive", KX_GameObject, pyattr_get_children_recursive), KX_PYATTRIBUTE_RO_FUNCTION("attrDict", KX_GameObject, pyattr_get_attrDict), KX_PYATTRIBUTE_RW_FUNCTION("color", KX_GameObject, pyattr_get_obcolor, pyattr_set_obcolor), + KX_PYATTRIBUTE_RO_FUNCTION("scene", KX_GameObject, pyattr_get_scene), /* experimental, don't rely on these yet */ KX_PYATTRIBUTE_RO_FUNCTION("sensors", KX_GameObject, pyattr_get_sensors), @@ -2436,6 +2437,16 @@ return PY_SET_ATTR_SUCCESS; } +PyObject* KX_GameObject::pyattr_get_scene(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_GameObject* self= static_cast(self_v); + SG_Node* node = self->GetSGNode(); + KX_Scene* scene = static_cast(node->GetSGClientInfo()); + if(scene) + return scene->GetProxy(); + Py_RETURN_NONE; +} + /* These are experimental! */ PyObject* KX_GameObject::pyattr_get_sensors(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { Index: source/gameengine/Ketsji/KX_GameObject.h =================================================================== --- source/gameengine/Ketsji/KX_GameObject.h (revision 48135) +++ source/gameengine/Ketsji/KX_GameObject.h (working copy) @@ -994,6 +994,7 @@ static PyObject* pyattr_get_attrDict(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_obcolor(void *selv_v, const KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_obcolor(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); + static PyObject* pyattr_get_scene(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); /* Experimental! */ static PyObject* pyattr_get_sensors(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);