mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-27 03:35:27 +00:00
Cache supported animations
This commit is contained in:
parent
579e533621
commit
80ae8ce116
@ -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…
x
Reference in New Issue
Block a user