From 6a4b23d0bbafd8b7c622b8053c9ab24c7a031135 Mon Sep 17 00:00:00 2001 From: CharleyLevenque Date: Tue, 31 Aug 2010 21:07:01 -0400 Subject: [PATCH] Log Out button, Pose Stand, Minimum Camera Zoom --- indra/newview/llagent.cpp | 86 ++++++------------- indra/newview/llviewermenu.cpp | 78 +++++++++++++++-- indra/newview/llviewermenufile.cpp | 13 +++ .../skins/default/xui/en-us/menu_viewer.xml | 4 + 4 files changed, 117 insertions(+), 64 deletions(-) diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 7eee584f5..7cfe81997 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -1547,6 +1547,10 @@ LLVector3 LLAgent::calcFocusOffset(LLViewerObject *object, LLVector3 original_fo //----------------------------------------------------------------------------- BOOL LLAgent::calcCameraMinDistance(F32 &obj_min_distance) { + /* Emerald: + We don't care about minimum distances in Emerald. No we don't. + ~Zwag + */ BOOL soft_limit = FALSE; // is the bounding box to be treated literally (volumes) or as an approximation (avatars) if (!mFocusObject || mFocusObject->isDead()) @@ -1719,6 +1723,7 @@ BOOL LLAgent::calcCameraMinDistance(F32 &obj_min_distance) obj_min_distance += LLViewerCamera::getInstance()->getNear() + (soft_limit ? 0.1f : 0.2f); return TRUE; + } F32 LLAgent::getCameraZoomFraction() @@ -1731,6 +1736,10 @@ F32 LLAgent::getCameraZoomFraction() // already [0,1] return mHUDTargetZoom; } + else if (gSavedSettings.getBOOL("AscentDisableMinZoomDist")) + { + return mCameraZoomFraction; + } else if (mFocusOnAvatar && cameraThirdPerson()) { return clamp_rescale(mCameraZoomFraction, MIN_ZOOM_FRACTION, MAX_ZOOM_FRACTION, 1.f, 0.f); @@ -1743,10 +1752,10 @@ F32 LLAgent::getCameraZoomFraction() else { F32 min_zoom; - const F32 DIST_FUDGE = 16.f; // meters - F32 max_zoom = llmin(mDrawDistance - DIST_FUDGE, - LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE, - MAX_CAMERA_DISTANCE_FROM_AGENT); + //const F32 DIST_FUDGE = 16.f; // meters + F32 max_zoom = 65535.f*4.f;//llmin(mDrawDistance - DIST_FUDGE, + // LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE, + // MAX_CAMERA_DISTANCE_FROM_AGENT); F32 distance = (F32)mCameraFocusOffsetTarget.magVec(); if (mFocusObject.notNull()) @@ -1898,27 +1907,27 @@ void LLAgent::cameraZoomIn(const F32 fraction) F32 current_distance = (F32)camera_offset_unit.normalize(); F32 new_distance = current_distance * fraction; - // Don't move through focus point - if (mFocusObject) + if (!gSavedSettings.getBOOL("AscentDisableMinZoomDist")) { - LLVector3 camera_offset_dir((F32)camera_offset_unit.mdV[VX], (F32)camera_offset_unit.mdV[VY], (F32)camera_offset_unit.mdV[VZ]); - - if (mFocusObject->isAvatar()) + if (mFocusObject) { - calcCameraMinDistance(min_zoom); - } - else - { - min_zoom = OBJECT_MIN_ZOOM; + LLVector3 camera_offset_dir((F32)camera_offset_unit.mdV[VX], (F32)camera_offset_unit.mdV[VY], (F32)camera_offset_unit.mdV[VZ]); + if (mFocusObject->isAvatar()) + { + calcCameraMinDistance(min_zoom); + } + else + { + min_zoom = OBJECT_MIN_ZOOM; + } } + new_distance = llmax(new_distance, min_zoom); } - new_distance = llmax(new_distance, min_zoom); - // Don't zoom too far back const F32 DIST_FUDGE = 16.f; // meters - F32 max_distance = llmin(mDrawDistance - DIST_FUDGE, - LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE ); + F32 max_distance = /*llmin(mDrawDistance*/ INT_MAX - DIST_FUDGE//, + /*LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE )*/; if (new_distance > max_distance) { @@ -1935,11 +1944,6 @@ void LLAgent::cameraZoomIn(const F32 fraction) */ } - if( cameraCustomizeAvatar() ) - { - new_distance = llclamp( new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM ); - } - mCameraFocusOffsetTarget = new_distance * camera_offset_unit; } @@ -1968,43 +1972,7 @@ void LLAgent::cameraOrbitIn(const F32 meters) LLVector3d camera_offset_unit(mCameraFocusOffsetTarget); F32 current_distance = (F32)camera_offset_unit.normalize(); F32 new_distance = current_distance - meters; - F32 min_zoom = LAND_MIN_ZOOM; - - // Don't move through focus point - if (mFocusObject.notNull()) - { - if (mFocusObject->isAvatar()) - { - min_zoom = AVATAR_MIN_ZOOM; - } - else - { - min_zoom = OBJECT_MIN_ZOOM; - } - } - new_distance = llmax(new_distance, min_zoom); - - // Don't zoom too far back - const F32 DIST_FUDGE = 16.f; // meters - F32 max_distance = llmin(mDrawDistance - DIST_FUDGE, - LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE ); - - if (new_distance > max_distance) - { - // Unless camera is unlocked - if (!gSavedSettings.getBOOL("DisableCameraConstraints")) - { - return; - } - } - - if( CAMERA_MODE_CUSTOMIZE_AVATAR == getCameraMode() ) - { - new_distance = llclamp( new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM ); - } - - // Compute new camera offset mCameraFocusOffsetTarget = new_distance * camera_offset_unit; cameraZoomIn(1.f); } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 4df22fea6..deeb78f6e 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -267,11 +267,6 @@ void init_debug_baked_texture_menu(LLMenuGL* menu); BOOL enable_land_build(void*); BOOL enable_object_build(void*); - - - - - LLVOAvatar* find_avatar_from_object( LLViewerObject* object ); LLVOAvatar* find_avatar_from_object( const LLUUID& object_id ); @@ -423,6 +418,15 @@ void handle_leave_god_mode(void*); // void handle_fake_away_status(void*); + +void handle_pose_stand_ltao(void*); +void handle_pose_stand_ltah(void*); +void handle_pose_stand_ltad(void*); +void handle_pose_stand_loau(void*); +void handle_pose_stand_loao(void*); +void handle_pose_stand_lhao(void*); +void handle_pose_stand_stop(void*); + void handle_force_ground_sit(void*); void handle_phantom_avatar(void*); void handle_hide_typing_notification(void*); @@ -560,6 +564,9 @@ BOOL enable_region_owner(void*); void menu_toggle_attached_lights(void* user_data); void menu_toggle_attached_particles(void* user_data); +// for pose stand +LLUUID current_pose = LLUUID::null; + class LLMenuParcelObserver : public LLParcelObserver { public: @@ -775,6 +782,20 @@ void init_menus() NULL, &menu_check_control, (void*)"ReSit")); + // + // Add in the pose stand ------------------------------------------- + LLMenuGL* sub = new LLMenuGL("Pose Stand"); + menu->appendMenu(sub); + + sub->append(new LLMenuItemCallGL( "Legs Together Arms Out", &handle_pose_stand_ltao, NULL)); + sub->append(new LLMenuItemCallGL( "Legs Together Arms Half", &handle_pose_stand_ltah, NULL)); + sub->append(new LLMenuItemCallGL( "Legs Together Arms Down", &handle_pose_stand_ltad, NULL)); + sub->append(new LLMenuItemCallGL( "Legs Out Arms Up", &handle_pose_stand_loau, NULL)); + sub->append(new LLMenuItemCallGL( "Legs Out Arms Out", &handle_pose_stand_loao, NULL)); + sub->append(new LLMenuItemCallGL( "Legs Half Arms Out", &handle_pose_stand_lhao, NULL)); + sub->append(new LLMenuItemCallGL( "Stop Pose Stand", &handle_pose_stand_stop, NULL)); + // ------------------------------------------------------ + //these should always be last in a sub menu menu->createJumpKeys(); gMenuBarView->appendMenu( menu ); @@ -3415,6 +3436,53 @@ void handle_close_all_notifications(void*) } } +// +// The following animations were made by Charley Levenque and are +// not public property or free to use via UUID. When replicating +// this code, please supply your own animations. +void handle_pose_stand_ltao(void*) +{ + gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_STOP); + current_pose.set("6c082c7b-f70e-9da0-0451-54793f869ff4"); + gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_START); +} +void handle_pose_stand_ltah(void*) +{ + gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_STOP); + current_pose.set("45e59c14-913b-c58c-2a55-c0a5c1eeef53"); + gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_START); +} +void handle_pose_stand_ltad(void*) +{ + gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_STOP); + current_pose.set("421d6bb4-94a9-3c42-4593-f2bc1f6a26e6"); + gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_START); +} +void handle_pose_stand_loau(void*) +{ + gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_STOP); + current_pose.set("8b3bb239-d610-1c0f-4d1a-69d29bc17e2c"); + gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_START); +} +void handle_pose_stand_loao(void*) +{ + gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_STOP); + current_pose.set("4d70e328-48b6-dc6a-0be1-85dd6b333e81"); + gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_START); +} +void handle_pose_stand_lhao(void*) +{ + gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_STOP); + current_pose.set("f088eaf0-f1c9-8cf1-99c8-09df96bb13ae"); + gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_START); +} +void handle_pose_stand_stop(void*) +{ + gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_STOP); + current_pose = LLUUID::null; +} +// --------------------------------------------------- + void handle_fake_away_status(void*) { if (!gSavedSettings.controlExists("FakeAway")) gSavedSettings.declareBOOL("FakeAway", FALSE, "", NO_PERSIST); diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 3fcbf4972..ed84320d0 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -769,6 +769,18 @@ class LLFileTakeSnapshotToDisk : public view_listener_t } }; +class LLFileLogOut : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + std::string command(gDirUtilp->getExecutableDir() + gDirUtilp->getDirDelimiter() + gDirUtilp->getExecutableFilename() + " --channel \"Ascent\" --settings settings_ascent.xml"); + gViewerWindow->getWindow()->ShellEx(command); + + LLAppViewer::instance()->userQuit(); + return true; + } +}; + class LLFileQuit : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -1546,6 +1558,7 @@ void init_menu_file() (new LLFileTakeSnapshot())->registerListener(gMenuHolder, "File.TakeSnapshot"); (new LLFileTakeSnapshotToDisk())->registerListener(gMenuHolder, "File.TakeSnapshotToDisk"); (new LLFileQuit())->registerListener(gMenuHolder, "File.Quit"); + (new LLFileLogOut())->registerListener(gMenuHolder, "File.LogOut"); //Emerald has a second llFileSaveTexture here... Same as the original. Odd. -HgB (new LLFileEnableUpload())->registerListener(gMenuHolder, "File.EnableUpload"); (new LLFileEnableSaveAs())->registerListener(gMenuHolder, "File.EnableSaveAs"); diff --git a/indra/newview/skins/default/xui/en-us/menu_viewer.xml b/indra/newview/skins/default/xui/en-us/menu_viewer.xml index e22641df7..db62c1684 100644 --- a/indra/newview/skins/default/xui/en-us/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en-us/menu_viewer.xml @@ -73,6 +73,10 @@ mouse_opaque="true" name="Quit" shortcut="control|Q" width="243"> + + +