From 6a92695d9550e6e521ad8e8778cbe084b003470d Mon Sep 17 00:00:00 2001 From: Unexpectedly Dismantled <darl@alchemyviewer.org> Date: Thu, 1 Feb 2024 20:44:11 -0600 Subject: [PATCH] Add user_settings colorlut loading for lightbox floater --- indra/newview/alfloaterlightbox.cpp | 26 ++++++++++++++++++++++++-- indra/newview/alfloaterlightbox.h | 1 + indra/newview/alrenderutils.cpp | 6 ++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/indra/newview/alfloaterlightbox.cpp b/indra/newview/alfloaterlightbox.cpp index f9eb141fa66..406e3e98226 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,27 @@ 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"); + if(boost::filesystem::is_directory(user_luts)) + { + if(!boost::filesystem::is_empty(user_luts)) + { + lut_combo->addSeparator(); + } + for (boost::filesystem::directory_entry& lut : boost::filesystem::directory_iterator(user_luts)) + { + 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 1db556a97ce..872265b3962 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 0ea6f0ae776..617ab60354e 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); -- GitLab