Per-slider reset buttons? Sure.

Adds callback to registrar: "Prefs.Reset", pass debug setting name as parameter.
This commit is contained in:
Inusaito Sayori
2014-08-07 20:29:12 -04:00
parent 20ea0968da
commit 21d54edeb9
3 changed files with 28 additions and 6 deletions

View File

@@ -341,9 +341,15 @@ void LLPreferenceCore::setPersonalInfo(const std::string& visibility, bool im_vi
//////////////////////////////////////////////
// LLFloaterPreference
void reset_to_default(const std::string& control)
{
LLUI::getControlControlGroup(control).getControl(control)->resetToDefault(true);
}
LLFloaterPreference::LLFloaterPreference()
{
mExitWithoutSaving = false;
mCommitCallbackRegistrar.add("Prefs.Reset", boost::bind(reset_to_default, _2));
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_preferences.xml");
}

View File

@@ -97,6 +97,7 @@ const F32 MIN_USER_FAR_CLIP = 64.f;
const S32 ASPECT_RATIO_STR_LEN = 100;
void reset_to_default(const std::string& control);
void reset_all_to_default(const LLView* panel)
{
LLView::child_list_const_iter_t end(panel->endChild());
@@ -105,7 +106,7 @@ void reset_all_to_default(const LLView* panel)
const std::string& control_name((*i)->getControlName());
if (control_name.empty()) continue;
if (control_name == "RenderDepthOfField") continue; // Don't touch render settings *sigh* hack
LLUI::getControlControlGroup(control_name).getControl(control_name)->resetToDefault(true);
reset_to_default(control_name);
}
}

View File

@@ -141,11 +141,26 @@ when the Atmospheric Shaders are enabled.
<panel border="true" bottom="-400" height="244" left="50" name="DoF" label="Depth of Field" width="500">
<check_box bottom="-22" left="5" follows="top|left" control_name="RenderDepthOfField" label="Enable Depth of Field" tool_tip="Toggles a camera like Depth of Field effect on or off, often used to blur out distance or things that shouldnt be in focus" name="RenderDepthOfField"/>
<slider bottom_delta="-18" left_delta="6" follows="top|left" height="16" width="298" control_name="CameraFNumber" can_edit_text="true" decimal_digits="1" increment="0.1" label_width="110" max_val="128" min_val="0.50" name="CameraFNum" label="F-Number:" tool_tip="Camera f-number value for Depth of Field effect"/>
<slider bottom_delta="-18" follows="top|left" height="16" width="298" control_name="CameraFocalLength" can_edit_text="true" decimal_digits="1" increment="0.1" label_width="110" max_val="300" min_val="0" name="CameraFocal" label="Focal Length(mm):" tool_tip="Camera focal length for Depth of Field effect (in millimeters)"/>
<slider bottom_delta="-18" follows="top|left" height="16" width="298" control_name="CameraMaxCoF" can_edit_text="true" decimal_digits="1" increment="0.1" label_width="110" max_val="100" min_val="0" name="CameraCoF" label="Circle of Confusion:" tool_tip="Set the Camera circle of confusion"/>
<slider bottom_delta="-18" follows="top|left" height="16" width="298" control_name="CameraFocusTransitionTime" can_edit_text="true" decimal_digits="2" increment="0.01" label_width="110" max_val="20" min_val="0.01" name="CameraFocusTrans" label="Transition Time(secs):" tool_tip="Time taken to alter focus from one place to the next"/>
<slider bottom_delta="-18" follows="top|left" height="16" width="298" control_name="CameraDoFResScale" can_edit_text="true" decimal_digits="2" increment="0.01" label_width="110" val_width="35" max_val="1" min_val="0.25" name="CameraDoFRes" label="Resolution:" tool_tip="Set the Resolution (Quality) of each DoF pixel"/>
<button bottom_delta="-24" follows="top|left" height="20" width="298" name="reset_dof" label="Reset Depth of Field Settings">
<button bottom_delta="-1" left_delta="300" follows="top|left" height="18" width="60" name="reset_f_num" label="Reset">
<button.commit_callback function="Prefs.Reset" parameter="CameraFNumber"/>
</button>
<slider bottom_delta="-17" left_delta="-300" follows="top|left" height="16" width="298" control_name="CameraFocalLength" can_edit_text="true" decimal_digits="1" increment="0.1" label_width="110" max_val="300" min_val="0" name="CameraFocal" label="Focal Length(mm):" tool_tip="Camera focal length for Depth of Field effect (in millimeters)"/>
<button bottom_delta="-1" left_delta="300" follows="top|left" height="18" width="60" name="reset_focal_length" label="Reset">
<button.commit_callback function="Prefs.Reset" parameter="CameraFocalLength"/>
</button>
<slider bottom_delta="-17" left_delta="-300" follows="top|left" height="16" width="298" control_name="CameraMaxCoF" can_edit_text="true" decimal_digits="1" increment="0.1" label_width="110" max_val="100" min_val="0" name="CameraCoF" label="Circle of Confusion:" tool_tip="Set the Camera circle of confusion"/>
<button bottom_delta="-1" left_delta="300" follows="top|left" height="18" width="60" name="reset_max_cof" label="Reset">
<button.commit_callback function="Prefs.Reset" parameter="CameraMaxCoF"/>
</button>
<slider bottom_delta="-17" left_delta="-300" follows="top|left" height="16" width="298" control_name="CameraFocusTransitionTime" can_edit_text="true" decimal_digits="2" increment="0.01" label_width="110" max_val="20" min_val="0.01" name="CameraFocusTrans" label="Transition Time(secs):" tool_tip="Time taken to alter focus from one place to the next"/>
<button bottom_delta="-1" left_delta="300" follows="top|left" height="18" width="60" name="reset_trans_time" label="Reset">
<button.commit_callback function="Prefs.Reset" parameter="CameraFocusTransitionTime"/>
</button>
<slider bottom_delta="-17" left_delta="-300" follows="top|left" height="16" width="298" control_name="CameraDoFResScale" can_edit_text="true" decimal_digits="2" increment="0.01" label_width="110" val_width="35" max_val="1" min_val="0.25" name="CameraDoFRes" label="Resolution:" tool_tip="Set the Resolution (Quality) of each DoF pixel"/>
<button bottom_delta="-1" left_delta="300" follows="top|left" height="18" width="60" name="reset_res_scale" label="Reset">
<button.commit_callback function="Prefs.Reset" parameter="CameraDoFResScale"/>
</button>
<button bottom_delta="-23" left_delta="-300" follows="top|left" height="20" width="298" name="reset_dof" label="Reset All Depth of Field Settings">
<button.commit_callback function="Graphics.ResetTab" parameter="DoF"/>
</button>
</panel>