forked from bartvdbraak/blender
BGE Animations: Fixing a bug with priority and non continuous animations.
This commit is contained in:
parent
de3c95a09c
commit
d122f24c1a
@ -184,8 +184,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
|
||||
if (!m_is_going && bPositiveEvent)
|
||||
{
|
||||
m_is_going = true;
|
||||
obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, m_blendin, play_mode, 0, m_ipo_flags);
|
||||
if (m_end_reset)
|
||||
if (obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, m_blendin, play_mode, 0, m_ipo_flags) && m_end_reset)
|
||||
obj->SetActionFrame(m_layer, m_localtime);
|
||||
}
|
||||
else if (m_is_going && bNegativeEvent)
|
||||
|
@ -104,7 +104,7 @@ BL_Action::~BL_Action()
|
||||
delete m_ptrrna;
|
||||
}
|
||||
|
||||
void BL_Action::Play(const char* name,
|
||||
bool BL_Action::Play(const char* name,
|
||||
float start,
|
||||
float end,
|
||||
short priority,
|
||||
@ -118,7 +118,7 @@ void BL_Action::Play(const char* name,
|
||||
// Only start playing a new action if we're done, or if
|
||||
// the new action has a higher priority
|
||||
if (priority != 0 && !IsDone() && priority >= m_priority)
|
||||
return;
|
||||
return false;
|
||||
m_priority = priority;
|
||||
bAction* prev_action = m_action;
|
||||
|
||||
@ -128,7 +128,7 @@ void BL_Action::Play(const char* name,
|
||||
{
|
||||
printf("Failed to load action: %s\n", name);
|
||||
m_done = true;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (prev_action != m_action)
|
||||
@ -178,6 +178,8 @@ void BL_Action::Play(const char* name,
|
||||
m_speed = playback_speed;
|
||||
|
||||
m_done = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BL_Action::Stop()
|
||||
@ -329,6 +331,9 @@ void BL_Action::Update(float curtime)
|
||||
game_blend_poses(m_pose, m_blendpose, weight);
|
||||
}
|
||||
|
||||
|
||||
// Handle layer blending
|
||||
|
||||
obj->SetPose(m_pose);
|
||||
|
||||
obj->SetActiveAction(NULL, 0, curtime);
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
BL_Action(class KX_GameObject* gameobj);
|
||||
~BL_Action();
|
||||
|
||||
void Play(const char* name,
|
||||
bool Play(const char* name,
|
||||
float start,
|
||||
float end,
|
||||
short priority,
|
||||
|
@ -56,7 +56,7 @@ void BL_ActionManager::SetActionFrame(short layer, float frame)
|
||||
m_layers[layer]->SetFrame(frame);
|
||||
}
|
||||
|
||||
void BL_ActionManager::PlayAction(const char* name,
|
||||
bool BL_ActionManager::PlayAction(const char* name,
|
||||
float start,
|
||||
float end,
|
||||
short layer,
|
||||
@ -67,7 +67,7 @@ void BL_ActionManager::PlayAction(const char* name,
|
||||
short ipo_flags,
|
||||
float playback_speed)
|
||||
{
|
||||
m_layers[layer]->Play(name, start, end, priority, blendin, play_mode, blend_mode, ipo_flags, playback_speed);
|
||||
return m_layers[layer]->Play(name, start, end, priority, blendin, play_mode, blend_mode, ipo_flags, playback_speed);
|
||||
}
|
||||
|
||||
void BL_ActionManager::StopAction(short layer)
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
BL_ActionManager(class KX_GameObject* obj);
|
||||
~BL_ActionManager();
|
||||
|
||||
void PlayAction(const char* name,
|
||||
bool PlayAction(const char* name,
|
||||
float start,
|
||||
float end,
|
||||
short layer=0,
|
||||
|
@ -360,7 +360,7 @@ BL_ActionManager* KX_GameObject::GetActionManager()
|
||||
return m_actionManager;
|
||||
}
|
||||
|
||||
void KX_GameObject::PlayAction(const char* name,
|
||||
bool KX_GameObject::PlayAction(const char* name,
|
||||
float start,
|
||||
float end,
|
||||
short layer,
|
||||
@ -371,7 +371,7 @@ void KX_GameObject::PlayAction(const char* name,
|
||||
short ipo_flags,
|
||||
float playback_speed)
|
||||
{
|
||||
GetActionManager()->PlayAction(name, start, end, layer, priority, blendin, play_mode, blend_mode, ipo_flags, playback_speed);
|
||||
return GetActionManager()->PlayAction(name, start, end, layer, priority, blendin, play_mode, blend_mode, ipo_flags, playback_speed);
|
||||
}
|
||||
|
||||
void KX_GameObject::StopAction(short layer)
|
||||
|
@ -211,7 +211,7 @@ public:
|
||||
/**
|
||||
* Adds an action to the object's action manager
|
||||
*/
|
||||
void PlayAction(const char* name,
|
||||
bool PlayAction(const char* name,
|
||||
float start,
|
||||
float end,
|
||||
short layer=0,
|
||||
|
Loading…
Reference in New Issue
Block a user