diff options
author | Porteries Tristan <republicthunderbolt9@gmail.com> | 2015-10-28 16:30:52 +0300 |
---|---|---|
committer | Porteries Tristan <republicthunderbolt9@gmail.com> | 2015-10-28 17:13:12 +0300 |
commit | f10db730bc4d8139e86ce078dd0fdd9fd07a8f35 (patch) | |
tree | 7fcfc82905b9b084c59c3c79be9e063318f189a2 | |
parent | e0c60985b64cf112cb782f6378552d5fc83f0f65 (diff) |
BGE: Fix T45945: Action bouncing.
Bug introduced in 583fa7d1e, KX_GameObject.setActionFrame can make BL_Action::m_starttime negative. But in BL_Action::Update m_starttime is set to the current time if it's negative.
To fix it we use a boolean BL_Action::m_initializedTime to know if we should initialize the time in BL_Action::Update, it's more stable than comparing times.
Tested with bug task T45945 and T32054, with an extra patch about to fix suspend resume scene issues with actions : D1569
-rw-r--r-- | source/gameengine/Ketsji/BL_Action.cpp | 8 | ||||
-rw-r--r-- | source/gameengine/Ketsji/BL_Action.h | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp index 5889f5ed412..89d8ec0d4ca 100644 --- a/source/gameengine/Ketsji/BL_Action.cpp +++ b/source/gameengine/Ketsji/BL_Action.cpp @@ -84,7 +84,8 @@ BL_Action::BL_Action(class KX_GameObject* gameobj) m_blendmode(ACT_BLEND_BLEND), m_ipo_flags(0), m_done(true), - m_calc_localtime(true) + m_calc_localtime(true), + m_initializedTime(false) { } @@ -271,6 +272,7 @@ bool BL_Action::Play(const char* name, m_layer_weight = layer_weight; m_done = false; + m_initializedTime = false; return true; } @@ -400,8 +402,10 @@ void BL_Action::Update(float curtime) // Grab the start time here so we don't end up with a negative m_localframe when // suspending and resuming scenes. - if (m_starttime < 0) + if (!m_initializedTime) { m_starttime = curtime; + m_initializedTime = true; + } if (m_calc_localtime) SetLocalTime(curtime); diff --git a/source/gameengine/Ketsji/BL_Action.h b/source/gameengine/Ketsji/BL_Action.h index f41b2ef9460..f4c2975a547 100644 --- a/source/gameengine/Ketsji/BL_Action.h +++ b/source/gameengine/Ketsji/BL_Action.h @@ -69,6 +69,8 @@ private: bool m_done; bool m_calc_localtime; + /// Set to true when m_starttime is initialized in Update. + bool m_initializedTime; void ClearControllerList(); void InitIPO(); |