mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-12 04:14:05 +00:00
Use normalized path in SceneManager::checkLoaded
This commit is contained in:
parent
28faae69b0
commit
5f2582fe68
@ -1126,19 +1126,19 @@ namespace MWWorld
|
|||||||
|
|
||||||
void Scene::preload(const std::string& mesh, bool useAnim)
|
void Scene::preload(const std::string& mesh, bool useAnim)
|
||||||
{
|
{
|
||||||
std::string meshPath = mesh;
|
const VFS::Path::Normalized meshPath = useAnim
|
||||||
if (useAnim)
|
? Misc::ResourceHelpers::correctActorModelPath(mesh, mRendering.getResourceSystem()->getVFS())
|
||||||
meshPath = Misc::ResourceHelpers::correctActorModelPath(meshPath, mRendering.getResourceSystem()->getVFS());
|
: mesh;
|
||||||
|
|
||||||
if (!mRendering.getResourceSystem()->getSceneManager()->checkLoaded(meshPath, mRendering.getReferenceTime()))
|
if (mRendering.getResourceSystem()->getSceneManager()->checkLoaded(meshPath, mRendering.getReferenceTime()))
|
||||||
{
|
return;
|
||||||
osg::ref_ptr<PreloadMeshItem> item(new PreloadMeshItem(
|
|
||||||
VFS::Path::toNormalized(meshPath), mRendering.getResourceSystem()->getSceneManager()));
|
osg::ref_ptr<PreloadMeshItem> item(
|
||||||
mRendering.getWorkQueue()->addWorkItem(item);
|
new PreloadMeshItem(meshPath, mRendering.getResourceSystem()->getSceneManager()));
|
||||||
const auto isDone = [](const osg::ref_ptr<SceneUtil::WorkItem>& v) { return v->isDone(); };
|
mRendering.getWorkQueue()->addWorkItem(item);
|
||||||
mWorkItems.erase(std::remove_if(mWorkItems.begin(), mWorkItems.end(), isDone), mWorkItems.end());
|
const auto isDone = [](const osg::ref_ptr<SceneUtil::WorkItem>& v) { return v->isDone(); };
|
||||||
mWorkItems.emplace_back(std::move(item));
|
mWorkItems.erase(std::remove_if(mWorkItems.begin(), mWorkItems.end(), isDone), mWorkItems.end());
|
||||||
}
|
mWorkItems.emplace_back(std::move(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene::preloadCells(float dt)
|
void Scene::preloadCells(float dt)
|
||||||
|
@ -597,9 +597,9 @@ namespace Resource
|
|||||||
mShaderManager->setShaderPath(path);
|
mShaderManager->setShaderPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SceneManager::checkLoaded(const std::string& name, double timeStamp)
|
bool SceneManager::checkLoaded(VFS::Path::NormalizedView name, double timeStamp)
|
||||||
{
|
{
|
||||||
return mCache->checkInObjectCache(VFS::Path::normalizeFilename(name), timeStamp);
|
return mCache->checkInObjectCache(name, timeStamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneManager::setUpNormalsRTForStateSet(osg::StateSet* stateset, bool enabled)
|
void SceneManager::setUpNormalsRTForStateSet(osg::StateSet* stateset, bool enabled)
|
||||||
|
@ -152,7 +152,7 @@ namespace Resource
|
|||||||
void setShaderPath(const std::filesystem::path& path);
|
void setShaderPath(const std::filesystem::path& path);
|
||||||
|
|
||||||
/// Check if a given scene is loaded and if so, update its usage timestamp to prevent it from being unloaded
|
/// Check if a given scene is loaded and if so, update its usage timestamp to prevent it from being unloaded
|
||||||
bool checkLoaded(const std::string& name, double referenceTime);
|
bool checkLoaded(VFS::Path::NormalizedView name, double referenceTime);
|
||||||
|
|
||||||
/// Get a read-only copy of this scene "template"
|
/// Get a read-only copy of this scene "template"
|
||||||
/// @note If the given filename does not exist or fails to load, an error marker mesh will be used instead.
|
/// @note If the given filename does not exist or fails to load, an error marker mesh will be used instead.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user