viewer#1114 Expose max impostors setting in basic graphics preferences

# Conflicts:
#	indra/newview/llfloaterpreferencesgraphicsadvanced.cpp
master
Andrey Kleshchev 2024-04-02 23:11:29 +03:00 committed by Andrey Lihatskiy
parent d8f3c242d4
commit ea7b63ffbf
6 changed files with 90 additions and 6 deletions

View File

@ -329,6 +329,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
mCommitCallbackRegistrar.add("Pref.AutoAdjustments", boost::bind(&LLFloaterPreference::onClickAutoAdjustments, this));
mCommitCallbackRegistrar.add("Pref.HardwareDefaults", boost::bind(&LLFloaterPreference::setHardwareDefaults, this));
mCommitCallbackRegistrar.add("Pref.AvatarImpostorsEnable", boost::bind(&LLFloaterPreference::onAvatarImpostorsEnable, this));
mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxNonImpostors", boost::bind(&LLFloaterPreference::updateMaxNonImpostors, this));
mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreference::updateMaxComplexity, this));
mCommitCallbackRegistrar.add("Pref.RenderOptionUpdate", boost::bind(&LLFloaterPreference::onRenderOptionEnable, this));
mCommitCallbackRegistrar.add("Pref.WindowedMod", boost::bind(&LLFloaterPreference::onCommitWindowedMode, this));
@ -360,6 +361,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
LLAvatarPropertiesProcessor::getInstance()->addObserver( gAgent.getID(), this );
mComplexityChangedSignal = gSavedSettings.getControl("RenderAvatarMaxComplexity")->getCommitSignal()->connect(boost::bind(&LLFloaterPreference::updateComplexityText, this));
mImpostorsChangedSignal = gSavedSettings.getControl("RenderAvatarMaxNonImpostors")->getSignal()->connect(boost::bind(&LLFloaterPreference::updateIndirectMaxNonImpostors, this, _2));
mCommitCallbackRegistrar.add("Pref.ClearLog", boost::bind(&LLConversationLog::onClearLog, &LLConversationLog::instance()));
mCommitCallbackRegistrar.add("Pref.DeleteTranscripts", boost::bind(&LLFloaterPreference::onDeleteTranscripts, this));
@ -543,6 +545,7 @@ LLFloaterPreference::~LLFloaterPreference()
{
LLConversationLog::instance().removeObserver(this);
mComplexityChangedSignal.disconnect();
mImpostorsChangedSignal.disconnect();
}
void LLFloaterPreference::draw()
@ -1287,6 +1290,9 @@ void LLAvatarComplexityControls::setIndirectMaxArc()
void LLFloaterPreference::refresh()
{
LLPanel::refresh();
setMaxNonImpostorsText(
gSavedSettings.getU32("RenderAvatarMaxNonImpostors"),
getChild<LLTextBox>("IndirectMaxNonImpostorsText", true));
LLAvatarComplexityControls::setText(
gSavedSettings.getU32("RenderAvatarMaxComplexity"),
getChild<LLTextBox>("IndirectMaxComplexityText", true));
@ -1561,6 +1567,44 @@ void LLAvatarComplexityControls::setRenderTimeText(F32 value, LLTextBox* text_bo
}
}
void LLFloaterPreference::updateMaxNonImpostors()
{
// Called when the IndirectMaxNonImpostors control changes
// Responsible for fixing the slider label (IndirectMaxNonImpostorsText) and setting RenderAvatarMaxNonImpostors
LLSliderCtrl* ctrl = getChild<LLSliderCtrl>("IndirectMaxNonImpostors", true);
U32 value = ctrl->getValue().asInteger();
if (0 == value || LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER <= value)
{
value = 0;
}
gSavedSettings.setU32("RenderAvatarMaxNonImpostors", value);
LLVOAvatar::updateImpostorRendering(value); // make it effective immediately
setMaxNonImpostorsText(value, getChild<LLTextBox>("IndirectMaxNonImpostorsText"));
}
void LLFloaterPreference::updateIndirectMaxNonImpostors(const LLSD& newvalue)
{
U32 value = newvalue.asInteger();
if ((value != 0) && (value != gSavedSettings.getU32("IndirectMaxNonImpostors")))
{
gSavedSettings.setU32("IndirectMaxNonImpostors", value);
}
setMaxNonImpostorsText(value, getChild<LLTextBox>("IndirectMaxNonImpostorsText"));
}
void LLFloaterPreference::setMaxNonImpostorsText(U32 value, LLTextBox* text_box)
{
if (0 == value)
{
text_box->setText(LLTrans::getString("no_limit"));
}
else
{
text_box->setText(llformat("%d", value));
}
}
void LLFloaterPreference::updateMaxComplexity()
{
// Called when the IndirectMaxComplexity control changes

View File

@ -206,6 +206,9 @@ private:
void onDeleteTranscripts();
void onDeleteTranscriptsResponse(const LLSD& notification, const LLSD& response);
void updateDeleteTranscriptsButton();
void updateMaxNonImpostors();
void updateIndirectMaxNonImpostors(const LLSD& newvalue);
void setMaxNonImpostorsText(U32 value, LLTextBox* text_box);
void updateMaxComplexity();
void updateComplexityText();
static bool loadFromFilename(const std::string& filename, std::map<std::string, std::string> &label_map);
@ -234,6 +237,7 @@ private:
std::unique_ptr< ll::prefs::SearchData > mSearchData;
bool mSearchDataDirty;
boost::signals2::connection mImpostorsChangedSignal;
boost::signals2::connection mComplexityChangedSignal;
void onUpdateFilterTerm( bool force = false );

View File

@ -51,6 +51,8 @@ LLFloaterPreferenceGraphicsAdvanced::LLFloaterPreferenceGraphicsAdvanced(const L
mCommitCallbackRegistrar.add("Pref.Cancel", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onBtnCancel, this, _2));
mCommitCallbackRegistrar.add("Pref.OK", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onBtnOK, this, _2));
mImpostorsChangedSignal = gSavedSettings.getControl("RenderAvatarMaxNonImpostors")->getSignal()->connect(boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateIndirectMaxNonImpostors, this, _2));
}
LLFloaterPreferenceGraphicsAdvanced::~LLFloaterPreferenceGraphicsAdvanced()
@ -58,7 +60,6 @@ LLFloaterPreferenceGraphicsAdvanced::~LLFloaterPreferenceGraphicsAdvanced()
mComplexityChangedSignal.disconnect();
mComplexityModeChangedSignal.disconnect();
mLODFactorChangedSignal.disconnect();
mNumImpostorsChangedSignal.disconnect();
}
bool LLFloaterPreferenceGraphicsAdvanced::postBuild()
@ -254,8 +255,8 @@ void LLFloaterPreferenceGraphicsAdvanced::updateIndirectMaxNonImpostors(const LL
if ((value != 0) && (value != gSavedSettings.getU32("IndirectMaxNonImpostors")))
{
gSavedSettings.setU32("IndirectMaxNonImpostors", value);
setMaxNonImpostorsText(value, getChild<LLTextBox>("IndirectMaxNonImpostorsText"));
}
setMaxNonImpostorsText(value, getChild<LLTextBox>("IndirectMaxNonImpostorsText"));
}
void LLFloaterPreferenceGraphicsAdvanced::setMaxNonImpostorsText(U32 value, LLTextBox* text_box)

