From e4531a6910fd73ad281714ee454395836d40cbd9 Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Mon, 12 Mar 2018 19:05:57 +0300 Subject: [PATCH 1/2] Use middle gray instead of pure black as default fallback color (Fixes #2841) --- components/fallback/fallback.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/fallback/fallback.cpp b/components/fallback/fallback.cpp index 11a577a45..f33509ec9 100644 --- a/components/fallback/fallback.cpp +++ b/components/fallback/fallback.cpp @@ -53,7 +53,7 @@ namespace Fallback { std::string sum=getFallbackString(fall); if(sum.empty()) - return osg::Vec4f(0.f,0.f,0.f,1.f); + return osg::Vec4f(0.5f,0.5f,0.5f,1.f); else { std::string ret[3]; From 002ad9ae1b85e98086b82004bb1a62fb91614619 Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Tue, 13 Mar 2018 23:59:01 +0300 Subject: [PATCH 2/2] Print a warning in case a fallback value wasn't found --- components/fallback/fallback.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/components/fallback/fallback.cpp b/components/fallback/fallback.cpp index f33509ec9..ce6cba313 100644 --- a/components/fallback/fallback.cpp +++ b/components/fallback/fallback.cpp @@ -1,5 +1,7 @@ #include "fallback.hpp" +#include + #include @@ -17,6 +19,7 @@ namespace Fallback std::map::const_iterator it; if((it = mFallbackMap.find(fall)) == mFallbackMap.end()) { + std::cerr << "Warning: fallback value " << fall << " not found." << std::endl; return ""; } return it->second; @@ -25,7 +28,7 @@ namespace Fallback float Map::getFallbackFloat(const std::string& fall) const { std::string fallback=getFallbackString(fall); - if(fallback.empty()) + if (fallback.empty()) return 0; else return boost::lexical_cast(fallback); @@ -34,7 +37,7 @@ namespace Fallback int Map::getFallbackInt(const std::string& fall) const { std::string fallback=getFallbackString(fall); - if(fallback.empty()) + if (fallback.empty()) return 0; else return std::stoi(fallback); @@ -43,7 +46,7 @@ namespace Fallback bool Map::getFallbackBool(const std::string& fall) const { std::string fallback=getFallbackString(fall); - if(fallback.empty()) + if (fallback.empty()) return false; else return stob(fallback); @@ -52,7 +55,7 @@ namespace Fallback osg::Vec4f Map::getFallbackColour(const std::string& fall) const { std::string sum=getFallbackString(fall); - if(sum.empty()) + if (sum.empty()) return osg::Vec4f(0.5f,0.5f,0.5f,1.f); else {