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>2011-06-01 09:46:19 +0400
committerMitchell Stokes <mogurijin@gmail.com>2011-06-01 09:46:19 +0400
commit54a37ba8559ef33bb35146c7cfc7dd6b38004d7c (patch)
tree9ad410029b757070764c28e504394440ef965314 /source/gameengine/Ketsji
parentb31385f3bd4af4e524fdeb719563dd293a86957c (diff)
BGE Animations: Adding more functions to BL_ActionManager and KX_GameObject:
BL_ActionManager: * IsActionDone(short layer) - Checks to see if the animation on the given layer has finished. KX_GameObject: * PlayAction(...) - Adds an action to the object's action manager * StopAction(short layer) - Remove an action from the object's action manager * IsActionDone(short layer) - Check if an action has finished playing
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r--source/gameengine/Ketsji/BL_ActionManager.cpp8
-rw-r--r--source/gameengine/Ketsji/BL_ActionManager.h1
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp24
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.h22
4 files changed, 54 insertions, 1 deletions
diff --git a/source/gameengine/Ketsji/BL_ActionManager.cpp b/source/gameengine/Ketsji/BL_ActionManager.cpp
index a4c8a7fe93f..ddbf287e501 100644
--- a/source/gameengine/Ketsji/BL_ActionManager.cpp
+++ b/source/gameengine/Ketsji/BL_ActionManager.cpp
@@ -66,6 +66,14 @@ void BL_ActionManager::StopAction(short layer)
m_layers[layer] = 0;
}
+bool BL_ActionManager::IsActionDone(short layer)
+{
+ if (m_layers[layer])
+ return m_layers[layer]->IsDone();
+
+ return true;
+}
+
void BL_ActionManager::Update(float curtime)
{
for (int i=0; i<MAX_ACTION_LAYERS; ++i)
diff --git a/source/gameengine/Ketsji/BL_ActionManager.h b/source/gameengine/Ketsji/BL_ActionManager.h
index a57e0e1ce87..4509020926f 100644
--- a/source/gameengine/Ketsji/BL_ActionManager.h
+++ b/source/gameengine/Ketsji/BL_ActionManager.h
@@ -53,6 +53,7 @@ public:
float playback_speed=1.f);
void StopAction(short layer);
+ bool IsActionDone(short layer);
void Update(float);
#ifdef WITH_CXX_GUARDEDALLOC
public:
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index 804a3d394ec..f5115f50d81 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -352,6 +352,28 @@ void KX_GameObject::RemoveParent(KX_Scene *scene)
}
}
+void KX_GameObject::PlayAction(const char* name,
+ float start,
+ float end,
+ short layer,
+ float blendin,
+ short play_mode,
+ short blend_mode,
+ float playback_speed)
+{
+ m_actionManager->PlayAction(this, name, start, end, layer, blendin, play_mode, blend_mode, playback_speed);
+}
+
+void KX_GameObject::StopAction(short layer)
+{
+ m_actionManager->StopAction(layer);
+}
+
+bool KX_GameObject::IsActionDone(short layer)
+{
+ return m_actionManager->IsActionDone(layer);
+}
+
void KX_GameObject::UpdateActionManager(float curtime)
{
m_actionManager->Update(curtime);
@@ -3024,7 +3046,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, playAction,
blend_mode = BL_Action::ACT_BLEND_NONE;
}
- m_actionManager->PlayAction(this, name, start, end, layer, blendin, play_mode, blend_mode, speed);
+ PlayAction(name, start, end, layer, blendin, play_mode, blend_mode, speed);
Py_RETURN_NONE;
}
diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h
index a5ca5f872d5..75c71833ce1 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -203,6 +203,28 @@ public:
void RemoveParent(KX_Scene *scene);
/**
+ * Adds an action to the object's action manager
+ */
+ void PlayAction(const char* name,
+ float start,
+ float end,
+ short layer=0,
+ float blendin=0.f,
+ short play_mode=0,
+ short blend_mode=0,
+ float playback_speed=1.f);
+
+ /**
+ * Remove an action from the object's action manager
+ */
+ void StopAction(short layer);
+
+ /**
+ * Check if an action has finished playing
+ */
+ bool IsActionDone(short layer);
+
+ /**
* Kick the object's action manager
*/
void UpdateActionManager(float curtime);