Merge remote branch 'shyotlsv/master'
This commit is contained in:
@@ -260,6 +260,13 @@ const F32 LLAgent::TYPING_TIMEOUT_SECS = 5.f;
|
||||
std::map<std::string, std::string> LLAgent::sTeleportErrorMessages;
|
||||
std::map<std::string, std::string> LLAgent::sTeleportProgressMessages;
|
||||
|
||||
BOOL isAgentAvatarValid()
|
||||
{
|
||||
return (gAgent.getAvatarObject() &&
|
||||
(gAgent.getAvatarObject()->getRegion() != NULL) &&
|
||||
(!gAgent.getAvatarObject()->isDead()));
|
||||
}
|
||||
|
||||
class LLAgentFriendObserver : public LLFriendObserver
|
||||
{
|
||||
public:
|
||||
@@ -548,8 +555,11 @@ void LLAgent::resetView(BOOL reset_camera, BOOL change_camera)
|
||||
LLSelectMgr::getInstance()->deselectAll();
|
||||
}
|
||||
|
||||
// Hide all popup menus
|
||||
gMenuHolder->hideMenus();
|
||||
if (gMenuHolder != NULL)
|
||||
{
|
||||
// Hide all popup menus
|
||||
gMenuHolder->hideMenus();
|
||||
}
|
||||
}
|
||||
|
||||
static const LLCachedControl<bool> freeze_time("FreezeTime",false);
|
||||
@@ -588,6 +598,8 @@ void LLAgent::resetView(BOOL reset_camera, BOOL change_camera)
|
||||
}
|
||||
|
||||
setFocusOnAvatar(TRUE, ANIMATE);
|
||||
|
||||
mCameraFOVZoomFactor = 0.f;
|
||||
}
|
||||
|
||||
mHUDTargetZoom = 1.f;
|
||||
@@ -610,7 +622,7 @@ void LLAgent::onAppFocusGained()
|
||||
|
||||
void LLAgent::ageChat()
|
||||
{
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
// get amount of time since I last chatted
|
||||
F64 elapsed_time = (F64)mAvatarObject->mChatTimer.getElapsedTimeF32();
|
||||
@@ -627,7 +639,7 @@ void LLAgent::unlockView()
|
||||
{
|
||||
if (getFocusOnAvatar())
|
||||
{
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
setFocusGlobal( LLVector3d::zero, mAvatarObject->mID );
|
||||
}
|
||||
@@ -844,7 +856,7 @@ void LLAgent::resetClientTag()
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLAgent::setFlying(BOOL fly)
|
||||
{
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
if(mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_STANDUP) != mAvatarObject->mSignaledAnimations.end())
|
||||
{
|
||||
@@ -881,13 +893,15 @@ void LLAgent::setFlying(BOOL fly)
|
||||
LLViewerStats::getInstance()->incStat(LLViewerStats::ST_FLY_COUNT);
|
||||
}
|
||||
setControlFlags(AGENT_CONTROL_FLY);
|
||||
gSavedSettings.setBOOL("FlyBtnState", TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
clearControlFlags(AGENT_CONTROL_FLY);
|
||||
gSavedSettings.setBOOL("FlyBtnState", FALSE);
|
||||
}
|
||||
|
||||
|
||||
gSavedSettings.setBOOL("FlyBtnState",fly);
|
||||
|
||||
mbFlagsDirty = TRUE;
|
||||
}
|
||||
|
||||
@@ -1066,6 +1080,7 @@ void LLAgent::sendMessage()
|
||||
if (!mRegionp)
|
||||
{
|
||||
llerrs << "No region for agent yet!" << llendl;
|
||||
return;
|
||||
}
|
||||
gMessageSystem->sendMessage(mRegionp->getHost());
|
||||
}
|
||||
@@ -1094,7 +1109,7 @@ void LLAgent::sendReliableMessage()
|
||||
//-----------------------------------------------------------------------------
|
||||
LLVector3 LLAgent::getVelocity() const
|
||||
{
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
return mAvatarObject->getVelocity();
|
||||
}
|
||||
@@ -1115,7 +1130,7 @@ void LLAgent::setPositionAgent(const LLVector3 &pos_agent)
|
||||
llerrs << "setPositionAgent is not a number" << llendl;
|
||||
}
|
||||
|
||||
if (mAvatarObject.notNull() && mAvatarObject->getParent())
|
||||
if (isAgentAvatarValid() && mAvatarObject->getParent())
|
||||
{
|
||||
LLVector3 pos_agent_sitting;
|
||||
LLVector3d pos_agent_d;
|
||||
@@ -1153,7 +1168,7 @@ void LLAgent::slamLookAt(const LLVector3 &look_at)
|
||||
//-----------------------------------------------------------------------------
|
||||
const LLVector3d &LLAgent::getPositionGlobal() const
|
||||
{
|
||||
if (mAvatarObject.notNull() && !mAvatarObject->mDrawable.isNull())
|
||||
if (isAgentAvatarValid() && !mAvatarObject->mDrawable.isNull())
|
||||
{
|
||||
mPositionGlobal = getPosGlobalFromAgent(mAvatarObject->getRenderPosition());
|
||||
}
|
||||
@@ -1298,7 +1313,7 @@ LLVector3 LLAgent::getReferenceUpVector()
|
||||
{
|
||||
// this vector is in the coordinate frame of the avatar's parent object, or the world if none
|
||||
LLVector3 up_vector = LLVector3::z_axis;
|
||||
if (mAvatarObject.notNull() &&
|
||||
if (isAgentAvatarValid() &&
|
||||
mAvatarObject->getParent() &&
|
||||
mAvatarObject->mDrawable.notNull())
|
||||
{
|
||||
@@ -1348,7 +1363,7 @@ F32 LLAgent::clampPitchToLimits(F32 angle)
|
||||
|
||||
F32 angle_from_skyward = acos( mFrameAgent.getAtAxis() * skyward );
|
||||
|
||||
if (mAvatarObject.notNull() && mAvatarObject->mIsSitting)
|
||||
if (isAgentAvatarValid() && mAvatarObject->mIsSitting)
|
||||
{
|
||||
look_down_limit = 130.f * DEG_TO_RAD;
|
||||
}
|
||||
@@ -2240,10 +2255,9 @@ void LLAgent::clearAFK()
|
||||
|
||||
// Gods can sometimes get into away state (via gestures)
|
||||
// without setting the appropriate control flag. JC
|
||||
LLVOAvatar* av = mAvatarObject;
|
||||
if (mControlFlags & AGENT_CONTROL_AWAY
|
||||
|| (av
|
||||
&& (av->mSignaledAnimations.find(ANIM_AGENT_AWAY) != av->mSignaledAnimations.end())))
|
||||
|| (isAgentAvatarValid()
|
||||
&& (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_AWAY) != mAvatarObject->mSignaledAnimations.end())))
|
||||
{
|
||||
sendAnimationRequest(ANIM_AGENT_AWAY, ANIM_REQUEST_STOP);
|
||||
clearControlFlags(AGENT_CONTROL_AWAY);
|
||||
@@ -2307,7 +2321,7 @@ BOOL LLAgent::getBusy() const
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLAgent::startAutoPilotGlobal(const LLVector3d &target_global, const std::string& behavior_name, const LLQuaternion *target_rotation, void (*finish_callback)(BOOL, void *), void *callback_data, F32 stop_distance, F32 rot_threshold)
|
||||
{
|
||||
if (!gAgent.getAvatarObject())
|
||||
if (!isAgentAvatarValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -2353,7 +2367,10 @@ void LLAgent::startAutoPilotGlobal(const LLVector3d &target_global, const std::s
|
||||
if ( distance > 1.f && heightDelta > (sqrtf(mAutoPilotStopDistance) + 1.f))
|
||||
{
|
||||
setFlying(TRUE);
|
||||
mAutoPilotFlyOnStop = TRUE;
|
||||
// Do not force flying for "Sit" behavior to prevent flying after pressing "Stand"
|
||||
// from an object. See EXT-1655.
|
||||
if ("Sit" != mAutoPilotBehaviorName)
|
||||
mAutoPilotFlyOnStop = TRUE;
|
||||
}
|
||||
|
||||
mAutoPilot = TRUE;
|
||||
@@ -2422,6 +2439,13 @@ void LLAgent::stopAutoPilot(BOOL user_cancel)
|
||||
{
|
||||
resetAxes(mAutoPilotTargetFacing);
|
||||
}
|
||||
// Restore previous flying state before invoking mAutoPilotFinishedCallback to allow
|
||||
// callback function to change the flying state (like in near_sit_down_point()).
|
||||
// If the user cancelled, don't change the fly state
|
||||
if (!user_cancel)
|
||||
{
|
||||
setFlying(mAutoPilotFlyOnStop);
|
||||
}
|
||||
//NB: auto pilot can terminate for a reason other than reaching the destination
|
||||
if (mAutoPilotFinishedCallback)
|
||||
{
|
||||
@@ -2429,11 +2453,6 @@ void LLAgent::stopAutoPilot(BOOL user_cancel)
|
||||
}
|
||||
mLeaderID = LLUUID::null;
|
||||
|
||||
// If the user cancelled, don't change the fly state
|
||||
if (!user_cancel)
|
||||
{
|
||||
setFlying(mAutoPilotFlyOnStop);
|
||||
}
|
||||
setControlFlags(AGENT_CONTROL_STOP);
|
||||
|
||||
if (user_cancel && !mAutoPilotBehaviorName.empty())
|
||||
@@ -2468,10 +2487,7 @@ void LLAgent::autoPilot(F32 *delta_yaw)
|
||||
mAutoPilotTargetGlobal = object->getPositionGlobal();
|
||||
}
|
||||
|
||||
if (mAvatarObject.isNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!isAgentAvatarValid()) return;
|
||||
|
||||
if (mAvatarObject->mInAir)
|
||||
{
|
||||
@@ -2549,7 +2565,7 @@ void LLAgent::autoPilot(F32 *delta_yaw)
|
||||
// If we're flying, handle autopilot points above or below you.
|
||||
if (getFlying() && xy_distance < AUTOPILOT_HEIGHT_ADJUST_DISTANCE)
|
||||
{
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
F64 current_height = mAvatarObject->getPositionGlobal().mdV[VZ];
|
||||
F32 delta_z = (F32)(mAutoPilotTargetGlobal.mdV[VZ] - current_height);
|
||||
@@ -2684,11 +2700,7 @@ void LLAgent::updateLookAt(const S32 mouse_x, const S32 mouse_y)
|
||||
{
|
||||
static LLVector3 last_at_axis;
|
||||
|
||||
|
||||
if (mAvatarObject.isNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!isAgentAvatarValid()) return;
|
||||
|
||||
LLQuaternion av_inv_rot = ~mAvatarObject->mRoot.getWorldRotation();
|
||||
LLVector3 root_at = LLVector3::x_axis * mAvatarObject->mRoot.getWorldRotation();
|
||||
@@ -2960,7 +2972,7 @@ void LLAgent::endAnimationUpdateUI()
|
||||
}
|
||||
|
||||
// Disable mouselook-specific animations
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
if( mAvatarObject->isAnyAnimationSignaled(AGENT_GUN_AIM_ANIMS, NUM_AGENT_GUN_AIM_ANIMS) )
|
||||
{
|
||||
@@ -3006,7 +3018,7 @@ void LLAgent::endAnimationUpdateUI()
|
||||
gMorphView->setVisible( FALSE );
|
||||
}
|
||||
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
if(mCustomAnim)
|
||||
{
|
||||
@@ -3048,7 +3060,7 @@ void LLAgent::endAnimationUpdateUI()
|
||||
|
||||
gConsole->setVisible( TRUE );
|
||||
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
// Trigger mouselook-specific animations
|
||||
if( mAvatarObject->isAnyAnimationSignaled(AGENT_GUN_HOLD_ANIMS, NUM_AGENT_GUN_HOLD_ANIMS) )
|
||||
@@ -3109,7 +3121,7 @@ void LLAgent::endAnimationUpdateUI()
|
||||
}
|
||||
|
||||
// freeze avatar
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
// <edit>
|
||||
//mPauseRequest = mAvatarObject->requestPause();
|
||||
@@ -3117,9 +3129,9 @@ void LLAgent::endAnimationUpdateUI()
|
||||
}
|
||||
}
|
||||
|
||||
if (getAvatarObject())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
getAvatarObject()->updateAttachmentVisibility(mCameraMode);
|
||||
mAvatarObject->updateAttachmentVisibility(mCameraMode);
|
||||
}
|
||||
|
||||
gFloaterTools->dirty();
|
||||
@@ -3145,7 +3157,7 @@ void LLAgent::updateCamera()
|
||||
|
||||
validateFocusObject();
|
||||
|
||||
if (mAvatarObject.notNull() &&
|
||||
if (isAgentAvatarValid() &&
|
||||
mAvatarObject->mIsSitting &&
|
||||
camera_mode == CAMERA_MODE_MOUSELOOK)
|
||||
{
|
||||
@@ -3259,7 +3271,7 @@ void LLAgent::updateCamera()
|
||||
//Ventrella
|
||||
if ( mCameraMode == CAMERA_MODE_FOLLOW )
|
||||
{
|
||||
if ( mAvatarObject.notNull() )
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
//--------------------------------------------------------------------------------
|
||||
// this is where the avatar's position and rotation are given to followCam, and
|
||||
@@ -3275,6 +3287,7 @@ void LLAgent::updateCamera()
|
||||
mFollowCam.copyParams(*current_cam);
|
||||
mFollowCam.setSubjectPositionAndRotation( mAvatarObject->getRenderPosition(), avatarRotationForFollowCam );
|
||||
mFollowCam.update();
|
||||
LLViewerJoystick::getInstance()->setCameraNeedsUpdate(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3504,6 +3517,11 @@ void LLAgent::updateCamera()
|
||||
}
|
||||
}
|
||||
|
||||
void LLAgent::updateLastCamera()
|
||||
{
|
||||
mLastCameraMode = mCameraMode;
|
||||
}
|
||||
|
||||
void LLAgent::updateFocusOffset()
|
||||
{
|
||||
validateFocusObject();
|
||||
@@ -3654,7 +3672,7 @@ LLVector3d LLAgent::calcThirdPersonFocusOffset()
|
||||
focus_offset.setVec(gSavedSettings.getVector3("FocusOffsetDefault"));
|
||||
|
||||
LLQuaternion agent_rot = mFrameAgent.getQuaternion();
|
||||
if (!mAvatarObject.isNull() && mAvatarObject->getParent())
|
||||
if (isAgentAvatarValid() && mAvatarObject->getParent())
|
||||
{
|
||||
agent_rot *= ((LLViewerObject*)(mAvatarObject->getParent()))->getRenderRotation();
|
||||
}
|
||||
@@ -3666,7 +3684,7 @@ LLVector3d LLAgent::calcThirdPersonFocusOffset()
|
||||
void LLAgent::setupSitCamera()
|
||||
{
|
||||
// agent frame entering this function is in world coordinates
|
||||
if (mAvatarObject.notNull() && mAvatarObject->getParent())
|
||||
if (isAgentAvatarValid() && mAvatarObject->getParent())
|
||||
{
|
||||
LLQuaternion parent_rot = ((LLViewerObject*)mAvatarObject->getParent())->getRenderRotation();
|
||||
// slam agent coordinate frame to proper parent local version
|
||||
@@ -3734,7 +3752,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit)
|
||||
{
|
||||
// Compute base camera position and look-at points.
|
||||
//F32 camera_land_height;
|
||||
LLVector3d frame_center_global = mAvatarObject.isNull() ? getPositionGlobal()
|
||||
LLVector3d frame_center_global = !isAgentAvatarValid() ? getPositionGlobal()
|
||||
: getPosGlobalFromAgent(mAvatarObject->mRoot.getWorldPosition());
|
||||
|
||||
LLVector3 upAxis = getUpAxis();
|
||||
@@ -3751,7 +3769,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit)
|
||||
}// End Ventrella
|
||||
else if (mCameraMode == CAMERA_MODE_MOUSELOOK)
|
||||
{
|
||||
if (mAvatarObject.isNull() || mAvatarObject->mDrawable.isNull())
|
||||
if (!isAgentAvatarValid() || mAvatarObject->mDrawable.isNull())
|
||||
{
|
||||
llwarns << "Null avatar drawable!" << llendl;
|
||||
return LLVector3d::zero;
|
||||
@@ -3786,7 +3804,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit)
|
||||
F32 camera_distance = 0.f;
|
||||
|
||||
if (mSitCameraEnabled
|
||||
&& mAvatarObject.notNull()
|
||||
&& isAgentAvatarValid()
|
||||
&& mAvatarObject->mIsSitting
|
||||
&& mSitCameraReferenceObject.notNull())
|
||||
{
|
||||
@@ -3803,7 +3821,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit)
|
||||
local_camera_offset = mCameraZoomFraction * mCameraOffsetDefault * gSavedSettings.getF32("CameraOffsetScale");
|
||||
|
||||
// are we sitting down?
|
||||
if (mAvatarObject.notNull() && mAvatarObject->getParent())
|
||||
if (isAgentAvatarValid() && mAvatarObject->getParent())
|
||||
{
|
||||
LLQuaternion parent_rot = ((LLViewerObject*)mAvatarObject->getParent())->getRenderRotation();
|
||||
// slam agent coordinate frame to proper parent local version
|
||||
@@ -3819,7 +3837,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit)
|
||||
local_camera_offset = mFrameAgent.rotateToAbsolute( local_camera_offset );
|
||||
}
|
||||
|
||||
if (!mCameraCollidePlane.isExactlyZero() && (mAvatarObject.isNull() || !mAvatarObject->mIsSitting))
|
||||
if (!mCameraCollidePlane.isExactlyZero() && (!isAgentAvatarValid() || !mAvatarObject->mIsSitting))
|
||||
{
|
||||
LLVector3 plane_normal;
|
||||
plane_normal.setVec(mCameraCollidePlane.mV);
|
||||
@@ -3872,11 +3890,11 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit)
|
||||
// set the global camera position
|
||||
LLVector3d camera_offset;
|
||||
|
||||
LLVector3 av_pos = mAvatarObject.isNull() ? LLVector3::zero : mAvatarObject->getRenderPosition();
|
||||
LLVector3 av_pos = !isAgentAvatarValid() ? LLVector3::zero : mAvatarObject->getRenderPosition();
|
||||
camera_offset.setVec( local_camera_offset );
|
||||
camera_position_global = frame_center_global + head_offset + camera_offset;
|
||||
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
LLVector3d camera_lag_d;
|
||||
F32 lag_interp = LLCriticalDamp::getInterpolant(CAMERA_LAG_HALF_LIFE);
|
||||
@@ -4077,7 +4095,7 @@ void LLAgent::changeCameraToMouselook(BOOL animate)
|
||||
gFocusMgr.setKeyboardFocus( NULL );
|
||||
if (gSavedSettings.getBOOL("AONoStandsInMouselook")) LLFloaterAO::stopMotion(LLFloaterAO::getCurrentStandId(), FALSE,TRUE);
|
||||
|
||||
mLastCameraMode = mCameraMode;
|
||||
updateLastCamera();
|
||||
mCameraMode = CAMERA_MODE_MOUSELOOK;
|
||||
U32 old_flags = mControlFlags;
|
||||
setControlFlags(AGENT_CONTROL_MOUSELOOK);
|
||||
@@ -4139,7 +4157,7 @@ void LLAgent::changeCameraToFollow(BOOL animate)
|
||||
}
|
||||
startCameraAnimation();
|
||||
|
||||
mLastCameraMode = mCameraMode;
|
||||
updateLastCamera();
|
||||
mCameraMode = CAMERA_MODE_FOLLOW;
|
||||
|
||||
// bang-in the current focus, position, and up vector of the follow cam
|
||||
@@ -4150,7 +4168,7 @@ void LLAgent::changeCameraToFollow(BOOL animate)
|
||||
LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
|
||||
}
|
||||
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
mAvatarObject->mPelvisp->setPosition(LLVector3::zero);
|
||||
mAvatarObject->startMotion( ANIM_AGENT_BODY_NOISE );
|
||||
@@ -4208,7 +4226,7 @@ void LLAgent::changeCameraToThirdPerson(BOOL animate)
|
||||
|
||||
mCameraZoomFraction = INITIAL_ZOOM_FRACTION;
|
||||
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
if (!mAvatarObject->mIsSitting)
|
||||
{
|
||||
@@ -4242,7 +4260,7 @@ void LLAgent::changeCameraToThirdPerson(BOOL animate)
|
||||
mTargetCameraDistance = MIN_CAMERA_DISTANCE;
|
||||
animate = FALSE;
|
||||
}
|
||||
mLastCameraMode = mCameraMode;
|
||||
updateLastCamera();
|
||||
mCameraMode = CAMERA_MODE_THIRD_PERSON;
|
||||
U32 old_flags = mControlFlags;
|
||||
clearControlFlags(AGENT_CONTROL_MOUSELOOK);
|
||||
@@ -4254,7 +4272,7 @@ void LLAgent::changeCameraToThirdPerson(BOOL animate)
|
||||
}
|
||||
|
||||
// Remove any pitch from the avatar
|
||||
if (mAvatarObject.notNull() && mAvatarObject->getParent())
|
||||
if (isAgentAvatarValid() && mAvatarObject->getParent())
|
||||
{
|
||||
LLQuaternion obj_rot = ((LLViewerObject*)mAvatarObject->getParent())->getRenderRotation();
|
||||
at_axis = LLViewerCamera::getInstance()->getAtAxis();
|
||||
@@ -4338,7 +4356,7 @@ void LLAgent::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL camera_ani
|
||||
LLVOAvatar::onCustomizeStart();
|
||||
}
|
||||
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
if(avatar_animate)
|
||||
{
|
||||
@@ -4458,7 +4476,7 @@ void LLAgent::setFocusGlobal(const LLVector3d& focus, const LLUUID &object_id)
|
||||
{
|
||||
if (focus.isExactlyZero())
|
||||
{
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
mFocusTargetGlobal = getPosGlobalFromAgent(mAvatarObject->mHeadp->getWorldPosition());
|
||||
}
|
||||
@@ -4503,7 +4521,7 @@ void LLAgent::setFocusGlobal(const LLVector3d& focus, const LLUUID &object_id)
|
||||
{
|
||||
if (focus.isExactlyZero())
|
||||
{
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
mFocusTargetGlobal = getPosGlobalFromAgent(mAvatarObject->mHeadp->getWorldPosition());
|
||||
}
|
||||
@@ -4641,7 +4659,7 @@ void LLAgent::setFocusOnAvatar(BOOL focus_on_avatar, BOOL animate)
|
||||
if (mCameraMode == CAMERA_MODE_THIRD_PERSON)
|
||||
{
|
||||
LLVector3 at_axis;
|
||||
if (mAvatarObject.notNull() && mAvatarObject->getParent())
|
||||
if (isAgentAvatarValid() && mAvatarObject->getParent())
|
||||
{
|
||||
LLQuaternion obj_rot = ((LLViewerObject*)mAvatarObject->getParent())->getRenderRotation();
|
||||
at_axis = LLViewerCamera::getInstance()->getAtAxis();
|
||||
@@ -4708,7 +4726,7 @@ void LLAgent::lookAtLastChat()
|
||||
if (chatter->isAvatar())
|
||||
{
|
||||
LLVOAvatar *chatter_av = (LLVOAvatar*)chatter;
|
||||
if (mAvatarObject.notNull() && chatter_av->mHeadp)
|
||||
if (isAgentAvatarValid() && chatter_av->mHeadp)
|
||||
{
|
||||
delta_pos = chatter_av->mHeadp->getWorldPosition() - mAvatarObject->mHeadp->getWorldPosition();
|
||||
}
|
||||
@@ -4897,13 +4915,13 @@ void LLAgent::setStartPosition( U32 location_id )
|
||||
const F32 REGION_WIDTH = LLWorld::getInstance()->getRegionWidthInMeters();
|
||||
|
||||
LLVector3 agent_pos = getPositionAgent();
|
||||
LLVector3 agent_look_at = mFrameAgent.getAtAxis();
|
||||
LLVector3 agent_look_at = mFrameAgent.getAtAxis();
|
||||
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
// the z height is at the agent's feet
|
||||
agent_pos.mV[VZ] -= 0.5f * mAvatarObject->mBodySize.mV[VZ];
|
||||
}
|
||||
// the z height is at the agent's feet
|
||||
agent_pos.mV[VZ] -= 0.5f * mAvatarObject->mBodySize.mV[VZ];
|
||||
}
|
||||
|
||||
agent_pos.mV[VX] = llclamp( agent_pos.mV[VX], INSET, REGION_WIDTH - INSET );
|
||||
agent_pos.mV[VY] = llclamp( agent_pos.mV[VY], INSET, REGION_WIDTH - INSET );
|
||||
@@ -5020,7 +5038,7 @@ void LLAgent::onAnimStop(const LLUUID& id)
|
||||
setControlFlags(AGENT_CONTROL_FINISH_ANIM);
|
||||
|
||||
// now trigger dusting self off animation
|
||||
if (mAvatarObject.notNull() && !mAvatarObject->mBelowWater && rand() % 3 == 0)
|
||||
if (isAgentAvatarValid() && !mAvatarObject->mBelowWater && rand() % 3 == 0)
|
||||
sendAnimationRequest( ANIM_AGENT_BRUSH, ANIM_REQUEST_START );
|
||||
}
|
||||
else if (id == ANIM_AGENT_PRE_JUMP || id == ANIM_AGENT_LAND || id == ANIM_AGENT_MEDIUM_LAND)
|
||||
@@ -5127,6 +5145,9 @@ int LLAgent::convertTextToMaturity(char text)
|
||||
|
||||
bool LLAgent::sendMaturityPreferenceToServer(int preferredMaturity)
|
||||
{
|
||||
if (!getRegion())
|
||||
return false;
|
||||
|
||||
// Update agent access preference on the server
|
||||
std::string url = getRegion()->getCapability("UpdateAgentInformation");
|
||||
if (!url.empty())
|
||||
@@ -5189,7 +5210,7 @@ const LLAgentAccess& LLAgent::getAgentAccess()
|
||||
|
||||
void LLAgent::buildFullname(std::string& name) const
|
||||
{
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
name = mAvatarObject->getFullname();
|
||||
}
|
||||
@@ -5207,7 +5228,7 @@ void LLAgent::buildFullnameAndTitle(std::string& name) const
|
||||
name.erase(0, name.length());
|
||||
}
|
||||
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
name += mAvatarObject->getFullname();
|
||||
}
|
||||
@@ -5406,7 +5427,7 @@ void LLAgent::buildLocationString(std::string& str)
|
||||
|
||||
LLQuaternion LLAgent::getHeadRotation()
|
||||
{
|
||||
if (mAvatarObject.isNull() || !mAvatarObject->mPelvisp || !mAvatarObject->mHeadp)
|
||||
if (!isAgentAvatarValid() || !mAvatarObject->mPelvisp || !mAvatarObject->mHeadp)
|
||||
{
|
||||
return LLQuaternion::DEFAULT;
|
||||
}
|
||||
@@ -6051,8 +6072,7 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void *
|
||||
{
|
||||
gAgent.mNumPendingQueries--;
|
||||
|
||||
LLVOAvatar* avatarp = gAgent.getAvatarObject();
|
||||
if (!avatarp || avatarp->isDead())
|
||||
if (!isAgentAvatarValid())
|
||||
{
|
||||
llwarns << "No avatar for user in cached texture update!" << llendl;
|
||||
return;
|
||||
@@ -6084,7 +6104,7 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void *
|
||||
&& gAgent.mActiveCacheQueries[ texture_index ] == query_id)
|
||||
{
|
||||
//llinfos << "Received cached texture " << (U32)texture_index << ": " << texture_id << llendl;
|
||||
avatarp->setCachedBakedTexture(getTextureIndex((EBakedTextureIndex)texture_index), texture_id);
|
||||
gAgent.getAvatarObject()->setCachedBakedTexture(getTextureIndex((EBakedTextureIndex)texture_index), texture_id);
|
||||
//avatarp->setTETexture( LLVOAvatar::sBakedTextureIndices[texture_index], texture_id );
|
||||
gAgent.mActiveCacheQueries[ texture_index ] = 0;
|
||||
num_results++;
|
||||
@@ -6093,20 +6113,19 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void *
|
||||
|
||||
llinfos << "Received cached texture response for " << num_results << " textures." << llendl;
|
||||
|
||||
avatarp->updateMeshTextures();
|
||||
gAgent.getAvatarObject()->updateMeshTextures();
|
||||
|
||||
if (gAgent.mNumPendingQueries == 0)
|
||||
{
|
||||
// RN: not sure why composites are disabled at this point
|
||||
avatarp->setCompositeUpdatesEnabled(TRUE);
|
||||
gAgent.getAvatarObject()->setCompositeUpdatesEnabled(TRUE);
|
||||
gAgent.sendAgentSetAppearance();
|
||||
}
|
||||
}
|
||||
|
||||
BOOL LLAgent::anyControlGrabbed() const
|
||||
{
|
||||
U32 i;
|
||||
for (i = 0; i < TOTAL_CONTROLS; i++)
|
||||
for (U32 i = 0; i < TOTAL_CONTROLS; i++)
|
||||
{
|
||||
if (gAgent.mControlsTakenCount[i] > 0)
|
||||
return TRUE;
|
||||
@@ -6152,11 +6171,10 @@ BOOL LLAgent::getHomePosGlobal( LLVector3d* pos_global )
|
||||
|
||||
void LLAgent::clearVisualParams(void *data)
|
||||
{
|
||||
LLVOAvatar* avatarp = gAgent.getAvatarObject();
|
||||
if (avatarp)
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
avatarp->clearVisualParamWeights();
|
||||
avatarp->updateVisualParams();
|
||||
gAgent.getAvatarObject()->clearVisualParamWeights();
|
||||
gAgent.getAvatarObject()->updateVisualParams();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6183,9 +6201,9 @@ bool LLAgent::teleportCore(bool is_local)
|
||||
// sync with other viewers. Discuss in DEV-14145/VWR-6744 before reenabling.
|
||||
|
||||
// Stop all animation before actual teleporting
|
||||
LLVOAvatar* avatarp = gAgent.getAvatarObject();
|
||||
if (avatarp)
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
LLVOAvatar* avatarp = gAgent.getAvatarObject();
|
||||
for ( LLVOAvatar::AnimIterator anim_it= avatarp->mPlayingAnimations.begin();
|
||||
anim_it != avatarp->mPlayingAnimations.end();
|
||||
++anim_it)
|
||||
@@ -6477,10 +6495,9 @@ void LLAgent::stopCurrentAnimations()
|
||||
{
|
||||
// This function stops all current overriding animations on this
|
||||
// avatar, propagating this change back to the server.
|
||||
|
||||
LLVOAvatar* avatarp = gAgent.getAvatarObject();
|
||||
if (avatarp)
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
LLVOAvatar* avatarp = gAgent.getAvatarObject();
|
||||
for ( LLVOAvatar::AnimIterator anim_it =
|
||||
avatarp->mPlayingAnimations.begin();
|
||||
anim_it != avatarp->mPlayingAnimations.end();
|
||||
@@ -7578,7 +7595,7 @@ void LLAgent::addWearableToAgentInventory(
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLAgent::sendAgentSetAppearance()
|
||||
{
|
||||
if (mAvatarObject.isNull()) return;
|
||||
if (!isAgentAvatarValid()) return;
|
||||
|
||||
if (mNumPendingQueries > 0 && !gAgent.cameraCustomizeAvatar())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user