diff --git a/components/resource/keyframemanager.cpp b/components/resource/keyframemanager.cpp index 88b37be0fc..a272d89dd1 100644 --- a/components/resource/keyframemanager.cpp +++ b/components/resource/keyframemanager.cpp @@ -35,22 +35,22 @@ namespace Resource double parseTimeSignature(std::string_view line) { - size_t spacePos = line.find_last_of(' '); + const std::size_t spacePos = line.find_last_of(' '); double time = 0.0; - if (spacePos != std::string::npos && spacePos + 1 < line.size()) + if (spacePos != std::string_view::npos && spacePos + 1 < line.size()) time = Misc::StringUtils::toNumeric(line.substr(spacePos + 1), time); return time; } } RetrieveAnimationsVisitor::RetrieveAnimationsVisitor(SceneUtil::KeyframeHolder& target, - osg::ref_ptr animationManager, const std::string& normalized, - const VFS::Manager* vfs) + osg::ref_ptr animationManager, VFS::Path::NormalizedView path, + const VFS::Manager& vfs) : osg::NodeVisitor(TRAVERSE_ALL_CHILDREN) , mTarget(target) , mAnimationManager(std::move(animationManager)) - , mPath(normalized) - , mVFS(vfs) + , mPath(path) + , mVFS(&vfs) { mPath.changeExtension("txt"); } @@ -208,7 +208,7 @@ namespace Resource osg::ref_ptr KeyframeManager::get(const std::string& name) { - const std::string normalized = VFS::Path::normalizeFilename(name); + const VFS::Path::Normalized normalized(name); osg::ref_ptr obj = mCache->getRefFromObjectCache(normalized); if (obj) @@ -220,7 +220,7 @@ namespace Resource { auto file = std::make_shared(normalized); Nif::Reader reader(*file, mEncoder); - reader.parse(mVFS->getNormalized(normalized)); + reader.parse(mVFS->get(normalized)); NifOsg::Loader::loadKf(*file, *loaded.get()); } else @@ -230,7 +230,7 @@ namespace Resource = dynamic_cast(scene->getUpdateCallback()); if (bam) { - Resource::RetrieveAnimationsVisitor rav(*loaded.get(), std::move(bam), normalized, mVFS); + Resource::RetrieveAnimationsVisitor rav(*loaded.get(), std::move(bam), normalized, *mVFS); scene->accept(rav); } } diff --git a/components/resource/keyframemanager.hpp b/components/resource/keyframemanager.hpp index 9dac730042..2f5aa875d0 100644 --- a/components/resource/keyframemanager.hpp +++ b/components/resource/keyframemanager.hpp @@ -21,9 +21,9 @@ namespace Resource class RetrieveAnimationsVisitor : public osg::NodeVisitor { public: - RetrieveAnimationsVisitor(SceneUtil::KeyframeHolder& target, - osg::ref_ptr animationManager, const std::string& normalized, - const VFS::Manager* vfs); + explicit RetrieveAnimationsVisitor(SceneUtil::KeyframeHolder& target, + osg::ref_ptr animationManager, VFS::Path::NormalizedView path, + const VFS::Manager& vfs); bool belongsToLeftUpperExtremity(const std::string& name); bool belongsToRightUpperExtremity(const std::string& name);