[Bf-blender-cvs] [f10db73] master: BGE: Fix T45945: Action bouncing.
Porteries Tristan
noreply at git.blender.org
Wed Oct 28 15:10:54 CET 2015
Commit: f10db730bc4d8139e86ce078dd0fdd9fd07a8f35
Author: Porteries Tristan
Date: Wed Oct 28 14:30:52 2015 +0100
Branches: master
https://developer.blender.org/rBf10db730bc4d8139e86ce078dd0fdd9fd07a8f35
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
===================================================================
M source/gameengine/Ketsji/BL_Action.cpp
M source/gameengine/Ketsji/BL_Action.h
===================================================================
diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp
index 5889f5e..89d8ec0 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 f41b2ef..f4c2975 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();
More information about the Bf-blender-cvs
mailing list