mirror of
https://github.com/OpenMW/openmw.git
synced 2025-12-13 11:13:06 +00:00
Cache supported animations
This commit is contained in:
parent
579e533621
commit
80ae8ce116
2 changed files with 8 additions and 9 deletions
|
|
@ -660,6 +660,9 @@ namespace MWRender
|
||||||
|
|
||||||
mAnimSources.push_back(std::move(animsrc));
|
mAnimSources.push_back(std::move(animsrc));
|
||||||
|
|
||||||
|
for (const std::string& group : mAnimSources.back()->getTextKeys().getGroups())
|
||||||
|
mSupportedAnimations.insert(group);
|
||||||
|
|
||||||
SceneUtil::AssignControllerSourcesVisitor assignVisitor(mAnimationTimePtr[0]);
|
SceneUtil::AssignControllerSourcesVisitor assignVisitor(mAnimationTimePtr[0]);
|
||||||
mObjectRoot->accept(assignVisitor);
|
mObjectRoot->accept(assignVisitor);
|
||||||
|
|
||||||
|
|
@ -698,6 +701,7 @@ namespace MWRender
|
||||||
|
|
||||||
mAccumCtrl = nullptr;
|
mAccumCtrl = nullptr;
|
||||||
|
|
||||||
|
mSupportedAnimations.clear();
|
||||||
mAnimSources.clear();
|
mAnimSources.clear();
|
||||||
|
|
||||||
mAnimVelocities.clear();
|
mAnimVelocities.clear();
|
||||||
|
|
@ -705,15 +709,7 @@ namespace MWRender
|
||||||
|
|
||||||
bool Animation::hasAnimation(std::string_view anim) const
|
bool Animation::hasAnimation(std::string_view anim) const
|
||||||
{
|
{
|
||||||
AnimSourceList::const_iterator iter(mAnimSources.begin());
|
return mSupportedAnimations.find(anim) != mSupportedAnimations.end();
|
||||||
for (; iter != mAnimSources.end(); ++iter)
|
|
||||||
{
|
|
||||||
const SceneUtil::TextKeyMap& keys = (*iter)->getTextKeys();
|
|
||||||
if (keys.hasGroupStart(anim))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float Animation::getStartTime(const std::string& groupname) const
|
float Animation::getStartTime(const std::string& groupname) const
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
#include <components/sceneutil/util.hpp>
|
#include <components/sceneutil/util.hpp>
|
||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <unordered_set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
|
|
@ -231,6 +232,8 @@ namespace MWRender
|
||||||
typedef std::vector<std::shared_ptr<AnimSource>> AnimSourceList;
|
typedef std::vector<std::shared_ptr<AnimSource>> AnimSourceList;
|
||||||
AnimSourceList mAnimSources;
|
AnimSourceList mAnimSources;
|
||||||
|
|
||||||
|
std::unordered_set<std::string_view> mSupportedAnimations;
|
||||||
|
|
||||||
osg::ref_ptr<osg::Group> mInsert;
|
osg::ref_ptr<osg::Group> mInsert;
|
||||||
|
|
||||||
osg::ref_ptr<osg::Group> mObjectRoot;
|
osg::ref_ptr<osg::Group> mObjectRoot;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue