FIRE-11267: Persist stored camera position in camera tools across relogs on per account basis
parent
daa6e0b181
commit
4fc2313314
|
|
@ -701,6 +701,47 @@
|
|||
<string></string>
|
||||
</map>
|
||||
<!-- End of settings imported from Exodus -->
|
||||
<key>FSStoredCameraPos</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Stored camera position in camera tools</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Vector3D</string>
|
||||
<key>Value</key>
|
||||
<array>
|
||||
<real>0.0</real>
|
||||
<real>0.0</real>
|
||||
<real>0.0</real>
|
||||
</array>
|
||||
</map>
|
||||
<key>FSStoredCameraFocus</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Stored camera focus position in camera tools</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Vector3D</string>
|
||||
<key>Value</key>
|
||||
<array>
|
||||
<real>0.0</real>
|
||||
<real>0.0</real>
|
||||
<real>0.0</real>
|
||||
</array>
|
||||
</map>
|
||||
<key>FSStoredCameraFocusObjectId</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Stored object ID of camera focus in camera tools</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>String</string>
|
||||
<key>Value</key>
|
||||
<string></string>
|
||||
</map>
|
||||
|
||||
</map>
|
||||
</llsd>
|
||||
|
|
|
|||
|
|
@ -182,13 +182,6 @@ LLAgentCamera::LLAgentCamera() :
|
|||
mPanInKey(0.f),
|
||||
mPanOutKey(0.f),
|
||||
|
||||
// <FS:Ansariel> FIRE-7758: Save/load camera position
|
||||
mStoredCameraPos(),
|
||||
mStoredCameraFocus(),
|
||||
mStoredCameraFocusObjectId(),
|
||||
mHasStoredCameraPos(false),
|
||||
// </FS:Ansariel>
|
||||
|
||||
mPointAtObject(NULL)
|
||||
{
|
||||
mFollowCam.setMaxCameraDistantFromSubject( MAX_CAMERA_DISTANCE_FROM_AGENT );
|
||||
|
|
@ -2902,35 +2895,39 @@ S32 LLAgentCamera::directionToKey(S32 direction)
|
|||
// <FS:Ansariel> FIRE-7758: Save/load camera position feature
|
||||
void LLAgentCamera::storeCameraPosition()
|
||||
{
|
||||
mStoredCameraPos = getCameraPositionGlobal();
|
||||
mStoredCameraFocus = getFocusTargetGlobal();
|
||||
mStoredCameraFocusObjectId = LLUUID::null;
|
||||
gSavedPerAccountSettings.setVector3d("FSStoredCameraPos", getCameraPositionGlobal());
|
||||
gSavedPerAccountSettings.setVector3d("FSStoredCameraFocus", getFocusTargetGlobal());
|
||||
LLUUID stored_camera_focus_object_id = LLUUID::null;
|
||||
if (mFocusObject)
|
||||
{
|
||||
mStoredCameraFocusObjectId = mFocusObject->getID();
|
||||
stored_camera_focus_object_id = mFocusObject->getID();
|
||||
}
|
||||
mHasStoredCameraPos = true;
|
||||
gSavedPerAccountSettings.setString("FSStoredCameraFocusObjectId", stored_camera_focus_object_id.asString());
|
||||
}
|
||||
|
||||
void LLAgentCamera::loadCameraPosition()
|
||||
{
|
||||
LLVector3d stored_camera_pos = gSavedPerAccountSettings.getVector3d("FSStoredCameraPos");
|
||||
LLVector3d stored_camera_focus = gSavedPerAccountSettings.getVector3d("FSStoredCameraFocus");
|
||||
LLUUID stored_camera_focus_object_id = LLUUID(gSavedPerAccountSettings.getString("FSStoredCameraFocusObjectId"));
|
||||
|
||||
F32 renderFarClip = gSavedSettings.getF32("RenderFarClip");
|
||||
F32 far_clip_squared = renderFarClip * renderFarClip;
|
||||
|
||||
if (!mHasStoredCameraPos)
|
||||
if (stored_camera_pos.isNull())
|
||||
{
|
||||
reportToNearbyChat(LLTrans::getString("LoadCameraPositionNoneSaved"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (dist_vec_squared(gAgent.getPositionGlobal(), mStoredCameraPos) > far_clip_squared)
|
||||
if (dist_vec_squared(gAgent.getPositionGlobal(), stored_camera_pos) > far_clip_squared)
|
||||
{
|
||||
reportToNearbyChat(LLTrans::getString("LoadCameraPositionOutsideDrawDistance"));
|
||||
return;
|
||||
}
|
||||
|
||||
unlockView();
|
||||
setCameraPosAndFocusGlobal(mStoredCameraPos, mStoredCameraFocus, mStoredCameraFocusObjectId);
|
||||
setCameraPosAndFocusGlobal(stored_camera_pos, stored_camera_focus, stored_camera_focus_object_id);
|
||||
}
|
||||
// </FS:Ansariel> FIRE-7758: Save/load camera position feature
|
||||
|
||||
|
|
|
|||
|
|
@ -396,12 +396,6 @@ private:
|
|||
public:
|
||||
void storeCameraPosition();
|
||||
void loadCameraPosition();
|
||||
|
||||
private:
|
||||
LLVector3d mStoredCameraPos;
|
||||
LLVector3d mStoredCameraFocus;
|
||||
LLUUID mStoredCameraFocusObjectId;
|
||||
bool mHasStoredCameraPos;
|
||||
// </FS:Ansariel> FIRE-7758: Save/load camera position feature
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue