mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-19 19:53:53 +00:00
Merge branch 'Error-marker-loading-failure-not-handled' into 'master'
Use the embedded marker error if we fail to load the error marker model from the vfs See merge request OpenMW/openmw!2757
This commit is contained in:
commit
a2fdaf8531
3 changed files with 33 additions and 14 deletions
|
@ -43,6 +43,7 @@
|
||||||
Bug #7122: Teleportation to underwater should cancel active water walking effect
|
Bug #7122: Teleportation to underwater should cancel active water walking effect
|
||||||
Bug #7163: Myar Aranath: Wheat breaks the GUI
|
Bug #7163: Myar Aranath: Wheat breaks the GUI
|
||||||
Bug #7172: Current music playlist continues playing indefinitely if next playlist is empty
|
Bug #7172: Current music playlist continues playing indefinitely if next playlist is empty
|
||||||
|
Bug #7229: Error marker loading failure is not handled
|
||||||
Bug #7243: Get Skyrim.esm loading
|
Bug #7243: Get Skyrim.esm loading
|
||||||
Feature #5492: Let rain and snow collide with statics
|
Feature #5492: Let rain and snow collide with statics
|
||||||
Feature #6447: Add LOD support to Object Paging
|
Feature #6447: Add LOD support to Object Paging
|
||||||
|
|
|
@ -831,6 +831,34 @@ namespace Resource
|
||||||
mSharedStateMutex.unlock();
|
mSharedStateMutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
osg::ref_ptr<osg::Node> SceneManager::loadErrorMarker()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
for (const auto meshType : { "nif", "osg", "osgt", "osgb", "osgx", "osg2", "dae" })
|
||||||
|
{
|
||||||
|
const std::string normalized = "meshes/marker_error." + std::string(meshType);
|
||||||
|
if (mVFS->exists(normalized))
|
||||||
|
return load(normalized, mVFS, mImageManager, mNifFileManager);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (const std::exception& e)
|
||||||
|
{
|
||||||
|
Log(Debug::Warning) << "Failed to load error marker:" << e.what()
|
||||||
|
<< ", using embedded marker_error instead";
|
||||||
|
}
|
||||||
|
Files::IMemStream file(ErrorMarker::sValue.data(), ErrorMarker::sValue.size());
|
||||||
|
return loadNonNif("error_marker.osgt", file, mImageManager);
|
||||||
|
}
|
||||||
|
|
||||||
|
osg::ref_ptr<osg::Node> SceneManager::cloneErrorMarker()
|
||||||
|
{
|
||||||
|
if (!mErrorMarker)
|
||||||
|
mErrorMarker = loadErrorMarker();
|
||||||
|
|
||||||
|
return static_cast<osg::Node*>(mErrorMarker->clone(osg::CopyOp::DEEP_COPY_ALL));
|
||||||
|
}
|
||||||
|
|
||||||
osg::ref_ptr<const osg::Node> SceneManager::getTemplate(const std::string& name, bool compile)
|
osg::ref_ptr<const osg::Node> SceneManager::getTemplate(const std::string& name, bool compile)
|
||||||
{
|
{
|
||||||
std::string normalized = mVFS->normalizeFilename(name);
|
std::string normalized = mVFS->normalizeFilename(name);
|
||||||
|
@ -850,21 +878,8 @@ namespace Resource
|
||||||
}
|
}
|
||||||
catch (const std::exception& e)
|
catch (const std::exception& e)
|
||||||
{
|
{
|
||||||
static osg::ref_ptr<osg::Node> errorMarkerNode = [&] {
|
|
||||||
static const char* const sMeshTypes[] = { "nif", "osg", "osgt", "osgb", "osgx", "osg2", "dae" };
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < sizeof(sMeshTypes) / sizeof(sMeshTypes[0]); ++i)
|
|
||||||
{
|
|
||||||
normalized = "meshes/marker_error." + std::string(sMeshTypes[i]);
|
|
||||||
if (mVFS->exists(normalized))
|
|
||||||
return load(normalized, mVFS, mImageManager, mNifFileManager);
|
|
||||||
}
|
|
||||||
Files::IMemStream file(ErrorMarker::sValue.data(), ErrorMarker::sValue.size());
|
|
||||||
return loadNonNif("error_marker.osgt", file, mImageManager);
|
|
||||||
}();
|
|
||||||
|
|
||||||
Log(Debug::Error) << "Failed to load '" << name << "': " << e.what() << ", using marker_error instead";
|
Log(Debug::Error) << "Failed to load '" << name << "': " << e.what() << ", using marker_error instead";
|
||||||
loaded = static_cast<osg::Node*>(errorMarkerNode->clone(osg::CopyOp::DEEP_COPY_ALL));
|
loaded = cloneErrorMarker();
|
||||||
}
|
}
|
||||||
|
|
||||||
// set filtering settings
|
// set filtering settings
|
||||||
|
|
|
@ -228,6 +228,8 @@ namespace Resource
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Shader::ShaderVisitor* createShaderVisitor(const std::string& shaderPrefix = "objects");
|
Shader::ShaderVisitor* createShaderVisitor(const std::string& shaderPrefix = "objects");
|
||||||
|
osg::ref_ptr<osg::Node> loadErrorMarker();
|
||||||
|
osg::ref_ptr<osg::Node> cloneErrorMarker();
|
||||||
|
|
||||||
std::unique_ptr<Shader::ShaderManager> mShaderManager;
|
std::unique_ptr<Shader::ShaderManager> mShaderManager;
|
||||||
bool mForceShaders;
|
bool mForceShaders;
|
||||||
|
@ -260,6 +262,7 @@ namespace Resource
|
||||||
osg::ref_ptr<osgUtil::IncrementalCompileOperation> mIncrementalCompileOperation;
|
osg::ref_ptr<osgUtil::IncrementalCompileOperation> mIncrementalCompileOperation;
|
||||||
|
|
||||||
unsigned int mParticleSystemMask;
|
unsigned int mParticleSystemMask;
|
||||||
|
mutable osg::ref_ptr<osg::Node> mErrorMarker;
|
||||||
|
|
||||||
SceneManager(const SceneManager&);
|
SceneManager(const SceneManager&);
|
||||||
void operator=(const SceneManager&);
|
void operator=(const SceneManager&);
|
||||||
|
|
Loading…
Reference in a new issue