viewer#1400 Allow forcing specific LODs for selection

meow-7.2.2
Andrey Kleshchev 2024-05-22 12:33:36 +03:00 committed by Andrey Kleshchev
parent c255174c56
commit b052240a50
6 changed files with 158 additions and 1 deletions

View File

@ -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>

View File

@ -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()

View File

@ -932,6 +932,7 @@ private:
BOOL mForceSelection;
std::vector<LLAnimPauseRequest> mPauseRequests;
boost::signals2::connection mSlectionLodModChangedConnection;
};
// *DEPRECATED: For callbacks or observers, use

View File

@ -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

View File

@ -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);

View File

@ -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