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:
authorMitchell Stokes <mogurijin@gmail.com>2014-05-05 02:37:18 +0400
committerMitchell Stokes <mogurijin@gmail.com>2014-05-05 02:39:15 +0400
commit362b25b38287cb75e4d22b30bdbc7f47e8eb3fdf (patch)
tree6d4b60050f1a98c1fa8ac6446f451d5fe3200218 /source/gameengine
parentd27eea6dc6886ff900d62d77863e432d724d4de1 (diff)
Fix T39928: Blender crash/freeze when game engine is started with animation played directly on camera object with parents.
Updating object IPOs is not currently thread-safe since it also updates children. This leads to problems when parents and children are both animated. For now, updating object IPOs is done in its own loop to avoid threading issues.
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/Ketsji/BL_Action.cpp9
-rw-r--r--source/gameengine/Ketsji/BL_Action.h4
-rw-r--r--source/gameengine/Ketsji/BL_ActionManager.cpp11
-rw-r--r--source/gameengine/Ketsji/BL_ActionManager.h5
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp5
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.h6
-rw-r--r--source/gameengine/Ketsji/KX_Scene.cpp4
7 files changed, 43 insertions, 1 deletions
diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp
index e4ab2d5ce28..a50c07a486a 100644
--- a/source/gameengine/Ketsji/BL_Action.cpp
+++ b/source/gameengine/Ketsji/BL_Action.cpp
@@ -485,8 +485,15 @@ void BL_Action::Update(float curtime)
}
}
- m_obj->UpdateIPO(m_localtime, m_ipo_flags & ACT_IPOFLAG_CHILD);
+ // This isn't thread-safe, so we move it into it's own function for now
+ //m_obj->UpdateIPO(m_localtime, m_ipo_flags & ACT_IPOFLAG_CHILD);
if (m_done)
ClearControllerList();
}
+
+void BL_Action::UpdateIPOs()
+{
+ if (!m_done)
+ m_obj->UpdateIPO(m_localtime, m_ipo_flags & ACT_IPOFLAG_CHILD);
+}
diff --git a/source/gameengine/Ketsji/BL_Action.h b/source/gameengine/Ketsji/BL_Action.h
index 463d177c876..dd1cd1f69ff 100644
--- a/source/gameengine/Ketsji/BL_Action.h
+++ b/source/gameengine/Ketsji/BL_Action.h
@@ -105,6 +105,10 @@ public:
* Update the action's frame, etc.
*/
void Update(float curtime);
+ /**
+ * Update object IPOs (note: not thread-safe!)
+ */
+ void UpdateIPOs();
// Accessors
float GetFrame();
diff --git a/source/gameengine/Ketsji/BL_ActionManager.cpp b/source/gameengine/Ketsji/BL_ActionManager.cpp
index 2e882ceba74..404f276eca8 100644
--- a/source/gameengine/Ketsji/BL_ActionManager.cpp
+++ b/source/gameengine/Ketsji/BL_ActionManager.cpp
@@ -102,3 +102,14 @@ void BL_ActionManager::Update(float curtime)
}
}
}
+
+void BL_ActionManager::UpdateIPOs()
+{
+ for (int i=0; i<MAX_ACTION_LAYERS; ++i)
+ {
+ if (!m_layers[i]->IsDone())
+ {
+ m_layers[i]->UpdateIPOs();
+ }
+ }
+}
diff --git a/source/gameengine/Ketsji/BL_ActionManager.h b/source/gameengine/Ketsji/BL_ActionManager.h
index 8c5b8e909da..be9097c3ca3 100644
--- a/source/gameengine/Ketsji/BL_ActionManager.h
+++ b/source/gameengine/Ketsji/BL_ActionManager.h
@@ -98,6 +98,11 @@ public:
*/
void Update(float);
+ /**
+ * Update object IPOs (note: not thread-safe!)
+ */
+ void UpdateIPOs();
+
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:BL_ActionManager")
#endif
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index 7042e6ed360..9ea76980c20 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -462,6 +462,11 @@ void KX_GameObject::UpdateActionManager(float curtime)
GetActionManager()->Update(curtime);
}
+void KX_GameObject::UpdateActionIPOs()
+{
+ GetActionManager()->UpdateIPOs();
+}
+
float KX_GameObject::GetActionFrame(short layer)
{
return GetActionManager()->GetActionFrame(layer);
diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h
index ac0afca91eb..7450be4fdef 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -300,6 +300,12 @@ public:
*/
void UpdateActionManager(float curtime);
+ /**
+ * Have the action manager update IPOs
+ * note: not thread-safe!
+ */
+ void UpdateActionIPOs();
+
/*********************************
* End Animation API
*********************************/
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index 5a33a612d2e..4c9fba8a10b 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -1658,6 +1658,10 @@ void KX_Scene::UpdateAnimations(double curtime)
BLI_task_pool_work_and_wait(pool);
BLI_task_pool_free(pool);
+
+ for (int i=0; i<m_animatedlist->GetCount(); ++i) {
+ ((KX_GameObject*)m_animatedlist->GetValue(i))->UpdateActionIPOs();
+ }
}
void KX_Scene::LogicUpdateFrame(double curtime, bool frame)