reset camera settings

This commit is contained in:
riso 2020-12-23 23:23:27 -06:00
parent ce13648721
commit 0d10f11a7f
2 changed files with 33 additions and 3 deletions

View File

@ -75,9 +75,17 @@
</div>
</div>
<spacer width="100%" height="2%"/>
<button id="close" text="Apply" align="center"/>
<spacer width="100%" height="1%"/>
<spacer height="4%" width="100%" />
<div layout="horizontal-row" width="100%" proportion="1">
<spacer width="25%" height="100%" />
<div layout="horizontal-row" proportion="1" height="fit">
<button id="close" text="Apply" align="center"/>
</div>
<div layout="horizontal-row" proportion="1" height="fit">
<button id="reset" text="Reset" align="center"/>
</div>
</div>
</div>
</div>
</stkgui>

View File

@ -129,6 +129,28 @@ GUIEngine::EventPropagation CustomCameraSettingsDialog::processEvent(const std::
m_self_destroy = true;
return GUIEngine::EVENT_BLOCK;
}
else if (eventSource == "reset") // discard all the changes
{
if (UserConfigParams::m_camera_present == 1) // Standard camera
{
getWidget<CheckBoxWidget>("camera_smoothing")->setState(UserConfigParams::m_standard_camera_forward_smoothing);
getWidget<CheckBoxWidget>("use_soccer_camera")->setState(UserConfigParams::m_standard_reverse_look_use_soccer_cam);
}
else if (UserConfigParams::m_camera_present == 2) // Drone chase camera
{
getWidget<CheckBoxWidget>("camera_smoothing")->setState(UserConfigParams::m_drone_camera_forward_smoothing);
getWidget<CheckBoxWidget>("use_soccer_camera")->setState(UserConfigParams::m_drone_reverse_look_use_soccer_cam);
}
else // Custom camera
{
getWidget<SpinnerWidget>("fov")->setValue(UserConfigParams::m_saved_camera_fov);
getWidget<SpinnerWidget>("camera_distance")->setFloatValue(UserConfigParams::m_saved_camera_distance);
getWidget<SpinnerWidget>("camera_angle")->setValue(UserConfigParams::m_saved_camera_forward_up_angle);
getWidget<CheckBoxWidget>("camera_smoothing")->setState(UserConfigParams::m_saved_camera_forward_smoothing);
getWidget<SpinnerWidget>("backward_camera_angle")->setValue(UserConfigParams::m_saved_camera_backward_up_angle);
getWidget<CheckBoxWidget>("use_soccer_camera")->setState(UserConfigParams::m_saved_reverse_look_use_soccer_cam);
}
}
#endif
return GUIEngine::EVENT_LET;
} // processEvent