[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54472] trunk/blender/source/gameengine/ Ketsji: BGE: Fix for issue #32606 " Raycasts are locked to the scene of calling object" reported by Josiah Lane (solarlune).
Mitchell Stokes
mogurijin at gmail.com
Mon Feb 11 19:29:20 CET 2013
Revision: 54472
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54472
Author: moguri
Date: 2013-02-11 18:29:19 +0000 (Mon, 11 Feb 2013)
Log Message:
-----------
BGE: Fix for issue #32606 "Raycasts are locked to the scene of calling object" reported by Josiah Lane (solarlune). The raycasting functions were using the active scene instead of the object's scene.
Modified Paths:
--------------
trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
trunk/blender/source/gameengine/Ketsji/KX_GameObject.h
Modified: trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp 2013-02-11 16:22:20 UTC (rev 54471)
+++ trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp 2013-02-11 18:29:19 UTC (rev 54472)
@@ -1400,6 +1400,14 @@
return list;
}
+KX_Scene* KX_GameObject::GetScene()
+{
+ SG_Node* node = this->GetSGNode();
+ KX_Scene* scene = static_cast<KX_Scene*>(node->GetSGClientInfo());
+
+ return scene;
+}
+
/* ---------------------------------------------------------------------
* Some stuff taken from the header
* --------------------------------------------------------------------- */
@@ -1754,8 +1762,7 @@
PyObject *KX_GameObject::PyEndObject()
{
- SG_Node* node = this->GetSGNode();
- KX_Scene* scene = static_cast<KX_Scene*>(node->GetSGClientInfo());
+ KX_Scene* scene = GetScene();
scene->DelayedRemoveObject(this);
@@ -2003,8 +2010,7 @@
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());
+ KX_Scene *scene = self->GetScene();
if (scene) {
return scene->GetProxy();
}
@@ -3056,7 +3062,7 @@
if (dist != 0.0f)
toPoint = fromPoint + dist * (toPoint-fromPoint).safe_normalized();
- PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment();
+ PHY_IPhysicsEnvironment* pe = GetScene()->GetPhysicsEnvironment();
KX_IPhysicsController *spc = GetPhysicsController();
KX_GameObject *parent = GetParent();
if (!spc && parent)
@@ -3202,7 +3208,7 @@
return none_tuple_3();
}
- PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment();
+ PHY_IPhysicsEnvironment* pe = GetScene()->GetPhysicsEnvironment();
KX_IPhysicsController *spc = GetPhysicsController();
KX_GameObject *parent = GetParent();
if (!spc && parent)
Modified: trunk/blender/source/gameengine/Ketsji/KX_GameObject.h
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_GameObject.h 2013-02-11 16:22:20 UTC (rev 54471)
+++ trunk/blender/source/gameengine/Ketsji/KX_GameObject.h 2013-02-11 18:29:19 UTC (rev 54472)
@@ -923,6 +923,8 @@
CListValue* GetChildren();
CListValue* GetChildrenRecursive();
+ KX_Scene* GetScene();
+
#ifdef WITH_PYTHON
/**
* \section Python interface functions.
More information about the Bf-blender-cvs
mailing list