diff options
-rw-r--r-- | indra/llui/llconsole.cpp | 3 | ||||
-rw-r--r-- | indra/llui/llstatgraph.cpp | 4 | ||||
-rw-r--r-- | indra/llui/lluicolortable.cpp | 68 | ||||
-rw-r--r-- | indra/llui/lluicolortable.h | 7 | ||||
-rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/newview/app_settings/settings.xml | 11 | ||||
-rw-r--r-- | indra/newview/llfloatersettingscolor.cpp | 334 | ||||
-rw-r--r-- | indra/newview/llfloatersettingscolor.h | 81 | ||||
-rw-r--r-- | indra/newview/llmanip.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llselectmgr.cpp | 25 | ||||
-rw-r--r-- | indra/newview/llselectmgr.h | 13 | ||||
-rw-r--r-- | indra/newview/llviewerfloaterreg.cpp | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_settings_color.xml | 117 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_login.xml | 7 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 7 |
15 files changed, 654 insertions, 33 deletions
diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp index 4f52f5936d..91e6f281da 100644 --- a/indra/llui/llconsole.cpp +++ b/indra/llui/llconsole.cpp @@ -183,7 +183,8 @@ void LLConsole::draw() static LLCachedControl<F32> console_bg_opacity(*LLUI::getInstance()->mSettingGroups["config"], "ConsoleBackgroundOpacity", 0.7f); F32 console_opacity = llclamp(console_bg_opacity(), 0.f, 1.f); - static LLColor4 color = LLUIColorTable::instance().getColor("ConsoleBackground"); + static LLUIColor console_color = LLUIColorTable::instance().getColor("ConsoleBackground"); + LLColor4 color = console_color; color.mV[VALPHA] *= console_opacity; F32 line_height = (F32)mFont->getLineHeight(); diff --git a/indra/llui/llstatgraph.cpp b/indra/llui/llstatgraph.cpp index 28b4d387f1..d97051247e 100644 --- a/indra/llui/llstatgraph.cpp +++ b/indra/llui/llstatgraph.cpp @@ -100,8 +100,8 @@ void LLStatGraph::draw() it--; } - static LLColor4 default_color = LLUIColorTable::instance().getColor( "MenuDefaultBgColor" ); - gGL.color4fv(default_color.mV); + static LLUIColor default_color = LLUIColorTable::instance().getColor( "MenuDefaultBgColor" ); + gGL.color4fv(default_color.get().mV); gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, true); gGL.color4fv(LLColor4::black.mV); diff --git a/indra/llui/lluicolortable.cpp b/indra/llui/lluicolortable.cpp index 3279926786..a792cb8103 100644 --- a/indra/llui/lluicolortable.cpp +++ b/indra/llui/lluicolortable.cpp @@ -198,7 +198,61 @@ LLUIColor LLUIColorTable::getColor(std::string_view name, const LLColor4& defaul // update user color, loaded colors are parsed on initialization void LLUIColorTable::setColor(std::string_view name, const LLColor4& color) { - setColor(name, color, mUserSetColors); + auto it = mUserSetColors.lower_bound(name); + if(it != mUserSetColors.end() && !(mUserSetColors.key_comp()(name, it->first))) + { + it->second = color; + } + else + { + string_color_map_t::iterator base_iter = mLoadedColors.find(name); + if (base_iter != mLoadedColors.end()) + { + LLColor4 original_color = base_iter->second.get(); + auto color_handle = mLoadedColors.extract(base_iter); + auto new_color_pair = mUserSetColors.insert(std::move(color_handle)); + new_color_pair.position->second = color; + mLoadedColors.emplace(name, LLUIColor(original_color)); + } + else + { + mUserSetColors.insert(it, std::make_pair(name, color)); + } + } +} + +bool LLUIColorTable::isDefault(std::string_view name) const +{ + string_color_map_t::const_iterator base_iter = mLoadedColors.find(name); + string_color_map_t::const_iterator user_iter = mUserSetColors.find(name); + if (base_iter != mLoadedColors.end()) + { + if(user_iter != mUserSetColors.end()) + return user_iter->second == base_iter->second; + + return true; + } + else if (user_iter != mUserSetColors.end()) // user only color ??? + { + return true; + } + + return false; +} + +void LLUIColorTable::resetToDefault(std::string_view name) +{ + string_color_map_t::iterator iter = mUserSetColors.find(name); + + if (iter != mUserSetColors.end()) + { + auto default_iter = mLoadedColors.find(name); + + if (default_iter != mLoadedColors.end()) + { + iter->second = default_iter->second.get(); + } + } } bool LLUIColorTable::loadFromSettings() @@ -223,18 +277,16 @@ void LLUIColorTable::saveUserSettings() const { Params params; - for(string_color_map_t::const_iterator it = mUserSetColors.begin(); - it != mUserSetColors.end(); - ++it) + for (const auto& color_pair : mUserSetColors) { // Compare user color value with the default value, skip if equal - string_color_map_t::const_iterator itd = mLoadedColors.find(it->first); - if(itd != mLoadedColors.end() && itd->second == it->second) + string_color_map_t::const_iterator itd = mLoadedColors.find(color_pair.first); + if(itd != mLoadedColors.end() && itd->second == color_pair.second) continue; ColorEntryParams color_entry; - color_entry.name = it->first; - color_entry.color.value = it->second; + color_entry.name = color_pair.first; + color_entry.color.value = color_pair.second; params.color_entries.add(color_entry); } diff --git a/indra/llui/lluicolortable.h b/indra/llui/lluicolortable.h index ca1ca9eaa7..0c6286e5eb 100644 --- a/indra/llui/lluicolortable.h +++ b/indra/llui/lluicolortable.h @@ -83,12 +83,19 @@ public: // returns true if color_name exists in the table bool colorExists(std::string_view color_name) const; + bool isDefault(std::string_view color_name) const; + + void resetToDefault(std::string_view color_name); + // loads colors from settings files bool loadFromSettings(); // saves colors specified by the user to the users skin directory void saveUserSettings() const; + const auto& getLoadedColors() { return mLoadedColors; } + const auto& getUserColors() { return mUserSetColors; } + private: bool loadFromFilename(const std::string& filename, string_color_map_t& table); diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 4c5deb4974..8df9c41219 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -286,6 +286,7 @@ set(viewer_SOURCE_FILES llfloaterscriptlimits.cpp llfloatersearch.cpp llfloatersellland.cpp + llfloatersettingscolor.cpp llfloatersettingsdebug.cpp llfloatersidepanelcontainer.cpp llfloatersnapshot.cpp @@ -954,6 +955,7 @@ set(viewer_HEADER_FILES llfloaterscriptlimits.h llfloatersearch.h llfloatersellland.h + llfloatersettingscolor.h llfloatersettingsdebug.h llfloatersidepanelcontainer.h llfloatersnapshot.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 9e5d3f09bd..eb053ebaa0 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -15773,6 +15773,17 @@ <key>Value</key> <integer>0</integer> </map> + <key>ColorSettingsHideDefault</key> + <map> + <key>Comment</key> + <string>Show non-default settings only in Color Settings list</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>DebugSettingsHideDefault</key> <map> <key>Comment</key> diff --git a/indra/newview/llfloatersettingscolor.cpp b/indra/newview/llfloatersettingscolor.cpp new file mode 100644 index 0000000000..d9c382a1dc --- /dev/null +++ b/indra/newview/llfloatersettingscolor.cpp @@ -0,0 +1,334 @@ +/** +* @file llfloatersettingscolor.cpp +* @brief Implementation of LLFloaterSettingsColor +* @author Rye Cogtail<rye@alchemyviewer.org> +* +* $LicenseInfo:firstyear=2024&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2024, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" + +#include "llfloatersettingscolor.h" + +#include "llfloater.h" +#include "llfiltereditor.h" +#include "lluictrlfactory.h" +#include "llcombobox.h" +#include "llspinctrl.h" +#include "llcolorswatch.h" +#include "llviewercontrol.h" +#include "lltexteditor.h" + + +LLFloaterSettingsColor::LLFloaterSettingsColor(const LLSD& key) +: LLFloater(key), + mSettingList(NULL) +{ + mCommitCallbackRegistrar.add("CommitSettings", boost::bind(&LLFloaterSettingsColor::onCommitSettings, this)); + mCommitCallbackRegistrar.add("ClickDefault", boost::bind(&LLFloaterSettingsColor::onClickDefault, this)); +} + +LLFloaterSettingsColor::~LLFloaterSettingsColor() +{} + +bool LLFloaterSettingsColor::postBuild() +{ + enableResizeCtrls(true, false, true); + + mAlphaSpinner = getChild<LLSpinCtrl>("alpha_spinner"); + mColorSwatch = getChild<LLColorSwatchCtrl>("color_swatch"); + + mDefaultButton = getChild<LLUICtrl>("default_btn"); + mSettingNameText = getChild<LLTextBox>("color_name_txt"); + + getChild<LLFilterEditor>("filter_input")->setCommitCallback(boost::bind(&LLFloaterSettingsColor::setSearchFilter, this, _2)); + + mSettingList = getChild<LLScrollListCtrl>("setting_list"); + mSettingList->setCommitOnSelectionChange(true); + mSettingList->setCommitCallback(boost::bind(&LLFloaterSettingsColor::onSettingSelect, this)); + + updateList(); + + gSavedSettings.getControl("ColorSettingsHideDefault")->getCommitSignal()->connect(boost::bind(&LLFloaterSettingsColor::updateList, this, false)); + + return LLFloater::postBuild(); +} + +void LLFloaterSettingsColor::draw() +{ + LLScrollListItem* first_selected = mSettingList->getFirstSelected(); + if (first_selected) + { + if(auto cell = first_selected->getColumn(1)) + { + updateControl(cell->getValue().asString()); + } + } + + LLFloater::draw(); +} + +void LLFloaterSettingsColor::onCommitSettings() +{ + LLScrollListItem* first_selected = mSettingList->getFirstSelected(); + if (!first_selected) + { + return; + } + auto cell = first_selected->getColumn(1); + + if (!cell) + { + return; + } + + auto color_name = cell->getValue().asString(); + if (color_name.empty()) + { + return; + } + + LLColor4 col4; + LLColor3 col3; + col3.setValue(mColorSwatch->getValue()); + col4 = LLColor4(col3, (F32)mAlphaSpinner->getValue().asReal()); + LLUIColorTable::instance().setColor(color_name, col4); + + updateDefaultColumn(color_name); +} + +// static +void LLFloaterSettingsColor::onClickDefault() +{ + LLScrollListItem* first_selected = mSettingList->getFirstSelected(); + if (first_selected) + { + auto cell = first_selected->getColumn(1); + if (cell) + { + auto name = cell->getValue().asString(); + LLUIColorTable::instance().resetToDefault(name); + updateDefaultColumn(name); + updateControl(name); + } + } +} + +// we've switched controls, or doing per-frame update, so update spinners, etc. +void LLFloaterSettingsColor::updateControl(const std::string& color_name) +{ + hideUIControls(); + + if (!isSettingHidden(color_name)) + { + mDefaultButton->setVisible(true); + mSettingNameText->setVisible(true); + mSettingNameText->setText(color_name); + mSettingNameText->setToolTip(color_name); + + LLColor4 clr = LLUIColorTable::instance().getColor(color_name); + mColorSwatch->setVisible(true); + // only set if changed so color picker doesn't update + if (clr != LLColor4(mColorSwatch->getValue())) + { + mColorSwatch->setOriginal(clr); + } + mAlphaSpinner->setVisible(true); + mAlphaSpinner->setLabel(std::string("Alpha")); + if (!mAlphaSpinner->hasFocus()) + { + mAlphaSpinner->setPrecision(3); + mAlphaSpinner->setMinValue(0.0); + mAlphaSpinner->setMaxValue(1.f); + mAlphaSpinner->setValue(clr.mV[VALPHA]); + } + } + +} + +void LLFloaterSettingsColor::updateList(bool skip_selection) +{ + std::string last_selected; + LLScrollListItem* item = mSettingList->getFirstSelected(); + if (item) + { + LLScrollListCell* cell = item->getColumn(1); + if (cell) + { + last_selected = cell->getValue().asString(); + } + } + + mSettingList->deleteAllItems(); + + const auto& base_colors = LLUIColorTable::instance().getLoadedColors(); + for (const auto& pair : base_colors) + { + const auto& name = pair.first; + if (matchesSearchFilter(name) && !isSettingHidden(name)) + { + LLSD row; + + row["columns"][0]["column"] = "changed_color"; + row["columns"][0]["value"] = LLUIColorTable::instance().isDefault(name) ? "" : "*"; + + row["columns"][1]["column"] = "color"; + row["columns"][1]["value"] = name; + + LLScrollListItem* item = mSettingList->addElement(row, ADD_BOTTOM, nullptr); + if (!mSearchFilter.empty() && (last_selected == name) && !skip_selection) + { + std::string lower_name(name); + LLStringUtil::toLower(lower_name); + if (LLStringUtil::startsWith(lower_name, mSearchFilter)) + { + item->setSelected(true); + } + } + } + } + + for (const auto& pair : LLUIColorTable::instance().getUserColors()) + { + const auto& name = pair.first; + if (base_colors.find(name) == base_colors.end() && matchesSearchFilter(name) && !isSettingHidden(name)) + { + LLSD row; + + row["columns"][0]["column"] = "changed_color"; + row["columns"][0]["value"] = LLUIColorTable::instance().isDefault(name) ? "" : "*"; + + row["columns"][1]["column"] = "color"; + row["columns"][1]["value"] = name; + + LLScrollListItem* item = mSettingList->addElement(row, ADD_BOTTOM, nullptr); + if (!mSearchFilter.empty() && (last_selected == name) && !skip_selection) + { + std::string lower_name(name); + LLStringUtil::toLower(lower_name); + if (LLStringUtil::startsWith(lower_name, mSearchFilter)) + { + item->setSelected(true); + } + } + } + } + + mSettingList->updateSort(); + + if (!mSettingList->isEmpty()) + { + if (mSettingList->hasSelectedItem()) + { + mSettingList->scrollToShowSelected(); + } + else if (!mSettingList->hasSelectedItem() && !mSearchFilter.empty() && !skip_selection) + { + if (!mSettingList->selectItemByPrefix(mSearchFilter, false, 1)) + { + mSettingList->selectFirstItem(); + } + mSettingList->scrollToShowSelected(); + } + } + else + { + LLSD row; + + row["columns"][0]["column"] = "changed_color"; + row["columns"][0]["value"] = ""; + row["columns"][1]["column"] = "color"; + row["columns"][1]["value"] = "No matching colors."; + + mSettingList->addElement(row); + hideUIControls(); + } +} + +void LLFloaterSettingsColor::onSettingSelect() +{ + LLScrollListItem* first_selected = mSettingList->getFirstSelected(); + if (first_selected) + { + auto cell = first_selected->getColumn(1); + if (cell) + { + updateControl(cell->getValue().asString()); + } + } +} + +void LLFloaterSettingsColor::setSearchFilter(const std::string& filter) +{ + if(mSearchFilter == filter) + return; + mSearchFilter = filter; + LLStringUtil::toLower(mSearchFilter); + updateList(); +} + +bool LLFloaterSettingsColor::matchesSearchFilter(std::string setting_name) +{ + // If the search filter is empty, everything passes. + if (mSearchFilter.empty()) return true; + + LLStringUtil::toLower(setting_name); + std::string::size_type match_name = setting_name.find(mSearchFilter); + + return (std::string::npos != match_name); +} + +bool LLFloaterSettingsColor::isSettingHidden(const std::string& color_name) +{ + static LLCachedControl<bool> hide_default(gSavedSettings, "ColorSettingsHideDefault", false); + return hide_default && LLUIColorTable::instance().isDefault(color_name); +} + +void LLFloaterSettingsColor::updateDefaultColumn(const std::string& color_name) +{ + if (isSettingHidden(color_name)) + { + hideUIControls(); + updateList(true); + return; + } + + LLScrollListItem* item = mSettingList->getFirstSelected(); + if (item) + { + LLScrollListCell* cell = item->getColumn(0); + if (cell) + { + std::string is_default = LLUIColorTable::instance().isDefault(color_name) ? "" : "*"; + cell->setValue(is_default); + } + } +} + +void LLFloaterSettingsColor::hideUIControls() +{ + mColorSwatch->setVisible(false); + mAlphaSpinner->setVisible(false); + mDefaultButton->setVisible(false); + mSettingNameText->setVisible(false); +} + diff --git a/indra/newview/llfloatersettingscolor.h b/indra/newview/llfloatersettingscolor.h new file mode 100644 index 0000000000..42eb85cd60 --- /dev/null +++ b/indra/newview/llfloatersettingscolor.h @@ -0,0 +1,81 @@ +/** +* @file llfloatersettingscolor.h +* @brief Header file for LLFloaterSettingsColor +* @author Rye Cogtail<rye@alchemyviewer.org> +* +* $LicenseInfo:firstyear=2024&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2024, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#ifndef LLFLOATERCOLORSETTINGS_H +#define LLFLOATERCOLORSETTINGS_H + +#include "llcontrol.h" +#include "llfloater.h" + +class LLColorSwatchCtrl; +class LLScrollListCtrl; +class LLSpinCtrl; +class LLTextBox; + +class LLFloaterSettingsColor final +: public LLFloater +{ + friend class LLFloaterReg; + +public: + + bool postBuild() override; + void draw() override; + + void updateControl(const std::string& color_name); + + void onCommitSettings(); + void onClickDefault(); + + bool matchesSearchFilter(std::string setting_name); + bool isSettingHidden(const std::string& color_name); + +private: + LLFloaterSettingsColor(const LLSD& key); + virtual ~LLFloaterSettingsColor(); + + void updateList(bool skip_selection = false); + void onSettingSelect(); + void setSearchFilter(const std::string& filter); + + void updateDefaultColumn(const std::string& color_name); + void hideUIControls(); + + LLScrollListCtrl* mSettingList; + +protected: + LLUICtrl* mDefaultButton = nullptr; + LLTextBox* mSettingNameText = nullptr; + + LLSpinCtrl* mAlphaSpinner = nullptr; + LLColorSwatchCtrl* mColorSwatch = nullptr; + + std::string mSearchFilter; +}; + +#endif //LLFLOATERCOLORSETTINGS_H + diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp index 0c82db1011..0d617753c8 100644 --- a/indra/newview/llmanip.cpp +++ b/indra/newview/llmanip.cpp @@ -594,9 +594,9 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string LLColor4 LLManip::setupSnapGuideRenderPass(S32 pass) { - static LLColor4 grid_color_fg = LLUIColorTable::instance().getColor("GridlineColor"); - static LLColor4 grid_color_bg = LLUIColorTable::instance().getColor("GridlineBGColor"); - static LLColor4 grid_color_shadow = LLUIColorTable::instance().getColor("GridlineShadowColor"); + static LLUIColor grid_color_fg = LLUIColorTable::instance().getColor("GridlineColor"); + static LLUIColor grid_color_bg = LLUIColorTable::instance().getColor("GridlineBGColor"); + static LLUIColor grid_color_shadow = LLUIColorTable::instance().getColor("GridlineShadowColor"); LLColor4 line_color; F32 line_alpha = gSavedSettings.getF32("GridOpacity"); diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index fcd1c84ba4..342048252f 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -128,12 +128,12 @@ F32 LLSelectMgr::sHighlightAlpha = 0.f; F32 LLSelectMgr::sHighlightAlphaTest = 0.f; F32 LLSelectMgr::sHighlightUAnim = 0.f; F32 LLSelectMgr::sHighlightVAnim = 0.f; -LLColor4 LLSelectMgr::sSilhouetteParentColor; -LLColor4 LLSelectMgr::sSilhouetteChildColor; -LLColor4 LLSelectMgr::sHighlightInspectColor; -LLColor4 LLSelectMgr::sHighlightParentColor; -LLColor4 LLSelectMgr::sHighlightChildColor; -LLColor4 LLSelectMgr::sContextSilhouetteColor; +LLUIColor LLSelectMgr::sSilhouetteParentColor; +LLUIColor LLSelectMgr::sSilhouetteChildColor; +LLUIColor LLSelectMgr::sHighlightInspectColor; +LLUIColor LLSelectMgr::sHighlightParentColor; +LLUIColor LLSelectMgr::sHighlightChildColor; +LLUIColor LLSelectMgr::sContextSilhouetteColor; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // struct LLDeRezInfo @@ -6437,8 +6437,10 @@ void LLSelectMgr::renderSilhouettes(bool for_hud) bool wireframe_selection = (gFloaterTools && gFloaterTools->getVisible()) || LLSelectMgr::sRenderHiddenSelections; F32 fogCfx = (F32)llclamp((LLSelectMgr::getInstance()->getSelectionCenterGlobal() - gAgentCamera.getCameraPositionGlobal()).magVec() / (LLSelectMgr::getInstance()->getBBoxOfSelection().getExtentLocal().magVec() * 4), 0.0, 1.0); - static LLColor4 sParentColor = LLColor4(sSilhouetteParentColor[VRED], sSilhouetteParentColor[VGREEN], sSilhouetteParentColor[VBLUE], LLSelectMgr::sHighlightAlpha); - static LLColor4 sChildColor = LLColor4(sSilhouetteChildColor[VRED], sSilhouetteChildColor[VGREEN], sSilhouetteChildColor[VBLUE], LLSelectMgr::sHighlightAlpha); + LLColor4 sParentColor = sSilhouetteParentColor; + sParentColor.mV[VALPHA] = LLSelectMgr::sHighlightAlpha; + LLColor4 sChildColor = sSilhouetteChildColor; + sChildColor.mV[VALPHA] = LLSelectMgr::sHighlightAlpha; auto renderMeshSelection_f = [fogCfx, wireframe_selection](LLSelectNode* node, LLViewerObject* objectp, LLColor4 hlColor) { @@ -8006,12 +8008,9 @@ S32 LLObjectSelection::getSelectedObjectRenderCost() cost += object->getRenderCost(textures); computed_objects.insert(object->getID()); - const_child_list_t children = object->getChildren(); - for (const_child_list_t::const_iterator child_iter = children.begin(); - child_iter != children.end(); - ++child_iter) + const const_child_list_t& children = object->getChildren(); + for (LLViewerObject* child_obj : children) { - LLViewerObject* child_obj = *child_iter; LLVOVolume *child = dynamic_cast<LLVOVolume*>( child_obj ); if (child) { diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 355e28595b..2764b0179c 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -44,6 +44,7 @@ #include "llcontrol.h" #include "llviewerobject.h" // LLObjectSelection::getSelectedTEValue template #include "llmaterial.h" +#include "lluicolor.h" #include <deque> #include <boost/iterator/filter_iterator.hpp> @@ -450,12 +451,12 @@ public: static F32 sHighlightAlphaTest; static F32 sHighlightUAnim; static F32 sHighlightVAnim; - static LLColor4 sSilhouetteParentColor; - static LLColor4 sSilhouetteChildColor; - static LLColor4 sHighlightParentColor; - static LLColor4 sHighlightChildColor; - static LLColor4 sHighlightInspectColor; - static LLColor4 sContextSilhouetteColor; + static LLUIColor sSilhouetteParentColor; + static LLUIColor sSilhouetteChildColor; + static LLUIColor sHighlightParentColor; + static LLUIColor sHighlightChildColor; + static LLUIColor sHighlightInspectColor; + static LLUIColor sContextSilhouetteColor; LLCachedControl<bool> mHideSelectedObjects; LLCachedControl<bool> mRenderHighlightSelections; diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index c97a512a57..9bdd246129 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -134,6 +134,7 @@ #include "llfloaterscriptlimits.h" #include "llfloatersearch.h" #include "llfloatersellland.h" +#include "llfloatersettingscolor.h" #include "llfloatersettingsdebug.h" #include "llfloatersidepanelcontainer.h" #include "llfloatersnapshot.h" @@ -486,6 +487,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("script_limits", "floater_script_limits.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterScriptLimits>); LLFloaterReg::add("my_scripts", "floater_my_scripts.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMyScripts>); LLFloaterReg::add("sell_land", "floater_sell_land.xml", &LLFloaterSellLand::buildFloater); + LLFloaterReg::add("settings_color", "floater_settings_color.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSettingsColor>); LLFloaterReg::add("settings_debug", "floater_settings_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSettingsDebug>); LLFloaterReg::add("sound_devices", "floater_sound_devices.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSoundDevices>); LLFloaterReg::add("stats", "floater_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloater>); diff --git a/indra/newview/skins/default/xui/en/floater_settings_color.xml b/indra/newview/skins/default/xui/en/floater_settings_color.xml new file mode 100644 index 0000000000..0722677f1d --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_settings_color.xml @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<floater + legacy_header_height="18" + can_minimize="false" + height="360" + min_height="367" + layout="topleft" + name="settings_color" + help_topic="settings_color" + title="COLOR SETTINGS" + reuse_instance="true" + can_resize="true" + min_width="550" + width="570"> + <filter_editor + follows="left|top|right" + height="23" + layout="topleft" + left="10" + right="-10" + label="Enter search text" + max_length_chars="300" + name="filter_input" + text_pad_left="10" + top="30" /> + <scroll_list + column_padding="0" + draw_heading="true" + draw_stripes="false" + heading_height="23" + height="266" + layout="topleft" + search_column="1" + sort_column="1" + left="10" + follows="left|top|bottom" + name="setting_list" + top_pad="2" + width="300"> + <scroll_list.columns + name="changed_color" + relative_width="0.05" /> + <scroll_list.columns + label="Color" + name="color" /> + </scroll_list> + <text + type="string" + length="1" + follows="left|top" + height="16" + layout="topleft" + name="color_name_txt" + font="SansSerifSmallBold" + top_delta="8" + left_pad="10" + visible="true" + use_ellipses="true" + text_color="White" + width="240"> + Color name + </text> + <color_swatch + top_pad="0" + left_delta="0" + follows="top|left" + can_apply_immediately="true" + height="180" + name="color_swatch" + visible="true" + layout="topleft" + width="240"> + <color_swatch.commit_callback + function="CommitSettings" /> + </color_swatch> + <spinner + height="20" + label="Alpha" + layout="topleft" + follows="top|left" + left_delta="0" + min_val="0" + max_val="1" + decimal_digits="3" + name="alpha_spinner" + top_pad="5" + visible="true" + width="120"> + <spinner.commit_callback + function="CommitSettings" /> + </spinner> + <button + height="22" + label="Reset to default" + follows="left|top" + layout="topleft" + left_delta="0" + name="default_btn" + visible="true" + top_pad="15" + width="150"> + <button.commit_callback + function="ClickDefault" /> + </button> + <check_box + control_name="ColorSettingsHideDefault" + height="16" + initial_value="true" + label="Show changed colors only" + layout="topleft" + top_pad="10" + left="10" + follows="left|bottom" + name="hide_default" + width="330"> + </check_box> +</floater>
\ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/menu_login.xml b/indra/newview/skins/default/xui/en/menu_login.xml index a71cbde21b..1d1b81e31a 100644 --- a/indra/newview/skins/default/xui/en/menu_login.xml +++ b/indra/newview/skins/default/xui/en/menu_login.xml @@ -149,6 +149,13 @@ function="Advanced.ShowDebugSettings" parameter="all" /> </menu_item_call> + <menu_item_call + label="Show Color settings" + name="Color Settings"> + <menu_item_call.on_click + function="Floater.Toggle" + parameter="settings_color" /> + </menu_item_call> <menu_item_separator /> <menu_item_call label="XUI Preview Tool" diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 941f0c6bb7..f7b10a376e 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -3830,6 +3830,13 @@ function="World.EnvPreset" name="XUI" tear_off="true"> <menu_item_call + label="Show Color settings" + name="Color Settings"> + <menu_item_call.on_click + function="Floater.Toggle" + parameter="settings_color" /> + </menu_item_call> + <menu_item_call label="Reload Color Settings" name="Reload Color Settings"> <menu_item_call.on_click |