diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2013-02-23 04:28:25 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2013-02-23 04:28:25 +0400 |
commit | eab8a25e038a0068ddc3dd78c07268bcb84a6ade (patch) | |
tree | 2f834a7ee5a3e090e9fbf70d167b0e0ee85ef28d /source | |
parent | d05cb9bca5654a621a9daf7547fa031ab467ef85 (diff) |
BGE: For BL_Action, use the object's scene rather than the "active" scene, which can potentially cause problems with multiple scenes.
Diffstat (limited to 'source')
-rw-r--r-- | source/gameengine/Ketsji/BL_Action.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp index 089a4050023..eb5d8844b6c 100644 --- a/source/gameengine/Ketsji/BL_Action.cpp +++ b/source/gameengine/Ketsji/BL_Action.cpp @@ -36,7 +36,6 @@ // These three are for getting the action from the logic manager #include "KX_Scene.h" -#include "KX_PythonInit.h" #include "SCA_LogicManager.h" extern "C" { @@ -132,8 +131,10 @@ bool BL_Action::Play(const char* name, m_priority = priority; bAction* prev_action = m_action; + KX_Scene* kxscene = m_obj->GetScene(); + // First try to load the action - m_action = (bAction*)KX_GetActiveScene()->GetLogicManager()->GetActionByName(name); + m_action = (bAction*)kxscene->GetLogicManager()->GetActionByName(name); if (!m_action) { printf("Failed to load action: %s\n", name); @@ -157,13 +158,13 @@ bool BL_Action::Play(const char* name, ClearControllerList(); // Create an SG_Controller - SG_Controller *sg_contr = BL_CreateIPO(m_action, m_obj, KX_GetActiveScene()->GetSceneConverter()); + SG_Controller *sg_contr = BL_CreateIPO(m_action, m_obj, kxscene->GetSceneConverter()); m_sg_contr_list.push_back(sg_contr); m_obj->GetSGNode()->AddSGController(sg_contr); sg_contr->SetObject(m_obj->GetSGNode()); // Try obcolor - sg_contr = BL_CreateObColorIPO(m_action, m_obj, KX_GetActiveScene()->GetSceneConverter()); + sg_contr = BL_CreateObColorIPO(m_action, m_obj, kxscene->GetSceneConverter()); if (sg_contr) { m_sg_contr_list.push_back(sg_contr); m_obj->GetSGNode()->AddSGController(sg_contr); @@ -173,14 +174,14 @@ bool BL_Action::Play(const char* name, // Extra controllers if (m_obj->GetGameObjectType() == SCA_IObject::OBJ_LIGHT) { - sg_contr = BL_CreateLampIPO(m_action, m_obj, KX_GetActiveScene()->GetSceneConverter()); + sg_contr = BL_CreateLampIPO(m_action, m_obj, kxscene->GetSceneConverter()); m_sg_contr_list.push_back(sg_contr); m_obj->GetSGNode()->AddSGController(sg_contr); sg_contr->SetObject(m_obj->GetSGNode()); } else if (m_obj->GetGameObjectType() == SCA_IObject::OBJ_CAMERA) { - sg_contr = BL_CreateCameraIPO(m_action, m_obj, KX_GetActiveScene()->GetSceneConverter()); + sg_contr = BL_CreateCameraIPO(m_action, m_obj, kxscene->GetSceneConverter()); m_sg_contr_list.push_back(sg_contr); m_obj->GetSGNode()->AddSGController(sg_contr); sg_contr->SetObject(m_obj->GetSGNode()); |