mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 12:53:51 +00:00
Search the textkeys to check if an animation group exists
This commit is contained in:
parent
a2fc43c7df
commit
7279e015e9
2 changed files with 20 additions and 1 deletions
|
@ -169,11 +169,28 @@ Ogre::Node *Animation::getNode(const std::string &name)
|
|||
}
|
||||
|
||||
|
||||
NifOgre::TextKeyMap::const_iterator Animation::findGroupStart(const NifOgre::TextKeyMap &keys, const std::string &groupname)
|
||||
{
|
||||
NifOgre::TextKeyMap::const_iterator iter(keys.begin());
|
||||
for(;iter != keys.end();iter++)
|
||||
{
|
||||
if(iter->second.compare(0, groupname.size(), groupname) == 0 &&
|
||||
iter->second.compare(groupname.size(), 2, ": ") == 0)
|
||||
break;
|
||||
}
|
||||
return iter;
|
||||
}
|
||||
|
||||
|
||||
bool Animation::hasAnimation(const std::string &anim)
|
||||
{
|
||||
for(std::vector<NifOgre::ObjectList>::const_iterator iter(mObjectLists.begin());iter != mObjectLists.end();iter++)
|
||||
{
|
||||
if(iter->mSkelBase && iter->mSkelBase->hasAnimationState(anim))
|
||||
if(iter->mTextKeys.size() == 0)
|
||||
continue;
|
||||
|
||||
const NifOgre::TextKeyMap &keys = iter->mTextKeys.begin()->second;
|
||||
if(findGroupStart(keys, anim) != keys.end())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -78,6 +78,8 @@ protected:
|
|||
* returns the wanted movement vector from the previous update. */
|
||||
Ogre::Vector3 updatePosition();
|
||||
|
||||
static NifOgre::TextKeyMap::const_iterator findGroupStart(const NifOgre::TextKeyMap &keys, const std::string &groupname);
|
||||
|
||||
/* Resets the animation to the time of the specified start marker, without
|
||||
* moving anything, and set the end time to the specified stop marker. If
|
||||
* the marker is not found, or if the markers are the same, it returns
|
||||
|
|
Loading…
Reference in a new issue