View File

@ -61,6 +61,7 @@ protected:
void onBtnOK(const LLSD& userdata);
void onBtnCancel(const LLSD& userdata);
boost::signals2::connection mImpostorsChangedSignal;
boost::signals2::connection mComplexityChangedSignal;
boost::signals2::connection mComplexityModeChangedSignal;
boost::signals2::connection mLODFactorChangedSignal;

View File

@ -257,7 +257,7 @@
height="16"
increment="1"
initial_value="12"
label="Max. # of non-impostors:"
label="Max. # animated avatars:"
label_width="185"
layout="topleft"
left="30"

View File

@ -210,26 +210,60 @@
increment="8"
initial_value="160"
label="Draw distance:"
label_width="90"
label_width="187"
layout="topleft"
left="30"
min_val="64"
max_val="512"
name="DrawDistance"
top_delta="40"
width="330" />
width="427" />
<text
type="string"
length="1"
follows="left|top"
height="12"
layout="topleft"
left_delta="330"
left_delta="427"
name="DrawDistanceMeterText2"
top_delta="0"
width="128">
m
</text>
<slider
control_name="IndirectMaxNonImpostors"
name="IndirectMaxNonImpostors"
decimal_digits="0"
increment="1"
initial_value="12"
show_text="false"
min_val="1"
max_val="66"
label="Maximum number of animated avatars:"
follows="left|top"
layout="topleft"
height="16"
label_width="240"
left="30"
top_delta="40"
width="393">
<slider.commit_callback
function="Pref.UpdateIndirectMaxNonImpostors"
parameter="IndirectNonImpostorsText" />
</slider>
<text
type="string"
length="1"
follows="left|top"
height="16"
layout="topleft"
top_delta="0"
left_delta="397"
text_readonly_color="LabelDisabledColor"
name="IndirectMaxNonImpostorsText"
width="65">
0
</text>
<button
height="23"