diff --git a/indra/newview/alfloaterlightbox.cpp b/indra/newview/alfloaterlightbox.cpp index f9eb141fa66a2df3b50abcd6db59c1dc1c166b9f..f52b4d15e7d49b375ed2e2aef5365ac696fae007 100644 --- a/indra/newview/alfloaterlightbox.cpp +++ b/indra/newview/alfloaterlightbox.cpp @@ -53,9 +53,10 @@ ALFloaterLightBox::~ALFloaterLightBox() BOOL ALFloaterLightBox::postBuild() { - updateTonemapper(); - mTonemapConnection = gSavedSettings.getControl("RenderToneMapType")->getSignal()->connect([&](LLControlVariable* control, const LLSD&, const LLSD&){ updateTonemapper(); }); + updateTonemapper(); + mTonemapConnection = gSavedSettings.getControl("RenderToneMapType")->getSignal()->connect([&](LLControlVariable* control, const LLSD&, const LLSD&){ updateTonemapper(); }); mCASConnection = gSavedSettings.getControl("RenderSharpenMethod")->getSignal()->connect([&](LLControlVariable* control, const LLSD&, const LLSD&){ updateCAS(); }); + populateLUTCombo(); return TRUE; } @@ -65,6 +66,50 @@ void ALFloaterLightBox::draw() LLFloater::draw(); } +void ALFloaterLightBox::populateLUTCombo() +{ + LLComboBox* lut_combo = getChild<LLComboBox>("colorlut_combo"); + const std::string& user_luts = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "colorlut"); + + boost::system::error_code ec; +#if LL_WINDOWS + boost::filesystem::path user_luts_path(ll_convert_string_to_wide(user_luts)); +#else + boost::filesystem::path user_luts_path(user_luts); +#endif + + if(boost::filesystem::is_directory(user_luts_path, ec)) + { + if(ec.failed()) + { + LL_WARNS() << "Error checking user LUTs directory: " << ec.message() << LL_ENDL; + return; + } + if(!boost::filesystem::is_empty(user_luts_path, ec) && !ec.failed()) + { + if(ec.failed()) + { + LL_WARNS() << "Error checking contents of user LUTs directory: " << ec.message() << LL_ENDL; + return; + } + lut_combo->addSeparator(); + } + for (boost::filesystem::directory_iterator lut(user_luts_path, ec); lut != boost::filesystem::directory_iterator(); ++lut) + { + if(ec.failed()) + { + LL_WARNS() << "Error reading user LUT file: " << ec.message() << LL_ENDL; + continue; + } + std::string lut_stem = lut->path().stem().string(); + std::string lut_filename = lut->path().filename().string(); + lut_combo->add(lut_stem, lut_filename); + } + lut_combo->selectByValue(gSavedSettings.getString("RenderColorGradeLUT")); + lut_combo->resetDirty(); + } +} + void ALFloaterLightBox::onClickResetControlDefault(const LLSD& userdata) { const std::string& control_name = userdata.asString(); diff --git a/indra/newview/alfloaterlightbox.h b/indra/newview/alfloaterlightbox.h index 1db556a97ce5220174df74ad8be92fde613f9b75..872265b396218c070bdef6c4c434c734b5fe12e0 100644 --- a/indra/newview/alfloaterlightbox.h +++ b/indra/newview/alfloaterlightbox.h @@ -50,6 +50,7 @@ class ALFloaterLightBox final : public LLFloater void onClickResetGroupDefault(const LLSD& userdata); void updateTonemapper(); void updateCAS(); + void populateLUTCombo(); boost::signals2::scoped_connection mTonemapConnection; boost::signals2::scoped_connection mCASConnection; diff --git a/indra/newview/alrenderutils.cpp b/indra/newview/alrenderutils.cpp index 0ea6f0ae776bddd4be613a29a6516e3f45e70878..617ab60354ead1dbc490b7f2986949d1ff6e605f 100644 --- a/indra/newview/alrenderutils.cpp +++ b/indra/newview/alrenderutils.cpp @@ -471,6 +471,12 @@ bool ALRenderUtil::setupColorGrade() if (!lut_name.empty()) { std::string lut_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "colorlut", lut_name); + + if(!gDirUtilp->fileExists(lut_path)) + { + lut_path = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "colorlut", lut_name); + } + if (!lut_path.empty()) { std::string temp_exten = gDirUtilp->getExtension(lut_path);