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:
Diffstat (limited to 'source/gameengine/Ketsji/BL_ActionManager.cpp')
-rw-r--r--source/gameengine/Ketsji/BL_ActionManager.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/source/gameengine/Ketsji/BL_ActionManager.cpp b/source/gameengine/Ketsji/BL_ActionManager.cpp
index 07adce73b4a..9e4690548d3 100644
--- a/source/gameengine/Ketsji/BL_ActionManager.cpp
+++ b/source/gameengine/Ketsji/BL_ActionManager.cpp
@@ -26,9 +26,13 @@
#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)
+ m_obj(obj),
+ m_prevUpdate(-1.0f)
{
}
@@ -64,6 +68,12 @@ float BL_ActionManager::GetActionFrame(short layer)
return action ? action->GetFrame() : 0.f;
}
+const char *BL_ActionManager::GetActionName(short layer)
+{
+ BL_Action *action = GetAction(layer);
+ return action ? action->GetName() : "";
+}
+
void BL_ActionManager::SetActionFrame(short layer, float frame)
{
BL_Action *action = GetAction(layer);
@@ -122,6 +132,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);
@@ -131,6 +153,10 @@ bool BL_ActionManager::IsActionDone(short layer)
void BL_ActionManager::Update(float curtime)
{
+ if (m_prevUpdate == curtime)
+ return;
+ m_prevUpdate = curtime;
+
BL_ActionMap::iterator it;
for (it = m_layers.begin(); it != m_layers.end(); )
{