[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37932] branches/soc-2011-pepper/source/ gameengine: BGE Animations: Fixing a bug with priority and non continuous animations.
Mitchell Stokes
mogurijin at gmail.com
Wed Jun 29 03:53:18 CEST 2011
Revision: 37932
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37932
Author: moguri
Date: 2011-06-29 01:53:17 +0000 (Wed, 29 Jun 2011)
Log Message:
-----------
BGE Animations: Fixing a bug with priority and non continuous animations.
Modified Paths:
--------------
branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.cpp
branches/soc-2011-pepper/source/gameengine/Ketsji/BL_Action.cpp
branches/soc-2011-pepper/source/gameengine/Ketsji/BL_Action.h
branches/soc-2011-pepper/source/gameengine/Ketsji/BL_ActionManager.cpp
branches/soc-2011-pepper/source/gameengine/Ketsji/BL_ActionManager.h
branches/soc-2011-pepper/source/gameengine/Ketsji/KX_GameObject.cpp
branches/soc-2011-pepper/source/gameengine/Ketsji/KX_GameObject.h
Modified: branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.cpp
===================================================================
--- branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.cpp 2011-06-29 01:05:12 UTC (rev 37931)
+++ branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.cpp 2011-06-29 01:53:17 UTC (rev 37932)
@@ -184,8 +184,7 @@
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)
Modified: branches/soc-2011-pepper/source/gameengine/Ketsji/BL_Action.cpp
===================================================================
--- branches/soc-2011-pepper/source/gameengine/Ketsji/BL_Action.cpp 2011-06-29 01:05:12 UTC (rev 37931)
+++ branches/soc-2011-pepper/source/gameengine/Ketsji/BL_Action.cpp 2011-06-29 01:53:17 UTC (rev 37932)
@@ -104,7 +104,7 @@
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 @@
// 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 @@
{
printf("Failed to load action: %s\n", name);
m_done = true;
- return;
+ return false;
}
if (prev_action != m_action)
@@ -178,6 +178,8 @@
m_speed = playback_speed;
m_done = false;
+
+ return true;
}
void BL_Action::Stop()
@@ -329,6 +331,9 @@
game_blend_poses(m_pose, m_blendpose, weight);
}
+
+ // Handle layer blending
+
obj->SetPose(m_pose);
obj->SetActiveAction(NULL, 0, curtime);
Modified: branches/soc-2011-pepper/source/gameengine/Ketsji/BL_Action.h
===================================================================
--- branches/soc-2011-pepper/source/gameengine/Ketsji/BL_Action.h 2011-06-29 01:05:12 UTC (rev 37931)
+++ branches/soc-2011-pepper/source/gameengine/Ketsji/BL_Action.h 2011-06-29 01:53:17 UTC (rev 37932)
@@ -78,7 +78,7 @@
BL_Action(class KX_GameObject* gameobj);
~BL_Action();
- void Play(const char* name,
+ bool Play(const char* name,
float start,
float end,
short priority,
Modified: branches/soc-2011-pepper/source/gameengine/Ketsji/BL_ActionManager.cpp
===================================================================
--- branches/soc-2011-pepper/source/gameengine/Ketsji/BL_ActionManager.cpp 2011-06-29 01:05:12 UTC (rev 37931)
+++ branches/soc-2011-pepper/source/gameengine/Ketsji/BL_ActionManager.cpp 2011-06-29 01:53:17 UTC (rev 37932)
@@ -56,7 +56,7 @@
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 @@
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)
Modified: branches/soc-2011-pepper/source/gameengine/Ketsji/BL_ActionManager.h
===================================================================
--- branches/soc-2011-pepper/source/gameengine/Ketsji/BL_ActionManager.h 2011-06-29 01:05:12 UTC (rev 37931)
+++ branches/soc-2011-pepper/source/gameengine/Ketsji/BL_ActionManager.h 2011-06-29 01:53:17 UTC (rev 37932)
@@ -42,7 +42,7 @@
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,
Modified: branches/soc-2011-pepper/source/gameengine/Ketsji/KX_GameObject.cpp
===================================================================
--- branches/soc-2011-pepper/source/gameengine/Ketsji/KX_GameObject.cpp 2011-06-29 01:05:12 UTC (rev 37931)
+++ branches/soc-2011-pepper/source/gameengine/Ketsji/KX_GameObject.cpp 2011-06-29 01:53:17 UTC (rev 37932)
@@ -360,7 +360,7 @@
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 @@
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)
Modified: branches/soc-2011-pepper/source/gameengine/Ketsji/KX_GameObject.h
===================================================================
--- branches/soc-2011-pepper/source/gameengine/Ketsji/KX_GameObject.h 2011-06-29 01:05:12 UTC (rev 37931)
+++ branches/soc-2011-pepper/source/gameengine/Ketsji/KX_GameObject.h 2011-06-29 01:53:17 UTC (rev 37932)
@@ -211,7 +211,7 @@
/**
* 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,
More information about the Bf-blender-cvs
mailing list