diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2013-05-15 02:52:10 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2013-05-15 02:52:10 +0400 |
commit | bb7b04bd94ee167e9561fe8b8914e3f126dd8abf (patch) | |
tree | 8832aa91513fbce98e59a0a5378ddcdf3da9d56f /source/gameengine/Ketsji/KX_GameObject.cpp | |
parent | 50c46fb9b3d1c6c423c0e6bf90a1bbc2e571c4bd (diff) |
BGE: A little bit of cleanup:
* Removing KX_Scene::RemoveAnimatedObject() since KX_Scene::NewRemoveObject() is already handling this.
* Don't create a new BL_ActionManager when replicating an object. Just set m_actionManager to NULL and let KX_GameObject::GetActionManager() allocate a new BL_ActionManager when one is needed.
* Use KX_GameObject::GetScene() instead of KX_GetActiveScene() in KX_GameObject::GetActionManager() to make sure we're using the object's scene instead of one where Python might currently be running from. This could avoid potential issues with playing actions for objects in other scenes.
Diffstat (limited to 'source/gameengine/Ketsji/KX_GameObject.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_GameObject.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index f52ee0c42c3..91488eb684a 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -165,7 +165,6 @@ KX_GameObject::~KX_GameObject() if (m_actionManager) { - KX_GetActiveScene()->RemoveAnimatedObject(this); delete m_actionManager; } @@ -413,7 +412,7 @@ BL_ActionManager* KX_GameObject::GetActionManager() // We only want to create an action manager if we need it if (!m_actionManager) { - KX_GetActiveScene()->AddAnimatedObject(this); + GetScene()->AddAnimatedObject(this); m_actionManager = new BL_ActionManager(this); } return m_actionManager; @@ -482,8 +481,7 @@ void KX_GameObject::ProcessReplica() m_pSGNode = NULL; m_pClient_info = new KX_ClientObjectInfo(*m_pClient_info); m_pClient_info->m_gameobject = this; - if (m_actionManager) - m_actionManager = new BL_ActionManager(this); + m_actionManager = NULL; m_state = 0; KX_Scene* scene = KX_GetActiveScene(); |