Add rudimentary animation control command to models.
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include "IniFile.h"
|
||||
#include "RageFile.h"
|
||||
#include "RageLog.h"
|
||||
#include "ActorUtil.h"
|
||||
|
||||
const float FRAMES_PER_SECOND = 30;
|
||||
const CString DEFAULT_ANIMATION_NAME = "default";
|
||||
@@ -909,3 +910,39 @@ int Model::GetNumStates()
|
||||
iMaxStates = max( iMaxStates, m_Materials[i].aniTexture.GetNumStates() );
|
||||
return iMaxStates;
|
||||
}
|
||||
|
||||
void Model::HandleCommand( const CStringArray &asTokens )
|
||||
{
|
||||
HandleParams;
|
||||
|
||||
/* XXX: It would be very useful to be able to tween animations, eg:
|
||||
*
|
||||
* play,Dance,1;sleep,2;linear,.5;play,Collapse,1
|
||||
*
|
||||
* to play "Dance" for two seconds, then tween to playing "Collapse" over half
|
||||
* a second, with the tween percentage weighting the animations.
|
||||
*
|
||||
* Also, being able to queue animations cleanly without knowing the exact duration
|
||||
* of the animation, eg:
|
||||
*
|
||||
* play,Dance,1;finishanim;play,Collapse,1
|
||||
*
|
||||
* to play "Dance", and then play "Collapse" when "Dance" finishes. (In this case,
|
||||
* Dance would presumably end on the same keyframe that Collapse begins on, since
|
||||
* it isn't queuing a tween.)
|
||||
*
|
||||
* We need more architecture for this, so we can put custom items in the Actor
|
||||
* tween queue.
|
||||
*/
|
||||
|
||||
const CString& sName = asTokens[0];
|
||||
if( sName=="play" )
|
||||
PlayAnimation( sParam(1),fParam(2) );
|
||||
else
|
||||
{
|
||||
Actor::HandleCommand( asTokens );
|
||||
return;
|
||||
}
|
||||
|
||||
CheckHandledParams;
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ public:
|
||||
void SetDefaultAnimation( CString sAnimation, float fPlayRate = 1 );
|
||||
bool m_bRevertToDefaultAnimation;
|
||||
|
||||
virtual void HandleCommand( const CStringArray &asTokens );
|
||||
|
||||
private:
|
||||
vector<msMesh> m_Meshes;
|
||||
|
||||
Reference in New Issue
Block a user