mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-29 09:32:45 +00:00
Pass normalized path to RetrieveAnimationsVisitor
This commit is contained in:
parent
616b033c36
commit
7e1ecfc0ee
@ -35,22 +35,22 @@ namespace Resource
|
|||||||
|
|
||||||
double parseTimeSignature(std::string_view line)
|
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;
|
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<double>(line.substr(spacePos + 1), time);
|
time = Misc::StringUtils::toNumeric<double>(line.substr(spacePos + 1), time);
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RetrieveAnimationsVisitor::RetrieveAnimationsVisitor(SceneUtil::KeyframeHolder& target,
|
RetrieveAnimationsVisitor::RetrieveAnimationsVisitor(SceneUtil::KeyframeHolder& target,
|
||||||
osg::ref_ptr<osgAnimation::BasicAnimationManager> animationManager, const std::string& normalized,
|
osg::ref_ptr<osgAnimation::BasicAnimationManager> animationManager, VFS::Path::NormalizedView path,
|
||||||
const VFS::Manager* vfs)
|
const VFS::Manager& vfs)
|
||||||
: osg::NodeVisitor(TRAVERSE_ALL_CHILDREN)
|
: osg::NodeVisitor(TRAVERSE_ALL_CHILDREN)
|
||||||
, mTarget(target)
|
, mTarget(target)
|
||||||
, mAnimationManager(std::move(animationManager))
|
, mAnimationManager(std::move(animationManager))
|
||||||
, mPath(normalized)
|
, mPath(path)
|
||||||
, mVFS(vfs)
|
, mVFS(&vfs)
|
||||||
{
|
{
|
||||||
mPath.changeExtension("txt");
|
mPath.changeExtension("txt");
|
||||||
}
|
}
|
||||||
@ -208,7 +208,7 @@ namespace Resource
|
|||||||
|
|
||||||
osg::ref_ptr<const SceneUtil::KeyframeHolder> KeyframeManager::get(const std::string& name)
|
osg::ref_ptr<const SceneUtil::KeyframeHolder> KeyframeManager::get(const std::string& name)
|
||||||
{
|
{
|
||||||
const std::string normalized = VFS::Path::normalizeFilename(name);
|
const VFS::Path::Normalized normalized(name);
|
||||||
|
|
||||||
osg::ref_ptr<osg::Object> obj = mCache->getRefFromObjectCache(normalized);
|
osg::ref_ptr<osg::Object> obj = mCache->getRefFromObjectCache(normalized);
|
||||||
if (obj)
|
if (obj)
|
||||||
@ -220,7 +220,7 @@ namespace Resource
|
|||||||
{
|
{
|
||||||
auto file = std::make_shared<Nif::NIFFile>(normalized);
|
auto file = std::make_shared<Nif::NIFFile>(normalized);
|
||||||
Nif::Reader reader(*file, mEncoder);
|
Nif::Reader reader(*file, mEncoder);
|
||||||
reader.parse(mVFS->getNormalized(normalized));
|
reader.parse(mVFS->get(normalized));
|
||||||
NifOsg::Loader::loadKf(*file, *loaded.get());
|
NifOsg::Loader::loadKf(*file, *loaded.get());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -230,7 +230,7 @@ namespace Resource
|
|||||||
= dynamic_cast<osgAnimation::BasicAnimationManager*>(scene->getUpdateCallback());
|
= dynamic_cast<osgAnimation::BasicAnimationManager*>(scene->getUpdateCallback());
|
||||||
if (bam)
|
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);
|
scene->accept(rav);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,9 +21,9 @@ namespace Resource
|
|||||||
class RetrieveAnimationsVisitor : public osg::NodeVisitor
|
class RetrieveAnimationsVisitor : public osg::NodeVisitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RetrieveAnimationsVisitor(SceneUtil::KeyframeHolder& target,
|
explicit RetrieveAnimationsVisitor(SceneUtil::KeyframeHolder& target,
|
||||||
osg::ref_ptr<osgAnimation::BasicAnimationManager> animationManager, const std::string& normalized,
|
osg::ref_ptr<osgAnimation::BasicAnimationManager> animationManager, VFS::Path::NormalizedView path,
|
||||||
const VFS::Manager* vfs);
|
const VFS::Manager& vfs);
|
||||||
|
|
||||||
bool belongsToLeftUpperExtremity(const std::string& name);
|
bool belongsToLeftUpperExtremity(const std::string& name);
|
||||||
bool belongsToRightUpperExtremity(const std::string& name);
|
bool belongsToRightUpperExtremity(const std::string& name);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user