diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-05-22 12:33:36 +0300 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2024-05-23 11:46:50 +0300 |
commit | b052240a500707fc0e34ef6f23a02af39fdfc500 (patch) | |
tree | 76e77a6efb566e5f9da845d80bf6f4ce72f90d00 | |
parent | c255174c561fcafcd114a787a9156e05347563d1 (diff) |
viewer#1400 Allow forcing specific LODs for selection
-rw-r--r-- | indra/newview/app_settings/settings.xml | 11 | ||||
-rw-r--r-- | indra/newview/llselectmgr.cpp | 18 | ||||
-rw-r--r-- | indra/newview/llselectmgr.h | 1 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 64 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 5 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 60 |
6 files changed, 158 insertions, 1 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 60e6a89371..667953ab54 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1830,6 +1830,17 @@ <key>Value</key> <integer>0</integer> </map> + <key>DebugSelectionLODs</key> + <map> + <key>Comment</key> + <string>Force selection to show specific LOD, -1 for off, 0 - lowest, 4 - high.</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>S32</string> + <key>Value</key> + <integer>-1</integer> + </map> <key>AnimatedObjectsAllowLeftClick</key> <map> <key>Comment</key> diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 885f4d993e..cbc52aeec6 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -250,6 +250,23 @@ LLSelectMgr::LLSelectMgr() mForceSelection = FALSE; mShowSelection = FALSE; + + LLControlVariable* ctrl = gSavedSettings.getControl("DebugSelectionLODs").get(); + if (ctrl) + { + mSlectionLodModChangedConnection = ctrl->getSignal()->connect([this](LLControlVariable*, const LLSD&, const LLSD&) + { + for (LLObjectSelection::iterator iter = mSelectedObjects->begin(); + iter != mSelectedObjects->end(); ++iter) + { + LLViewerObject* object = (*iter)->getObject(); + if (object) + { + object->updateLOD(); + } + } + }); + } } @@ -259,6 +276,7 @@ LLSelectMgr::LLSelectMgr() LLSelectMgr::~LLSelectMgr() { clearSelections(); + mSlectionLodModChangedConnection.disconnect(); } void LLSelectMgr::clearSelections() diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 1ce53fe149..e3ecdf1013 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -932,6 +932,7 @@ private: BOOL mForceSelection; std::vector<LLAnimPauseRequest> mPauseRequests; + boost::signals2::connection mSlectionLodModChangedConnection; }; // *DEPRECATED: For callbacks or observers, use diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index ad2675a786..39cd72c6b2 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -5510,6 +5510,38 @@ class LLToolsEnablePathfindingRebakeRegion : public view_listener_t } }; +class LLToolsCheckSelectionLODMode : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + std::string param = userdata.asString(); + static LLCachedControl<S32> debug_selection_lods(gSavedSettings, "DebugSelectionLODs", 0); + if ("default" == param) + { + return debug_selection_lods() < 0; + } + else if ("high" == param) + { + return debug_selection_lods() == 3; + } + else if ("medium" == param) + { + return debug_selection_lods() == 2; + } + else if ("low" == param) + { + return debug_selection_lods() == 1; + } + else if ("lowest" == param) + { + return debug_selection_lods() == 0; + } + + return false; + } +}; + + // Round the position of all root objects to the grid class LLToolsSnapObjectXY : public view_listener_t { @@ -8319,6 +8351,36 @@ class LLToolsSelectBySurrounding : public view_listener_t } }; +class LLToolsSelectionLODMode : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + std::string param = userdata.asString(); + if ("default" == param) + { + gSavedSettings.setS32("DebugSelectionLODs", -1); + } + else if ("high" == param) + { + gSavedSettings.setS32("DebugSelectionLODs", 3); + } + else if ("medium" == param) + { + gSavedSettings.setS32("DebugSelectionLODs", 2); + } + else if ("low" == param) + { + gSavedSettings.setS32("DebugSelectionLODs", 1); + } + else if ("lowest" == param) + { + gSavedSettings.setS32("DebugSelectionLODs", 0); + } + + return true; + } +}; + class LLToolsShowHiddenSelection : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -9563,6 +9625,7 @@ void initialize_menus() view_listener_t::addMenu(new LLToolsSelectInvisibleObjects(), "Tools.SelectInvisibleObjects"); view_listener_t::addMenu(new LLToolsSelectReflectionProbes(), "Tools.SelectReflectionProbes"); view_listener_t::addMenu(new LLToolsSelectBySurrounding(), "Tools.SelectBySurrounding"); + view_listener_t::addMenu(new LLToolsSelectionLODMode(), "Tools.SelectionLODMode"); view_listener_t::addMenu(new LLToolsShowHiddenSelection(), "Tools.ShowHiddenSelection"); view_listener_t::addMenu(new LLToolsShowSelectionLightRadius(), "Tools.ShowSelectionLightRadius"); view_listener_t::addMenu(new LLToolsEditLinkedParts(), "Tools.EditLinkedParts"); @@ -9594,6 +9657,7 @@ void initialize_menus() view_listener_t::addMenu(new LLToolsEnablePathfindingView(), "Tools.EnablePathfindingView"); view_listener_t::addMenu(new LLToolsDoPathfindingRebakeRegion(), "Tools.DoPathfindingRebakeRegion"); view_listener_t::addMenu(new LLToolsEnablePathfindingRebakeRegion(), "Tools.EnablePathfindingRebakeRegion"); + view_listener_t::addMenu(new LLToolsCheckSelectionLODMode(), "Tools.ToolsCheckSelectionLODMode"); // Help menu // most items use the ShowFloater method diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 316e0206d3..b4ea06f8b7 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1503,11 +1503,16 @@ BOOL LLVOVolume::calcLOD() mLODAdjustedDistance = distance; + static LLCachedControl<S32> debug_selection_lods(gSavedSettings, "DebugSelectionLODs", 0); if (isHUDAttachment()) { // HUDs always show at highest detail cur_detail = 3; } + else if (isSelected() && debug_selection_lods() >= 0) + { + cur_detail = llmin(debug_selection_lods(), 3); + } else { cur_detail = computeLODDetail(ll_round(distance, 0.01f), ll_round(radius, 0.01f), lod_factor); diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 5b0ebf1110..6e92d91320 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1598,7 +1598,65 @@ function="World.EnvPreset" function="ToggleControl" parameter="RenderDisablePostProcessing" /> </menu_item_check> - + + + <menu + create_jump_keys="true" + label="Selection level of detail" + name="Selection level of detail" + tear_off="true"> + + <menu_item_check + label="Default" + name="Default lod setting"> + <menu_item_check.on_check + function="Tools.ToolsCheckSelectionLODMode" + parameter="default" /> + <menu_item_check.on_click + function="Tools.SelectionLODMode" + parameter="default" /> + </menu_item_check> + <menu_item_check + label="High" + name="High lod setting"> + <menu_item_check.on_check + function="Tools.ToolsCheckSelectionLODMode" + parameter="high" /> + <menu_item_check.on_click + function="Tools.SelectionLODMode" + parameter="high" /> + </menu_item_check> + <menu_item_check + label="Medium" + name="Medium lod setting"> + <menu_item_check.on_check + function="Tools.ToolsCheckSelectionLODMode" + parameter="medium" /> + <menu_item_check.on_click + function="Tools.SelectionLODMode" + parameter="medium" /> + </menu_item_check> + <menu_item_check + label="Low" + name="Low lod setting"> + <menu_item_check.on_check + function="Tools.ToolsCheckSelectionLODMode" + parameter="low" /> + <menu_item_check.on_click + function="Tools.SelectionLODMode" + parameter="low" /> + </menu_item_check> + <menu_item_check + label="Lowest" + name="Lowest lod setting"> + <menu_item_check.on_check + function="Tools.ToolsCheckSelectionLODMode" + parameter="lowest" /> + <menu_item_check.on_click + function="Tools.SelectionLODMode" + parameter="lowest" /> + </menu_item_check> + </menu> <menu_item_separator/> <menu_item_check |