Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>2004-12-05 05:50:57 +0300
committerKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>2004-12-05 05:50:57 +0300
commitef971de66d946d69114c817b4340b82316c4d108 (patch)
treeea796d89d8acfa32bcaf3e686a1f40e1a8340c26 /source/gameengine
parent5d04d876f724626c36e5feba2dd6c16a3049243b (diff)
Fix Action & IPO actuators: (Bugs #1921 & #1920)
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/Converter/BL_ActionActuator.cpp31
-rw-r--r--source/gameengine/Converter/BL_ActionActuator.h22
-rw-r--r--source/gameengine/Ketsji/KX_IpoActuator.cpp14
3 files changed, 38 insertions, 29 deletions
diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp
index 0289ec42d74..22ee2371e8c 100644
--- a/source/gameengine/Converter/BL_ActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ActionActuator.cpp
@@ -166,18 +166,28 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
// result = true if animation has to be continued, false if animation stops
// maybe there are events for us in the queue !
-
- for (vector<CValue*>::iterator i=m_events.end(); !(i==m_events.begin());)
+ if (frame)
{
- i--;
- if ((*i)->GetNumber() == 0.0f)
+ for (vector<CValue*>::iterator i=m_events.end(); !(i==m_events.begin());)
{
- bNegativeEvent = true;
+ i--;
+ if ((*i)->GetNumber() == 0.0f)
+ bNegativeEvent = true;
+ else
+ bPositiveEvent= true;
+ (*i)->Release();
+ m_events.pop_back();
+ }
+
+ if (bPositiveEvent)
+ m_flag |= ACT_FLAG_ACTIVE;
+
+ if (bNegativeEvent)
+ {
+ if (!(m_flag & ACT_FLAG_ACTIVE))
+ return false;
+ m_flag &= ~ACT_FLAG_ACTIVE;
}
- else
- bPositiveEvent= true;
- (*i)->Release();
- m_events.pop_back();
}
/* We know that action actuators have been discarded from all non armature objects:
@@ -236,7 +246,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
if (!(m_flag & ACT_FLAG_LOCKINPUT)){
m_flag &= ~ACT_FLAG_REVERSE;
m_flag |= ACT_FLAG_LOCKINPUT;
- m_starttime = curtime;
+ SetStartTime(curtime);
}
}
else if (bNegativeEvent){
@@ -324,6 +334,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
m_localtime = m_endframe;
m_flag &= ~ACT_FLAG_LOCKINPUT;
}
+ SetStartTime(curtime);
}
break;
case ACT_ACTION_PLAY:
diff --git a/source/gameengine/Converter/BL_ActionActuator.h b/source/gameengine/Converter/BL_ActionActuator.h
index 0c1eb780bcb..1c3f57e965a 100644
--- a/source/gameengine/Converter/BL_ActionActuator.h
+++ b/source/gameengine/Converter/BL_ActionActuator.h
@@ -52,22 +52,22 @@ public:
PyTypeObject* T=&Type)
: SCA_IActuator(gameobj,T),
- m_blendframe(0),
m_lastpos(0, 0, 0),
+ m_blendframe(0),
m_flag(0),
m_startframe (starttime),
m_endframe(endtime) ,
m_localtime(starttime),
m_lastUpdate(-1),
- m_playtype(playtype),
m_blendin(blendin),
- m_priority(priority),
m_stridelength(stride),
+ m_playtype(playtype),
+ m_priority(priority),
m_pose(NULL),
m_blendpose(NULL),
m_userpose(NULL),
- m_propname(propname),
- m_action(action)
+ m_action(action),
+ m_propname(propname)
{
};
virtual ~BL_ActionActuator();
@@ -115,8 +115,8 @@ protected:
void SetLocalTime(float curtime);
bool ClampLocalTime();
- float m_blendframe;
MT_Point3 m_lastpos;
+ float m_blendframe;
int m_flag;
/** The frame this action starts */
float m_startframe;
@@ -128,23 +128,23 @@ protected:
float m_localtime;
float m_lastUpdate;
- short m_playtype;
float m_blendin;
float m_blendstart;
- short m_priority;
float m_stridelength;
+ short m_playtype;
+ short m_priority;
struct bPose* m_pose;
struct bPose* m_blendpose;
struct bPose* m_userpose;
- STR_String m_propname;
struct bAction *m_action;
-
+ STR_String m_propname;
};
enum {
ACT_FLAG_REVERSE = 0x00000001,
ACT_FLAG_LOCKINPUT = 0x00000002,
- ACT_FLAG_KEYUP = 0x00000004
+ ACT_FLAG_KEYUP = 0x00000004,
+ ACT_FLAG_ACTIVE = 0x00000008
};
#endif
diff --git a/source/gameengine/Ketsji/KX_IpoActuator.cpp b/source/gameengine/Ketsji/KX_IpoActuator.cpp
index ea9fe8554cc..37c0578987c 100644
--- a/source/gameengine/Ketsji/KX_IpoActuator.cpp
+++ b/source/gameengine/Ketsji/KX_IpoActuator.cpp
@@ -112,14 +112,13 @@ KX_IpoActuator::KX_IpoActuator(SCA_IObject* gameobj,
m_endframe(endtime),
m_recurse(recurse),
m_localtime(starttime),
- m_starttime(-1.0),
m_direction(1),
m_propname(propname),
m_ipo_as_force(ipo_as_force),
m_force_ipo_local(force_ipo_local),
m_type((IpoActType)acttype)
{
- // intentionally empty
+ m_starttime = -2.0*fabs(m_endframe - m_startframe) - 1.0;
}
void KX_IpoActuator::SetStart(float starttime)
@@ -189,10 +188,11 @@ bool KX_IpoActuator::Update(double curtime, bool frame)
// result = true if animation has to be continued, false if animation stops
// maybe there are events for us in the queue !
bool bNegativeEvent = false;
- int numevents = m_events.size();
+ int numevents = 0;
if (frame)
{
+ numevents = m_events.size();
for (vector<CValue*>::iterator i=m_events.end(); !(i==m_events.begin());)
{
--i;
@@ -204,15 +204,13 @@ bool KX_IpoActuator::Update(double curtime, bool frame)
m_events.clear();
if (bNegativeEvent)
- {
RemoveAllEvents();
- }
}
double start_smaller_then_end = ( m_startframe < m_endframe ? 1.0 : -1.0);
bool result=true;
- if (m_starttime < 0.0)
+ if (m_starttime < -2.0*start_smaller_then_end*(m_endframe - m_startframe))
m_starttime = curtime;
switch (m_type)
@@ -273,7 +271,7 @@ bool KX_IpoActuator::Update(double curtime, bool frame)
}
case KX_ACT_IPO_FLIPPER:
{
- result = true;
+ result = !(bNegativeEvent && (m_localtime == m_startframe));
if (numevents)
{
if (bNegativeEvent)
@@ -404,7 +402,7 @@ bool KX_IpoActuator::Update(double curtime, bool frame)
}
if (!result && m_type != KX_ACT_IPO_LOOPSTOP)
- m_starttime = -1.0;
+ m_starttime = -2.0*start_smaller_then_end*(m_endframe - m_startframe) - 1.0;
return result;
}