Merge branch 'DRTVWR-460' of https://bitbucket.org/lindenlab/viewer
commit
d11b42035e
|
|
@ -1880,7 +1880,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
|
|||
at_axis.normalize();
|
||||
gAgent.resetAxes(at_axis * ~parent_rot);
|
||||
|
||||
local_camera_offset = local_camera_offset * gAgent.getFrameAgent().getQuaternion() * parent_rot;
|
||||
local_camera_offset = local_camera_offset * parent_rot;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2147,13 +2147,19 @@ bool LLAgentCamera::clampCameraPosition(LLVector3d& posCamGlobal, const LLVector
|
|||
|
||||
LLVector3 LLAgentCamera::getCurrentCameraOffset()
|
||||
{
|
||||
LLVector3 camera_offset = (LLViewerCamera::getInstance()->getOrigin() - getAvatarRootPosition() - mThirdPersonHeadOffset) * ~gAgent.getFrameAgent().getQuaternion();
|
||||
LLVector3 camera_offset = (LLViewerCamera::getInstance()->getOrigin() - getAvatarRootPosition() - mThirdPersonHeadOffset) * ~getCurrentAvatarRotation();
|
||||
return camera_offset / mCameraZoomFraction / gSavedSettings.getF32("CameraOffsetScale");
|
||||
}
|
||||
|
||||
LLVector3d LLAgentCamera::getCurrentFocusOffset()
|
||||
{
|
||||
return (mFocusTargetGlobal - gAgent.getPositionGlobal()) * ~gAgent.getFrameAgent().getQuaternion();
|
||||
return (mFocusTargetGlobal - gAgent.getPositionGlobal()) * ~getCurrentAvatarRotation();
|
||||
}
|
||||
|
||||
LLQuaternion LLAgentCamera::getCurrentAvatarRotation()
|
||||
{
|
||||
LLViewerObject* sit_object = (LLViewerObject*)gAgentAvatarp->getParent();
|
||||
return sit_object ? sit_object->getRenderRotation() : gAgent.getFrameAgent().getQuaternion();
|
||||
}
|
||||
|
||||
bool LLAgentCamera::isJoystickCameraUsed()
|
||||
|
|
@ -2517,15 +2523,7 @@ void LLAgentCamera::changeCameraToThirdPerson(BOOL animate)
|
|||
}
|
||||
|
||||
// Remove any pitch from the avatar
|
||||
if (isAgentAvatarValid() && gAgentAvatarp->getParent())
|
||||
{
|
||||
LLQuaternion obj_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation();
|
||||
at_axis = LLViewerCamera::getInstance()->getAtAxis();
|
||||
at_axis.mV[VZ] = 0.f;
|
||||
at_axis.normalize();
|
||||
gAgent.resetAxes(at_axis * ~obj_rot);
|
||||
}
|
||||
else
|
||||
if (!isAgentAvatarValid() || !gAgentAvatarp->getParent())
|
||||
{
|
||||
at_axis = gAgent.getFrameAgent().getAtAxis();
|
||||
at_axis.mV[VZ] = 0.f;
|
||||
|
|
@ -2924,15 +2922,7 @@ void LLAgentCamera::setFocusOnAvatar(BOOL focus_on_avatar, BOOL animate)
|
|||
if (mCameraMode == CAMERA_MODE_THIRD_PERSON)
|
||||
{
|
||||
LLVector3 at_axis;
|
||||
if (isAgentAvatarValid() && gAgentAvatarp->getParent())
|
||||
{
|
||||
LLQuaternion obj_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation();
|
||||
at_axis = LLViewerCamera::getInstance()->getAtAxis();
|
||||
at_axis.mV[VZ] = 0.f;
|
||||
at_axis.normalize();
|
||||
gAgent.resetAxes(at_axis * ~obj_rot);
|
||||
}
|
||||
else
|
||||
if (!isAgentAvatarValid() || !gAgentAvatarp->getParent())
|
||||
{
|
||||
at_axis = LLViewerCamera::getInstance()->getAtAxis();
|
||||
at_axis.mV[VZ] = 0.f;
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ public:
|
|||
|
||||
LLVector3 getCurrentCameraOffset();
|
||||
LLVector3d getCurrentFocusOffset();
|
||||
LLQuaternion getCurrentAvatarRotation();
|
||||
bool isJoystickCameraUsed();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -677,7 +677,7 @@ void LLFloaterCamera::fromFreeToPresets()
|
|||
|
||||
void LLFloaterCamera::populatePresetCombo()
|
||||
{
|
||||
LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_CAMERA, mPresetCombo, EDefaultOptions::DEFAULT_VIEWS_HIDE);
|
||||
LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_CAMERA, mPresetCombo, EDefaultOptions::DEFAULT_HIDE);
|
||||
std::string active_preset_name = gSavedSettings.getString("PresetCameraActive");
|
||||
if (active_preset_name.empty())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -55,13 +55,10 @@ void LLFloaterCameraPresets::populateList()
|
|||
mPresetList->clear();
|
||||
|
||||
LLPresetsManager* presetsMgr = LLPresetsManager::getInstance();
|
||||
std::string presets_dir = presetsMgr->getPresetsDir(PRESETS_CAMERA);
|
||||
std::list<std::string> preset_names;
|
||||
|
||||
presetsMgr->loadPresetNamesFromDir(presets_dir, preset_names, DEFAULT_VIEWS_HIDE);
|
||||
preset_names.push_back(PRESETS_FRONT_VIEW);
|
||||
preset_names.push_back(PRESETS_REAR_VIEW);
|
||||
preset_names.push_back(PRESETS_SIDE_VIEW);
|
||||
presetsMgr->loadPresetNamesFromDir(PRESETS_CAMERA, preset_names, DEFAULT_BOTTOM);
|
||||
|
||||
for (std::list<std::string>::const_iterator it = preset_names.begin(); it != preset_names.end(); ++it)
|
||||
{
|
||||
const std::string& name = *it;
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ void LLFloaterSaveCameraPreset::onOpen(const LLSD& key)
|
|||
index = key["index"].asInteger();
|
||||
}
|
||||
|
||||
LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_CAMERA, mPresetCombo, DEFAULT_HIDE);
|
||||
LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_CAMERA, mPresetCombo, DEFAULT_BOTTOM);
|
||||
|
||||
mSaveRadioGroup->setSelectedIndex(index);
|
||||
onPresetNameEdited();
|
||||
|
|
@ -111,8 +111,7 @@ void LLFloaterSaveCameraPreset::onBtnSave()
|
|||
if (is_saving_new)
|
||||
{
|
||||
std::list<std::string> preset_names;
|
||||
std::string presets_dir = LLPresetsManager::getInstance()->getPresetsDir(PRESETS_CAMERA);
|
||||
LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, preset_names, DEFAULT_HIDE);
|
||||
LLPresetsManager::getInstance()->loadPresetNamesFromDir(PRESETS_CAMERA, preset_names, DEFAULT_HIDE);
|
||||
if (std::find(preset_names.begin(), preset_names.end(), name) != preset_names.end())
|
||||
{
|
||||
LLSD args;
|
||||
|
|
@ -134,7 +133,7 @@ void LLFloaterSaveCameraPreset::onBtnSave()
|
|||
|
||||
void LLFloaterSaveCameraPreset::onPresetsListChange()
|
||||
{
|
||||
LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_CAMERA, mPresetCombo, DEFAULT_HIDE);
|
||||
LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_CAMERA, mPresetCombo, DEFAULT_BOTTOM);
|
||||
}
|
||||
|
||||
void LLFloaterSaveCameraPreset::onBtnCancel()
|
||||
|
|
|
|||
|
|
@ -80,8 +80,7 @@ BOOL LLPanelPresetsCameraPulldown::postBuild()
|
|||
|
||||
void LLPanelPresetsCameraPulldown::populatePanel()
|
||||
{
|
||||
std::string presets_dir = LLPresetsManager::getInstance()->getPresetsDir(PRESETS_CAMERA);
|
||||
LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, mPresetNames, DEFAULT_TOP);
|
||||
LLPresetsManager::getInstance()->loadPresetNamesFromDir(PRESETS_CAMERA, mPresetNames, DEFAULT_BOTTOM);
|
||||
|
||||
LLScrollListCtrl* scroll = getChild<LLScrollListCtrl>("preset_camera_list");
|
||||
|
||||
|
|
|
|||
|
|
@ -72,8 +72,7 @@ BOOL LLPanelPresetsPulldown::postBuild()
|
|||
|
||||
void LLPanelPresetsPulldown::populatePanel()
|
||||
{
|
||||
std::string presets_dir = LLPresetsManager::getInstance()->getPresetsDir(PRESETS_GRAPHIC);
|
||||
LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, mPresetNames, DEFAULT_TOP);
|
||||
LLPresetsManager::getInstance()->loadPresetNamesFromDir(PRESETS_GRAPHIC, mPresetNames, DEFAULT_TOP);
|
||||
|
||||
LLScrollListCtrl* scroll = getChild<LLScrollListCtrl>("preset_list");
|
||||
|
||||
|
|
|
|||
|
|
@ -162,8 +162,12 @@ std::string LLPresetsManager::getPresetsDir(const std::string& subdirectory)
|
|||
return dest_path;
|
||||
}
|
||||
|
||||
void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_name_list_t& presets, EDefaultOptions default_option)
|
||||
void LLPresetsManager::loadPresetNamesFromDir(const std::string& subdirectory, preset_name_list_t& presets, EDefaultOptions default_option)
|
||||
{
|
||||
bool IS_CAMERA = (PRESETS_CAMERA == subdirectory);
|
||||
bool IS_GRAPHIC = (PRESETS_GRAPHIC == subdirectory);
|
||||
|
||||
std::string dir = LLPresetsManager::getInstance()->getPresetsDir(subdirectory);
|
||||
LL_INFOS("AppInit") << "Loading list of preset names from " << dir << LL_ENDL;
|
||||
|
||||
mPresetNames.clear();
|
||||
|
|
@ -181,25 +185,31 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_nam
|
|||
std::string name = LLURI::unescape(gDirUtilp->getBaseFileName(path, /*strip_exten = */ true));
|
||||
LL_DEBUGS() << " Found preset '" << name << "'" << LL_ENDL;
|
||||
|
||||
if (isTemplateCameraPreset(name))
|
||||
if (IS_CAMERA)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (default_option == DEFAULT_VIEWS_HIDE)
|
||||
{
|
||||
if (isDefaultCameraPreset(name))
|
||||
if (isTemplateCameraPreset(name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (PRESETS_DEFAULT != name)
|
||||
{
|
||||
if ((default_option == DEFAULT_HIDE) || (default_option == DEFAULT_BOTTOM))
|
||||
{
|
||||
if (isDefaultCameraPreset(name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
mPresetNames.push_back(name);
|
||||
}
|
||||
else
|
||||
if (IS_GRAPHIC)
|
||||
{
|
||||
switch (default_option)
|
||||
if (PRESETS_DEFAULT != name)
|
||||
{
|
||||
mPresetNames.push_back(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (default_option)
|
||||
{
|
||||
case DEFAULT_SHOW:
|
||||
mPresetNames.push_back(LLTrans::getString(PRESETS_DEFAULT));
|
||||
break;
|
||||
|
|
@ -211,11 +221,23 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_nam
|
|||
case DEFAULT_HIDE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_CAMERA)
|
||||
{
|
||||
mPresetNames.sort();
|
||||
if (default_option == DEFAULT_BOTTOM)
|
||||
{
|
||||
mPresetNames.push_back(PRESETS_FRONT_VIEW);
|
||||
mPresetNames.push_back(PRESETS_REAR_VIEW);
|
||||
mPresetNames.push_back(PRESETS_SIDE_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
presets = mPresetNames;
|
||||
}
|
||||
|
||||
|
|
@ -469,30 +491,24 @@ bool LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory,
|
|||
combo->clearRows();
|
||||
combo->setEnabled(TRUE);
|
||||
|
||||
std::string presets_dir = getPresetsDir(subdirectory);
|
||||
std::list<std::string> preset_names;
|
||||
loadPresetNamesFromDir(subdirectory, preset_names, default_option);
|
||||
|
||||
if (!presets_dir.empty())
|
||||
if (preset_names.begin() != preset_names.end())
|
||||
{
|
||||
std::list<std::string> preset_names;
|
||||
loadPresetNamesFromDir(presets_dir, preset_names, default_option);
|
||||
|
||||
//std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive"); // <FS:Ansariel> Unused
|
||||
|
||||
if (preset_names.begin() != preset_names.end())
|
||||
for (std::list<std::string>::const_iterator it = preset_names.begin(); it != preset_names.end(); ++it)
|
||||
{
|
||||
for (std::list<std::string>::const_iterator it = preset_names.begin(); it != preset_names.end(); ++it)
|
||||
{
|
||||
const std::string& name = *it;
|
||||
combo->add(name, name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
combo->setLabel(LLTrans::getString("preset_combo_label"));
|
||||
combo->setEnabled(PRESETS_CAMERA != subdirectory);
|
||||
sts = false;
|
||||
const std::string& name = *it;
|
||||
combo->add(name, name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
combo->setLabel(LLTrans::getString("preset_combo_label"));
|
||||
combo->setEnabled(PRESETS_CAMERA != subdirectory);
|
||||
sts = false;
|
||||
}
|
||||
|
||||
return sts;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ enum EDefaultOptions
|
|||
{
|
||||
DEFAULT_SHOW,
|
||||
DEFAULT_TOP,
|
||||
DEFAULT_VIEWS_HIDE,
|
||||
DEFAULT_BOTTOM,
|
||||
DEFAULT_HIDE // Do not display "Default" in a list
|
||||
};
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ public:
|
|||
void triggerChangeSignal();
|
||||
static std::string getPresetsDir(const std::string& subdirectory);
|
||||
bool setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo, EDefaultOptions default_option);
|
||||
void loadPresetNamesFromDir(const std::string& dir, preset_name_list_t& presets, EDefaultOptions default_option);
|
||||
void loadPresetNamesFromDir(const std::string& subdirectory, preset_name_list_t& presets, EDefaultOptions default_option);
|
||||
bool savePreset(const std::string& subdirectory, std::string name, bool createDefault = false);
|
||||
void loadPreset(const std::string& subdirectory, std::string name);
|
||||
bool deletePreset(const std::string& subdirectory, std::string name);
|
||||
|
|
|
|||
|
|
@ -383,6 +383,7 @@ void camera_spin_around_ccw_sitting( EKeystate s )
|
|||
else
|
||||
{
|
||||
//change camera but do not send keystrokes
|
||||
gAgentCamera.unlockView();
|
||||
gAgentCamera.setOrbitLeftKey( get_orbit_rate() );
|
||||
}
|
||||
}
|
||||
|
|
@ -399,6 +400,7 @@ void camera_spin_around_cw_sitting( EKeystate s )
|
|||
else
|
||||
{
|
||||
//change camera but do not send keystrokes
|
||||
gAgentCamera.unlockView();
|
||||
gAgentCamera.setOrbitRightKey( get_orbit_rate() );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue