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
path: root/source
diff options
context:
space:
mode:
authorPorteries Tristan <republicthunderbolt9@gmail.com>2015-07-01 17:38:31 +0300
committerPorteries Tristan <republicthunderbolt9@gmail.com>2015-07-01 17:51:48 +0300
commit607dca070587f4d8bc4afa3c4a49e0f9a74873cd (patch)
tree3969f1922125584f4e924d6b625980ca63aa5177 /source
parentd3709f4e7948b03defa76908a2043018e3fecffa (diff)
BGE: Fix T44069 playing action during libfree.
Diffstat (limited to 'source')
-rw-r--r--source/gameengine/Converter/KX_BlenderSceneConverter.cpp2
-rw-r--r--source/gameengine/Ketsji/BL_ActionManager.cpp15
-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.h5
5 files changed, 32 insertions, 0 deletions
diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
index 9e53d9e1569..28de61f0e04 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
@@ -1082,6 +1082,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(Main *maggie)
if (IS_TAGGED(action)) {
STR_HashedString an = action->name + 2;
mapStringToActions.remove(an);
+ m_map_blender_to_gameAdtList.remove(CHashedPtr(action));
i--;
}
}
@@ -1110,6 +1111,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(Main *maggie)
}
}
else {
+ gameobj->RemoveTaggedActions();
/* free the mesh, we could be referecing a linked one! */
int mesh_index = gameobj->GetMeshCount();
while (mesh_index--) {
diff --git a/source/gameengine/Ketsji/BL_ActionManager.cpp b/source/gameengine/Ketsji/BL_ActionManager.cpp
index c3d0f9e9ad0..975f9ea6da8 100644
--- a/source/gameengine/Ketsji/BL_ActionManager.cpp
+++ b/source/gameengine/Ketsji/BL_ActionManager.cpp
@@ -26,6 +26,9 @@
#include "BL_Action.h"
#include "BL_ActionManager.h"
+#include "DNA_ID.h"
+
+#define IS_TAGGED(_id) ((_id) && (((ID *)_id)->flag & LIB_DOIT))
BL_ActionManager::BL_ActionManager(class KX_GameObject *obj):
m_obj(obj),
@@ -123,6 +126,18 @@ void BL_ActionManager::StopAction(short layer)
if (action) action->Stop();
}
+void BL_ActionManager::RemoveTaggedActions()
+{
+ for (BL_ActionMap::iterator it = m_layers.begin(); it != m_layers.end();) {
+ if (IS_TAGGED(it->second->GetAction())) {
+ delete it->second;
+ m_layers.erase(it++);
+ }
+ else
+ ++it;
+ }
+}
+
bool BL_ActionManager::IsActionDone(short layer)
{
BL_Action *action = GetAction(layer);
diff --git a/source/gameengine/Ketsji/BL_ActionManager.h b/source/gameengine/Ketsji/BL_ActionManager.h
index 45bcd104826..00e536655c7 100644
--- a/source/gameengine/Ketsji/BL_ActionManager.h
+++ b/source/gameengine/Ketsji/BL_ActionManager.h
@@ -110,6 +110,11 @@ public:
void StopAction(short layer);
/**
+ * Remove playing tagged actions.
+ */
+ void RemoveTaggedActions();
+
+ /**
* Check if an action has finished playing
*/
bool IsActionDone(short layer);
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index 5701d0e54a0..d98669cc5b4 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -469,6 +469,11 @@ void KX_GameObject::StopAction(short layer)
GetActionManager()->StopAction(layer);
}
+void KX_GameObject::RemoveTaggedActions()
+{
+ GetActionManager()->RemoveTaggedActions();
+}
+
bool KX_GameObject::IsActionDone(short layer)
{
return GetActionManager()->IsActionDone(layer);
diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h
index 670fcd6fb6e..3639d73d1e5 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -302,6 +302,11 @@ public:
void StopAction(short layer);
/**
+ * Remove playing tagged actions.
+ */
+ void RemoveTaggedActions();
+
+ /**
* Check if an action has finished playing
*/
bool IsActionDone(short layer);