Add a method to clear all Animation sources except the first

The first needs to remain, since that's where any mSkelBase entity comes from,
and where any retrieved nodes are from.
actorid
Chris Robinson 12 years ago
parent 9be20b90f1
commit 9a2a32f2a5

@ -187,6 +187,36 @@ void Animation::setRenderProperties(const NifOgre::ObjectList &objlist, Ogre::ui
}
void Animation::clearExtraSources()
{
for(size_t layer = 0;layer < sMaxLayers;layer++)
{
mLayer[layer].mGroupName.clear();
mLayer[layer].mTextKeys = NULL;
mLayer[layer].mControllers = NULL;
mLayer[layer].mTime = 0.0f;
mLayer[layer].mLoopCount = 0;
mLayer[layer].mPlaying = false;
}
mNonAccumCtrl = NULL;
mAnimVelocity = 0.0f;
mLastPosition = Ogre::Vector3(0.0f);
if(mAccumRoot)
mAccumRoot->setPosition(mLastPosition);
if(mObjects.size() > 1)
{
mObjects.resize(1);
mObjects[0].mActiveLayers = 0;
NifOgre::ObjectList &objlist = mObjects[0].mObjectList;
mActiveCtrls.clear();
mActiveCtrls.insert(mActiveCtrls.end(), objlist.mControllers.begin(), objlist.mControllers.end());
}
}
void Animation::updateActiveControllers()
{
mActiveCtrls.clear();
@ -538,6 +568,7 @@ bool Animation::play(const std::string &groupname, const std::string &start, con
mLayer[layeridx].mGroupName.clear();
mLayer[layeridx].mTextKeys = NULL;
mLayer[layeridx].mControllers = NULL;
mLayer[layeridx].mTime = 0.0f;
mLayer[layeridx].mLoopCount = 0;
mLayer[layeridx].mPlaying = false;
@ -571,6 +602,7 @@ bool Animation::play(const std::string &groupname, const std::string &start, con
{
if(!reset(layeridx, keys, nonaccumctrl, groupname, start, stop, startpoint))
continue;
mLayer[layeridx].mGroupName = groupname;
mLayer[layeridx].mTextKeys = &keys;
mLayer[layeridx].mControllers = &objlist.mControllers;
@ -619,6 +651,7 @@ void Animation::disable(size_t layeridx)
mLayer[layeridx].mGroupName.clear();
mLayer[layeridx].mTextKeys = NULL;
mLayer[layeridx].mControllers = NULL;
mLayer[layeridx].mTime = 0.0f;
mLayer[layeridx].mLoopCount = 0;
mLayer[layeridx].mPlaying = false;

@ -116,6 +116,11 @@ public:
Animation(const MWWorld::Ptr &ptr);
virtual ~Animation();
/** Clears all ObjectLists except the first one. As a consequence, any
* playing animations are stopped.
*/
void clearExtraSources();
void updatePtr(const MWWorld::Ptr &ptr);
bool hasAnimation(const std::string &anim);

Loading…
Cancel
Save