Feature Request: Add Camera preset switching functionality (part of quicksettings)

Hitting Escape will reset to the normal Back preset
Adds new Cam_Preset_*_(On|Off).png textures, these should probably be reskinned, any volunteers?
This commit is contained in:
Inusaito Sayori
2013-11-01 17:35:12 -04:00
parent 2d421a27e1
commit 0fc9d540bf
10 changed files with 53 additions and 2 deletions

View File

@@ -189,6 +189,7 @@
#include "llvovolume.h"
#include "hippogridmanager.h"
#include "wlfPanel_AdvSettings.h"
void toggle_search_floater();
@@ -4122,6 +4123,16 @@ void reset_view_final( BOOL proceed )
}
gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW);
if (wlfPanel_AdvSettings::instanceExists()) // Fix up the buttons on the wlf panel to match the preset switch
{
wlfPanel_AdvSettings& inst(wlfPanel_AdvSettings::instance());
if (inst.isExpanded())
{
inst.getChildView("Rear")->setValue(true);
inst.getChildView("Front")->setValue(false);
inst.getChildView("Group")->setValue(false);
}
}
gAgentCamera.resetView(TRUE, TRUE);
gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR);

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@@ -1,7 +1,17 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<panel bg_visible="false" border="false" border_visible="false" height="180" name="Adv_Settings" use_bounding_rect="true" width="220">
<panel bottom="1" filename="panel_bg_tab.xml" height="177" width="197"/>
<slider bottom="157" left="5" control_name="RenderFarClip" decimal_digits="0" height="20" increment="8" label="Draw Dist.:" can_edit_text="true" label_width="60" max_val="1024" min_val="24" val_width="36" name="DrawDistance" width="189" tool_tip="Change your Draw Distance"/>
<panel bottom="1" filename="panel_bg_tab.xml" height="194" width="197"/>
<text bottom="169" left="5" height="20" width="190" name="Camera Preset:">Cam Preset:</text>
<button bottom="171" left="81" width="20" height="20" label="" toggle="true" image_selected="Cam_Preset_Back_On.png" image_unselected="Cam_Preset_Back_Off.png" name="Rear">
<button.commit_callback function="Wlf.ChangeCameraPreset" parameter="0"/>
</button>
<button bottom_delta="0" left_delta="20" width="20" height="20" label="" toggle="true" image_selected="Cam_Preset_Front_On.png" image_unselected="Cam_Preset_Front_Off.png" name="Front">
<button.commit_callback function="Wlf.ChangeCameraPreset" parameter="1"/>
</button>
<button bottom_delta="0" left_delta="20" width="20" height="20" label="" toggle="true" image_selected="Cam_Preset_Side_On.png" image_unselected="Cam_Preset_Side_Off.png" name="Group">
<button.commit_callback function="Wlf.ChangeCameraPreset" parameter="2"/>
</button>
<slider bottom_delta="-20" left="5" control_name="RenderFarClip" decimal_digits="0" height="20" increment="8" label="Draw Dist.:" can_edit_text="true" label_width="60" max_val="1024" min_val="24" val_width="36" name="DrawDistance" width="190" tool_tip="Change your Draw Distance"/>
<slider bottom_delta="-20" control_name="RenderMaxPartCount" decimal_digits="0" height="20" increment="256" label="Particles:" can_edit_text="true" label_width="60" max_val="8192" min_val="0" val_width="36" name="MaxParticleCount" width="189" tool_tip="Amount of particles to render"/>
<slider bottom_delta="-20" control_name="RenderAvatarMaxVisible" decimal_digits="0" height="20" increment="1" label="Max Avs:" can_edit_text="true" label_width="60" max_val="50" min_val="1" val_width="36" name="RenderAvatarMaxVisible" width="189" tool_tip="How many avatars to fully render on screen. Lowering this greatly improves FPS in crowded situations. Requires Avatar Impostors to be on. [Default 35]"/>
<slider bottom_delta="-20" control_name="RenderVolumeLODFactor" height="20" increment="0.125" label="Obj. Detail:" can_edit_text="true" label_width="60" max_val="4" min_val="0.5" name="Object Detail" val_width="36" width="189" tool_tip="Controls level of detail of primitives (multiplier for current screen area when calculated level of detail[0.5 to 2.0 is stable])"/>

