From 73fd8000775e1558b5140ace86860477d61d8b98 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 16 Sep 2008 21:11:38 +0000 Subject: [PATCH] Fix for bug #5413: game engine armature actions and shapes keys didn't work correct with scene suspend/resume, now works the same as IPO's. --- source/gameengine/Converter/BL_ActionActuator.cpp | 2 ++ source/gameengine/Converter/BL_ShapeActionActuator.cpp | 2 ++ source/gameengine/Ketsji/KX_IpoActuator.cpp | 7 ++++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index 119465c8726..b8514e33127 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -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 ! diff --git a/source/gameengine/Converter/BL_ShapeActionActuator.cpp b/source/gameengine/Converter/BL_ShapeActionActuator.cpp index 679b0df7ec6..da5ca1e7c95 100644 --- a/source/gameengine/Converter/BL_ShapeActionActuator.cpp +++ b/source/gameengine/Converter/BL_ShapeActionActuator.cpp @@ -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 ! diff --git a/source/gameengine/Ketsji/KX_IpoActuator.cpp b/source/gameengine/Ketsji/KX_IpoActuator.cpp index a203ea6a6ff..75e4ade6574 100644 --- a/source/gameengine/Ketsji/KX_IpoActuator.cpp +++ b/source/gameengine/Ketsji/KX_IpoActuator.cpp @@ -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; }