[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37062] branches/soc-2011-pepper/source/ gameengine/Converter: BGE Animations: Beginning work on the new action actuator.
Mitchell Stokes
mogurijin at gmail.com
Wed Jun 1 07:48:38 CEST 2011
Revision: 37062
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37062
Author: moguri
Date: 2011-06-01 05:48:37 +0000 (Wed, 01 Jun 2011)
Log Message:
-----------
BGE Animations: Beginning work on the new action actuator.
* Converted BL_ActionActuator::Update() to use the new action api (still just armatures)
* Not all of the functionality of the old Update() have been ported (Lood end, continued animation, etc)
* Things are still pretty messy. Once have things more flushed out, I'll start stripping more of the old actuator out.
Modified Paths:
--------------
branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.cpp
branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.h
Modified: branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.cpp
===================================================================
--- branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.cpp 2011-06-01 05:46:19 UTC (rev 37061)
+++ branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.cpp 2011-06-01 05:48:37 UTC (rev 37062)
@@ -36,6 +36,7 @@
#include "BL_ActionActuator.h"
#include "BL_ArmatureObject.h"
#include "BL_SkinDeformer.h"
+#include "BL_Action.h"
#include "KX_GameObject.h"
#include "STR_HashedString.h"
#include "MEM_guardedalloc.h"
@@ -143,7 +144,53 @@
m_localtime = m_endframe - delta_time;
}
+bool BL_ActionActuator::Update(double curtime, bool frame)
+{
+ bool bNegativeEvent = false;
+ bool bPositiveEvent = false;
+ KX_GameObject *obj = (KX_GameObject*)GetParent();
+ short play_mode = BL_Action::ACT_MODE_PLAY;
+ // Don't do anything if we're not "active"
+ if (!frame)
+ return true;
+
+ // Convert playmode
+ if (m_playtype == ACT_ACTION_LOOP_END)
+ play_mode = BL_Action::ACT_MODE_LOOP;
+ else if (m_playtype == ACT_ACTION_LOOP_STOP)
+ play_mode = BL_Action::ACT_MODE_LOOP;
+ else if (m_playtype == ACT_ACTION_PINGPONG)
+ play_mode = BL_Action::ACT_MODE_PING_PONG;
+
+
+ // Handle events
+ bNegativeEvent = m_negevent;
+ bPositiveEvent = m_posevent;
+ RemoveAllEvents();
+
+ if (!m_is_going && bPositiveEvent)
+ {
+ m_is_going = true;
+ obj->PlayAction(m_action->id.name+2, m_startframe, m_endframe, 0, m_blendin, play_mode);
+ }
+ else if (m_is_going && bNegativeEvent)
+ {
+ m_is_going = false;
+ obj->StopAction(0);
+ return false;
+ }
+
+ // Handle a finished animation
+ if (m_is_going && obj->IsActionDone(0))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+#if 0 // Kept around as reference for now
bool BL_ActionActuator::Update(double curtime, bool frame)
{
bool bNegativeEvent = false;
@@ -449,6 +496,7 @@
}
return keepgoing;
};
+#endif
#ifdef WITH_PYTHON
Modified: branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.h
===================================================================
--- branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.h 2011-06-01 05:46:19 UTC (rev 37061)
+++ branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.h 2011-06-01 05:48:37 UTC (rev 37062)
@@ -70,6 +70,7 @@
m_playtype(playtype),
m_priority(priority),
m_end_reset(end_reset),
+ m_is_going(false),
m_pose(NULL),
m_blendpose(NULL),
m_userpose(NULL),
@@ -163,6 +164,7 @@
short m_playtype;
short m_priority;
bool m_end_reset;
+ bool m_is_going;
struct bPose* m_pose;
struct bPose* m_blendpose;
struct bPose* m_userpose;
More information about the Bf-blender-cvs
mailing list