Revision: 41239
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41239
Author:   moguri
Date:     2011-10-24 07:25:34 +0000 (Mon, 24 Oct 2011)
Log Message:
-----------
BGE Action Actuator fixes:
  * Ping pong now has the same behavior as 2.59.
  * Setting the frame on a animation playing in reverse now works correctly
  * The frames for continuous were a frame or so behind, this is now fixed.

Modified Paths:
--------------
    trunk/blender/source/gameengine/Converter/BL_ActionActuator.cpp
    trunk/blender/source/gameengine/Ketsji/BL_Action.cpp

Modified: trunk/blender/source/gameengine/Converter/BL_ActionActuator.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/BL_ActionActuator.cpp     
2011-10-24 06:57:53 UTC (rev 41238)
+++ trunk/blender/source/gameengine/Converter/BL_ActionActuator.cpp     
2011-10-24 07:25:34 UTC (rev 41239)
@@ -158,6 +158,8 @@
 
                        m_starttime = curtime;
 
+                       m_flag ^= ACT_FLAG_REVERSE;
+
                        break;
                }
        }
@@ -206,9 +208,8 @@
                
                        if (m_flag & ACT_FLAG_REVERSE)
                        {
-                               m_localtime = start;
-                               start = end;
-                               end = m_localtime;
+                               start = m_endframe;
+                               end = m_startframe;
                        }
 
                        break;
@@ -236,6 +237,12 @@
                RemoveAllEvents();
        }
 
+       if (bUseContinue && (m_flag & ACT_FLAG_ACTIVE))
+       {
+               m_localtime = obj->GetActionFrame(m_layer);
+               ResetStartTime(curtime);
+       }
+
        if (m_flag & ACT_FLAG_ATTEMPT_PLAY)
                SetLocalTime(curtime);
 
@@ -257,6 +264,9 @@
        {
                m_flag &= ~ACT_FLAG_ACTIVE;
                m_flag &= ~ACT_FLAG_ATTEMPT_PLAY;
+
+               if (m_playtype == ACT_ACTION_PINGPONG)
+                       m_flag ^= ACT_FLAG_REVERSE;
                return false;
        }
        
@@ -266,7 +276,7 @@
 
        if (bPositiveEvent || (m_flag & ACT_FLAG_ATTEMPT_PLAY && !(m_flag & 
ACT_FLAG_ACTIVE)))
        {
-               if (bPositiveEvent)
+               if (bPositiveEvent && m_playtype == ACT_ACTION_PLAY)
                {
                        if (obj->IsActionDone(m_layer))
                                m_localtime = start;
@@ -279,7 +289,7 @@
                        if (bUseContinue)
                                obj->SetActionFrame(m_layer, m_localtime);
 
-                       if (m_playtype == ACT_ACTION_PLAY)
+                       if (m_playtype == ACT_ACTION_PLAY || m_playtype == 
ACT_ACTION_PINGPONG)
                                m_flag |= ACT_FLAG_PLAY_END;
                        else
                                m_flag &= ~ACT_FLAG_PLAY_END;
@@ -307,9 +317,6 @@
                                // We're done
                                m_flag &= ~ACT_FLAG_ACTIVE;
                                return false;
-                       case ACT_ACTION_PINGPONG:
-                               m_flag ^= ACT_FLAG_REVERSE;
-                               // Now fallthrough to LOOP_END code
                        case ACT_ACTION_LOOP_END:
                                // Convert into a play and let it finish
                                obj->SetPlayMode(m_layer, 
BL_Action::ACT_MODE_PLAY);
@@ -327,12 +334,6 @@
                                break;
                }
        }
-       
-       if (bUseContinue && (m_flag & ACT_FLAG_ACTIVE))
-       {
-               m_localtime = obj->GetActionFrame(m_layer);
-               ResetStartTime(curtime);
-       }
 
        return true;
 }

Modified: trunk/blender/source/gameengine/Ketsji/BL_Action.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/BL_Action.cpp        2011-10-24 
06:57:53 UTC (rev 41238)
+++ trunk/blender/source/gameengine/Ketsji/BL_Action.cpp        2011-10-24 
07:25:34 UTC (rev 41239)
@@ -279,7 +279,7 @@
 
 void BL_Action::ResetStartTime(float curtime)
 {
-       float dt = m_localtime - m_startframe;
+       float dt = (m_localtime > m_startframe) ? m_localtime - m_startframe : 
m_startframe - m_localtime;
 
        m_starttime = curtime - dt / 
(KX_KetsjiEngine::GetAnimFrameRate()*m_speed);
        SetLocalTime(curtime);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to