Cache supported animations

revert-6246b479
elsid 2 years ago
parent 579e533621
commit 80ae8ce116
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

@ -660,6 +660,9 @@ namespace MWRender
mAnimSources.push_back(std::move(animsrc));
for (const std::string& group : mAnimSources.back()->getTextKeys().getGroups())
mSupportedAnimations.insert(group);
SceneUtil::AssignControllerSourcesVisitor assignVisitor(mAnimationTimePtr[0]);
mObjectRoot->accept(assignVisitor);
@ -698,6 +701,7 @@ namespace MWRender
mAccumCtrl = nullptr;
mSupportedAnimations.clear();
mAnimSources.clear();
mAnimVelocities.clear();
@ -705,15 +709,7 @@ namespace MWRender
bool Animation::hasAnimation(std::string_view anim) const
{
AnimSourceList::const_iterator iter(mAnimSources.begin());
for (; iter != mAnimSources.end(); ++iter)
{
const SceneUtil::TextKeyMap& keys = (*iter)->getTextKeys();
if (keys.hasGroupStart(anim))
return true;
}
return false;
return mSupportedAnimations.find(anim) != mSupportedAnimations.end();
}
float Animation::getStartTime(const std::string& groupname) const

@ -10,6 +10,7 @@
#include <components/sceneutil/util.hpp>
#include <unordered_map>
#include <unordered_set>
#include <vector>
namespace ESM
@ -231,6 +232,8 @@ namespace MWRender
typedef std::vector<std::shared_ptr<AnimSource>> AnimSourceList;
AnimSourceList mAnimSources;
std::unordered_set<std::string_view> mSupportedAnimations;
osg::ref_ptr<osg::Group> mInsert;
osg::ref_ptr<osg::Group> mObjectRoot;

Loading…
Cancel
Save