diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-10-25 02:51:44 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-10-25 02:51:44 +0400 |
commit | 47463742e264d5bfbf81215ea7d907c4e9a3a1e1 (patch) | |
tree | bab7eea6ec1903c5922d3d9dcea9c99a4b1cc42e /source/gameengine | |
parent | 4cd1e6337e516015383f3c47886b180ee16d2e3a (diff) | |
parent | 5b6224c84719213883334bcd9d2c46216053fe35 (diff) |
Cycles: svn merge -r41232:41266 ^/trunk/blender
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Converter/BL_ActionActuator.cpp | 29 | ||||
-rw-r--r-- | source/gameengine/Ketsji/BL_Action.cpp | 2 |
2 files changed, 16 insertions, 15 deletions
diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index 505bbf9dee4..6f2ca28c135 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -158,6 +158,8 @@ void BL_ActionActuator::SetLocalTime(float curtime) m_starttime = curtime; + m_flag ^= ACT_FLAG_REVERSE; + break; } } @@ -206,9 +208,8 @@ bool BL_ActionActuator::Update(double curtime, bool frame) 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 @@ bool BL_ActionActuator::Update(double curtime, bool frame) 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 @@ bool BL_ActionActuator::Update(double curtime, bool frame) { 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 @@ bool BL_ActionActuator::Update(double curtime, bool frame) 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 @@ bool BL_ActionActuator::Update(double curtime, bool frame) 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 @@ bool BL_ActionActuator::Update(double curtime, bool frame) // 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 @@ bool BL_ActionActuator::Update(double curtime, bool frame) break; } } - - if (bUseContinue && (m_flag & ACT_FLAG_ACTIVE)) - { - m_localtime = obj->GetActionFrame(m_layer); - ResetStartTime(curtime); - } return true; } diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp index 2da3fdfd225..931e5412338 100644 --- a/source/gameengine/Ketsji/BL_Action.cpp +++ b/source/gameengine/Ketsji/BL_Action.cpp @@ -279,7 +279,7 @@ void BL_Action::SetLocalTime(float curtime) 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); |