Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-10-09 09:58:09 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-10-09 09:58:09 +0400
commit8d2835b5e55e901483ad839d87f11d7ada4d21a8 (patch)
tree9227efc3267711cdeb7107a84b267cf16e4441f8 /source/gameengine/Ketsji/KX_GameObject.cpp
parent62d3754a40540a246a7b0e50324df548f91c2d9b (diff)
patch [#31875] Patch to get scene access through a game object
from Jay Parker (battery)
Diffstat (limited to 'source/gameengine/Ketsji/KX_GameObject.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index cfc7b81bde5..a8f3c54508c 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -1682,7 +1682,8 @@ PyAttributeDef KX_GameObject::Attributes[] = {
KX_PYATTRIBUTE_RO_FUNCTION("name", KX_GameObject, pyattr_get_name),
KX_PYATTRIBUTE_RO_FUNCTION("parent", KX_GameObject, pyattr_get_parent),
KX_PYATTRIBUTE_RO_FUNCTION("members", KX_GameObject, pyattr_get_instance_objects),
- KX_PYATTRIBUTE_RO_FUNCTION("group", KX_GameObject, pyattr_get_dupli_group_object),
+ KX_PYATTRIBUTE_RO_FUNCTION("group", KX_GameObject, pyattr_get_dupli_group_object),
+ KX_PYATTRIBUTE_RO_FUNCTION("scene", KX_GameObject, pyattr_get_scene),
KX_PYATTRIBUTE_RO_FUNCTION("life", KX_GameObject, pyattr_get_life),
KX_PYATTRIBUTE_RW_FUNCTION("mass", KX_GameObject, pyattr_get_mass, pyattr_set_mass),
KX_PYATTRIBUTE_RW_FUNCTION("linVelocityMin", KX_GameObject, pyattr_get_lin_vel_min, pyattr_set_lin_vel_min),
@@ -1988,6 +1989,17 @@ PyObject *KX_GameObject::pyattr_get_instance_objects(void *self_v, const KX_PYAT
Py_RETURN_NONE;
}
+PyObject* KX_GameObject::pyattr_get_scene(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_GameObject *self = static_cast<KX_GameObject*>(self_v);
+ SG_Node *node = self->GetSGNode();
+ KX_Scene *scene = static_cast<KX_Scene *>(node->GetSGClientInfo());
+ if (scene) {
+ return scene->GetProxy();
+ }
+ Py_RETURN_NONE;
+}
+
PyObject *KX_GameObject::pyattr_get_dupli_group_object(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_GameObject* self= static_cast<KX_GameObject*>(self_v);