[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39089] branches/soc-2011-pepper/source/ gameengine/Converter: BGE Animations: Making the ping pong mode for action actuators behave more like trunk.
Mitchell Stokes
mogurijin at gmail.com
Sat Aug 6 02:35:17 CEST 2011
Revision: 39089
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39089
Author: moguri
Date: 2011-08-06 00:35:16 +0000 (Sat, 06 Aug 2011)
Log Message:
-----------
BGE Animations: Making the ping pong mode for action actuators behave more like trunk. The behavior is a lot closer, but there are still differences when interrupting a ping pong action. I'm still trying to decide if these are acceptable differences as they don't look all that simple to fix.
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-08-05 22:17:23 UTC (rev 39088)
+++ branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.cpp 2011-08-06 00:35:16 UTC (rev 39089)
@@ -153,7 +153,18 @@
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;
+ {
+ // We handle ping pong ourselves to increase compabitility with the pre-Pepper actuator
+ play_mode = BL_Action::ACT_MODE_PLAY;
+
+ if (m_flag & ACT_FLAG_REVERSE)
+ {
+ float tmp = start;
+ start = end;
+ end = tmp;
+ m_localtime = end;
+ }
+ }
else if (m_playtype == ACT_ACTION_FROM_PROP)
{
CValue* prop = GetParent()->GetProperty(m_propname);
@@ -173,13 +184,14 @@
if (bPositiveEvent)
{
- if (m_flag & ACT_FLAG_ACTIVE && m_flag & ACT_FLAG_CONTINUE)
+
+ if (m_playtype != ACT_ACTION_PINGPONG && m_flag & ACT_FLAG_ACTIVE && m_flag & ACT_FLAG_CONTINUE)
start = m_localtime = obj->GetActionFrame(m_layer);
if (obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, m_blendin, play_mode, m_layer_weight, m_ipo_flags))
{
m_flag |= ACT_FLAG_ACTIVE;
- if (m_flag & ACT_FLAG_CONTINUE)
+ if (m_playtype != ACT_ACTION_PINGPONG && m_flag & ACT_FLAG_CONTINUE)
obj->SetActionFrame(m_layer, m_localtime);
if (m_playtype == ACT_ACTION_PLAY)
@@ -211,7 +223,7 @@
m_flag &= ~ACT_FLAG_ACTIVE;
return false;
}
- else if (m_playtype == ACT_ACTION_LOOP_END)
+ else if (m_playtype == ACT_ACTION_LOOP_END || m_playtype == ACT_ACTION_PINGPONG)
{
// Convert into a play and let it finish
start = obj->GetActionFrame(m_layer);
@@ -219,6 +231,9 @@
obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, 0, BL_Action::ACT_MODE_PLAY, m_layer_weight, m_ipo_flags);
m_flag |= ACT_FLAG_PLAY_END;
+
+ if (m_playtype == ACT_ACTION_PINGPONG)
+ m_flag ^= ACT_FLAG_REVERSE;
}
else if (m_playtype == ACT_ACTION_FLIPPER)
{
Modified: branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.h
===================================================================
--- branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.h 2011-08-05 22:17:23 UTC (rev 39088)
+++ branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.h 2011-08-06 00:35:16 UTC (rev 39089)
@@ -151,7 +151,7 @@
STR_String m_framepropname;
};
-// The first values are not used in BL_ActionActuator anymore,
+// Not all of these values are used in BL_ActionActuator anymore,
// but BL_ShapeActionActuator still uses them, so we keep them around
// for now.
enum {
More information about the Bf-blender-cvs
mailing list