From 48f53e23bfaba6ea8aa32536aeb5386e5e03a4c3 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 25 Jan 2016 16:59:31 +0100 Subject: [PATCH] Allow alternate mesh formats for marker_error --- components/resource/scenemanager.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/components/resource/scenemanager.cpp b/components/resource/scenemanager.cpp index 1d1c5a365..e14282649 100644 --- a/components/resource/scenemanager.cpp +++ b/components/resource/scenemanager.cpp @@ -201,10 +201,22 @@ namespace Resource } catch (std::exception& e) { - std::cerr << "Failed to load '" << name << "': " << e.what() << ", using marker_error.nif instead" << std::endl; - Files::IStreamPtr file = mVFS->get("meshes/marker_error.nif"); - normalized = "meshes/marker_error.nif"; - loaded = load(file, normalized, mTextureManager, mNifFileManager); + static const char * const sMeshTypes[] = { "nif", "osg", "osgt", "osgb", "osgx", "osg2", 0 }; + + for (unsigned int i=0; iexists(normalized)) + { + std::cerr << "Failed to load '" << name << "': " << e.what() << ", using marker_error." << sMeshTypes[i] << " instead" << std::endl; + Files::IStreamPtr file = mVFS->get(normalized); + loaded = load(file, normalized, mTextureManager, mNifFileManager); + break; + } + } + + if (!loaded) + throw; } osgDB::Registry::instance()->getOrCreateSharedStateManager()->share(loaded.get());