View File

@@ -47,6 +47,7 @@
#include "llfloaterwindlight.h"
#include "llfloaterwater.h"
#include "llagentcamera.h"
#include "lldaycyclemanager.h"
#include "llenvmanager.h"
#include "llwaterparammanager.h"
@@ -58,6 +59,7 @@ wlfPanel_AdvSettings::wlfPanel_AdvSettings() : mExpanded(false)
setVisible(false);
setIsChrome(TRUE);
setFocusRoot(TRUE);
mCommitCallbackRegistrar.add("Wlf.ChangeCameraPreset", boost::bind(&wlfPanel_AdvSettings::onChangeCameraPreset, this, _1, _2));
if(rlv_handler_t::isEnabled())
gRlvHandler.setBehaviourToggleCallback(boost::bind(&wlfPanel_AdvSettings::onRlvBehaviorChange, this, _1, _2));
}
@@ -184,6 +186,14 @@ BOOL wlfPanel_AdvSettings::postBuild()
mTimeSlider->setCommitCallback(boost::bind(&wlfPanel_AdvSettings::onChangeDayTime, this, _2));
updateTimeSlider();
updateRlvVisibility();
const U32 preset(gSavedSettings.getU32("CameraPreset"));
if (preset == CAMERA_PRESET_REAR_VIEW)
getChildView("Rear")->setValue(true);
else if (preset == CAMERA_PRESET_FRONT_VIEW)
getChildView("Front")->setValue(true);
else if (preset == CAMERA_PRESET_GROUP_VIEW)
getChildView("Group")->setValue(true);
}
return TRUE;
}
@@ -203,6 +213,24 @@ void wlfPanel_AdvSettings::onClickExpandBtn(void* user_data)
gSavedSettings.setBOOL("wlfAdvSettingsPopup",!gSavedSettings.getBOOL("wlfAdvSettingsPopup"));
}
void wlfPanel_AdvSettings::onChangeCameraPreset(LLUICtrl* ctrl, const LLSD& param)
{
if (!ctrl->getValue()) // One of these must be set at all times
{
ctrl->setValue(true);
return;
}
// 0 is rear, 1 is front, 2 is group
const ECameraPreset preset((param.asInteger() == 0) ? CAMERA_PRESET_REAR_VIEW : (param.asInteger() == 1) ? CAMERA_PRESET_FRONT_VIEW : CAMERA_PRESET_GROUP_VIEW);
// Turn off the other preset indicators
if (preset != CAMERA_PRESET_REAR_VIEW) getChildView("Rear")->setValue(false);
if (preset != CAMERA_PRESET_FRONT_VIEW) getChildView("Front")->setValue(false);
if (preset != CAMERA_PRESET_GROUP_VIEW) getChildView("Group")->setValue(false);
// Actually switch the camera
gAgentCamera.switchCameraPreset(preset);
}
void wlfPanel_AdvSettings::onUseRegionSettings(const LLSD& value)
{
LLEnvManagerNew::instance().setUseRegionSettings(value.asBoolean(), gSavedSettings.getBOOL("PhoenixInterpolateSky"));

View File

@@ -57,8 +57,10 @@ public:
static void updateClass();
static void onClickExpandBtn(void* user_data);
void onChangeCameraPreset(LLUICtrl* ctrl, const LLSD& param);
void onChangeWWPresetName(const LLSD& value);
void onChangeWLPresetName(const LLSD& value);
const bool& isExpanded() const { return mExpanded; }
protected:
void build();