diff --git a/indra/newview/app_settings/camera/Front.xml b/indra/newview/app_settings/camera/Front.xml
index d5ead526b7..a4b5ace33c 100644
--- a/indra/newview/app_settings/camera/Front.xml
+++ b/indra/newview/app_settings/camera/Front.xml
@@ -37,10 +37,10 @@
6
- CameraOffsetRearView
+ CameraOffsetFrontView
- FocusOffsetRearView
+ FocusOffsetFrontView
- CameraOffsetRearView
+ CameraOffsetGroupView
Comment
- Initial camera offset from avatar in Rear View
+ Initial camera offset from avatar in Side View
Persist
1
Type
@@ -74,10 +74,10 @@
Value
0
- FocusOffsetRearView
+ FocusOffsetGroupView
Comment
- Initial focus point offset relative to avatar for the camera preset Rear View (x-axis is forward)
+ Initial focus point offset relative to avatar for the camera preset Side View (x-axis is forward)
Persist
1
Type
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index a02cccb613..f44185340a 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -1499,6 +1499,21 @@
0.5
+ CameraOffsetCustomPreset
+
+ Comment
+ Initial camera offset from avatar for the custom camera preset
+ Persist
+ 1
+ Type
+ Vector3
+ Value
+
+ -3.0
+ 0.0
+ 0.75
+
+
CameraOffsetScale
Comment
@@ -4356,6 +4371,21 @@
1.0
+ FocusOffsetCustomPreset
+
+ Comment
+ Initial focus point offset relative to avatar for the custom camera preset (x-axis is forward)
+ Persist
+ 1
+ Type
+ Vector3D
+ Value
+
+ 1.0
+ 0.0
+ 1.0
+
+
FocusPosOnLogout
Comment
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index bbe1354fc3..3e56c1dd71 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -210,10 +210,12 @@ void LLAgentCamera::init()
mCameraOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getControl("CameraOffsetRearView");
mCameraOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getControl("CameraOffsetFrontView");
mCameraOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getControl("CameraOffsetGroupView");
+ mCameraOffsetInitial[CAMERA_PRESET_CUSTOM] = gSavedSettings.getControl("CameraOffsetCustomPreset");
mFocusOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getControl("FocusOffsetRearView");
mFocusOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getControl("FocusOffsetFrontView");
mFocusOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getControl("FocusOffsetGroupView");
+ mFocusOffsetInitial[CAMERA_PRESET_CUSTOM] = gSavedSettings.getControl("FocusOffsetCustomPreset");
mCameraCollidePlane.clearVec();
mCurrentCameraDistance = getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale");
@@ -1936,6 +1938,21 @@ LLVector3 LLAgentCamera::getCameraOffsetInitial()
return convert_from_llsd(mCameraOffsetInitial[mCameraPreset]->get(), TYPE_VEC3, "");
}
+LLVector3d LLAgentCamera::getFocusOffsetInitial()
+{
+ return convert_from_llsd(mFocusOffsetInitial[mCameraPreset]->get(), TYPE_VEC3D, "");
+}
+
+std::string LLAgentCamera::getCameraOffsetCtrlName()
+{
+ return mCameraOffsetInitial[mCameraPreset]->getName();
+}
+
+std::string LLAgentCamera::getFocusOffsetCtrlName()
+{
+ return mFocusOffsetInitial[mCameraPreset]->getName();
+}
+
F32 LLAgentCamera::getCameraMaxZoomDistance()
{
// Ignore "DisableCameraConstraints", we don't want to be out of draw range when we focus onto objects or avatars
diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h
index 4575c1501a..294e81c2e1 100644
--- a/indra/newview/llagentcamera.h
+++ b/indra/newview/llagentcamera.h
@@ -59,7 +59,7 @@ enum ECameraPreset
CAMERA_PRESET_GROUP_VIEW,
/** Current view when a preset is saved */
- CAMERA_PRESET_CUSTOM0
+ CAMERA_PRESET_CUSTOM
};
//------------------------------------------------------------------------
@@ -112,9 +112,14 @@ private:
//--------------------------------------------------------------------
public:
void switchCameraPreset(ECameraPreset preset);
-private:
/** Determines default camera offset depending on the current camera preset */
LLVector3 getCameraOffsetInitial();
+ /** Determines default focus offset depending on the current camera preset */
+ LLVector3d getFocusOffsetInitial();
+
+ std::string getCameraOffsetCtrlName();
+ std::string getFocusOffsetCtrlName();
+private:
/** Determines maximum camera distance from target for mouselook, opposite to LAND_MIN_ZOOM */
F32 getCameraMaxZoomDistance();
diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp
index c12ccb386e..933e758653 100644
--- a/indra/newview/llfloatercamera.cpp
+++ b/indra/newview/llfloatercamera.cpp
@@ -34,6 +34,7 @@
// Viewer includes
#include "llagent.h"
#include "llagentcamera.h"
+#include "llpresetsmanager.h"
#include "lljoystickbutton.h"
#include "llviewercontrol.h"
#include "llviewercamera.h"
@@ -53,7 +54,6 @@ const F32 ORBIT_NUDGE_RATE = 0.05f; // fraction of normal speed
#define ORBIT "cam_rotate_stick"
#define PAN "cam_track_stick"
#define ZOOM "zoom"
-#define PRESETS "preset_views_list"
#define CONTROLS "controls"
bool LLFloaterCamera::sFreeCamera = false;
@@ -270,13 +270,7 @@ void LLFloaterCamera::onAvatarEditingAppearance(bool editing)
void LLFloaterCamera::handleAvatarEditingAppearance(bool editing)
{
- //camera presets (rear, front, etc.)
- getChildView("preset_views_list")->setEnabled(!editing);
- getChildView("presets_btn")->setEnabled(!editing);
- //camera modes (object view, mouselook view)
- getChildView("camera_modes_list")->setEnabled(!editing);
- getChildView("avatarview_btn")->setEnabled(!editing);
}
void LLFloaterCamera::update()
@@ -323,6 +317,8 @@ void LLFloaterCamera::onOpen(const LLSD& key)
else
toPrevMode();
mClosed = FALSE;
+
+ populatePresetCombo();
}
void LLFloaterCamera::onClose(bool app_quitting)
@@ -354,7 +350,7 @@ LLFloaterCamera::LLFloaterCamera(const LLSD& val)
{
LLHints::registerHintTarget("view_popup", getHandle());
mCommitCallbackRegistrar.add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraItem, _2));
- mCommitCallbackRegistrar.add("Presets.GoViewPrefs", boost::bind(&LLFloaterCamera::onViewButtonClick, this, _2));
+ mCommitCallbackRegistrar.add("CameraPresets.Save", boost::bind(&LLFloaterCamera::onSavePreset, this));
}
// virtual
@@ -366,9 +362,11 @@ BOOL LLFloaterCamera::postBuild()
mZoom = findChild(ZOOM);
mTrack = getChild(PAN);
- assignButton2Mode(CAMERA_CTRL_MODE_MODES, "avatarview_btn");
- assignButton2Mode(CAMERA_CTRL_MODE_PAN, "pan_btn");
- assignButton2Mode(CAMERA_CTRL_MODE_PRESETS, "presets_btn");
+ getChild("precise_ctrs_label")->setShowCursorHand(false);
+ getChild("precise_ctrs_label")->setSoundFlags(LLView::MOUSE_UP);
+ getChild("precise_ctrs_label")->setClickedCallback(boost::bind(&LLFloaterReg::showInstance, "prefs_view_advanced", LLSD(), FALSE));
+ getChild("preset_combo")->setCommitCallback(boost::bind(&LLFloaterCamera::onCustomPresetSelected, this));
+ LLPresetsManager::getInstance()->setPresetListChangeCameraCallback(boost::bind(&LLFloaterCamera::populatePresetCombo, this));
update();
@@ -387,24 +385,6 @@ F32 LLFloaterCamera::getCurrentTransparency()
}
-void LLFloaterCamera::onViewButtonClick(const LLSD& user_data)
-{
- // bring up the prefs floater
- LLFloater* prefsfloater = LLFloaterReg::showInstance("preferences");
- if (prefsfloater)
- {
- // grab the 'view' panel from the preferences floater and
- // bring it the front!
- LLTabContainer* tabcontainer = prefsfloater->getChild("pref core");
- LLPanel* graphicspanel = prefsfloater->getChild("view");
- if (tabcontainer && graphicspanel)
- {
- tabcontainer->selectTabPanel(graphicspanel);
- }
- }
-}
-
-
void LLFloaterCamera::fillFlatlistFromPanel (LLFlatListView* list, LLPanel* panel)
{
// copying child list and then iterating over a copy, because list itself
@@ -473,13 +453,6 @@ void LLFloaterCamera::switchMode(ECameraControlMode mode)
switch (mode)
{
- case CAMERA_CTRL_MODE_MODES:
- if(sFreeCamera)
- {
- switchMode(CAMERA_CTRL_MODE_FREE_CAMERA);
- }
- break;
-
case CAMERA_CTRL_MODE_PAN:
sFreeCamera = false;
clear_camera_tool();
@@ -503,36 +476,8 @@ void LLFloaterCamera::switchMode(ECameraControlMode mode)
}
}
-
-void LLFloaterCamera::onClickBtn(ECameraControlMode mode)
-{
- // check for a click on active button
- if (mCurrMode == mode) mMode2Button[mode]->setToggleState(TRUE);
-
- switchMode(mode);
-
-}
-
-void LLFloaterCamera::assignButton2Mode(ECameraControlMode mode, const std::string& button_name)
-{
- LLButton* button = getChild(button_name);
-
- button->setClickedCallback(boost::bind(&LLFloaterCamera::onClickBtn, this, mode));
- mMode2Button[mode] = button;
-}
-
void LLFloaterCamera::updateState()
{
- getChildView(ZOOM)->setVisible(CAMERA_CTRL_MODE_PAN == mCurrMode);
-
- bool show_presets = (CAMERA_CTRL_MODE_PRESETS == mCurrMode) || (CAMERA_CTRL_MODE_FREE_CAMERA == mCurrMode
- && CAMERA_CTRL_MODE_PRESETS == mPrevMode);
- getChildView(PRESETS)->setVisible(show_presets);
-
- bool show_camera_modes = CAMERA_CTRL_MODE_MODES == mCurrMode || (CAMERA_CTRL_MODE_FREE_CAMERA == mCurrMode
- && CAMERA_CTRL_MODE_MODES == mPrevMode);
- getChildView("camera_modes_list")->setVisible( show_camera_modes);
-
updateItemsSelection();
if (CAMERA_CTRL_MODE_FREE_CAMERA == mCurrMode)
@@ -552,11 +497,11 @@ void LLFloaterCamera::updateItemsSelection()
{
ECameraPreset preset = (ECameraPreset) gSavedSettings.getU32("CameraPreset");
LLSD argument;
- argument["selected"] = preset == CAMERA_PRESET_REAR_VIEW;
+ argument["selected"] = (preset == CAMERA_PRESET_REAR_VIEW) && !sFreeCamera;
getChild("rear_view")->setValue(argument);
- argument["selected"] = preset == CAMERA_PRESET_GROUP_VIEW;
+ argument["selected"] = (preset == CAMERA_PRESET_GROUP_VIEW) && !sFreeCamera;
getChild("group_view")->setValue(argument);
- argument["selected"] = preset == CAMERA_PRESET_FRONT_VIEW;
+ argument["selected"] = (preset == CAMERA_PRESET_FRONT_VIEW) && !sFreeCamera;
getChild("front_view")->setValue(argument);
argument["selected"] = gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK;
getChild("mouselook_view")->setValue(argument);
@@ -580,6 +525,9 @@ void LLFloaterCamera::onClickCameraItem(const LLSD& param)
}
else
{
+ LLFloaterCamera* camera_floater = LLFloaterCamera::findInstance();
+ if (camera_floater)
+ camera_floater->switchMode(CAMERA_CTRL_MODE_PAN);
switchToPreset(name);
}
@@ -599,14 +547,17 @@ void LLFloaterCamera::switchToPreset(const std::string& name)
if ("rear_view" == name)
{
gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW);
+ LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, PRESETS_REAR);
}
else if ("group_view" == name)
{
gAgentCamera.switchCameraPreset(CAMERA_PRESET_GROUP_VIEW);
+ LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, PRESETS_SIDE);
}
else if ("front_view" == name)
{
gAgentCamera.switchCameraPreset(CAMERA_PRESET_FRONT_VIEW);
+ LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, PRESETS_FRONT);
}
}
@@ -617,3 +568,36 @@ void LLFloaterCamera::fromFreeToPresets()
switchMode(CAMERA_CTRL_MODE_PRESETS);
}
}
+
+void LLFloaterCamera::populatePresetCombo()
+{
+ LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_CAMERA, getChild("preset_combo"), EDefaultOptions::DEFAULT_VIEWS_HIDE);
+ if ((ECameraPreset)gSavedSettings.getU32("CameraPreset") == CAMERA_PRESET_CUSTOM)
+ {
+ getChild("preset_combo")->selectByValue(gSavedSettings.getString("PresetCameraActive"));
+ }
+ else
+ {
+ std::string inactive_text = getString("inactive_combo_text");
+ getChild("preset_combo")->setLabel(inactive_text);// add(inactive_text, inactive_text, ADD_TOP);
+ }
+}
+
+void LLFloaterCamera::onSavePreset()
+{
+ LLFloaterReg::hideInstance("delete_pref_preset", PRESETS_CAMERA);
+ LLFloaterReg::hideInstance("load_pref_preset", PRESETS_CAMERA);
+ LLFloaterReg::showInstance("save_pref_preset", PRESETS_CAMERA);
+}
+
+void LLFloaterCamera::onCustomPresetSelected()
+{
+ std::string selected_preset = getChild("preset_combo")->getSelectedItemLabel();
+ if (gSavedSettings.getString("PresetCameraActive") != selected_preset && getString("inactive_combo_text") != selected_preset)
+ {
+ gAgentCamera.switchCameraPreset(CAMERA_PRESET_CUSTOM);
+ updateItemsSelection();
+ fromFreeToPresets();
+ LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, selected_preset);
+ }
+}
diff --git a/indra/newview/llfloatercamera.h b/indra/newview/llfloatercamera.h
index 481e9aec1b..b1e0c83ce0 100644
--- a/indra/newview/llfloatercamera.h
+++ b/indra/newview/llfloatercamera.h
@@ -39,7 +39,6 @@ class LLPanelCameraZoom;
enum ECameraControlMode
{
- CAMERA_CTRL_MODE_MODES,
CAMERA_CTRL_MODE_PAN,
CAMERA_CTRL_MODE_FREE_CAMERA,
CAMERA_CTRL_MODE_PRESETS
@@ -50,7 +49,6 @@ class LLFloaterCamera : public LLFloater
friend class LLFloaterReg;
public:
-
/* whether in free camera mode */
static bool inFreeCameraMode();
/* callback for camera items selection changing */
@@ -77,6 +75,11 @@ public:
virtual void onOpen(const LLSD& key);
virtual void onClose(bool app_quitting);
+ void onSavePreset();
+ void onCustomPresetSelected();
+
+ void populatePresetCombo();
+
LLJoystickCameraRotate* mRotate;
LLPanelCameraZoom* mZoom;
LLJoystickCameraTrack* mTrack;
@@ -112,9 +115,6 @@ private:
/* update camera modes items selection and camera preset items selection according to the currently selected preset */
void updateItemsSelection();
- void onClickBtn(ECameraControlMode mode);
- void assignButton2Mode(ECameraControlMode mode, const std::string& button_name);
-
// fills flatlist with items from given panel
void fillFlatlistFromPanel (LLFlatListView* list, LLPanel* panel);
diff --git a/indra/newview/llfloaterpreferenceviewadvanced.cpp b/indra/newview/llfloaterpreferenceviewadvanced.cpp
index 791ff79d87..57484d0d0a 100644
--- a/indra/newview/llfloaterpreferenceviewadvanced.cpp
+++ b/indra/newview/llfloaterpreferenceviewadvanced.cpp
@@ -25,6 +25,7 @@
*/
#include "llviewerprecompiledheaders.h"
+#include "llagentcamera.h"
#include "llfloaterpreferenceviewadvanced.h"
#include "llfloater.h"
#include "llfloaterreg.h"
@@ -36,40 +37,12 @@
LLFloaterPreferenceViewAdvanced::LLFloaterPreferenceViewAdvanced(const LLSD& key)
: LLFloater(key)
{
- mCommitCallbackRegistrar.add("Cancel", boost::bind(&LLFloaterPreferenceViewAdvanced::onClickCancel, this));
mCommitCallbackRegistrar.add("CommitSettings", boost::bind(&LLFloaterPreferenceViewAdvanced::onCommitSettings, this));
- mCommitCallbackRegistrar.add("Ok", boost::bind(&LLFloaterPreferenceViewAdvanced::onClickOk, this));
-
}
LLFloaterPreferenceViewAdvanced::~LLFloaterPreferenceViewAdvanced()
{}
-void LLFloaterPreferenceViewAdvanced::onClickOk()
-{
- closeFloater();
-}
-
-void LLFloaterPreferenceViewAdvanced::onClickCancel()
-{
- gSavedSettings.setVector3("CameraOffsetRearView", mCameraSaved);
- gSavedSettings.setVector3d("FocusOffsetRearView", mFocusSaved);
-
- updateCameraControl(mCameraSaved);
- updateFocusControl(mFocusSaved);
-}
-
-BOOL LLFloaterPreferenceViewAdvanced::postBuild()
-{
- mCameraSaved = gSavedSettings.getVector3("CameraOffsetRearView");
- mFocusSaved = gSavedSettings.getVector3d("FocusOffsetRearView");
-
- updateCameraControl(mCameraSaved);
- updateFocusControl(mFocusSaved);
-
- return TRUE;
-}
-
void LLFloaterPreferenceViewAdvanced::updateCameraControl(const LLVector3& vector)
{
getChild("camera_x")->setValue(vector[VX]);
@@ -86,11 +59,8 @@ void LLFloaterPreferenceViewAdvanced::updateFocusControl(const LLVector3d& vecto
void LLFloaterPreferenceViewAdvanced::draw()
{
- static LLCachedControl camera(gSavedSettings, "CameraOffsetRearView");
- static LLCachedControl focus(gSavedSettings, "FocusOffsetRearView");
-
- updateCameraControl(camera);
- updateFocusControl(focus);
+ updateCameraControl(gAgentCamera.getCameraOffsetInitial());
+ updateFocusControl(gAgentCamera.getFocusOffsetInitial());
LLFloater::draw();
}
@@ -103,10 +73,10 @@ void LLFloaterPreferenceViewAdvanced::onCommitSettings()
vector.mV[VX] = (F32)getChild("camera_x")->getValue().asReal();
vector.mV[VY] = (F32)getChild("camera_y")->getValue().asReal();
vector.mV[VZ] = (F32)getChild("camera_z")->getValue().asReal();
- gSavedSettings.setVector3("CameraOffsetRearView", vector);
+ gSavedSettings.setVector3(gAgentCamera.getCameraOffsetCtrlName(), vector);
vector3d.mdV[VX] = (F32)getChild("focus_x")->getValue().asReal();
vector3d.mdV[VY] = (F32)getChild("focus_y")->getValue().asReal();
vector3d.mdV[VZ] = (F32)getChild("focus_z")->getValue().asReal();
- gSavedSettings.setVector3d("FocusOffsetRearView", vector3d);
+ gSavedSettings.setVector3d(gAgentCamera.getFocusOffsetCtrlName(), vector3d);
}
diff --git a/indra/newview/llfloaterpreferenceviewadvanced.h b/indra/newview/llfloaterpreferenceviewadvanced.h
index 8f4b594605..4619fdaab1 100644
--- a/indra/newview/llfloaterpreferenceviewadvanced.h
+++ b/indra/newview/llfloaterpreferenceviewadvanced.h
@@ -37,21 +37,14 @@ class LLFloaterPreferenceViewAdvanced
public:
LLFloaterPreferenceViewAdvanced(const LLSD& key);
- virtual BOOL postBuild();
virtual void draw();
void onCommitSettings();
- void onClickCancel();
- void onClickOk();
void updateCameraControl(const LLVector3& vector);
void updateFocusControl(const LLVector3d& vector3d);
private:
virtual ~LLFloaterPreferenceViewAdvanced();
-
- LLVector3 mCameraSaved;
- LLVector3d mFocusSaved;
-
};
#endif //LLFLOATERPREFERENCEVIEWADVANCED_H
diff --git a/indra/newview/llfloatersaveprefpreset.cpp b/indra/newview/llfloatersaveprefpreset.cpp
index bae7602566..10fad347bf 100644
--- a/indra/newview/llfloatersaveprefpreset.cpp
+++ b/indra/newview/llfloatersaveprefpreset.cpp
@@ -32,12 +32,14 @@
#include "llcombobox.h"
#include "llfloaterpreference.h"
#include "llfloaterreg.h"
+#include "lllineeditor.h"
#include "llnotificationsutil.h"
#include "llpresetsmanager.h"
+#include "llradiogroup.h"
#include "lltrans.h"
LLFloaterSavePrefPreset::LLFloaterSavePrefPreset(const LLSD &key)
-: LLFloater(key)
+ : LLModalDialog(key)
{
}
@@ -49,29 +51,39 @@ BOOL LLFloaterSavePrefPreset::postBuild()
{
preferences->addDependentFloater(this);
}
- getChild("preset_combo")->setTextEntryCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this));
- getChild("preset_combo")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this));
- getChild("save")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnSave, this));
+
+ mPresetCombo = getChild("preset_combo");
+ //mPresetCombo->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this));
+
+ mNameEditor = getChild("preset_txt_editor");
+ mNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this), NULL);
+
+ mSaveButton = getChild("save");
+ mSaveButton->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnSave, this));
+
+ mSaveRadioGroup = getChild("radio_save_preset");
+ mSaveRadioGroup->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onSwitchSaveReplace, this));
+
getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnCancel, this));
LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetsListChange, this));
- mSaveButton = getChild("save");
- mPresetCombo = getChild("preset_combo");
-
return TRUE;
}
void LLFloaterSavePrefPreset::onPresetNameEdited()
{
- // Disable saving a preset having empty name.
- std::string name = mPresetCombo->getSimple();
-
- mSaveButton->setEnabled(!name.empty());
+ if (mSaveRadioGroup->getSelectedIndex() == 0)
+ {
+ // Disable saving a preset having empty name.
+ std::string name = mNameEditor->getValue();
+ mSaveButton->setEnabled(!name.empty());
+ }
}
void LLFloaterSavePrefPreset::onOpen(const LLSD& key)
{
+ LLModalDialog::onOpen(key);
mSubdirectory = key.asString();
std::string floater_title = getString(std::string("title_") + mSubdirectory);
@@ -81,22 +93,41 @@ void LLFloaterSavePrefPreset::onOpen(const LLSD& key)
EDefaultOptions option = DEFAULT_HIDE;
LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo, option);
+ mSaveRadioGroup->setSelectedIndex(0);
onPresetNameEdited();
+ onSwitchSaveReplace();
}
void LLFloaterSavePrefPreset::onBtnSave()
{
- std::string name = mPresetCombo->getSimple();
+ bool is_saving_new = mSaveRadioGroup->getSelectedIndex() == 0;
+ std::string name = is_saving_new ? mNameEditor->getValue() : mPresetCombo->getSimple();
if ((name == LLTrans::getString(PRESETS_DEFAULT)) || (name == PRESETS_DEFAULT))
{
LLNotificationsUtil::add("DefaultPresetNotSaved");
}
- else if (!LLPresetsManager::getInstance()->savePreset(mSubdirectory, name))
+ else
{
- LLSD args;
- args["NAME"] = name;
- LLNotificationsUtil::add("PresetNotSaved", args);
+ if (is_saving_new)
+ {
+ std::list preset_names;
+ std::string presets_dir = LLPresetsManager::getInstance()->getPresetsDir(mSubdirectory);
+ LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, preset_names, DEFAULT_HIDE);
+ if (std::find(preset_names.begin(), preset_names.end(), name) != preset_names.end())
+ {
+ LLSD args;
+ args["NAME"] = name;
+ LLNotificationsUtil::add("PresetAlreadyExists", args);
+ return;
+ }
+ }
+ if (!LLPresetsManager::getInstance()->savePreset(mSubdirectory, name))
+ {
+ LLSD args;
+ args["NAME"] = name;
+ LLNotificationsUtil::add("PresetNotSaved", args);
+ }
}
closeFloater();
@@ -112,3 +143,20 @@ void LLFloaterSavePrefPreset::onBtnCancel()
{
closeFloater();
}
+
+void LLFloaterSavePrefPreset::onSwitchSaveReplace()
+{
+ bool is_saving_new = mSaveRadioGroup->getSelectedIndex() == 0;
+ std::string label = is_saving_new ? getString("btn_label_save") : getString("btn_label_replace");
+ mSaveButton->setLabel(label);
+ mNameEditor->setEnabled(is_saving_new);
+ mPresetCombo->setEnabled(!is_saving_new);
+ if (is_saving_new)
+ {
+ onPresetNameEdited();
+ }
+ else
+ {
+ mSaveButton->setEnabled(true);
+ }
+}
diff --git a/indra/newview/llfloatersaveprefpreset.h b/indra/newview/llfloatersaveprefpreset.h
index 09a87b8c62..c61379e5ad 100644
--- a/indra/newview/llfloatersaveprefpreset.h
+++ b/indra/newview/llfloatersaveprefpreset.h
@@ -28,11 +28,13 @@
#ifndef LL_LLFLOATERSAVEPREFPRESET_H
#define LL_LLFLOATERSAVEPREFPRESET_H
-#include "llfloater.h"
+#include "llmodaldialog.h"
class LLComboBox;
+class LLRadioGroup;
+class LLLineEditor;
-class LLFloaterSavePrefPreset : public LLFloater
+class LLFloaterSavePrefPreset : public LLModalDialog
{
public:
@@ -43,8 +45,11 @@ public:
void onBtnSave();
void onBtnCancel();
+ void onSwitchSaveReplace();
private:
+ LLRadioGroup* mSaveRadioGroup;
+ LLLineEditor* mNameEditor;
LLComboBox* mPresetCombo;
LLButton* mSaveButton;
diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp
index 17fefbe6b1..94e6e64754 100644
--- a/indra/newview/llpresetsmanager.cpp
+++ b/indra/newview/llpresetsmanager.cpp
@@ -65,22 +65,22 @@ void LLPresetsManager::createMissingDefault(const std::string& subdirectory)
{
if(gDirUtilp->getLindenUserDir().empty())
{
- return;
+return;
}
std::string default_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR,
- subdirectory, PRESETS_DEFAULT + ".xml");
+ subdirectory, PRESETS_DEFAULT + ".xml");
if (!gDirUtilp->fileExists(default_file))
{
LL_INFOS() << "No default preset found -- creating one at " << default_file << LL_ENDL;
// Write current settings as the default
- savePreset(subdirectory, PRESETS_DEFAULT, true);
+ savePreset(subdirectory, PRESETS_DEFAULT, true);
+ }
+ else
+ {
+ LL_DEBUGS() << "default preset exists; no-op" << LL_ENDL;
}
- else
- {
- LL_DEBUGS() << "default preset exists; no-op" << LL_ENDL;
- }
}
void LLPresetsManager::startWatching(const std::string& subdirectory)
@@ -99,7 +99,7 @@ void LLPresetsManager::startWatching(const std::string& subdirectory)
if (cntrl_ptr.isNull())
{
LL_WARNS("Init") << "Unable to set signal on global setting '" << ctrl_name
- << "'" << LL_ENDL;
+ << "'" << LL_ENDL;
}
else
{
@@ -120,25 +120,25 @@ std::string LLPresetsManager::getPresetsDir(const std::string& subdirectory)
if (!gDirUtilp->fileExists(dest_path))
LLFile::mkdir(dest_path);
- if (PRESETS_CAMERA == subdirectory)
+ if (PRESETS_CAMERA == subdirectory)
+ {
+ std::string source_dir = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, PRESETS_CAMERA);
+ LLDirIterator dir_iter(source_dir, "*.xml");
+ bool found = true;
+ while (found)
{
- std::string source_dir = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, PRESETS_CAMERA);
- LLDirIterator dir_iter(source_dir, "*.xml");
- bool found = true;
- while (found)
- {
- std::string file;
- found = dir_iter.next(file);
+ std::string file;
+ found = dir_iter.next(file);
- if (found)
- {
- std::string source = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, PRESETS_CAMERA, file);
- file = LLURI::escape(file);
- std::string dest = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, PRESETS_CAMERA, file);
- LLFile::copy(source, dest);
- }
+ if (found)
+ {
+ std::string source = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, PRESETS_CAMERA, file);
+ file = LLURI::escape(file);
+ std::string dest = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, PRESETS_CAMERA, file);
+ LLFile::copy(source, dest);
}
}
+ }
return dest_path;
}
@@ -160,8 +160,15 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_nam
{
std::string path = gDirUtilp->add(dir, file);
std::string name = LLURI::unescape(gDirUtilp->getBaseFileName(path, /*strip_exten = */ true));
- LL_DEBUGS() << " Found preset '" << name << "'" << LL_ENDL;
+ LL_DEBUGS() << " Found preset '" << name << "'" << LL_ENDL;
+ if (default_option == DEFAULT_VIEWS_HIDE)
+ {
+ if (name == PRESETS_REAR || name == PRESETS_SIDE || name == PRESETS_FRONT)
+ {
+ continue;
+ }
+ }
if (PRESETS_DEFAULT != name)
{
mPresetNames.push_back(name);
@@ -205,11 +212,15 @@ void LLPresetsManager::settingChanged()
{
setCameraDirty(true);
- gSavedSettings.setString("PresetCameraActive", "");
-
-// Hack call because this is a static routine
- LLPresetsManager::getInstance()->triggerChangeCameraSignal();
+ static LLCachedControl preset_camera_active(gSavedSettings, "PresetCameraActive", "");
+ std::string preset_name = preset_camera_active;
+ if (!preset_name.empty())
+ {
+ gSavedSettings.setString("PresetCameraActive", "");
+ // Hack call because this is a static routine
+ LLPresetsManager::getInstance()->triggerChangeCameraSignal();
+ }
}
void LLPresetsManager::getControlNames(std::vector& names)
@@ -222,8 +233,6 @@ void LLPresetsManager::getControlNames(std::vector& names)
("AppearanceCameraMovement")
// From llagentcamera.cpp
("CameraOffsetBuild")
- ("CameraOffsetRearView")
- ("FocusOffsetRearView")
("CameraOffsetScale")
("TrackFocusObject")
;
@@ -286,9 +295,25 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n
}
else
{
+ bool custom_camera_offsets = false;
+ if (subdirectory == PRESETS_CAMERA)
+ {
+ name_list.push_back(gAgentCamera.getCameraOffsetCtrlName());
+ name_list.push_back(gAgentCamera.getFocusOffsetCtrlName());
+ custom_camera_offsets = (name != PRESETS_REAR && name != PRESETS_SIDE && name != PRESETS_FRONT);
+ }
for (std::vector::iterator it = name_list.begin(); it != name_list.end(); ++it)
{
std::string ctrl_name = *it;
+ std::string dest_ctrl_name = ctrl_name;
+ if (custom_camera_offsets && ctrl_name == gAgentCamera.getCameraOffsetCtrlName())
+ {
+ dest_ctrl_name = "CameraOffsetCustomPreset";
+ }
+ if (custom_camera_offsets && ctrl_name == gAgentCamera.getFocusOffsetCtrlName())
+ {
+ dest_ctrl_name = "FocusOffsetCustomPreset";
+ }
LLControlVariable* ctrl = gSavedSettings.getControl(ctrl_name).get();
if (ctrl)
{
@@ -296,10 +321,10 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n
std::string type = LLControlGroup::typeEnumToString(ctrl->type());
LLSD value = ctrl->getValue();
- paramsData[ctrl_name]["Comment"] = comment;
- paramsData[ctrl_name]["Persist"] = 1;
- paramsData[ctrl_name]["Type"] = type;
- paramsData[ctrl_name]["Value"] = value;
+ paramsData[dest_ctrl_name]["Comment"] = comment;
+ paramsData[dest_ctrl_name]["Persist"] = 1;
+ paramsData[dest_ctrl_name]["Type"] = type;
+ paramsData[dest_ctrl_name]["Value"] = value;
}
}
}
@@ -354,6 +379,7 @@ bool LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory,
combo->clearRows();
+
std::string presets_dir = getPresetsDir(subdirectory);
if (!presets_dir.empty())
@@ -368,7 +394,7 @@ bool LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory,
for (std::list::const_iterator it = preset_names.begin(); it != preset_names.end(); ++it)
{
const std::string& name = *it;
- combo->add(name, LLSD().with(0, name));
+ combo->add(name, name);
}
}
else
diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h
index 7370e0a3b1..cb32b58fc4 100644
--- a/indra/newview/llpresetsmanager.h
+++ b/indra/newview/llpresetsmanager.h
@@ -36,11 +36,15 @@ static const std::string PRESETS_DEFAULT = "Default";
static const std::string PRESETS_DIR = "presets";
static const std::string PRESETS_GRAPHIC = "graphic";
static const std::string PRESETS_CAMERA = "camera";
+static const std::string PRESETS_REAR = "Rear";
+static const std::string PRESETS_FRONT = "Front";
+static const std::string PRESETS_SIDE = "Side";
enum EDefaultOptions
{
DEFAULT_SHOW,
DEFAULT_TOP,
+ DEFAULT_VIEWS_HIDE,
DEFAULT_HIDE // Do not display "Default" in a list
};
diff --git a/indra/newview/skins/default/xui/en/floater_camera.xml b/indra/newview/skins/default/xui/en/floater_camera.xml
index 25db24da2e..933d50acae 100644
--- a/indra/newview/skins/default/xui/en/floater_camera.xml
+++ b/indra/newview/skins/default/xui/en/floater_camera.xml
@@ -7,7 +7,7 @@
legacy_header_height="18"
can_minimize="true"
can_close="true"
- height="164"
+ height="135"
layout="topleft"
name="camera_floater"
help_topic="camera_floater"
@@ -16,7 +16,7 @@
title="CAMERA CONTROLS"
chrome="true"
save_rect="true"
- width="228">
+ width="400">
Rotate Camera Around Focus
@@ -33,6 +33,7 @@
name="free_mode_title">
View Object
+ Use preset
-
-
-
-
-
-
- Front View
-
-
-
-
-
-
-
- Side View
-
-
-
-
-
-
-
- Rear View
-
-
-
-
-
-
-
- Object View
-
-
-
-
-
-
-
- Mouselook View
-
-
-
-
-
+ width="220">
-
+ width="220">
+ top="25"
+ width="78" />
-
-
-
-
+ left_pad="2"
+ name="buttons_panel"
+ top="22"
+ width="212">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/indra/newview/skins/default/xui/en/floater_preferences_view_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_view_advanced.xml
index 5b2cbee914..3826ead5c2 100644
--- a/indra/newview/skins/default/xui/en/floater_preferences_view_advanced.xml
+++ b/indra/newview/skins/default/xui/en/floater_preferences_view_advanced.xml
@@ -1,10 +1,10 @@
@@ -113,28 +113,4 @@
-
-
-
diff --git a/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml b/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml
index a9cda26f0b..178ecad0f3 100644
--- a/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml
+++ b/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml
@@ -1,51 +1,71 @@
+ width="280">
Save Graphic Preset
Save Camera Preset
-
- Save
+ Replace
+
- Type a name for the preset or choose an existing preset.
-
+ top="15"
+ width="150"
+ name="radio_save_preset">
+
+
+
+
+ width="110"/>
+ width="110"/>
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index f72767cceb..7e06389bfe 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -8355,6 +8355,18 @@ Error saving preset [NAME].
Can not overwrite default preset.
+
+'[NAME]' is in use. You may replace
+this preset or choose another name.
+ fail
+
+
+
+ width="30" />
+ width="30" />