Fix for bug #5413: game engine armature actions and shapes keys
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 16 Sep 2008 21:11:38 +0000 (21:11 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 16 Sep 2008 21:11:38 +0000 (21:11 +0000)
didn't work correct with scene suspend/resume, now works the same
as IPO's.

source/gameengine/Converter/BL_ActionActuator.cpp
source/gameengine/Converter/BL_ShapeActionActuator.cpp
source/gameengine/Ketsji/KX_IpoActuator.cpp

index 119465c87267e3ea54ed6e4ccc105d24779583cb..b8514e3312773de8f3e293a8fb9e76b1ccad6bb7 100644 (file)
@@ -152,6 +152,8 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
        bool apply=true;
        int     priority;
        float newweight;
+
+       curtime -= KX_KetsjiEngine::GetSuspendedDelta();
        
        // result = true if animation has to be continued, false if animation stops
        // maybe there are events for us in the queue !
index 679b0df7ec685951bd9acf26b13ad6ebfd0a74b8..da5ca1e7c95ca6be9be860e6bb930db2d791db9b 100644 (file)
@@ -155,6 +155,8 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
        bool apply=true;
        int     priority;
        float newweight;
+
+       curtime -= KX_KetsjiEngine::GetSuspendedDelta();
        
        // result = true if animation has to be continued, false if animation stops
        // maybe there are events for us in the queue !
index a203ea6a6ff30ada6676ea60f3b5f7c84774260a..75e4ade6574500d8525ffd5a1da27e24a449bbc1 100644 (file)
@@ -130,7 +130,6 @@ void KX_IpoActuator::SetStartTime(float curtime)
 {
        float direction = m_startframe < m_endframe ? 1.0f : -1.0f;
 
-       curtime = curtime - KX_KetsjiEngine::GetSuspendedDelta();       
        if (m_direction > 0)
                m_starttime = curtime - direction*(m_localtime - m_startframe)/KX_KetsjiEngine::GetAnimFrameRate();
        else
@@ -139,7 +138,7 @@ void KX_IpoActuator::SetStartTime(float curtime)
 
 void KX_IpoActuator::SetLocalTime(float curtime)
 {
-       float delta_time = ((curtime - m_starttime) - KX_KetsjiEngine::GetSuspendedDelta())*KX_KetsjiEngine::GetAnimFrameRate();
+       float delta_time = (curtime - m_starttime)*KX_KetsjiEngine::GetAnimFrameRate();
        
        // negative delta_time is caused by floating point inaccuracy
        // perhaps the inaccuracy could be reduced a bit
@@ -165,6 +164,8 @@ bool KX_IpoActuator::Update(double curtime, bool frame)
        int numevents = 0;
        bool bIpoStart = false;
 
+       curtime -= KX_KetsjiEngine::GetSuspendedDelta();
+
        if (frame)
        {
                numevents = m_events.size();
@@ -180,7 +181,7 @@ bool KX_IpoActuator::Update(double curtime, bool frame)
                if (m_starttime < -2.0f*start_smaller_then_end*(m_endframe - m_startframe))
                {
                        // start for all Ipo, initial start for LOOP_STOP
-                       m_starttime = curtime - KX_KetsjiEngine::GetSuspendedDelta();
+                       m_starttime = curtime;
                        m_bIpoPlaying = true;
                        bIpoStart = true;
                }