[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37061] branches/soc-2011-pepper/source/ gameengine/Ketsji: BGE Animations: Adding more functions to BL_ActionManager and KX_GameObject:
Mitchell Stokes
mogurijin at gmail.com
Wed Jun 1 07:46:19 CEST 2011
Revision: 37061
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37061
Author: moguri
Date: 2011-06-01 05:46:19 +0000 (Wed, 01 Jun 2011)
Log Message:
-----------
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
Modified Paths:
--------------
branches/soc-2011-pepper/source/gameengine/Ketsji/BL_ActionManager.cpp
branches/soc-2011-pepper/source/gameengine/Ketsji/BL_ActionManager.h
branches/soc-2011-pepper/source/gameengine/Ketsji/KX_GameObject.cpp
branches/soc-2011-pepper/source/gameengine/Ketsji/KX_GameObject.h
Modified: branches/soc-2011-pepper/source/gameengine/Ketsji/BL_ActionManager.cpp
===================================================================
--- branches/soc-2011-pepper/source/gameengine/Ketsji/BL_ActionManager.cpp 2011-06-01 05:40:48 UTC (rev 37060)
+++ branches/soc-2011-pepper/source/gameengine/Ketsji/BL_ActionManager.cpp 2011-06-01 05:46:19 UTC (rev 37061)
@@ -66,6 +66,14 @@
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)
Modified: branches/soc-2011-pepper/source/gameengine/Ketsji/BL_ActionManager.h
===================================================================
--- branches/soc-2011-pepper/source/gameengine/Ketsji/BL_ActionManager.h 2011-06-01 05:40:48 UTC (rev 37060)
+++ branches/soc-2011-pepper/source/gameengine/Ketsji/BL_ActionManager.h 2011-06-01 05:46:19 UTC (rev 37061)
@@ -53,6 +53,7 @@
float playback_speed=1.f);
void StopAction(short layer);
+ bool IsActionDone(short layer);
void Update(float);
#ifdef WITH_CXX_GUARDEDALLOC
public:
Modified: branches/soc-2011-pepper/source/gameengine/Ketsji/KX_GameObject.cpp
===================================================================
--- branches/soc-2011-pepper/source/gameengine/Ketsji/KX_GameObject.cpp 2011-06-01 05:40:48 UTC (rev 37060)
+++ branches/soc-2011-pepper/source/gameengine/Ketsji/KX_GameObject.cpp 2011-06-01 05:46:19 UTC (rev 37061)
@@ -352,6 +352,28 @@
}
}
+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 @@
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;
}
Modified: branches/soc-2011-pepper/source/gameengine/Ketsji/KX_GameObject.h
===================================================================
--- branches/soc-2011-pepper/source/gameengine/Ketsji/KX_GameObject.h 2011-06-01 05:40:48 UTC (rev 37060)
+++ branches/soc-2011-pepper/source/gameengine/Ketsji/KX_GameObject.h 2011-06-01 05:46:19 UTC (rev 37061)
@@ -203,6 +203,28 @@
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);
More information about the Bf-blender-cvs
mailing list