diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 00099ac2cd..75fc631ca2 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1366,17 +1366,6 @@ Backup 0 - RLVaShowNameTags - - Comment - Display of names above avatars is subject to the general "Show Names" setting when @shownames=n restricted - Persist - 1 - Type - Boolean - Value - 0 - RLVaTopLevelMenu Comment diff --git a/indra/newview/chatbar_as_cmdline.cpp b/indra/newview/chatbar_as_cmdline.cpp index 714dfacc14..e459912fc6 100644 --- a/indra/newview/chatbar_as_cmdline.cpp +++ b/indra/newview/chatbar_as_cmdline.cpp @@ -777,7 +777,7 @@ bool cmd_line_chat(const std::string& revised_text, EChatType type, bool from_ge report_to_nearby_chat(llformat("Object with key %s not found!", target_key.asString().c_str())); return false; } - if ((!rlv_handler_t::isEnabled()) || (gRlvHandler.canSit(myObject, LLVector3::zero))) + if ((!RlvActions::isRlvEnabled()) || (RlvActions::canSit(myObject, LLVector3::zero))) { LLMessageSystem *msg = gMessageSystem; msg->newMessageFast(_PREHASH_AgentRequestSit); diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index cbbcd58a3e..4a2d824ada 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -2312,7 +2312,10 @@ std::ostream& operator<<(std::ostream &s, const LLAgent &agent) //----------------------------------------------------------------------------- BOOL LLAgent::needsRenderAvatar() { - if (gAgentCamera.cameraMouselook() && !LLVOAvatar::sVisibleInFirstPerson) +// if (gAgentCamera.cameraMouselook() && !LLVOAvatar::sVisibleInFirstPerson) +// [RLVa:KB] - Checked: RLVa-2.0.2 + if ( (gAgentCamera.cameraMouselook() && !LLVOAvatar::sVisibleInFirstPerson) || (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWSELF)) ) +// [/RLVa:KB] { return FALSE; } @@ -2323,7 +2326,10 @@ BOOL LLAgent::needsRenderAvatar() // TRUE if we need to render your own avatar's head. BOOL LLAgent::needsRenderHead() { - return (LLVOAvatar::sVisibleInFirstPerson && LLPipeline::sReflectionRender) || (mShowAvatar && !gAgentCamera.cameraMouselook()); +// [RLVa:KB] - Checked: RLVa-2.0.2 + return ((LLVOAvatar::sVisibleInFirstPerson && LLPipeline::sReflectionRender) || (mShowAvatar && !gAgentCamera.cameraMouselook())) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWSELFHEAD)); +// [/RLVa:KB] +// return (LLVOAvatar::sVisibleInFirstPerson && LLPipeline::sReflectionRender) || (mShowAvatar && !gAgentCamera.cameraMouselook()); } //----------------------------------------------------------------------------- @@ -4777,7 +4783,7 @@ void LLAgent::teleportViaLocation(const LLVector3d& pos_global) // [RLVa:KB] - Checked: RLVa-2.0.0 if ( (RlvActions::isRlvEnabled()) && (!RlvUtil::isForceTp()) ) { - if ( (RlvActions::isLocalTp(pos_global)) ? !RlvActions::canTeleportToLocal() : !RlvActions::canTeleportToLocation() ) + if ( (RlvActions::isLocalTp(pos_global)) ? !RlvActions::canTeleportToLocal(pos_global) : !RlvActions::canTeleportToLocation() ) { RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_TELEPORT); return; @@ -4857,7 +4863,7 @@ void LLAgent::teleportViaLocationLookAt(const LLVector3d& pos_global, const LLVe { if ( (RlvActions::isRlvEnabled()) && (!RlvUtil::isForceTp()) ) { - if ( (RlvActions::isLocalTp(pos_global)) ? !RlvActions::canTeleportToLocal() : !RlvActions::canTeleportToLocation() ) + if ( (RlvActions::isLocalTp(pos_global)) ? !RlvActions::canTeleportToLocal(pos_global) : !RlvActions::canTeleportToLocation() ) { RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_TELEPORT); return; diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 1d29bf4b9e..a6b4c6cd92 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -217,10 +217,18 @@ 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"); +// [RLVa:KB] - Checked: RLVa-2.0.0 + mCameraOffsetInitial[CAMERA_RLV_SETCAM_VIEW] = gSavedSettings.declareVec3("CameraOffsetRLVaView", LLVector3(mCameraOffsetInitial[CAMERA_PRESET_REAR_VIEW]->getDefault()), "Declared in code", LLControlVariable::PERSIST_NO); + mCameraOffsetInitial[CAMERA_RLV_SETCAM_VIEW]->setHiddenFromSettingsEditor(true); +// [/RLVa:KB] mFocusOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getControl("FocusOffsetRearView"); mFocusOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getControl("FocusOffsetFrontView"); mFocusOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getControl("FocusOffsetGroupView"); +// [RLVa:KB] - Checked: RLVa-2.0.0 + mFocusOffsetInitial[CAMERA_RLV_SETCAM_VIEW] = gSavedSettings.declareVec3("FocusOffsetRLVaView", LLVector3(mFocusOffsetInitial[CAMERA_PRESET_REAR_VIEW]->getDefault()), "Declared in code", LLControlVariable::PERSIST_NO); + mFocusOffsetInitial[CAMERA_RLV_SETCAM_VIEW]->setHiddenFromSettingsEditor(true); +// [/RLVa:KB] mCameraCollidePlane.clearVec(); mCurrentCameraDistance = getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale"); @@ -830,7 +838,13 @@ void LLAgentCamera::setCameraZoomFraction(F32 fraction) LLVector3d camera_offset_dir = mCameraFocusOffsetTarget; camera_offset_dir.normalize(); - mCameraFocusOffsetTarget = camera_offset_dir * rescale(fraction, 0.f, 1.f, max_zoom, min_zoom); +// [RLVa:KB] - Checked: 2.0.0 + const LLVector3d focus_offset_target = camera_offset_dir * rescale(fraction, 0.f, 1.f, max_zoom, min_zoom); + if ( (RlvActions::isRlvEnabled()) && (!allowFocusOffsetChange(focus_offset_target)) ) + return; + mCameraFocusOffsetTarget = focus_offset_target; +// [/RLVa:KB] +// mCameraFocusOffsetTarget = camera_offset_dir * rescale(fraction, 0.f, 1.f, max_zoom, min_zoom); } startCameraAnimation(); } @@ -962,6 +976,11 @@ void LLAgentCamera::cameraZoomIn(const F32 fraction) new_distance = llclamp( new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM ); } +// [RLVa:KB] - Checked: 2.0.0 + if ( (RlvActions::isRlvEnabled()) && (!allowFocusOffsetChange(new_distance * camera_offset_unit)) ) + return; +// [/RLVa:KB] + mCameraFocusOffsetTarget = new_distance * camera_offset_unit; } @@ -1033,6 +1052,11 @@ void LLAgentCamera::cameraOrbitIn(const F32 meters) new_distance = llclamp( new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM ); } +// [RLVa:KB] - Checked: 2.0.0 + if ( (RlvActions::isRlvEnabled()) && (!allowFocusOffsetChange(new_distance * camera_offset_unit)) ) + return; +// [/RLVa:KB] + // Compute new camera offset mCameraFocusOffsetTarget = new_distance * camera_offset_unit; cameraZoomIn(1.f); @@ -1177,6 +1201,14 @@ void LLAgentCamera::updateCamera() mCameraUpVector = LLVector3::z_axis; //LLVector3 camera_skyward(0.f, 0.f, 1.f); +// [RLVa:KB] - Checked: RLVa-2.0.0 + // Set focus back on our avie if something changed it + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM_UNLOCK)) && (cameraThirdPerson()) && (!getFocusOnAvatar()) ) + { + setFocusOnAvatar(TRUE, FALSE); + } +// [/RLVa:KB] + U32 camera_mode = mCameraAnimating ? mLastCameraMode : mCameraMode; validateFocusObject(); @@ -1957,6 +1989,44 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) // } +// [RLVa:KB] - Checked: RLVa-2.0.0 + if ( (CAMERA_MODE_THIRD_PERSON == mCameraMode) && (RlvActions::isRlvEnabled()) && (RlvActions::isCameraDistanceClamped()) ) + { + m_fRlvMinDist = m_fRlvMaxDist = false; + + // Av-locked | Focus-locked | Result + // =================================================== + // T | T | skip focus => slam av + // T | F | skip focus => slam av + // F | T | skip av => slam focus + // F | F | clamp focus then av + bool fCamAvDistClamped, fCamAvDistLocked = false; float nCamAvDistLimitMin, nCamAvDistLimitMax; + if (fCamAvDistClamped = RlvActions::getCameraAvatarDistanceLimits(nCamAvDistLimitMin, nCamAvDistLimitMax)) + fCamAvDistLocked = nCamAvDistLimitMin == nCamAvDistLimitMax; + bool fCamOriginDistClamped, fCamOriginDistLocked = false; float nCamOriginDistLimitMin, nCamOriginDistLimitMax; + if (fCamOriginDistClamped = RlvActions::getCameraOriginDistanceLimits(nCamOriginDistLimitMin, nCamOriginDistLimitMax)) + fCamOriginDistLocked = nCamOriginDistLimitMin == nCamOriginDistLimitMax; + + // Check focus distance limits + if ( (fCamOriginDistClamped) && (!fCamAvDistLocked) ) + { + const LLVector3 offsetCameraLocal = mCameraZoomFraction * getCameraOffsetInitial() * gSavedSettings.getF32("CameraOffsetScale"); + const LLVector3d offsetCamera(gAgent.getFrameAgent().rotateToAbsolute(offsetCameraLocal)); + const LLVector3d posFocusCam = frame_center_global + head_offset + offsetCamera; + if (clampCameraPosition(camera_position_global, posFocusCam, nCamOriginDistLimitMin, nCamOriginDistLimitMax)) + isConstrained = TRUE; + } + + // Check avatar distance limits + if ( (fCamAvDistClamped) && (fCamAvDistLocked || !fCamOriginDistClamped) ) + { + const LLVector3d posAvatarCam = gAgent.getPosGlobalFromAgent( (isAgentAvatarValid()) ? gAgentAvatarp->mHeadp->getWorldPosition() : gAgent.getPositionAgent() ); + if (clampCameraPosition(camera_position_global, posAvatarCam, nCamAvDistLimitMin, nCamAvDistLimitMax)) + isConstrained = TRUE; + } + } +// [/RLVa:KB] + // Don't let camera go underground F32 camera_min_off_ground = getCameraMinOffGround(); @@ -1977,6 +2047,49 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) return camera_position_global; } +// [RLVa:KB] - Checked: RLVa-2.0.0 +bool LLAgentCamera::allowFocusOffsetChange(const LLVector3d& offsetFocus) +{ + if (RlvActions::isCameraDistanceClamped()) + { + if ( (CAMERA_MODE_THIRD_PERSON == getCameraMode()) && ((m_fRlvMinDist) || (m_fRlvMaxDist)) ) + { + const LLVector3d posFocusGlobal = calcFocusPositionTargetGlobal(); + // Don't allow moving the focus offset if at minimum and moving closer (or if at maximum and moving further) to prevent camera warping + F32 nCurDist = llabs((posFocusGlobal + mCameraFocusOffsetTarget - m_posRlvRefGlobal).magVec()); + F32 nNewDist = llabs((posFocusGlobal + offsetFocus - m_posRlvRefGlobal).magVec()); + if ( ((m_fRlvMaxDist) && (nNewDist > nCurDist)) || ((m_fRlvMinDist) && (nNewDist < nCurDist)) ) + return false; + } + } + return true; +} + +bool LLAgentCamera::clampCameraPosition(LLVector3d& posCamGlobal, const LLVector3d posCamRefGlobal, float nDistMin, float nDistMax) +{ + const LLVector3d offsetCamera = posCamGlobal - posCamRefGlobal; + + F32 nCamAvDist = llabs(offsetCamera.magVec()), nDistMult = NAN; + if (nCamAvDist > nDistMax) + { + nDistMult = nDistMax / nCamAvDist; + m_fRlvMaxDist = true; + } + else if (nCamAvDist < nDistMin) + { + nDistMult = nDistMin / nCamAvDist; + m_fRlvMinDist = true; + } + + if (!isnan(nDistMult)) + { + posCamGlobal = posCamRefGlobal + nDistMult * offsetCamera; + m_posRlvRefGlobal = posCamRefGlobal; + return true; + } + return false; +} +// [/RLVa:KB] LLVector3 LLAgentCamera::getCameraOffsetInitial() { @@ -2110,6 +2223,10 @@ void LLAgentCamera::resetCamera() void LLAgentCamera::changeCameraToMouselook(BOOL animate) { if (!gSavedSettings.getBOOL("EnableMouselook") +// [RLVa:KB] - Checked: RLVa-2.0.0 + || ( (RlvActions::isRlvEnabled()) && (!RlvActions::canChangeToMouselook()) ) +// [/RLVa:KB] + || LLViewerJoystick::getInstance()->getOverrideCamera()) { return; @@ -2404,6 +2521,26 @@ void LLAgentCamera::changeCameraToCustomizeAvatar() void LLAgentCamera::switchCameraPreset(ECameraPreset preset) { +// [RLVa:KB] - Checked: RLVa-2.0.0 + if (RlvActions::isRlvEnabled()) + { + // Don't allow changing away from the our view if an object is restricting it + if (RlvActions::isCameraPresetLocked()) + preset = CAMERA_RLV_SETCAM_VIEW; + + // Don't reset anything if our view is already current + if ( (CAMERA_RLV_SETCAM_VIEW == preset) && (CAMERA_RLV_SETCAM_VIEW == mCameraPreset) ) + return; + + // Reset our view when switching away + if (CAMERA_RLV_SETCAM_VIEW != preset) + { + mCameraOffsetInitial[CAMERA_RLV_SETCAM_VIEW]->resetToDefault(); + mFocusOffsetInitial[CAMERA_RLV_SETCAM_VIEW]->resetToDefault(); + } + } +// [/RLVa:KB] + //zoom is supposed to be reset for the front and group views mCameraZoomFraction = 1.f; diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h index 92178c70a5..98296e8a8a 100644 --- a/indra/newview/llagentcamera.h +++ b/indra/newview/llagentcamera.h @@ -56,7 +56,12 @@ enum ECameraPreset CAMERA_PRESET_FRONT_VIEW, /** "Above and to the left, over the shoulder, pulled back a little on the zoom" */ - CAMERA_PRESET_GROUP_VIEW + CAMERA_PRESET_GROUP_VIEW, + +// [RLVa:KB] - Checked: RLVa-2.0.0 + /* Used by RLVa */ + CAMERA_RLV_SETCAM_VIEW +// [/RLVa:KB] }; //------------------------------------------------------------------------ @@ -305,6 +310,18 @@ public: F32 mHUDTargetZoom; // Target zoom level for HUD objects (used when editing) F32 mHUDCurZoom; // Current animated zoom level for HUD objects +// [RLVa:KB] - Checked: RLVa-2.0.0 + //-------------------------------------------------------------------- + // RLVa + //-------------------------------------------------------------------- +protected: + bool allowFocusOffsetChange(const LLVector3d& offsetFocus); + bool clampCameraPosition(LLVector3d& posCamGlobal, const LLVector3d posCamRefGlobal, float nDistMin, float nDistMax); + + bool m_fRlvMaxDist; // True if the camera is at max distance + bool m_fRlvMinDist; // True if the camera is at min distance + LLVector3d m_posRlvRefGlobal; // Current reference point for distance calculations +// [/RLVa:KB] /******************************************************************************** ** ** diff --git a/indra/newview/llagentlistener.cpp b/indra/newview/llagentlistener.cpp index ff3d4e6ce2..85bae5cd75 100644 --- a/indra/newview/llagentlistener.cpp +++ b/indra/newview/llagentlistener.cpp @@ -186,7 +186,7 @@ void LLAgentListener::requestSit(LLSD const & event_data) const // [RLVa:KB] - Checked: 2010-03-06 (RLVa-1.2.0c) | Modified: RLVa-1.1.0j // TODO-RLVa: [RLVa-1.2.1] Figure out how to call this? - if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canSit(object)) ) + if ( (rlv_handler_t::isEnabled()) && (!RlvActions::canSit(object)) ) { return; } diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 5bb5de4b3a..c68067896f 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -617,8 +617,8 @@ void LLAvatarActions::teleportRequest(const LLUUID& id) LLSD notification; notification["uuid"] = id; -// [RLVa:KB] - Checked: 2014-03-31 (Catznip-3.6) - notification["NAME"] = LLSLURL("agent", id, (RlvActions::canShowName(RlvActions::SNC_TELEPORTREQUEST)) ? "completename" : "rlvanonym").getSLURLString(); +// [RLVa:KB] - Checked: RLVa-1.5.0 + notification["NAME"] = LLSLURL("agent", id, (RlvActions::canShowName(RlvActions::SNC_TELEPORTREQUEST, id)) ? "completename" : "rlvanonym").getSLURLString(); // [/RLVa:KB] // LLAvatarName av_name; // if (!LLAvatarNameCache::get(id, &av_name)) diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp index 225e270a72..de9b687688 100644 --- a/indra/newview/llavatarlist.cpp +++ b/indra/newview/llavatarlist.cpp @@ -49,8 +49,8 @@ #include "lltooldraganddrop.h" // [RLVa:KB] - Checked: 2010-06-04 (RLVa-1.2.2a) #include "rlvhandler.h" +#include "rlvactions.h" // [/RLVa:KB] - static LLDefaultChildRegistry::Register r("avatar_list"); // Last interaction time update period. @@ -185,7 +185,7 @@ LLAvatarList::LLAvatarList(const Params& p) , mShowProfileBtn(p.show_profile_btn) , mShowSpeakingIndicator(p.show_speaking_indicator) , mShowPermissions(p.show_permissions_granted) -// [RLVa:KB] - Checked: 2010-04-05 (RLVa-1.2.2a) | Added: RLVa-1.2.0d +// [RLVa:KB] - Checked: RLVa-1.2.0 , mRlvCheckShowNames(false) // [/RLVa:KB] , mShowVoiceVolume(p.show_voice_volume) @@ -581,7 +581,7 @@ S32 LLAvatarList::notifyParent(const LLSD& info) void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, BOOL is_online, EAddPosition pos) { LLAvatarListItem* item = new LLAvatarListItem(); -// [RLVa:KB] - Checked: 2010-04-05 (RLVa-1.2.2a) | Added: RLVa-1.2.0d +// [RLVa:KB] - Checked: RLVa-1.2.0 item->setRlvCheckShowNames(mRlvCheckShowNames); // [/RLVa:KB] @@ -610,7 +610,7 @@ BOOL LLAvatarList::handleRightMouseDown(S32 x, S32 y, MASK mask) BOOL handled = LLUICtrl::handleRightMouseDown(x, y, mask); // if ( mContextMenu && !isAvalineItemSelected()) // [RLVa:KB] - Checked: 2010-06-04 (RLVa-1.2.2a) | Modified: RLVa-1.2.0d - if ( (mContextMenu && !isAvalineItemSelected()) && ((!mRlvCheckShowNames) || (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))) ) + if ( (mContextMenu && !isAvalineItemSelected()) && ((!mRlvCheckShowNames) || (!RlvActions::hasBehaviour(RLV_BHVR_SHOWNAMES))) ) // [/RLVa:KB] { uuid_vec_t selected_uuids; @@ -735,7 +735,7 @@ void LLAvatarList::onItemDoubleClicked(LLUICtrl* ctrl, S32 x, S32 y, MASK mask) { // mItemDoubleClickSignal(ctrl, x, y, mask); // [RLVa:KB] - Checked: 2010-06-05 (RLVa-1.2.2a) | Added: RLVa-1.2.0d - if ( (!mRlvCheckShowNames) || (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ) + if ( (!mRlvCheckShowNames) || (!RlvActions::hasBehaviour(RLV_BHVR_SHOWNAMES)) ) mItemDoubleClickSignal(ctrl, x, y, mask); // [/RLVa:KB] } @@ -744,7 +744,7 @@ void LLAvatarList::onItemDoubleClicked(LLUICtrl* ctrl, S32 x, S32 y, MASK mask) // static std::string LLAvatarList::getNameForDisplay(const LLAvatarName& av_name, bool show_displayname, bool show_username, bool rlv_check_shownames) { - bool fRlvFilter = (rlv_check_shownames) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); + bool fRlvFilter = (rlv_check_shownames) && (RlvActions::hasBehaviour(RLV_BHVR_SHOWNAMES)); if (show_displayname && !show_username) { return ( (!fRlvFilter) ? av_name.getDisplayName() : RlvStrings::getAnonym(av_name) ); diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h index bb40be0fd4..84c5fca005 100644 --- a/indra/newview/llavatarlist.h +++ b/indra/newview/llavatarlist.h @@ -102,7 +102,7 @@ public: // Return true if filter has at least one match. bool filterHasMatches(); -// [RLVa:KB] - Checked: 2010-04-05 (RLVa-1.2.2a) | Added: RLVa-1.2.0d +// [RLVa:KB] - Checked: RLVa-1.2.0 void setRlvCheckShowNames(bool fRlvCheckShowNames) { mRlvCheckShowNames = fRlvCheckShowNames; } // We need this to be public since we call it from RlvUIEnabler::onToggleShowNames() void updateAvatarNames(); @@ -151,7 +151,7 @@ private: bool mShowVoiceVolume; bool mShowSpeakingIndicator; bool mShowPermissions; -// [RLVa:KB] - Checked: 2010-04-05 (RLVa-1.2.2a) | Added: RLVa-1.2.0d +// [RLVa:KB] - RLVa-1.2.0 bool mRlvCheckShowNames; // [/RLVa:KB] bool mShowDisplayName; diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index 5607e11369..dd6eeed42b 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -42,8 +42,9 @@ #include "llavatariconctrl.h" #include "lloutputmonitorctrl.h" #include "lltooldraganddrop.h" -// [RLVa:KB] - Checked: 2010-04-05 (RLVa-1.2.2a) -#include "rlvhandler.h" +// [RLVa:KB] - Checked: RLVa-2.0.1 +#include "rlvactions.h" +#include "rlvcommon.h" // [/RLVa:KB] #include #include "llnotificationsutil.h" @@ -87,7 +88,7 @@ LLAvatarListItem::LLAvatarListItem(bool not_from_ui_factory/* = true*/) mOnlineStatus(E_UNKNOWN), mShowInfoBtn(true), mShowProfileBtn(true), -// [RLVa:KB] - Checked: 2010-04-05 (RLVa-1.2.2a) | Added: RLVa-1.2.0d +// [RLVa:KB] - Checked: RLVa-1.2.0 mRlvCheckShowNames(false), // [/RLVa:KB] mShowPermissions(false), @@ -232,9 +233,10 @@ void LLAvatarListItem::onMouseEnter(S32 x, S32 y, MASK mask) // , removed on-hover visibility. Don't do this. instead flip info buttons on full-time in postbuild. // mInfoBtn->setVisible(mShowInfoBtn); // mProfileBtn->setVisible(mShowProfileBtn); -// [RLVa:KB] - Checked: 2010-04-05 (RLVa-1.2.2a) | Added: RLVa-1.2.0d - //mInfoBtn->setVisible( (mShowInfoBtn) && ((!mRlvCheckShowNames) || (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))) ); - //mProfileBtn->setVisible( (mShowProfileBtn) && ((!mRlvCheckShowNames) || (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))) ); +// [RLVa:KB] - Checked: RLVa-1.2.0 + //bool fRlvCanShowName = (!mRlvCheckShowNames) || (RlvActions::canShowName(RlvActions::SNC_DEFAULT, mAvatarId)); + //mInfoBtn->setVisible( (mShowInfoBtn) && (fRlvCanShowName) ); + //mProfileBtn->setVisible( (mShowProfileBtn) && (fRlvCanShowName) ); // [/RLVa:KB] mHovered = true; @@ -422,13 +424,13 @@ void LLAvatarListItem::setLastInteractionTime(U32 secs_since) void LLAvatarListItem::setShowInfoBtn(bool show) { mShowInfoBtn = show; - mInfoBtn->setVisible( (mShowInfoBtn) && ((!mRlvCheckShowNames) || (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))) ); + mInfoBtn->setVisible( (mShowInfoBtn) && ((!mRlvCheckShowNames) || (RlvActions::canShowName(RlvActions::SNC_DEFAULT, mAvatarId))) ); } void LLAvatarListItem::setShowVoiceVolume(bool show) { mShowVoiceVolume = show; - mVoiceSlider->setVisible( (mShowVoiceVolume) && ((!mRlvCheckShowNames) || (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))) ); + mVoiceSlider->setVisible( (mShowVoiceVolume) && ((!mRlvCheckShowNames) || (RlvActions::canShowName(RlvActions::SNC_DEFAULT, mAvatarId))) ); if (show) { updateVoiceLevelSlider(); @@ -509,7 +511,7 @@ void LLAvatarListItem::onProfileBtnClick() BOOL LLAvatarListItem::handleDoubleClick(S32 x, S32 y, MASK mask) { // if(mInfoBtn->getRect().pointInRect(x, y)) -// [SL:KB] - Checked: 2010-10-31 (RLVa-1.2.2a) | Added: RLVa-1.2.2a +// [RVLa:KB] - Checked: RLVa-1.2.2 if ( (mInfoBtn->getVisible()) && (mInfoBtn->getEnabled()) && (mInfoBtn->getRect().pointInRect(x, y)) ) // [/SL:KB] { @@ -517,7 +519,7 @@ BOOL LLAvatarListItem::handleDoubleClick(S32 x, S32 y, MASK mask) return TRUE; } // if(mProfileBtn->getRect().pointInRect(x, y)) -// [SL:KB] - Checked: 2010-10-31 (RLVa-1.2.2a) | Added: RLVa-1.2.2a +// [RLVa:KB] - Checked: RLVa-1.2.2 if ( (mProfileBtn->getVisible()) && (mProfileBtn->getEnabled()) && (mProfileBtn->getRect().pointInRect(x, y)) ) // [/SL:KB] { @@ -580,22 +582,21 @@ void LLAvatarListItem::onAvatarNameCache(const LLAvatarName& av_name) mAvatarNameCacheConnection.disconnect(); // setAvatarName(av_name.getDisplayName()); // setAvatarToolTip(av_name.getUserName()); -// [RLVa:KB] - Checked: 2010-10-31 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a +// [RLVa:KB] - Checked: RLVa-1.2.2 // Centralized in LLAvatarList::getNameForDisplay! - bool fRlvFilter = (mRlvCheckShowNames) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); + bool fRlvCanShowName = (!mRlvCheckShowNames) || (RlvActions::canShowName(RlvActions::SNC_DEFAULT, mAvatarId)); //if (mShowDisplayName && !mShowUsername) - // setAvatarName( (!fRlvFilter) ? av_name.getDisplayName() : RlvStrings::getAnonym(av_name) ); + // setAvatarName( (fRlvCanShowName) ? av_name.getDisplayName() : RlvStrings::getAnonym(av_name) ); //else if (!mShowDisplayName && mShowUsername) - // setAvatarName( (!fRlvFilter) ? av_name.getUserName() : RlvStrings::getAnonym(av_name) ); + // setAvatarName( (fRlvCanShowName) ? av_name.getUserName() : RlvStrings::getAnonym(av_name) ); //else - // setAvatarName( (!fRlvFilter) ? av_name.getCompleteName() : RlvStrings::getAnonym(av_name) ); + // setAvatarName( (fRlvCanShowName) ? av_name.getCompleteName() : RlvStrings::getAnonym(av_name) ); setAvatarName(LLAvatarList::getNameForDisplay(av_name, mShowDisplayName, mShowUsername, mRlvCheckShowNames)); // NOTE: If you change this, you will break sorting the contacts list // by username unless you go change the comparator too. -- TS - setAvatarToolTip( (!fRlvFilter) ? av_name.getUserName() : RlvStrings::getAnonym(av_name) ); // TODO-RLVa: bit of a hack putting this here. Maybe find a better way? - mAvatarIcon->setDrawTooltip(!fRlvFilter); + mAvatarIcon->setDrawTooltip(fRlvCanShowName); // [/RLVa:KB] //KC - store the username for use in sorting diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h index 154c3852db..bc8b3d5d6c 100644 --- a/indra/newview/llavatarlistitem.h +++ b/indra/newview/llavatarlistitem.h @@ -116,7 +116,7 @@ public: void setShowPermissions(bool show); void showLastInteractionTime(bool show); void setAvatarIconVisible(bool visible); -// [RLVa:KB] - Checked: 2010-04-05 (RLVa-1.2.2a) | Added: RLVa-1.2.0d +// [RLVa:KB] - Checked: RLVa-1.2.0 void setRlvCheckShowNames(bool fRlvCheckShowNames); void updateRlvRestrictions(); // [/RLVa:KB] @@ -252,7 +252,7 @@ private: bool mShowInfoBtn; bool mShowVoiceVolume; bool mShowProfileBtn; -// [RLVa:KB] - Checked: 2010-04-05 (RLVa-1.2.2a) | Added: RLVa-1.2.0d +// [RLVa:KB] - Checked: RLVa-1.2.0 bool mRlvCheckShowNames; // [/RLVa:KB] std::string mUserName; //KC - username cache used for sorting diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index 764d49b1c0..0a432f24e0 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -337,10 +337,16 @@ void LLDrawPoolTerrain::renderFullShader() // Hack! Get the region that this draw pool is rendering from! LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion(); LLVLComposition *compp = regionp->getComposition(); - LLViewerTexture *detail_texture0p = compp->mDetailTextures[0]; - LLViewerTexture *detail_texture1p = compp->mDetailTextures[1]; - LLViewerTexture *detail_texture2p = compp->mDetailTextures[2]; - LLViewerTexture *detail_texture3p = compp->mDetailTextures[3]; +// [SL:KB] - Patch: Render-TextureToggle (Catznip-4.0) + LLViewerTexture *detail_texture0p = (LLPipeline::sRenderTextures) ? compp->mDetailTextures[0] : LLViewerFetchedTexture::sDefaultDiffuseImagep; + LLViewerTexture *detail_texture1p = (LLPipeline::sRenderTextures) ? compp->mDetailTextures[1] : LLViewerFetchedTexture::sDefaultDiffuseImagep; + LLViewerTexture *detail_texture2p = (LLPipeline::sRenderTextures) ? compp->mDetailTextures[2] : LLViewerFetchedTexture::sDefaultDiffuseImagep; + LLViewerTexture *detail_texture3p = (LLPipeline::sRenderTextures) ? compp->mDetailTextures[3] : LLViewerFetchedTexture::sDefaultDiffuseImagep; +// [/SL:KB] +// LLViewerTexture *detail_texture0p = compp->mDetailTextures[0]; +// LLViewerTexture *detail_texture1p = compp->mDetailTextures[1]; +// LLViewerTexture *detail_texture2p = compp->mDetailTextures[2]; +// LLViewerTexture *detail_texture3p = compp->mDetailTextures[3]; LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal(); F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale; @@ -488,10 +494,16 @@ void LLDrawPoolTerrain::renderFull4TU() // Hack! Get the region that this draw pool is rendering from! LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion(); LLVLComposition *compp = regionp->getComposition(); - LLViewerTexture *detail_texture0p = compp->mDetailTextures[0]; - LLViewerTexture *detail_texture1p = compp->mDetailTextures[1]; - LLViewerTexture *detail_texture2p = compp->mDetailTextures[2]; - LLViewerTexture *detail_texture3p = compp->mDetailTextures[3]; +// [SL:KB] - Patch: Render-TextureToggle (Catznip-4.0) + LLViewerTexture *detail_texture0p = (LLPipeline::sRenderTextures) ? compp->mDetailTextures[0] : LLViewerFetchedTexture::sDefaultDiffuseImagep; + LLViewerTexture *detail_texture1p = (LLPipeline::sRenderTextures) ? compp->mDetailTextures[1] : LLViewerFetchedTexture::sDefaultDiffuseImagep; + LLViewerTexture *detail_texture2p = (LLPipeline::sRenderTextures) ? compp->mDetailTextures[2] : LLViewerFetchedTexture::sDefaultDiffuseImagep; + LLViewerTexture *detail_texture3p = (LLPipeline::sRenderTextures) ? compp->mDetailTextures[3] : LLViewerFetchedTexture::sDefaultDiffuseImagep; +// [/SL:KB] +// LLViewerTexture *detail_texture0p = compp->mDetailTextures[0]; +// LLViewerTexture *detail_texture1p = compp->mDetailTextures[1]; +// LLViewerTexture *detail_texture2p = compp->mDetailTextures[2]; +// LLViewerTexture *detail_texture3p = compp->mDetailTextures[3]; LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal(); F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale; @@ -690,10 +702,16 @@ void LLDrawPoolTerrain::renderFull2TU() // Hack! Get the region that this draw pool is rendering from! LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion(); LLVLComposition *compp = regionp->getComposition(); - LLViewerTexture *detail_texture0p = compp->mDetailTextures[0]; - LLViewerTexture *detail_texture1p = compp->mDetailTextures[1]; - LLViewerTexture *detail_texture2p = compp->mDetailTextures[2]; - LLViewerTexture *detail_texture3p = compp->mDetailTextures[3]; +// [SL:KB] - Patch: Render-TextureToggle (Catznip-4.0) + LLViewerTexture *detail_texture0p = (LLPipeline::sRenderTextures) ? compp->mDetailTextures[0] : LLViewerFetchedTexture::sDefaultDiffuseImagep; + LLViewerTexture *detail_texture1p = (LLPipeline::sRenderTextures) ? compp->mDetailTextures[1] : LLViewerFetchedTexture::sDefaultDiffuseImagep; + LLViewerTexture *detail_texture2p = (LLPipeline::sRenderTextures) ? compp->mDetailTextures[2] : LLViewerFetchedTexture::sDefaultDiffuseImagep; + LLViewerTexture *detail_texture3p = (LLPipeline::sRenderTextures) ? compp->mDetailTextures[3] : LLViewerFetchedTexture::sDefaultDiffuseImagep; +// [/SL:KB] +// LLViewerTexture *detail_texture0p = compp->mDetailTextures[0]; +// LLViewerTexture *detail_texture1p = compp->mDetailTextures[1]; +// LLViewerTexture *detail_texture2p = compp->mDetailTextures[2]; +// LLViewerTexture *detail_texture3p = compp->mDetailTextures[3]; LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal(); F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale; diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index d07239c0cb..98df6f1c28 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -98,7 +98,10 @@ void LLDrawPoolTree::render(S32 pass) LLGLState test(GL_ALPHA_TEST, LLGLSLShader::sNoFixedFunction ? 0 : 1); LLOverrideFaceColor color(this, 1.f, 1.f, 1.f, 1.f); - gGL.getTexUnit(sDiffTex)->bind(mTexturep); +// [SL:KB] - Patch: Render-TextureToggle (Catznip-4.0) + gGL.getTexUnit(sDiffTex)->bind( (LLPipeline::sRenderTextures) ? mTexturep : LLViewerFetchedTexture::sDefaultDiffuseImagep ); +// [/SL:KB] +// gGL.getTexUnit(sDiffTex)->bind(mTexturep); for (std::vector::iterator iter = mDrawFace.begin(); iter != mDrawFace.end(); iter++) diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index b339522305..4da204b538 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -53,6 +53,9 @@ #include "llviewershadermgr.h" #include "llviewertexture.h" #include "llvoavatar.h" +// [RLVa:KB] - Checked: RLVa-2.0.0 +#include "rlvhandler.h" +// [/RLVa:KB] #if LL_LINUX // Work-around spurious used before init warning on Vector4a @@ -166,6 +169,10 @@ void LLFace::init(LLDrawable* drawablep, LLViewerObject* objp) mBoundingSphereRadius = 0.0f ; mHasMedia = FALSE ; + +// [SL:KB] - Patch: Render-TextureToggle (Catznip-4.0) + mShowDiffTexture = true; +// [/SL:KB] } void LLFace::destroy() @@ -282,6 +289,14 @@ void LLFace::setTexture(U32 ch, LLViewerTexture* tex) return ; } +// [SL:KB] - Patch: Render-TextureToggle (Catznip-4.0) + if ( (LLRender::DIFFUSE_MAP == ch) && (!mShowDiffTexture) ) + { + mOrigDiffTexture = tex; + return; + } +// [/SL:KB] + if(mTexture[ch].notNull()) { mTexture[ch]->removeFace(ch, this) ; @@ -2698,9 +2713,60 @@ LLViewerTexture* LLFace::getTexture(U32 ch) const { llassert(ch < LLRender::NUM_TEXTURE_CHANNELS); +// [SL:KB] - Patch: Render-TextureToggle (Catznip-4.0) + // Check whether the diffuse texture needs to be obscured or restored + if (mShowDiffTexture != LLPipeline::sRenderTextures) + setDefaultTexture(LLRender::DIFFUSE_MAP, !LLPipeline::sRenderTextures); +// [/SL:KB] + return mTexture[ch] ; } +// [SL:KB] - Patch: Render-TextureToggle (Catznip-4.0) +void LLFace::setDefaultTexture(U32 nChannel, bool fShowDefault) const +{ + bool fUpdated = false; + if ( (LLRender::DIFFUSE_MAP == nChannel) && (mVObjp) && (!mVObjp->isDead()) && ((LL_PCODE_VOLUME == mVObjp->getPCode()) || (LLViewerObject::LL_VO_PART_GROUP == mVObjp->getPCode())) ) + { + if ( ((mShowDiffTexture) && (fShowDefault)) || + ((!mShowDiffTexture) && (fShowDefault) && (mOrigDiffTexture.notNull()) && (mTexture[nChannel]) && (mTexture[nChannel]->getID() != LLViewerFetchedTexture::sDefaultDiffuseImagep->getID())) ) + { + if (mOrigDiffTexture.notNull()) + mShowDiffTexture = true; // Swap out the default texture + else + mOrigDiffTexture = mTexture[nChannel]; // Cache the original texture + + if ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM_TEXTURES)) || (!mVObjp->isAttachment()) ) + { + if (LL_PCODE_VOLUME == mVObjp->getPCode()) + const_cast(this)->switchTexture(nChannel, LLViewerFetchedTexture::sDefaultDiffuseImagep); + else + const_cast(this)->setTexture(nChannel, LLViewerFetchedTexture::sDefaultDiffuseImagep); + } + mShowDiffTexture = false; fUpdated = true; + } + else if ( (!mShowDiffTexture) && (!fShowDefault) && (mOrigDiffTexture.notNull()) ) + { + mShowDiffTexture = true; + if (LL_PCODE_VOLUME == mVObjp->getPCode()) + const_cast(this)->switchTexture(nChannel, mOrigDiffTexture); + else + const_cast(this)->setTexture(nChannel, mOrigDiffTexture); + mOrigDiffTexture = nullptr; fUpdated = true; + } + + if ((fUpdated) && (mDrawablep)) + { + gPipeline.markTextured(mDrawablep); + const_cast(mDrawablep.get())->updateTexture(); + } + } + + // Always flip the flag even if we didn't obscure so we don't keep wasting cycles with negative checks + mShowDiffTexture = !fShowDefault; +} +// [/SL:KB] + void LLFace::setVertexBuffer(LLVertexBuffer* buffer) { mVertexBuffer = buffer; diff --git a/indra/newview/llface.h b/indra/newview/llface.h index ee545acb94..35cfdc1f8b 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -220,6 +220,10 @@ public: BOOL switchTexture() ; +// [SL:KB] - Patch: Render-TextureToggle (Catznip-4.0) + void setDefaultTexture(U32 nChannel, bool fShowDefault) const; +// [/SL:KB] + //vertex buffer tracking void setVertexBuffer(LLVertexBuffer* buffer); void clearVertexBuffer(); //sets mVertexBuffer to NULL @@ -294,7 +298,11 @@ private: F32 mBoundingSphereRadius ; bool mHasMedia ; - +// [SL:KB] - Patch: Render-TextureToggle (Catznip-4.0) + mutable bool mShowDiffTexture; + mutable LLPointer mOrigDiffTexture; +// [/SL:KB] + protected: static BOOL sSafeRenderSelect; diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index da20794924..f1f464a480 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -408,6 +408,7 @@ void LLFloaterAvatarPicker::onList() RLV_ASSERT( (pTabs) && (pNearMePanel) ); if ( (pTabs) && (pNearMePanel) ) { + // TODO-RLVa: check this for RlvActions::canShowName() bool fRlvEnable = !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES); pTabs->enableTabButton(pTabs->getIndexForPanel(pNearMePanel), fRlvEnable); if ( (!fRlvEnable) && (pTabs->getCurrentPanel() == pNearMePanel) ) diff --git a/indra/newview/llfloaterbuy.cpp b/indra/newview/llfloaterbuy.cpp index 5a9cdbba44..fa1667de73 100644 --- a/indra/newview/llfloaterbuy.cpp +++ b/indra/newview/llfloaterbuy.cpp @@ -104,7 +104,10 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info) // Clean up the lists... floater->reset(); floater->mSaleInfo = sale_info; - floater->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); +// [RLVa:KB] - Checked: RLVa-2.0.0 + floater->mObjectSelection = LLSelectMgr::getInstance()->getSelection(); +// [/RLVa:KB] +// floater->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); LLSelectNode* node = selection->getFirstRootNode(); if (!node) diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp index b32ac860aa..9d0682d251 100644 --- a/indra/newview/llfloaterbuycontents.cpp +++ b/indra/newview/llfloaterbuycontents.cpp @@ -104,7 +104,10 @@ void LLFloaterBuyContents::show(const LLSaleInfo& sale_info) if (list) list->deleteAllItems(); - floater->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); +// [RLVa:KB] - Checked: RLVa-2.0.0 + floater->mObjectSelection = LLSelectMgr::getInstance()->getSelection(); +// [/RLVa:KB] +// floater->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); LLUUID owner_id; std::string owner_name; diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp index 6dc7efc5f9..983c1721cf 100644 --- a/indra/newview/llfloaterimnearbychat.cpp +++ b/indra/newview/llfloaterimnearbychat.cpp @@ -71,6 +71,7 @@ #include "llautoreplace.h" // [RLVa:KB] - Checked: 2010-02-27 (RLVa-1.2.0b) #include "rlvhandler.h" +#include "rlvactions.h" // [/RLVa:KB] S32 LLFloaterIMNearbyChat::sLastSpecialChatChannel = 0; @@ -876,7 +877,7 @@ void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channe else { // Don't allow chat on a non-public channel if sendchannel restricted (unless the channel is an exception) - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SENDCHANNEL)) && (!gRlvHandler.isException(RLV_BHVR_SENDCHANNEL, channel)) ) + if (!RlvActions::canSendChannel(channel)) return; // Don't allow chat on debug channel if @sendchat, @redirchat or @rediremote restricted (shows as public chat on viewers) diff --git a/indra/newview/llfloaterimnearbychathandler.cpp b/indra/newview/llfloaterimnearbychathandler.cpp index 615e786432..e2fed73c0a 100644 --- a/indra/newview/llfloaterimnearbychathandler.cpp +++ b/indra/newview/llfloaterimnearbychathandler.cpp @@ -46,8 +46,9 @@ #include "llrootview.h" #include "lllayoutstack.h" -// [RLVa:KB] - Checked: 2010-04-21 (RLVa-1.2.0f) -#include "rlvhandler.h" +// [RLVa:KB] - Checked: RLVa-2.0.0 +#include "rlvactions.h" +#include "rlvcommon.h" // [/RLVa:KB] #include "fsconsoleutils.h" @@ -551,16 +552,16 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg, LLChat& tmp_chat = const_cast(chat_msg); // [RLVa:KB] - Checked: 2010-04-20 (RLVa-1.2.0f) | Modified: RLVa-1.2.0f - if (rlv_handler_t::isEnabled()) + if (RlvActions::isRlvEnabled()) { // NOTE-RLVa: we can only filter the *message* here since most everything else will already be part of "args" as well LLChat& tmp_chat = const_cast(chat_msg); - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) && (!tmp_chat.mRlvLocFiltered) && (CHAT_SOURCE_AGENT != tmp_chat.mSourceType) ) + if ( (!RlvActions::canShowLocation()) && (!tmp_chat.mRlvLocFiltered) && (CHAT_SOURCE_AGENT != tmp_chat.mSourceType) ) { RlvUtil::filterLocation(tmp_chat.mText); tmp_chat.mRlvLocFiltered = TRUE; } - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (!tmp_chat.mRlvNamesFiltered) && (CHAT_SOURCE_AGENT != tmp_chat.mSourceType) ) + if ( (!RlvActions::canShowName(RlvActions::SNC_DEFAULT)) && (!tmp_chat.mRlvNamesFiltered) && (CHAT_SOURCE_AGENT != tmp_chat.mSourceType) ) { RlvUtil::filterNames(tmp_chat.mText); tmp_chat.mRlvNamesFiltered = TRUE; @@ -664,8 +665,8 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg, LLFirstUse::otherAvatarChatFirst(); // Add sender to the recent people list. -// [RLVa:KB] - Checked: 2012-03-15 (RLVa-1.4.6) | Added: RLVa-1.4.6 - if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) +// [RLVa:KB] - Checked: RLVa-2.0.0 + if ( (!RlvActions::isRlvEnabled()) || (RlvActions::canShowName(RlvActions::SNC_DEFAULT, chat_msg.mFromID)) ) LLRecentPeople::instance().add(chat_msg.mFromID); // [/RLVa:KB] // LLRecentPeople::instance().add(chat_msg.mFromID); @@ -765,8 +766,8 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg, LLUUID id; id.generate(); chat["id"] = id; -// [RLVa:KB] - Checked: 2010-04-20 (RLVa-1.2.0f) | Added: RLVa-1.2.0f - if (rlv_handler_t::isEnabled()) +// [RLVa:KB] - Checked: RLVa-1.2.0 + if (RlvActions::isRlvEnabled()) chat["show_icon_tooltip"] = !chat_msg.mRlvNamesFiltered; // [/RLVa:KB] std::string r_color_name = "White"; diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp index 6ae9f045dc..e9aacd408f 100644 --- a/indra/newview/llfloaterinspect.cpp +++ b/indra/newview/llfloaterinspect.cpp @@ -42,9 +42,10 @@ #include "llviewercontrol.h" #include "llviewerobject.h" #include "lluictrlfactory.h" -// [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1a) -#include "rlvhandler.h" -#include "llagent.h" +// [RLVa:KB] - Checked: RLVa-2.0.1 +#include "rlvactions.h" +#include "rlvcommon.h" +#include "rlvui.h" // [/RLVa:KB] //LLFloaterInspect* LLFloaterInspect::sInstance = NULL; @@ -105,11 +106,13 @@ void LLFloaterInspect::onOpen(const LLSD& key) mObjectSelection = LLSelectMgr::getInstance()->getSelection(); refresh(); } -void LLFloaterInspect::onClickCreatorProfile() + +// [RLVa:KB] - Checked: RLVa-2.0.1 +const LLSelectNode* LLFloaterInspect::getSelectedNode() /*const*/ { if(mObjectList->getAllSelected().size() == 0) { - return; + return NULL; } LLScrollListItem* first_selected =mObjectList->getFirstSelected(); @@ -124,41 +127,29 @@ void LLFloaterInspect::onClickCreatorProfile() return (obj_id == node->getObject()->getID()); } } func(first_selected->getUUID()); - LLSelectNode* node = mObjectSelection->getFirstNode(&func); + return mObjectSelection->getFirstNode(&func); + } + return NULL; +} + +void LLFloaterInspect::onClickCreatorProfile() +{ + const LLSelectNode* node = getSelectedNode(); if(node) { -// LLAvatarActions::showProfile(node->mPermissions->getCreator()); -// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.2a) | Modified: RLVa-1.0.0e + // Only anonymize the creator if they're also the owner or if they're a nearby avie const LLUUID& idCreator = node->mPermissions->getCreator(); - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && - ((node->mPermissions->getOwner() == idCreator) || (RlvUtil::isNearbyAgent(idCreator))) ) + if ( (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, idCreator)) && ((node->mPermissions->getOwner() == idCreator) || (RlvUtil::isNearbyAgent(idCreator))) ) { return; } LLAvatarActions::showProfile(idCreator); -// [/RLVa:KB] } - } } void LLFloaterInspect::onClickOwnerProfile() { - if(mObjectList->getAllSelected().size() == 0) return; - LLScrollListItem* first_selected =mObjectList->getFirstSelected(); - - if (first_selected) - { - LLUUID selected_id = first_selected->getUUID(); - struct f : public LLSelectedNodeFunctor - { - LLUUID obj_id; - f(const LLUUID& id) : obj_id(id) {} - virtual bool apply(LLSelectNode* node) - { - return (obj_id == node->getObject()->getID()); - } - } func(selected_id); - LLSelectNode* node = mObjectSelection->getFirstNode(&func); + const LLSelectNode* node = getSelectedNode(); if(node) { if(node->mPermissions->isGroupOwned()) @@ -169,30 +160,108 @@ void LLFloaterInspect::onClickOwnerProfile() else { const LLUUID& owner_id = node->mPermissions->getOwner(); -// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.2a) | Modified: RLVa-1.0.0e - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) - return; -// [/RLVa:KB] + if (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, owner_id)) + return; LLAvatarActions::showProfile(owner_id); } } - } } void LLFloaterInspect::onSelectObject() { if(LLFloaterInspect::getSelectedUUID() != LLUUID::null) { -// getChildView("button owner")->setEnabled(true); -// getChildView("button creator")->setEnabled(true); -// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.2a) | Modified: RLVa-1.0.0e - getChildView("button owner")->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); - // TODO-RLVa: [RLVa-1.2.2] Is it worth checking the selected node just to selectively disable this button? - getChildView("button creator")->setEnabled(true); -// [/RLVa:KB] + if (!RlvActions::isRlvEnabled()) + { + getChildView("button owner")->setEnabled(true); + getChildView("button creator")->setEnabled(true); + } + else + { + const LLSelectNode* node = getSelectedNode(); + const LLUUID& idOwner = (node) ? node->mPermissions->getOwner() : LLUUID::null; + const LLUUID& idCreator = (node) ? node->mPermissions->getCreator() : LLUUID::null; + + // See LLFloaterInspect::onClickCreatorProfile() + getChildView("button owner")->setEnabled( (RlvActions::canShowName(RlvActions::SNC_DEFAULT, idOwner)) || ((node) && (node->mPermissions->isGroupOwned())) ); + // See LLFloaterInspect::onClickOwnerProfile() + getChildView("button creator")->setEnabled( ((idOwner != idCreator) && (!RlvUtil::isNearbyAgent(idCreator))) || (RlvActions::canShowName(RlvActions::SNC_DEFAULT, idCreator)) ); + } } } +// [/RLVa:KB] + +//void LLFloaterInspect::onClickCreatorProfile() +//{ +// if(mObjectList->getAllSelected().size() == 0) +// { +// return; +// } +// LLScrollListItem* first_selected =mObjectList->getFirstSelected(); +// +// if (first_selected) +// { +// struct f : public LLSelectedNodeFunctor +// { +// LLUUID obj_id; +// f(const LLUUID& id) : obj_id(id) {} +// virtual bool apply(LLSelectNode* node) +// { +// return (obj_id == node->getObject()->getID()); +// } +// } func(first_selected->getUUID()); +// LLSelectNode* node = mObjectSelection->getFirstNode(&func); +// if(node) +// { +// LLAvatarActions::showProfile(node->mPermissions->getCreator()); +// } +// } +//} + +//void LLFloaterInspect::onClickOwnerProfile() +//{ +// if(mObjectList->getAllSelected().size() == 0) return; +// LLScrollListItem* first_selected =mObjectList->getFirstSelected(); +// +// if (first_selected) +// { +// LLUUID selected_id = first_selected->getUUID(); +// struct f : public LLSelectedNodeFunctor +// { +// LLUUID obj_id; +// f(const LLUUID& id) : obj_id(id) {} +// virtual bool apply(LLSelectNode* node) +// { +// return (obj_id == node->getObject()->getID()); +// } +// } func(selected_id); +// LLSelectNode* node = mObjectSelection->getFirstNode(&func); +// if(node) +// { +// if(node->mPermissions->isGroupOwned()) +// { +// const LLUUID& idGroup = node->mPermissions->getGroup(); +// LLGroupActions::show(idGroup); +// } +// else +// { +// const LLUUID& owner_id = node->mPermissions->getOwner(); +// LLAvatarActions::showProfile(owner_id); +// } +// +// } +// } +//} + +//void LLFloaterInspect::onSelectObject() +//{ +// if(LLFloaterInspect::getSelectedUUID() != LLUUID::null) +// { +// getChildView("button owner")->setEnabled(true); +// getChildView("button creator")->setEnabled(true); +// } +//} LLUUID LLFloaterInspect::getSelectedUUID() { @@ -278,12 +347,11 @@ void LLFloaterInspect::refresh() // actual name and set a placeholder. if (LLAvatarNameCache::get(idOwner, &av_name)) { -// owner_name = av_name.getCompleteName(); -// [RLVa:KB] - Checked: 2010-11-01 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a - bool fRlvFilterOwner = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (idOwner != gAgent.getID()) && - (!obj->mPermissions->isGroupOwned()); - owner_name = (!fRlvFilterOwner) ? av_name.getCompleteName() : RlvStrings::getAnonym(av_name); +// [RLVa:KB] - Checked: RLVa-2.0.1 + bool fRlvCanShowName = (RlvActions::canShowName(RlvActions::SNC_DEFAULT, idOwner)) || (obj->mPermissions->isGroupOwned()); + owner_name = (fRlvCanShowName) ? av_name.getCompleteName() : RlvStrings::getAnonym(av_name); // [/RLVa:KB] +// owner_name = av_name.getCompleteName(); } else { @@ -298,14 +366,12 @@ void LLFloaterInspect::refresh() if (LLAvatarNameCache::get(idCreator, &av_name)) { -// creator_name = av_name.getCompleteName(); -// [RLVa:KB] - Checked: 2010-11-01 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a +// [RLVa:KB] - Checked: RLVa-2.0.1 const LLUUID& idCreator = obj->mPermissions->getCreator(); - LLAvatarNameCache::get(idCreator, &av_name); - bool fRlvFilterCreator = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (idCreator != gAgent.getID()) && - ( (obj->mPermissions->getOwner() == idCreator) || (RlvUtil::isNearbyAgent(idCreator)) ); - creator_name = (!fRlvFilterCreator) ? av_name.getCompleteName() : RlvStrings::getAnonym(av_name); + bool fRlvCanShowName = (RlvActions::canShowName(RlvActions::SNC_DEFAULT, idCreator)) || ( (obj->mPermissions->getOwner() != idCreator) && (!RlvUtil::isNearbyAgent(idCreator)) ); + creator_name = (fRlvCanShowName) ? av_name.getCompleteName() : RlvStrings::getAnonym(av_name); // [/RLVa:KB] +// creator_name = av_name.getCompleteName(); } else { @@ -316,7 +382,7 @@ void LLFloaterInspect::refresh() } mCreatorNameCacheConnection = LLAvatarNameCache::get(idCreator, boost::bind(&LLFloaterInspect::onGetCreatorNameCallback, this)); } - + row["id"] = obj->getObject()->getID(); row["columns"][0]["column"] = "object_name"; row["columns"][0]["type"] = "text"; diff --git a/indra/newview/llfloaterinspect.h b/indra/newview/llfloaterinspect.h index 44381eac96..7f7f7377f0 100644 --- a/indra/newview/llfloaterinspect.h +++ b/indra/newview/llfloaterinspect.h @@ -36,6 +36,9 @@ class LLObjectSelection; class LLScrollListCtrl; class LLUICtrl; +// [RLVa:KB] - Checked: RLVa-2.0.1 +class LLSelectNode; +// [/RLVa:KB] class LLFloaterInspect : public LLFloater { @@ -61,6 +64,10 @@ protected: void setDirty() { mDirty = TRUE; } bool mDirty; +// [RLVa:KB] - Checked: RLVa-2.0.1 + const LLSelectNode* getSelectedNode() /*const*/; +// [/RLVa:KB] + private: void onGetOwnerNameCallback(); void onGetCreatorNameCallback(); diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp index 3ba8bbf2dc..e3a468167f 100644 --- a/indra/newview/llfloaterproperties.cpp +++ b/indra/newview/llfloaterproperties.cpp @@ -59,8 +59,9 @@ #include "lluictrlfactory.h" -// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.1b) -#include "rlvhandler.h" +// [RLVa:KB] - Checked: RLVa-2.0.1 +#include "rlvactions.h" +#include "rlvcommon.h" // [/RLVa:KB] #include "llviewernetwork.h" // For OpenSim export perms #include "llexperiencecache.h" @@ -306,11 +307,10 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) getChildView("BtnCreator")->setEnabled(TRUE); getChildView("LabelCreatorTitle")->setEnabled(TRUE); getChildView("LabelCreatorName")->setEnabled(TRUE); -// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.1b) | Modified: RLVa-1.0.0e +// [RLVa:KB] - Checked: RLVa-2.0.1 // If the object creator matches the object owner we need to anonymize the creator field as well - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && - ( ((perm.isOwned()) && (!perm.isGroupOwned()) && (perm.getOwner() == item->getCreatorUUID()) ) || - (RlvUtil::isNearbyAgent(item->getCreatorUUID())) ) ) + if ( (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, item->getCreatorUUID())) && + ( ((perm.isOwned()) && (!perm.isGroupOwned()) && (perm.getOwner() == item->getCreatorUUID()) ) || (RlvUtil::isNearbyAgent(item->getCreatorUUID())) ) ) { childSetEnabled("BtnCreator", FALSE); name = RlvStrings::getAnonym(name); @@ -331,6 +331,9 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) //////////////// if(perm.isOwned()) { +// [RLVa:KB] - Checked: RVLa-2.0.1 + bool fRlvCanShowOwner = true; +// [/RLVa:KB] std::string name; if (perm.isGroupOwned()) { @@ -339,14 +342,18 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) else { gCacheName->getFullName(perm.getOwner(), name); -// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.1b) | Modified: RLVa-1.0.0e - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) - name = RlvStrings::getAnonym(name); +// [RLVa:KB] - Checked: RLVa-2.0.1 + if (RlvActions::isRlvEnabled()) + { + fRlvCanShowOwner = RlvActions::canShowName(RlvActions::SNC_DEFAULT, perm.getOwner()); + if (!fRlvCanShowOwner) + name = RlvStrings::getAnonym(name); + } // [/RLVa:KB] } // getChildView("BtnOwner")->setEnabled(TRUE); -// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.1b) | Added: RLVa-1.0.0e - getChildView("BtnOwner")->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); +// [RLVa:KB] - Checked: RLVa-2.0.1 + getChildView("BtnOwner")->setEnabled(fRlvCanShowOwner); // [/RLVa:KB] getChildView("LabelOwnerTitle")->setEnabled(TRUE); getChildView("LabelOwnerName")->setEnabled(TRUE); @@ -616,12 +623,12 @@ void LLFloaterProperties::onClickCreator() if(!item) return; if(!item->getCreatorUUID().isNull()) { -// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.1b) | Added: RLVa-1.2.1b - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) +// [RLVa:KB] - Checked: RLVa-1.2.1 + const LLUUID& idCreator = item->getCreatorUUID(); + if ( (RlvActions::isRlvEnabled()) && (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, idCreator)) ) { const LLPermissions& perm = item->getPermissions(); - if ( ((perm.isOwned()) && (!perm.isGroupOwned()) && (perm.getOwner() == item->getCreatorUUID()) ) || - (RlvUtil::isNearbyAgent(item->getCreatorUUID())) ) + if ( ((perm.isOwned()) && (!perm.isGroupOwned()) && (perm.getOwner() == idCreator) ) || (RlvUtil::isNearbyAgent(idCreator)) ) { return; } @@ -642,8 +649,8 @@ void LLFloaterProperties::onClickOwner() } else { -// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.1b) | Modified: RLVa-1.0.0e - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) +// [RLVa:KB] - Checked: RLVa-1.0.0 + if ( (RlvActions::isRlvEnabled()) && (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, item->getPermissions().getOwner())) ) return; // [/RLVa:KB] LLAvatarActions::showProfile(item->getPermissions().getOwner()); diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 29e2505237..07bb73015d 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -61,6 +61,10 @@ #include "chatbar_as_cmdline.h" // For FIRE-1624 +// [RLVa:KB] - Checked: RLVa-2.0.0 +#include "rlvactions.h" +// [/RLVa:KB] + // Longest time, in seconds, to wait for all animations to stop playing const F32 MAX_WAIT_ANIM_SECS = 60.f; @@ -532,6 +536,11 @@ void LLGestureMgr::playGesture(LLMultiGesture* gesture) { if (!gesture) return; +// [RLVa:KB] - Checked: RLVa-2.0.0 | Handles: @sendgesture + if (!RlvActions::canPlayGestures()) + return; +// [/RLVa:KB] + // Reset gesture to first step gesture->mCurrentStep = 0; diff --git a/indra/newview/llgiveinventory.cpp b/indra/newview/llgiveinventory.cpp index d8b5e81ca1..1062e1ae78 100644 --- a/indra/newview/llgiveinventory.cpp +++ b/indra/newview/llgiveinventory.cpp @@ -46,9 +46,10 @@ #include "llrecentpeople.h" #include "llviewerobjectlist.h" #include "llvoavatarself.h" -// [RLVa:KB] - Checked: 2010-03-04 (RLVa-1.2.2a) +// [RLVa:KB] - Checked: RLVa-1.2.2 #include "llavatarnamecache.h" -#include "rlvhandler.h" +#include "rlvactions.h" +#include "rlvcommon.h" #include "rlvui.h" // [/RLVa:KB] #include "llworld.h" // Aurora Sim @@ -326,9 +327,8 @@ void LLGiveInventory::logInventoryOffer(const LLUUID& to_agent, const LLUUID &im { gIMMgr->addSystemMessage(im_session_id, "inventory_item_offered", args); } -// [RLVa:KB] - Checked: 2010-05-26 (RLVa-1.2.2a) | Modified: RLVa-1.2.0h - else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (RlvUtil::isNearbyAgent(to_agent)) && - (!RlvUIEnabler::hasOpenProfile(to_agent)) ) +// [RLVa:KB] - Checked: RLVa-1.2.0 + else if ( (RlvActions::isRlvEnabled()) && (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, to_agent)) && (RlvUtil::isNearbyAgent(to_agent)) && (!RlvUIEnabler::hasOpenProfile(to_agent)) ) { // Log to chat history if the user didn't drop on an IM session or a profile to avoid revealing the name of the recipient std::string strMsgName = "inventory_item_offered-im"; LLSD args; LLAvatarName avName; @@ -462,10 +462,10 @@ void LLGiveInventory::commitGiveInventoryItem(const LLUUID& to_agent, // add buddy to recent people list // LLRecentPeople::instance().add(to_agent); -// [RLVa:KB] - Checked: 2010-04-21 (RLVa-1.2.2a) | Added: RLVa-1.2.0f +// [RLVa:KB] - Checked: RLVa-2.0.0 // Block the recent activity update if this was an in-world drop on an avatar (as opposed to a drop on an IM session or on a profile) - if ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) || (im_session_id.notNull()) || (!RlvUtil::isNearbyAgent(to_agent)) || - (RlvUIEnabler::hasOpenProfile(to_agent)) ) + if ( (!RlvActions::isRlvEnabled()) || + (RlvActions::canShowName(RlvActions::SNC_DEFAULT, to_agent)) || (im_session_id.notNull()) || (!RlvUtil::isNearbyAgent(to_agent)) || (RlvUIEnabler::hasOpenProfile(to_agent)) ) { LLRecentPeople::instance().add(to_agent); } @@ -536,10 +536,10 @@ bool LLGiveInventory::commitGiveInventoryCategory(const LLUUID& to_agent, // add buddy to recent people list // LLRecentPeople::instance().add(to_agent); -// [RLVa:KB] - Checked: 2010-04-20 (RLVa-1.2.2a) | Added: RLVa-1.2.0f +// [RLVa:KB] - Checked: RLVa-2.0.0 // Block the recent activity update if this was an in-world drop on an avatar (as opposed to a drop on an IM session or on a profile) - if ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) || (im_session_id.notNull()) || (!RlvUtil::isNearbyAgent(to_agent)) || - (RlvUIEnabler::hasOpenProfile(to_agent)) ) + if ( (!RlvActions::isRlvEnabled()) || + (RlvActions::canShowName(RlvActions::SNC_DEFAULT, to_agent)) || (im_session_id.notNull()) || (!RlvUtil::isNearbyAgent(to_agent)) || (RlvUIEnabler::hasOpenProfile(to_agent)) ) { LLRecentPeople::instance().add(to_agent); } diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 8a6052c153..822016942c 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -64,7 +64,9 @@ #include "llspatialpartition.h" #include "llviewershadermgr.h" // [RLVa:KB] - Checked: 2010-04-11 (RLVa-1.2.0e) +#include "rlvactions.h" #include "rlvhandler.h" +#include "rlvhelper.h" // [/RLVa:KB] // Height of the yellow selection highlight posts for land @@ -167,13 +169,15 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) // [RLVa:KB] - Checked: 2010-04-11 (RLVa-1.2.0e) | Modified: RLVa-1.0.0g if (gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) { + static RlvCachedBehaviourModifier s_nFartouchDist(RLV_MODIFIER_FARTOUCHDIST); + // We'll allow drag selection under fartouch, but only within the fartouch range // (just copy/paste the code above us to make that work, thank you Lindens!) LLVector3 relative_av_pos = av_pos; relative_av_pos -= LLViewerCamera::getInstance()->getOrigin(); - F32 new_far = relative_av_pos * LLViewerCamera::getInstance()->getAtAxis() + 1.5f; - F32 new_near = relative_av_pos * LLViewerCamera::getInstance()->getAtAxis() - 1.5f; + F32 new_far = relative_av_pos * LLViewerCamera::getInstance()->getAtAxis() + s_nFartouchDist; + F32 new_near = relative_av_pos * LLViewerCamera::getInstance()->getAtAxis() - s_nFartouchDist; new_near = llmax(new_near, 0.1f); @@ -182,7 +186,7 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) // Usurp these two limit_select_distance = TRUE; - select_dist_squared = 1.5f * 1.5f; + select_dist_squared = s_nFartouchDist * s_nFartouchDist; } // [/RLVa:KB] LLViewerCamera::getInstance()->setPerspective(FOR_SELECTION, @@ -269,7 +273,7 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) } // [RLVa:KB] - Checked: 2010-11-29 (RLVa-1.3.0c) | Added: RLVa-1.3.0c - if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canEdit(vobjp)) ) + if ( (RlvActions::isRlvEnabled()) && (!RlvActions::canEdit(vobjp)) ) { continue; } diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index 8f325043e3..ad4dc3a1de 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -46,7 +46,8 @@ #include "llstatusbar.h" #include "llmenugl.h" #include "pipeline.h" -// [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.4.0a) +// [RLVa:KB] - Checked: RLVa-1.4.0 +#include "rlvactions.h" #include "rlvhandler.h" // [/RLVa:KB] #include @@ -260,14 +261,14 @@ void LLHUDText::setString(const std::string &text_utf8) // addLine(text_utf8, mColor); // [RLVa:KB] - Checked: 2010-03-02 (RLVa-1.4.0a) | Modified: RLVa-1.0.0f // NOTE: setString() is called for debug and map beacons as well - if (rlv_handler_t::isEnabled()) + if (RlvActions::isRlvEnabled()) { std::string text(text_utf8); if (gRlvHandler.canShowHoverText(mSourceObject)) { - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + if (!RlvActions::canShowLocation()) RlvUtil::filterLocation(text); - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + if (!RlvActions::canShowName(RlvActions::SNC_DEFAULT)) RlvUtil::filterNames(text); } else diff --git a/indra/newview/llinspectobject.cpp b/indra/newview/llinspectobject.cpp index a2d3a15b5b..30275d44a4 100644 --- a/indra/newview/llinspectobject.cpp +++ b/indra/newview/llinspectobject.cpp @@ -39,6 +39,7 @@ #include "llviewermediafocus.h" #include "llviewerobjectlist.h" // to select the requested object // [RLVa:KB] - Checked: 2010-02-27 (RLVa-1.2.0c) +#include "rlvactions.h" #include "rlvhandler.h" #include "lltoolpie.h" // [/RLVa:KB] @@ -401,7 +402,7 @@ void LLInspectObject::updateSitLabel(LLSelectNode* nodep) if (rlv_handler_t::isEnabled()) { const LLPickInfo& pick = LLToolPie::getInstance()->getPick(); - sit_btn->setEnabled( (pick.mObjectID.notNull()) && (gRlvHandler.canSit(pick.getObject(), pick.mObjectOffset)) ); + sit_btn->setEnabled( (pick.mObjectID.notNull()) && (RlvActions::canSit(pick.getObject(), pick.mObjectOffset)) ); } // [/RLVa:KB] } @@ -501,12 +502,10 @@ void LLInspectObject::updateCreator(LLSelectNode* nodep) LLUUID creator_id = nodep->mPermissions->getCreator(); // std::string creator_url = // LLSLURL("agent", creator_id, "about").getSLURLString(); -// [RLVa:KB] - Checked: 2010-11-02 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a +// [RLVa:KB] - Checked: RLVa-1.2.2 // Only anonymize the creator if they're also the owner or if they're a nearby avie - bool fRlvHideCreator = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && - ((nodep->mPermissions->getOwner() == creator_id) || (RlvUtil::isNearbyAgent(creator_id))); - std::string creator_url = - LLSLURL("agent", creator_id, (!fRlvHideCreator) ? "about" : "rlvanonym").getSLURLString(); + bool fRlvHideCreator = (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, creator_id)) && ((nodep->mPermissions->getOwner() == creator_id) || (RlvUtil::isNearbyAgent(creator_id))); + const std::string creator_url = LLSLURL("agent", creator_id, (!fRlvHideCreator) ? "about" : "rlvanonym").getSLURLString(); // [/RLVa:KB] args["[CREATOR]"] = creator_url; @@ -523,8 +522,8 @@ void LLInspectObject::updateCreator(LLSelectNode* nodep) { owner_id = nodep->mPermissions->getOwner(); // owner_url = LLSLURL("agent", owner_id, "about").getSLURLString(); -// [RLVa:KB] - Checked: 2010-11-02 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a - bool fRlvHideOwner = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); +// [RLVa:KB] - Checked: RLVa-1.2.2 + bool fRlvHideOwner = (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, owner_id)); owner_url = LLSLURL("agent", owner_id, (!fRlvHideOwner) ? "about" : "rlvanonym").getSLURLString(); // [/RLVa:KB] } diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index d684e534ea..c9daeca3bc 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -74,8 +74,9 @@ #include "llviewerwindow.h" #include "llworld.h" #include "llworldmapview.h" // shared draw code -// [RLVa:KB] - Checked: 2010-04-19 (RLVa-1.2.0f) -#include "rlvhandler.h" +// [RLVa:KB] - Checked: RLVa-2.0.1 +#include "rlvactions.h" +#include "rlvcommon.h" // [/RLVa:KB] #include "llmutelist.h" #include "lfsimfeaturehandler.h" @@ -677,7 +678,7 @@ void LLNetMap::draw() // [RLVa:KB] - Checked: 2010-04-19 (RLVa-1.2.0f) | Modified: RLVa-1.2.0f | FS-Specific LLWorldMapView::drawAvatar( pos_map.mV[VX], pos_map.mV[VY], - ((!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? color : map_avatar_color.get()), + (RlvActions::canShowName(RlvActions::SNC_DEFAULT, uuid)) ? color : map_avatar_color.get(), pos_map.mV[VZ], mDotRadius, unknown_relative_z); // [/RLVa:KB] @@ -995,26 +996,17 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, MASK mask ) // If the cursor is near an avatar on the minimap, a mini-inspector will be // shown for the avatar, instead of the normal map tooltip. // if (handleToolTipAgent(mClosestAgentToCursor)) -// [RLVa:KB] - Checked: 2010-10-31 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a - if ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (handleToolTipAgent(mClosestAgentToCursor)) ) +// [RLVa:KB] - Checked: RLVa-1.2.2 + bool fRlvCanShowName = (mClosestAgentToCursor.notNull()) && (RlvActions::canShowName(RlvActions::SNC_DEFAULT, mClosestAgentToCursor)); + if ( (fRlvCanShowName) && (handleToolTipAgent(mClosestAgentToCursor)) ) // [/RLVa:KB] { return TRUE; } -// [RLVa:KB] - Checked: 2010-10-31 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a - LLStringUtil::format_map_t args; - - LLAvatarName avName; - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && - (mClosestAgentToCursor.notNull()) && (LLAvatarNameCache::get(mClosestAgentToCursor, &avName)) ) - { - args["[AGENT]"] = RlvStrings::getAnonym(avName) + "\n"; - } - else - { - args["[AGENT]"] = ""; - } +// [RLVa:KB] - Checked: RLVa-1.2.2 + LLStringUtil::format_map_t args; LLAvatarName avName; + args["[AGENT]"] = ( (!fRlvCanShowName) && (mClosestAgentToCursor.notNull()) && (LLAvatarNameCache::get(mClosestAgentToCursor, &avName)) ) ? RlvStrings::getAnonym(avName) + "\n" : ""; // [/RLVa:KB] LLRect sticky_rect; @@ -1029,8 +1021,8 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, MASK mask ) sticky_rect.mTop = sticky_rect.mBottom + 2 * SLOP; // region_name = region->getName(); -// [RLVa:KB] - Checked: 2010-10-19 (RLVa-1.2.2b) | Modified: RLVa-1.2.2b - region_name = ((!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? region->getName() : RlvStrings::getString(RLV_STRING_HIDDEN_REGION)); +// [RLVa:KB] - Checked: RLVa-1.2.2 + region_name = (RlvActions::canShowLocation()) ? region->getName() : RlvStrings::getString(RLV_STRING_HIDDEN_REGION); // [/RLVa:KB] // Synchronize tooltips throughout instances //if (!region_name.empty()) @@ -1553,7 +1545,7 @@ BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask) mPopupMenu->setItemVisible("More Options", mClosestAgentsToCursor.size() == 1); mPopupMenu->setItemVisible("View Profile", mClosestAgentsToCursor.size() == 1); - bool can_show_names = !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES); + bool can_show_names = !RlvActions::hasBehaviour(RLV_BHVR_SHOWNAMES); mPopupMenu->setItemEnabled("Add to Set Multiple", can_show_names); mPopupMenu->setItemEnabled("More Options", can_show_names); mPopupMenu->setItemEnabled("View Profile", can_show_names); @@ -1601,8 +1593,8 @@ BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask) mPopupMenu->setItemVisible("MarkAvatar", mClosestAgentToCursor.notNull()); mPopupMenu->setItemVisible("Start Tracking", mClosestAgentToCursor.notNull()); mPopupMenu->setItemVisible("Profile Separator", (mClosestAgentsToCursor.size() >= 1 || mClosestAgentToCursor.notNull())); - mPopupMenu->setItemEnabled("Place Profile", !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); - mPopupMenu->setItemEnabled("World Map", !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWWORLDMAP)); + mPopupMenu->setItemEnabled("Place Profile", RlvActions::canShowLocation()); + mPopupMenu->setItemEnabled("World Map", !RlvActions::hasBehaviour(RLV_BHVR_SHOWWORLDMAP)); // [/SL:KB] mPopupMenu->buildDrawLabels(); @@ -1960,7 +1952,7 @@ bool LLNetMap::canMap() bool LLNetMap::canShare() { - return (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWINV)); + return (!RlvActions::hasBehaviour(RLV_BHVR_SHOWINV)); } bool LLNetMap::canOfferTeleport() diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index d319191d35..c337663dd1 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -75,8 +75,8 @@ #include "llagentui.h" #include "llslurl.h" #include "llevents.h" // for LLEventPumps -// [RLVa:KB] - Checked: 2010-06-04 (RLVa-1.2.2a) -#include "rlvhandler.h" +// [RLVa:KB] - Checked: RLVa-1.2.2 +#include "rlvactions.h" // [/RLVa:KB] @@ -693,7 +693,7 @@ BOOL LLPanelPeople::postBuild() //mNearbyList->setNoFilteredItemsMsg(getString("no_one_filtered_near")); //mNearbyList->setShowIcons("NearbyListShowIcons"); // Firestorm radar -// [RLVa:KB] - Checked: 2010-04-05 (RLVa-1.2.2a) | Added: RLVa-1.2.0d +// [RLVa:KB] - Checked: RLVa-1.2.0 // Externalized to FSRadar //mNearbyList->setRlvCheckShowNames(true); // [/RLVa:KB] @@ -1010,7 +1010,7 @@ void LLPanelPeople::updateFacebookList(bool visible) void LLPanelPeople::updateButtons() { std::string cur_tab = getActiveTabName(); -// [RLVa:KB] - Checked: 2013-05-06 (RLVa-1.4.9) +// [RLVa:KB] - Checked: RLVa-1.4.9 bool nearby_tab_active = (cur_tab == NEARBY_TAB_NAME); // [/RLVa:KB] bool friends_tab_active = (cur_tab == FRIENDS_TAB_NAME); @@ -1060,7 +1060,7 @@ void LLPanelPeople::updateButtons() //if (cur_panel->hasChild("add_friend_btn", TRUE)) // cur_panel->getChildView("add_friend_btn")->setEnabled(item_selected && !is_friend && !is_self); if (!nearby_tab_active && cur_panel->hasChild("add_friend_btn", TRUE)) - cur_panel->getChildView("add_friend_btn")->setEnabled(item_selected && !is_friend && !is_self && !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); + cur_panel->getChildView("add_friend_btn")->setEnabled(item_selected && !is_friend && !is_self && RlvActions::canShowName(RlvActions::SNC_DEFAULT, selected_id)); // RLVa check if (friends_tab_active) @@ -1078,10 +1078,13 @@ void LLPanelPeople::updateButtons() } } -// [RLVa:KB] - Checked: 2010-06-04 (RLVa-1.2.2a) | Modified: RLVa-1.2.0d - if ( (nearby_tab_active) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ) +// [RLVa:KB] - Checked: RLVa-1.2.0 + if ( (nearby_tab_active) && (RlvActions::isRlvEnabled()) && (!RlvActions::canShowName(RlvActions::SNC_DEFAULT)) ) { - item_selected = multiple_selected = false; + bool fCanShowNames = true; + std::for_each(selected_uuids.begin(), selected_uuids.end(), [&fCanShowNames](const LLUUID& idAgent) { fCanShowNames &= RlvActions::canShowName(RlvActions::SNC_DEFAULT, idAgent); }); + if (!fCanShowNames) + item_selected = multiple_selected = false; } // [/RLBa:KB] } @@ -1318,13 +1321,6 @@ void LLPanelPeople::onTabSelected(const LLSD& param) void LLPanelPeople::onAvatarListDoubleClicked(LLUICtrl* ctrl) { -// [RLVa:KB] - Checked: 2014-03-31 (Catznip-3.6) - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (NEARBY_TAB_NAME == getActiveTabName()) ) - { - return; - } -// [/RLVa:KB] - LLAvatarListItem* item = dynamic_cast(ctrl); if(!item) { @@ -1337,6 +1333,13 @@ void LLPanelPeople::onAvatarListDoubleClicked(LLUICtrl* ctrl) return; } +// [RLVa:KB] - Checked: RLVa-2.0.1 + if ( (RlvActions::isRlvEnabled()) && (NEARBY_TAB_NAME == getActiveTabName()) && (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, clicked_id)) ) + { + return; + } +// [/RLVa:KB] + #if 0 // SJB: Useful for testing, but not currently functional or to spec LLAvatarActions::showProfile(clicked_id); #else // spec says open IM window @@ -1451,15 +1454,17 @@ void LLPanelPeople::onGearButtonClicked(LLUICtrl* btn) void LLPanelPeople::onImButtonClicked() { -// [RLVa:KB] - Checked: 2014-03-31 (Catznip-3.6) - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (NEARBY_TAB_NAME == getActiveTabName()) ) - { - return; - } -// [/RLVa:KB] - uuid_vec_t selected_uuids; getCurrentItemIDs(selected_uuids); +// [RLVa:KB] - Checked: RLVa-2.0.1 + if ( (RlvActions::isRlvEnabled()) && (NEARBY_TAB_NAME == getActiveTabName()) && (!RlvActions::canShowName(RlvActions::SNC_DEFAULT)) ) + { + bool fCanShowNames = true; + std::for_each(selected_uuids.begin(), selected_uuids.end(), [&fCanShowNames](const LLUUID& idAgent) { fCanShowNames &= RlvActions::canShowName(RlvActions::SNC_DEFAULT, idAgent); }); + if (!fCanShowNames) + return; + } +// [/RLVa:KB] if ( selected_uuids.size() == 1 ) { // if selected only one person then start up IM diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index 72201b3018..17747f2d1f 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -69,7 +69,7 @@ public: bool mTryToConnectToFacebook; -// [RLVa:KB] - Checked: 2010-04-05 (RLVa-1.2.0d) | Added: RLVa-1.2.0d +// [RLVa:KB] - Checked: RLVa-1.2.0 LLAvatarList* getNearbyList() { return mNearbyList; } // [/RLVa:KB] diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp index a8ad2b9faa..e38eaaf802 100644 --- a/indra/newview/llpanelpeoplemenus.cpp +++ b/indra/newview/llpanelpeoplemenus.cpp @@ -43,7 +43,9 @@ #include "llconversationmodel.h" #include "llviewerobjectlist.h" #include "llinventorybridge.h" // CHUI merge -#include "rlvhandler.h" +// [RLVa:KB] - Checked: RLVa-2.0.1 +#include "rlvactions.h" +// [/RLVa:KB] namespace LLPanelPeopleMenus { @@ -194,7 +196,10 @@ bool PeopleContextMenu::enableContextMenuItem(const LLSD& userdata) for (;id != uuids_end; ++id) { - if ( LLAvatarActions::isFriend(*id) ) +// if ( LLAvatarActions::isFriend(*id) ) +// [RLVa:KB] - Checked: 2014-03-31 (RLVa-2.0.1) + if ( (LLAvatarActions::isFriend(*id)) || (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, *id)) ) +// [/RLVa:KB] { result = false; break; @@ -217,7 +222,10 @@ bool PeopleContextMenu::enableContextMenuItem(const LLSD& userdata) for (;id != uuids_end; ++id) { - if ( !LLAvatarActions::isFriend(*id) ) +// if ( !LLAvatarActions::isFriend(*id) ) +// [RLVa:KB] - Checked: 2014-03-31 (RLVa-2.0.1) + if ( (!LLAvatarActions::isFriend(*id)) || (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, *id)) ) +// [/RLVa:KB] { result = false; break; @@ -260,7 +268,7 @@ bool PeopleContextMenu::enableContextMenuItem(const LLSD& userdata) // FIRE-8804: Prevent opening inventory from using share in radar context menu else if (item == std::string("can_open_inventory")) { - return (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWINV)); + return (!RlvActions::hasBehaviour(RLV_BHVR_SHOWINV)); } // else if (item == std::string("can_callog")) @@ -292,14 +300,29 @@ void PeopleContextMenu::requestTeleport() { // boost::bind cannot recognize overloaded method LLAvatarActions::teleportRequest(), // so we have to use a wrapper. +// [RLVa:KB] - Checked: RLVa-2.0.1 + bool fRlvCanShowName = (!m_fRlvCheck) || (RlvActions::canShowName(RlvActions::SNC_DEFAULT, mUUIDs.front())); + RlvActions::setShowName(RlvActions::SNC_TELEPORTREQUEST, fRlvCanShowName); LLAvatarActions::teleportRequest(mUUIDs.front()); + RlvActions::setShowName(RlvActions::SNC_TELEPORTREQUEST, true); +// [/RLVa:KB] +// LLAvatarActions::teleportRequest(mUUIDs.front()); } void PeopleContextMenu::offerTeleport() { // boost::bind cannot recognize overloaded method LLAvatarActions::offerTeleport(), // so we have to use a wrapper. +// [RLVa:KB] - Checked: RLVa-2.0.1 + bool fRlvCanShowName = true; + if ( (m_fRlvCheck) && (RlvActions::isRlvEnabled()) ) + std::for_each(mUUIDs.begin(), mUUIDs.end(), [&fRlvCanShowName](const LLUUID& idAgent) { fRlvCanShowName &= RlvActions::canShowName(RlvActions::SNC_DEFAULT, idAgent); }); + + RlvActions::setShowName(RlvActions::SNC_TELEPORTOFFER, fRlvCanShowName); LLAvatarActions::offerTeleport(mUUIDs); + RlvActions::setShowName(RlvActions::SNC_TELEPORTOFFER, true); +// [/RLVa:KB] +// LLAvatarActions::offerTeleport(mUUIDs); } void PeopleContextMenu::startConference() @@ -329,7 +352,29 @@ void NearbyPeopleContextMenu::buildContextMenu(class LLMenuGL& menu, U32 flags) menuentry_vec_t items; menuentry_vec_t disabled_items; - if (flags & ITEM_IN_MULTI_SELECTION) +// [RLVa:KB] - Checked: RLVa-1.5.0 + bool fRlvCanShowName = true; + if ( (m_fRlvCheck) && (RlvActions::isRlvEnabled()) ) + std::for_each(mUUIDs.begin(), mUUIDs.end(), [&fRlvCanShowName](const LLUUID& idAgent) { fRlvCanShowName &= RlvActions::canShowName(RlvActions::SNC_DEFAULT, idAgent); }); + + if (!fRlvCanShowName) + { + if (flags & ITEM_IN_MULTI_SELECTION) + { + items.push_back(std::string("offer_teleport")); + } + else + { + items.push_back(std::string("offer_teleport")); + items.push_back(std::string("request_teleport")); + items.push_back(std::string("separator_invite_to_group")); + items.push_back(std::string("zoom_in")); + items.push_back(std::string("block_unblock")); + } + } + else if (flags & ITEM_IN_MULTI_SELECTION) +// [/RLVa:KB] +// if (flags & ITEM_IN_MULTI_SELECTION) { items.push_back(std::string("add_friends")); items.push_back(std::string("remove_friends")); diff --git a/indra/newview/llpanelpeoplemenus.h b/indra/newview/llpanelpeoplemenus.h index bc38ee36dd..bc060bd737 100644 --- a/indra/newview/llpanelpeoplemenus.h +++ b/indra/newview/llpanelpeoplemenus.h @@ -38,6 +38,9 @@ namespace LLPanelPeopleMenus class PeopleContextMenu : public LLListContextMenu { public: +// [RLVa:KB] - Checked: RLVa-1.5.0 + PeopleContextMenu() : m_fRlvCheck(false) {} +// [/RLVa:KB] /*virtual*/ LLContextMenu* createMenu(); protected: @@ -52,6 +55,10 @@ private: // Add to contact set void addToContactSet(); +// [RLVa:KB] - Checked: RLVa-1.5.0 +protected: + bool m_fRlvCheck; +// [/RLVa:KB] }; /** @@ -59,6 +66,10 @@ private: */ class NearbyPeopleContextMenu : public PeopleContextMenu { +// [RLVa:KB] - Checked: RLVa-1.5.0 +public: + NearbyPeopleContextMenu() : PeopleContextMenu() { m_fRlvCheck = true; } +// [/RLVa:KB] protected: /*virtual*/ void buildContextMenu(class LLMenuGL& menu, U32 flags); }; diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 55e60b4ffa..27f926b54a 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -65,7 +65,8 @@ #include "lltrans.h" // [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.2a) #include "llslurl.h" -#include "rlvhandler.h" +#include "rlvactions.h" +#include "rlvcommon.h" // [/RLVa:KB] // For OpenSim export permisson #include "lfsimfeaturehandler.h" @@ -462,15 +463,15 @@ void LLPanelPermissions::refresh() // getChildView("Owner Name")->setEnabled(TRUE); // [RLVa:KB] - Moved further down to avoid an annoying flicker when the text is set twice in a row -// [RLVa:KB] - Checked: 2010-11-02 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) +// [RLVa:KB] - Checked: RLVa-2.0.1 + if ( (RlvActions::isRlvEnabled()) && (!RlvActions::canShowName(RlvActions::SNC_DEFAULT)) ) { // Only anonymize the creator if all of the selection was created by the same avie who's also the owner or they're a nearby avie - if ( (creators_identical) && (mCreatorID != gAgent.getID()) && ((mCreatorID == mOwnerID) || (RlvUtil::isNearbyAgent(mCreatorID))) ) + if ( (creators_identical) && (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, mCreatorID)) && ((mCreatorID == mOwnerID) || (RlvUtil::isNearbyAgent(mCreatorID))) ) creator_name = LLSLURL("agent", mCreatorID, "rlvanonym").getSLURLString(); // Only anonymize the owner name if all of the selection is owned by the same avie and isn't group owned - if ( (owners_identical) && (!LLSelectMgr::getInstance()->selectIsGroupOwned()) && (mOwnerID != gAgent.getID()) ) + if ( (owners_identical) && (!LLSelectMgr::getInstance()->selectIsGroupOwned()) && (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, mOwnerID)) ) owner_name = LLSLURL("agent", mOwnerID, "rlvanonym").getSLURLString(); // Only anonymize the last owner name if all of the selection was last owned by the same avie diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index d6e251509c..5a4334a4ff 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -99,6 +99,7 @@ // [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1a) #include "rlvactions.h" #include "rlvhandler.h" +#include "rlvhelper.h" // [/RLVa:KB] // Aurora Sim #include "llviewernetwork.h" @@ -4402,7 +4403,7 @@ void LLSelectMgr::deselectAllIfTooFar() bool apply(LLSelectNode* pNode) { const LLViewerObject* pObj = pNode->getObject(); - return (!pNode->isTransient()) && (pObj) && (!gRlvHandler.canEdit(pObj)) && (pObj->getID() != LLViewerMediaFocus::getInstance()->getFocusedObjectID()); + return (!pNode->isTransient()) && (pObj) && (!RlvActions::canEdit(pObj)) && (pObj->getID() != LLViewerMediaFocus::getInstance()->getFocusedObjectID()); } } f; if (mSelectedObjects->getFirstRootNode(&f, TRUE)) @@ -4434,6 +4435,8 @@ void LLSelectMgr::deselectAllIfTooFar() LLVector3d selectionCenter = getSelectionCenterGlobal(); // if (gSavedSettings.getBOOL("LimitSelectDistance") // [RLVa:KB] - Checked: 2010-04-11 (RLVa-1.2.0e) | Modified: RLVa-0.2.0f + static RlvCachedBehaviourModifier s_nFartouchDist(RLV_MODIFIER_FARTOUCHDIST); + BOOL fRlvFartouch = gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH) && gFloaterTools->getVisible(); if ( (gSavedSettings.getBOOL("LimitSelectDistance") || (fRlvFartouch) ) // [/RLVa:KB] @@ -4444,7 +4447,7 @@ void LLSelectMgr::deselectAllIfTooFar() { // F32 deselect_dist = gSavedSettings.getF32("MaxSelectDistance"); // [RLVa:KB] - Checked: 2010-04-11 (RLVa-1.2.0e) | Modified: RLVa-0.2.0f - F32 deselect_dist = (!fRlvFartouch) ? gSavedSettings.getF32("MaxSelectDistance") : 1.5f; + F32 deselect_dist = (!fRlvFartouch) ? gSavedSettings.getF32("MaxSelectDistance") : s_nFartouchDist; // [/RLVa:KB] F32 deselect_dist_sq = deselect_dist * deselect_dist; diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp index 37a8397c82..c43fef98cc 100644 --- a/indra/newview/llsidepaneliteminfo.cpp +++ b/indra/newview/llsidepaneliteminfo.cpp @@ -46,8 +46,9 @@ #include "llviewerobjectlist.h" #include "llexperiencecache.h" #include "lltrans.h" -// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.2a) -#include "rlvhandler.h" +// [RLVa:KB] - Checked: RLVa-2.0.1 +#include "rlvactions.h" +#include "rlvcommon.h" // [/RLVa:KB] //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -361,13 +362,16 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) // std::string name = // LLSLURL("agent", creator_id, "completename").getSLURLString(); // getChildView("BtnCreator")->setEnabled(TRUE); -// [RLVa:KB] - Checked: 2010-11-01 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a +// [RLVa:KB] - Checked: RLVa-2.0.1 // If the object creator matches the object owner we need to anonymize the creator field as well - bool fRlvFilterCreator = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && - ( ((perm.isOwned()) && (!perm.isGroupOwned()) && (perm.getOwner() == creator_id) && (perm.getOwner() != gAgent.getID())) || - (RlvUtil::isNearbyAgent(item->getCreatorUUID())) ); - std::string name = LLSLURL("agent", creator_id, (!fRlvFilterCreator) ? "completename" : "rlvanonym").getSLURLString(); - getChildView("BtnCreator")->setEnabled(!fRlvFilterCreator); + bool fRlvCanShowCreator = true; + if ( (RlvActions::isRlvEnabled()) && (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, creator_id)) && + ( ((perm.isOwned()) && (!perm.isGroupOwned()) && (perm.getOwner() == creator_id) ) || (RlvUtil::isNearbyAgent(item->getCreatorUUID())) ) ) + { + fRlvCanShowCreator = false; + } + std::string name = LLSLURL("agent", creator_id, (fRlvCanShowCreator) ? "completename" : "rlvanonym").getSLURLString(); + getChildView("BtnCreator")->setEnabled(fRlvCanShowCreator); // [/RLVa:KB] getChildView("LabelCreatorTitle")->setEnabled(TRUE); getChildView("LabelCreatorName")->setEnabled(FALSE); @@ -386,6 +390,9 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) //////////////// if(perm.isOwned()) { +// [RLVa:KB] - Checked: RVLa-2.0.1 + bool fRlvCanShowOwner = true; +// [/RLVa:KB] std::string name; if (perm.isGroupOwned()) { @@ -395,14 +402,14 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) { LLUUID owner_id = perm.getOwner(); // name = LLSLURL("agent", owner_id, "completename").getSLURLString(); -// [RLVa:KB] - Checked: 2010-11-01 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a - bool fRlvFilterOwner = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (owner_id != gAgent.getID()); - name = LLSLURL("agent", owner_id, (!fRlvFilterOwner) ? "completename" : "rlvanonym").getSLURLString(); +// [RLVa:KB] - Checked: RLVa-2.0.1 + fRlvCanShowOwner = RlvActions::canShowName(RlvActions::SNC_DEFAULT, owner_id); + name = LLSLURL("agent", owner_id, (fRlvCanShowOwner) ? "completename" : "rlvanonym").getSLURLString(); // [/RLVa:KB] } // getChildView("BtnOwner")->setEnabled(TRUE); -// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.2a) | Added: RLVa-1.0.0e - getChildView("BtnOwner")->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); +// [RLVa:KB] - Checked: RLVa-2.0.1 + getChildView("BtnOwner")->setEnabled(fRlvCanShowOwner); // [/RLVa:KB] getChildView("LabelOwnerTitle")->setEnabled(TRUE); getChildView("LabelOwnerName")->setEnabled(FALSE); @@ -760,12 +767,12 @@ void LLSidepanelItemInfo::onClickCreator() if(!item) return; if(!item->getCreatorUUID().isNull()) { -// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.2a) | Added: RLVa-1.2.1b - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) +// [RLVa:KB] - Checked: RLVa-1.2.1 + const LLUUID& idCreator = item->getCreatorUUID(); + if ( (RlvActions::isRlvEnabled()) && (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, idCreator)) ) { const LLPermissions& perm = item->getPermissions(); - if ( ((perm.isOwned()) && (!perm.isGroupOwned()) && (perm.getOwner() == item->getCreatorUUID()) && (perm.getOwner() != gAgent.getID())) || - (RlvUtil::isNearbyAgent(item->getCreatorUUID())) ) + if ( ((perm.isOwned()) && (!perm.isGroupOwned()) && (perm.getOwner() == idCreator) ) || (RlvUtil::isNearbyAgent(idCreator)) ) { return; } @@ -786,8 +793,8 @@ void LLSidepanelItemInfo::onClickOwner() } else { -// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.2a) | Modified: RLVa-1.0.0e - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (item->getPermissions().getOwner() != gAgent.getID()) ) +// [RLVa:KB] - Checked: RLVa-1.0.0 + if ( (RlvActions::isRlvEnabled()) && (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, item->getPermissions().getOwner())) ) return; // [/RLVa:KB] LLAvatarActions::showProfile(item->getPermissions().getOwner()); diff --git a/indra/newview/lltoolface.cpp b/indra/newview/lltoolface.cpp index ac2700949a..8405e1ee0a 100644 --- a/indra/newview/lltoolface.cpp +++ b/indra/newview/lltoolface.cpp @@ -40,6 +40,7 @@ #include "llviewerwindow.h" #include "llfloatertools.h" // [RLVa:KB] - Checked: 2010-04-11 (RLVa-1.2.0e) +#include "rlvactions.h" #include "rlvhandler.h" // [/RLVa:KB] @@ -112,7 +113,7 @@ void LLToolFace::pickCallback(const LLPickInfo& pick_info) // [RLVa:KB] - Checked: 2010-11-29 (RLVa-1.3.0c) | Modified: RLVa-1.3.0c if ( (rlv_handler_t::isEnabled()) && - ( (!gRlvHandler.canEdit(hit_obj)) || + ( (!RlvActions::canEdit(hit_obj)) || ((gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) && (!gRlvHandler.canTouch(hit_obj, pick_info.mObjectOffset))) ) ) { return; diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 609b37e0aa..f2f3b640f3 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -74,6 +74,7 @@ #include "llweb.h" #include "pipeline.h" // setHighlightObject // [RLVa:KB] - Checked: 2010-03-06 (RLVa-1.2.0c) +#include "rlvactions.h" #include "rlvhandler.h" // [/RLVa:KB] @@ -477,7 +478,7 @@ ECursorType LLToolPie::cursorFromObject(LLViewerObject* object) // if (isAgentAvatarValid() && !gAgentAvatarp->isSitting()) // not already sitting? // [RLVa:KB] - Checked: 2010-03-06 (RLVa-1.2.0c) | Modified: RLVa-1.2.0g if ( (isAgentAvatarValid() && !gAgentAvatarp->isSitting()) && - ((!rlv_handler_t::isEnabled()) || (gRlvHandler.canSit(object, LLToolPie::getInstance()->getHoverPick().mObjectOffset))) ) + ((!rlv_handler_t::isEnabled()) || (RlvActions::canSit(object, LLToolPie::getInstance()->getHoverPick().mObjectOffset))) ) // [/RLVa:KB] { cursor = UI_CURSOR_TOOLSIT; @@ -753,10 +754,24 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask) FALSE /* ignore transparent */, FALSE /* ignore particles */); - if (!mPick.mPosGlobal.isExactlyZero() // valid coordinates for pick - && (mPick.mPickType == LLPickInfo::PICK_LAND // we clicked on land - || mPick.mObjectID.notNull())) // or on an object +// if (!mPick.mPosGlobal.isExactlyZero() // valid coordinates for pick +// && (mPick.mPickType == LLPickInfo::PICK_LAND // we clicked on land +// || mPick.mObjectID.notNull())) // or on an object +// [RLVa:KB] - Checked: RLVa-2.0.0 + bool fValidPick = (!mPick.mPosGlobal.isExactlyZero() // valid coordinates for pick + && (mPick.mPickType == LLPickInfo::PICK_LAND // we clicked on land + || mPick.mObjectID.notNull())); // or on an object + + if ( (fValidPick) && (RlvActions::isRlvEnabled()) && (!RlvActions::canTeleportToLocal(mPick.mPosGlobal)) ) + { + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_AUTOPILOT); + fValidPick = false; + } + + if (fValidPick) +// [/RLVa:KB] { + // handle special cases of steering picks LLViewerObject* avatar_object = mPick.getObject(); @@ -851,8 +866,20 @@ BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask) } } - if ((mPick.mPickType == LLPickInfo::PICK_LAND && !mPick.mPosGlobal.isExactlyZero()) || - (mPick.mObjectID.notNull() && !mPick.mPosGlobal.isExactlyZero())) +// if ((mPick.mPickType == LLPickInfo::PICK_LAND && !mPick.mPosGlobal.isExactlyZero()) || +// (mPick.mObjectID.notNull() && !mPick.mPosGlobal.isExactlyZero())) +// [RLVa:KB] - Checked: RLVa-2.0.0 + bool fValidPick = ((mPick.mPickType == LLPickInfo::PICK_LAND && !mPick.mPosGlobal.isExactlyZero()) || + (mPick.mObjectID.notNull() && !mPick.mPosGlobal.isExactlyZero())); + + if ( (fValidPick) && (RlvActions::isRlvEnabled()) && (!RlvActions::canTeleportToLocal(mPick.mPosGlobal)) ) + { + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_AUTOPILOT); + fValidPick = false; + } + + if (fValidPick) +// [/RLVa:KB] { walkToClickedLocation(); return TRUE; @@ -1149,8 +1176,8 @@ BOOL LLToolPie::handleTooltipObject( LLViewerObject* hover_object, std::string l if (LLAvatarNameCache::get(hover_object->getID(), &av_name)) { // final_name = av_name.getCompleteName(); -// [RLVa:KB] - Checked: 2010-10-31 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a - final_name = (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? av_name.getCompleteName() : RlvStrings::getAnonym(av_name); +// [RLVa:KB] - Checked: RLVa-1.2.2 + final_name = (RlvActions::canShowName(RlvActions::SNC_DEFAULT, hover_object->getID())) ? av_name.getCompleteName() : RlvStrings::getAnonym(av_name); // [/RLVa:KB] // Make sure group title gets added to the tool tip. This is done separately to // the RLVa code to prevent this change from getting lost in future RLVa merges @@ -1167,9 +1194,9 @@ BOOL LLToolPie::handleTooltipObject( LLViewerObject* hover_object, std::string l // *HACK: We may select this object, so pretend it was clicked mPick = mHoverPick; -// [RLVa:KB] - Checked: 2010-04-11 (RLVa-1.2.2a) | Added: RLVa-1.2.0e +// [RLVa:KB] - Checked: RLVa-1.2.0 if ( (!rlv_handler_t::isEnabled()) || - ( (gRlvHandler.canTouch(hover_object, mHoverPick.mObjectOffset)) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ) ) + ( (gRlvHandler.canTouch(hover_object, mHoverPick.mObjectOffset)) && (RlvActions::canShowName(RlvActions::SNC_DEFAULT, hover_object->getID())) ) ) { // [/RLVa:KB] LLInspector::Params p; diff --git a/indra/newview/lltoolplacer.cpp b/indra/newview/lltoolplacer.cpp index 44cad88644..0bc5749d0a 100644 --- a/indra/newview/lltoolplacer.cpp +++ b/indra/newview/lltoolplacer.cpp @@ -45,6 +45,7 @@ #include "llui.h" // [RLVa:KB] - Checked: 2010-03-23 (RLVa-1.2.0a) #include "rlvhandler.h" +#include "rlvhelper.h" // [/RLVa:KB] //Headers added for functions moved from viewer.cpp @@ -166,9 +167,11 @@ BOOL LLToolPlacer::raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, // [RLVa:KB] - Checked: 2010-04-11 (RLVa-1.2.0e) | Modified: RLVa-0.2.0f // NOTE: don't use surface_pos_global since for prims it will be the center of the prim while we need center + offset - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) && (dist_vec_squared(gAgent.getPositionGlobal(), pick.mPosGlobal) > 1.5f * 1.5f) ) + if (gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) { - return FALSE; + static RlvCachedBehaviourModifier s_nFartouchDist(RLV_MODIFIER_FARTOUCHDIST); + if (dist_vec_squared(gAgent.getPositionGlobal(), pick.mPosGlobal) > s_nFartouchDist * s_nFartouchDist) + return FALSE; } // [/RLVa:KB] diff --git a/indra/newview/lltoolselect.cpp b/indra/newview/lltoolselect.cpp index 4f63d50fb3..38e7b3b8a8 100644 --- a/indra/newview/lltoolselect.cpp +++ b/indra/newview/lltoolselect.cpp @@ -47,8 +47,9 @@ #include "llviewerwindow.h" #include "llvoavatarself.h" #include "llworld.h" -// [RLVa:KB] - Checked: 2010-03-06 (RLVa-1.2.0c) -#include "rlvhandler.h" +// [RLVa:KB] - Checked: RLVa-2.0.0 +#include "rlvactions.h" +#include "rlvhelper.h" #include "llfloaterreg.h" // [/RLVa:KB] @@ -86,22 +87,23 @@ LLObjectSelectionHandle LLToolSelect::handleObjectSelection(const LLPickInfo& pi } // [RLVa:KB] - Checked: 2010-11-29 (RLVa-1.3.0c) | Modified: RLVa-1.3.0c - if ( (object) && (rlv_handler_t::isEnabled()) ) + if ( (object) && (RlvActions::isRlvEnabled()) ) { - if (!gRlvHandler.canEdit(object)) + if (!RlvActions::canEdit(object)) { if (!temp_select) return LLSelectMgr::getInstance()->getSelection(); else if (LLToolMgr::instance().inBuildMode()) LLToolMgr::instance().toggleBuildMode(LLSD("toggleonly")); } - - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) && ((!object->isAttachment()) || (!object->permYouOwner())) && - (dist_vec_squared(gAgent.getPositionAgent(), object->getPositionRegion()) > 1.5f * 1.5f) ) + + if ( (RlvActions::hasBehaviour(RLV_BHVR_FARTOUCH)) && ((!object->isAttachment()) || (!object->permYouOwner())) ) { - // NOTE: see behaviour notes for a rather lengthy explanation of why we're doing things this way - //if (dist_vec_squared(gAgent.getPositionAgent(), object->getPositionRegion() + pick.mObjectOffset) > 1.5f * 1.5f) - if (dist_vec_squared(gAgent.getPositionAgent(), pick.mIntersection) > 1.5f * 1.5f) + static RlvCachedBehaviourModifier s_nFartouchDist(RLV_MODIFIER_FARTOUCHDIST); + float nFartouchDistSq = s_nFartouchDist * s_nFartouchDist; + // NOTE: recheck why we did it this way, might be able to simplify + if ( (dist_vec_squared(gAgent.getPositionAgent(), object->getPositionRegion()) > nFartouchDistSq) && + (dist_vec_squared(gAgent.getPositionAgent(), pick.mIntersection) > nFartouchDistSq) ) { if ( (LLFloaterReg::instanceVisible("build")) && (pick.mKeyMask != MASK_SHIFT) && (pick.mKeyMask != MASK_CONTROL) ) LLSelectMgr::getInstance()->deselectAll(); diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp index ac09961402..4b0a36ddcd 100644 --- a/indra/newview/llviewercamera.cpp +++ b/indra/newview/llviewercamera.cpp @@ -41,7 +41,8 @@ #include "llworld.h" #include "lltoolmgr.h" #include "llviewerjoystick.h" -// [RLVa:KB] - Checked: 2010-04-11 (RLVa-1.2.0e) +// [RLVa:KB] - RLVa-2.0.0 +#include "rlvactions.h" #include "rlvhandler.h" // [/RLVa:KB] @@ -356,15 +357,17 @@ void LLViewerCamera::setPerspective(BOOL for_selection, if (limit_select_distance) { // ...select distance from control -// z_far = gSavedSettings.getF32("MaxSelectDistance"); -// [RLVa:KB] - Checked: 2010-04-11 (RLVa-1.2.0e) | Added: RLVa-1.2.0e - z_far = (!gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) ? gSavedSettings.getF32("MaxSelectDistance") : 1.5; -// [/RLVa:KB] + z_far = gSavedSettings.getF32("MaxSelectDistance"); } else { z_far = gAgentCamera.mDrawDistance; } + +// [RLVa:KB] - Checked: RLVa-2.0.0 + if (RlvActions::hasBehaviour(RLV_BHVR_FARTOUCH)) + z_far = RlvActions::getModifierValue(RLV_MODIFIER_FARTOUCHDIST); +// [/RLVa:KB] } else { @@ -882,6 +885,12 @@ BOOL LLViewerCamera::areVertsVisible(LLViewerObject* volumep, BOOL all_verts) void LLViewerCamera::setDefaultFOV(F32 vertical_fov_rads) { +// [RLVa:KB] - Checked: RLVa-2.0.0 + F32 nCamFOVMin, nCamFOVMax; + if ( (RlvActions::isRlvEnabled()) && (RlvActions::getCameraFOVLimits(nCamFOVMin, nCamFOVMax)) ) + vertical_fov_rads = llclamp(vertical_fov_rads, nCamFOVMin, nCamFOVMax); +// [/RLVa:KB] + vertical_fov_rads = llclamp(vertical_fov_rads, getMinView(), getMaxView()); setView(vertical_fov_rads); mCameraFOVDefault = vertical_fov_rads; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 75e7dbf75d..e9a66562e0 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -1363,13 +1363,22 @@ class LLAdvancedToggleWireframe : public view_listener_t { bool handleEvent(const LLSD& userdata) { -// [RLVa:KB] - Checked: 2013-05-11 (RLVa-1.4.9) +// [RLVa:KB] - Checked: RLVa-2.0.0 bool fRlvBlockWireframe = gRlvAttachmentLocks.hasLockedHUD(); if ( (!gUseWireframe) && (fRlvBlockWireframe) ) - { RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_WIREFRAME); - } - gUseWireframe = (!gUseWireframe) && (!fRlvBlockWireframe); + set_use_wireframe( (!gUseWireframe) && (!fRlvBlockWireframe) ); + return true; + } +}; + +// Called from rlvhandler.cpp +void set_use_wireframe(BOOL useWireframe) + { + if (gUseWireframe == useWireframe) + return; + + gUseWireframe = useWireframe; // [/RLVa:KB] // gUseWireframe = !(gUseWireframe); @@ -1390,9 +1399,9 @@ class LLAdvancedToggleWireframe : public view_listener_t LLViewerShaderMgr::instance()->setShaders(); } - return true; +// return true; } -}; +//}; class LLAdvancedCheckWireframe : public view_listener_t { @@ -3573,15 +3582,15 @@ bool enable_object_mute() lastname && !LLStringUtil::compareStrings(lastname->getString(), "Linden"); bool is_self = avatar->isSelf(); // return !is_linden && !is_self; -// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.1b) | Added: RLVa-1.2.1b -// return !is_linden && !is_self && !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES); +// [RLVa:KB] - Checked: RLVa-1.2.1 +// return !is_linden && !is_self && (RlvActions::canShowName(RlvActions::SNC_DEFAULT, avatar->getID())); // [/RLVa:KB] // Make enable/disable of block/unblock menu items work for avatars if(is_linden || is_self) return false; - if(gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + if (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, avatar->getID())) return false; LLNameValue *firstname = avatar->getNVPair("FirstName"); @@ -3741,14 +3750,14 @@ class LLObjectMute : public view_listener_t LLVOAvatar* avatar = find_avatar_from_object(object); if (avatar) { -// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.1b) | Added: RLVa-1.0.0e - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + id = avatar->getID(); +// [RLVa:KB] - Checked: RLVa-1.0.0 + if (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, id)) return true; // [/RLVa:KB] avatar->mNeedsImpostorUpdate = TRUE; - id = avatar->getID(); LLNameValue *firstname = avatar->getNVPair("FirstName"); LLNameValue *lastname = avatar->getNVPair("LastName"); @@ -3916,8 +3925,8 @@ void handle_avatar_freeze(const LLSD& avatar_id) // { // LLSD args; // args["AVATAR_NAME"] = fullname; -// [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.0.0e -// args["AVATAR_NAME"] = (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? fullname : RlvStrings::getAnonym(fullname); +// [RLVa:KB] - Checked: RLVa-1.0.0 +// args["AVATAR_NAME"] = (RlvActions::canShowName(RlvActions::SNC_DEFAULT, avatar->getID())) ? fullname : RlvStrings::getAnonym(fullname); // [/RLVa:KB] // LLNotificationsUtil::add("FreezeAvatarFullname", // args, @@ -4064,8 +4073,8 @@ void handle_avatar_eject(const LLSD& avatar_id) // { // LLSD args; // args["AVATAR_NAME"] = fullname; -// [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.0.0e -// args["AVATAR_NAME"] = (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? fullname : RlvStrings::getAnonym(fullname); +// [RLVa:KB] - Checked: RLVa-1.0.0 +// args["AVATAR_NAME"] = (RlvActions::canShowName(RlvActions::SNC_DEFAULT, avatar->getID())) ? fullname : RlvStrings::getAnonym(fullname); // [/RLVa:KB] // LLNotificationsUtil::add("EjectAvatarFullname", // args, @@ -4087,8 +4096,8 @@ void handle_avatar_eject(const LLSD& avatar_id) // { // LLSD args; // args["AVATAR_NAME"] = fullname; -// [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.0.0e -// args["AVATAR_NAME"] = (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? fullname : RlvStrings::getAnonym(fullname); +// [RLVa:KB] - Checked: RLVa-1.0.0 +// args["AVATAR_NAME"] = (RlvActions::canShowName(RlvActions::SNC_DEFAULT, avatar->getID())) ? fullname : RlvStrings::getAnonym(fullname); // [/RLVa:KB] // LLNotificationsUtil::add("EjectAvatarFullnameNoBan", // args, @@ -4878,8 +4887,8 @@ class LLAvatarEnableAddFriend : public view_listener_t { LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()); // bool new_value = avatar && !LLAvatarActions::isFriend(avatar->getID()); -// [RLVa:KB] - Checked: 2010-04-20 (RLVa-1.2.0f) | Modified: RLVa-1.2.0f - bool new_value = avatar && !LLAvatarActions::isFriend(avatar->getID()) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); +// [RLVa:KB] - Checked: RLVa-1.2.0 + bool new_value = avatar && !LLAvatarActions::isFriend(avatar->getID()) && (RlvActions::canShowName(RlvActions::SNC_DEFAULT, avatar->getID())); // [/RLVa:KB] return new_value; } @@ -4957,7 +4966,7 @@ bool is_object_sittable() if (rlv_handler_t::isEnabled()) { const LLPickInfo& pick = LLToolPie::getInstance()->getPick(); - if ( (pick.mObjectID.notNull()) && (!gRlvHandler.canSit(pick.getObject(), pick.mObjectOffset)) ) + if ( (pick.mObjectID.notNull()) && (!RlvActions::canSit(pick.getObject(), pick.mObjectOffset)) ) return false; } // [/RLVa:KB] @@ -4996,7 +5005,7 @@ void handle_object_sit_or_stand() // if (object && object->getPCode() == LL_PCODE_VOLUME) // [RLVa:KB] - Checked: 2010-03-06 (RLVa-1.2.0c) | Modified: RLVa-1.2.0c if ( (object && object->getPCode() == LL_PCODE_VOLUME) && - ((!rlv_handler_t::isEnabled()) || (gRlvHandler.canSit(object, pick.mObjectOffset))) ) + ((!rlv_handler_t::isEnabled()) || (RlvActions::canSit(object, pick.mObjectOffset))) ) // [/RLVa:KB] { // [RLVa:KB] - Checked: 2010-08-29 (RLVa-1.2.1c) | Added: RLVa-1.2.1c @@ -7280,8 +7289,8 @@ class LLAvatarInviteToGroup : public view_listener_t { LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); // if(avatar) -// [RLVa:KB] - Checked: 2010-06-04 (RLVa-1.2.0d) | Added: RLVa-1.2.0d - if ( (avatar) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ) +// [RLVa:KB] - Checked: RLVa-1.2.0 + if ( (avatar) && (RlvActions::canShowName(RlvActions::SNC_DEFAULT, avatar->getID())) ) // [/RLVa:KB] { LLAvatarActions::inviteToGroup(avatar->getID()); @@ -7296,8 +7305,8 @@ class LLAvatarAddFriend : public view_listener_t { LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); // if(avatar && !LLAvatarActions::isFriend(avatar->getID())) -// [RLVa:KB] - Checked: 2010-04-20 (RLVa-1.2.0f) | Modified: RLVa-1.2.0f - if ( (avatar && !LLAvatarActions::isFriend(avatar->getID())) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ) +// [RLVa:KB] - Checked: RLVa-1.2.0 + if ( (avatar && !LLAvatarActions::isFriend(avatar->getID())) && (RlvActions::canShowName(RlvActions::SNC_DEFAULT, avatar->getID())) ) // [/RLVa:KB] { request_friendship(avatar->getID()); @@ -7340,8 +7349,8 @@ class LLAvatarAddContact : public view_listener_t { LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); // if(avatar) -// [RLVa:KB] - Checked: 2010-04-20 (RLVa-1.2.0f) | Modified: RLVa-1.2.0f - if ( (avatar) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ) +// [RLVa:KB] - Checked: RLVa-1.2.0 + if ( (avatar) && (RlvActions::canShowName(RlvActions::SNC_DEFAULT, avatar->getID())) ) // [/RLVa:KB] { create_inventory_callingcard(avatar->getID()); @@ -7407,8 +7416,8 @@ bool enable_pay_avatar() LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); LLVOAvatar* avatar = find_avatar_from_object(obj); // return (avatar != NULL); -// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.1b) | Added: RLVa-1.2.1b - return (avatar != NULL) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); +// [RLVa:KB] - Checked: RLVa-1.2.1 + return (avatar != NULL) && (RlvActions::canShowName(RlvActions::SNC_DEFAULT, avatar->getID())); // [/RLVa:KB] } @@ -7464,7 +7473,7 @@ bool enable_object_sit(LLUICtrl* ctrl) { const LLPickInfo& pick = LLToolPie::getInstance()->getPick(); if (pick.mObjectID.notNull()) - sitting_on_sel = !gRlvHandler.canSit(pick.getObject(), pick.mObjectOffset); + sitting_on_sel = !RlvActions::canSit(pick.getObject(), pick.mObjectOffset); } // [/RLVa:KB] @@ -7799,8 +7808,8 @@ class LLShowAgentProfile : public view_listener_t LLVOAvatar* avatar = find_avatar_from_object(agent_id); // if (avatar) -// [RLVa:KB] - Checked: 2010-06-04 (RLVa-1.2.0d) | Modified: RLVa-1.2.0d - if ( (avatar) && ((!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) || (gAgent.getID() == agent_id)) ) +// [RLVa:KB] - Checked: RLVa-1.2.0 + if ( (avatar) && ((RlvActions::canShowName(RlvActions::SNC_DEFAULT, agent_id)) || (gAgent.getID() == agent_id)) ) // [/RLVa:KB] { LLAvatarActions::showProfile(avatar->getID()); @@ -8533,8 +8542,8 @@ class LLAvatarSendIM : public view_listener_t { LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); // if(avatar) -// [RLVa:KB] - Checked: 2010-06-04 (RLVa-1.2.0d) | Added: RLVa-1.2.0d - if ( (avatar) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ) +// [RLVa:KB] - Checked: RLVa-1.2.0 + if ( (avatar) && (RlvActions::canShowName(RlvActions::SNC_DEFAULT, avatar->getID())) ) // [/RLVa:KB] { LLAvatarActions::startIM(avatar->getID()); @@ -8549,8 +8558,8 @@ class LLAvatarCall : public view_listener_t { LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); // if(avatar) -// [RLVa:KB] - Checked: 2010-06-04 (RLVa-1.2.0d) | Added: RLVa-1.2.0d - if ( (avatar) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ) +// [RLVa:KB] - Checked: RLVa-1.2.0 + if ( (avatar) && (RlvActions::canShowName(RlvActions::SNC_DEFAULT, avatar->getID())) ) // [/RLVa:KB] { LLAvatarActions::startCall(avatar->getID()); @@ -8559,10 +8568,16 @@ class LLAvatarCall : public view_listener_t } }; -// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.1b) | Added: RLVa-1.2.1b +// [RLVa:KB] - Checked: RLVa-1.2.1 bool enable_avatar_call() { - return (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (LLAvatarActions::canCall()); + if (RlvActions::isRlvEnabled()) + { + const LLVOAvatar* pAvatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()); + if ((!pAvatar) || (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, pAvatar->getID()))) + return false; + } + return LLAvatarActions::canCall(); } // [/RLVa:KB] @@ -11331,10 +11346,11 @@ void initialize_menus() view_listener_t::addMenu(new LLEditableSelectedMono(), "EditableSelectedMono"); view_listener_t::addMenu(new LLToggleUIHints(), "ToggleUIHints"); -// [RLVa:KB] - Checked: 2010-04-23 (RLVa-1.2.0g) | Added: RLVa-1.2.0 +// [RLVa:KB] - Checked: RLVa-2.0.0 enable.add("RLV.MainToggleVisible", boost::bind(&rlvMenuMainToggleVisible, _1)); - if (rlv_handler_t::isEnabled()) + if (RlvActions::isRlvEnabled()) { + enable.add("RLV.CanShowName", boost::bind(&rlvMenuCanShowName)); enable.add("RLV.EnableIfNot", boost::bind(&rlvMenuEnableIfNot, _2)); } // [/RLVa:KB] diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h index 91067108fe..fb48ffa07a 100644 --- a/indra/newview/llviewermenu.h +++ b/indra/newview/llviewermenu.h @@ -39,6 +39,10 @@ class LLObjectSelection; class LLSelectNode; class PieMenu; // ## Zi: Pie Menu +// [RLVa:KB] - Checked: RLVa-2.0.0 +void set_use_wireframe(BOOL useWireframe); +// [/RLVa:KB] + void initialize_edit_menu(); void initialize_spellcheck_menu(); void initialize_volume_controls_callbacks(); // Centralize a some of these volume panel callbacks diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 5b9fa6af92..2e1622a22a 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1626,13 +1626,12 @@ void LLOfferInfo::send_auto_receive_response(void) { // add buddy to recent people list // LLRecentPeople::instance().add(mFromID); -// [RLVa:KB] - Checked: 2010-04-20 (RLVa-1.2.2a) | Added: RLVa-1.2.0f - // RELEASE-RLVa: [RLVa-1.2.2] Make sure this stays in sync with the condition in inventory_offer_handler() - if ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) || (!RlvUtil::isNearbyAgent(mFromID)) || - (RlvUIEnabler::hasOpenIM(mFromID)) || ((RlvUIEnabler::hasOpenProfile(mFromID))) ) - { +// [RLVa:KB] - Checked: RLVa-2.0.1 + // RELEASE-RLVa: [RLVa-2.0.1] Make sure this stays in sync with the condition in inventory_offer_handler() + bool fRlvCanShowName = (!RlvActions::isRlvEnabled()) || + (RlvActions::canShowName(RlvActions::SNC_DEFAULT, mFromID)) || (!RlvUtil::isNearbyAgent(mFromID)) || (RlvUIEnabler::hasOpenIM(mFromID)) || (RlvUIEnabler::hasOpenProfile(mFromID)); + if (fRlvCanShowName) LLRecentPeople::instance().add(mFromID); - } // [/RLVa:KB] } } @@ -1991,9 +1990,11 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const // [SL:KB] - Checked: 2010-11-02 (RLVa-1.2.2a) | Added: RLVa-1.2.2a std::string name_slurl = LLSLURL("agent", mFromID, "about").getSLURLString(); -// [RLVa:KB] - Checked: 2010-11-02 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a - // RELEASE-RLVa: [RLVa-1.2.2] Make sure this stays in sync with the condition in inventory_offer_handler() - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (RlvUtil::isNearbyAgent(mFromID)) ) +// [RLVa:KB] - Checked: RLVa-2.0.1 + // RELEASE-RLVa: [RLVa-2.0.1] Make sure this stays in sync with the condition in inventory_offer_handler() + bool fRlvCanShowName = (!RlvActions::isRlvEnabled()) || + (RlvActions::canShowName(RlvActions::SNC_DEFAULT, mFromID)) || (!RlvUtil::isNearbyAgent(mFromID)) || (RlvUIEnabler::hasOpenIM(mFromID)) || (RlvUIEnabler::hasOpenProfile(mFromID)); + if (!fRlvCanShowName) name_slurl = LLSLURL("agent", mFromID, "rlvanonym").getSLURLString(); // [/RLVa:KB] @@ -2273,9 +2274,9 @@ void inventory_offer_handler(LLOfferInfo* info) // Object -> Agent Inventory Offer if (info->mFromObject && !bAutoAccept) { -// [RLVa:KB] - Checked: 2010-11-02 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a +// [RLVa:KB] - Checked: RLVa-1.2.2 // Only filter if the object owner is a nearby agent - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (RlvUtil::isNearbyAgent(info->mFromID)) ) + if ( (RlvActions::isRlvEnabled()) && (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, info->mFromID)) && (RlvUtil::isNearbyAgent(info->mFromID)) ) { payload["rlv_shownames"] = TRUE; args["NAME_SLURL"] = LLSLURL("agent", info->mFromID, "rlvanonym").getSLURLString(); @@ -2296,10 +2297,11 @@ void inventory_offer_handler(LLOfferInfo* info) } else // Agent -> Agent Inventory Offer { -// [RLVa:KB] - Checked: 2010-11-02 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a +// [RLVa:KB] - Checked: RLVa-2.0.1 // Only filter if the offer is from a nearby agent and if there's no open IM session (doesn't necessarily have to be focused) - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (RlvUtil::isNearbyAgent(info->mFromID)) && - (!RlvUIEnabler::hasOpenIM(info->mFromID)) ) + bool fRlvCanShowName = (!RlvActions::isRlvEnabled()) || + (RlvActions::canShowName(RlvActions::SNC_DEFAULT, info->mFromID)) || (!RlvUtil::isNearbyAgent(info->mFromID)) || (RlvUIEnabler::hasOpenIM(info->mFromID)) || (RlvUIEnabler::hasOpenProfile(info->mFromID)); + if (!fRlvCanShowName) { payload["rlv_shownames"] = TRUE; args["NAME"] = RlvStrings::getAnonym(info->mFromName); @@ -3512,11 +3514,11 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_INVENTORY_ACCEPTED: { // args["NAME"] = LLSLURL("agent", from_id, "completename").getSLURLString();; -// [RLVa:KB] - Checked: 2010-11-02 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a +// [RLVa:KB] - Checked: RLVa-1.2.2 // Only anonymize the name if the agent is nearby, there isn't an open IM session to them and their profile isn't open - bool fRlvFilterName = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (RlvUtil::isNearbyAgent(from_id)) && - (!RlvUIEnabler::hasOpenProfile(from_id)) && (!RlvUIEnabler::hasOpenIM(from_id)); - args["NAME"] = LLSLURL("agent", from_id, (!fRlvFilterName) ? "completename" : "rlvanonym").getSLURLString();; + bool fRlvCanShowName = (!RlvActions::isRlvEnabled()) || + (RlvActions::canShowName(RlvActions::SNC_DEFAULT, from_id)) || (!RlvUtil::isNearbyAgent(from_id)) || (RlvUIEnabler::hasOpenProfile(from_id)) || (RlvUIEnabler::hasOpenIM(from_id)); + args["NAME"] = LLSLURL("agent", from_id, (fRlvCanShowName) ? "completename" : "rlvanonym").getSLURLString();; // [/RLVa:KB] LLSD payload; payload["from_id"] = from_id; @@ -3529,11 +3531,11 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_INVENTORY_DECLINED: { // args["NAME"] = LLSLURL("agent", from_id, "completename").getSLURLString();; -// [RLVa:KB] - Checked: 2010-11-02 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a +// [RLVa:KB] - Checked: RLVa-1.2.2 // Only anonymize the name if the agent is nearby, there isn't an open IM session to them and their profile isn't open - bool fRlvFilterName = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (RlvUtil::isNearbyAgent(from_id)) && - (!RlvUIEnabler::hasOpenProfile(from_id)) && (!RlvUIEnabler::hasOpenIM(from_id)); - args["NAME"] = LLSLURL("agent", from_id, (!fRlvFilterName) ? "completename" : "rlvanonym").getSLURLString();; + bool fRlvCanShowName = (!RlvActions::isRlvEnabled()) || + (RlvActions::canShowName(RlvActions::SNC_DEFAULT, from_id)) || (!RlvUtil::isNearbyAgent(from_id)) || (RlvUIEnabler::hasOpenProfile(from_id)) || (RlvUIEnabler::hasOpenIM(from_id)); + args["NAME"] = LLSLURL("agent", from_id, (fRlvCanShowName) ? "completename" : "rlvanonym").getSLURLString();; // [/RLVa:KB] LLSD payload; payload["from_id"] = from_id; @@ -3608,18 +3610,18 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) LLSD query_string; query_string["owner"] = from_id; -// [RLVa:KB] - Checked: 2010-04-22 (RLVa-1.2.0f) | Added: RLVa-1.2.0f - if (rlv_handler_t::isEnabled()) +// [RLVa:KB] - Checked: RLVa-1.2.0 + if (RlvActions::isRlvEnabled()) { // NOTE: the chat message itself will be filtered in LLNearbyChatHandler::processChat() - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (!from_group) && (RlvUtil::isNearbyAgent(from_id)) ) + if ( (!RlvActions::canShowName(RlvActions::SNC_DEFAULT)) && (!from_group) && (RlvUtil::isNearbyAgent(from_id)) ) { query_string["rlv_shownames"] = TRUE; RlvUtil::filterNames(name); chat.mFromName = name; } - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + if (!RlvActions::canShowLocation()) { std::string::size_type idxPos = location.find('/'); if ( (std::string::npos != idxPos) && (RlvUtil::isNearbyRegion(location.substr(0, idxPos))) ) @@ -4625,7 +4627,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) // Filtering "rules": // avatar => filter only their name (unless it's this avie) // other => filter everything - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + if (!RlvActions::canShowName(RlvActions::SNC_DEFAULT)) { if (CHAT_SOURCE_AGENT != chat.mSourceType) { @@ -4635,19 +4637,19 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) { chat.mFromName = RlvStrings::getAnonym(chat.mFromName); chat.mRlvNamesFiltered = TRUE; - } + } } // Create an "objectim" URL for objects if we're either @shownames or @showloc restricted // (we need to do this now because we won't be have enough information to do it later on) - if ( (CHAT_SOURCE_OBJECT == chat.mSourceType) && - ((gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))) ) + if ( (CHAT_SOURCE_OBJECT == chat.mSourceType) && + ( (!RlvActions::canShowName(RlvActions::SNC_DEFAULT)) || (!RlvActions::canShowLocation()) ) ) { LLSD sdQuery; sdQuery["name"] = chat.mFromName; sdQuery["owner"] = owner_id; - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (!is_owned_by_me) ) + if ( (!RlvActions::canShowName(RlvActions::SNC_COUNT, owner_id)) && (!is_owned_by_me) ) sdQuery["rlv_shownames"] = true; const LLViewerRegion* pRegion = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent); @@ -7866,12 +7868,12 @@ void process_alert_core(const std::string& message, BOOL modal) } std::string new_msg =LLNotifications::instance().getGlobalString(text); -// [RLVa:KB] - Checked: 2012-02-07 (RLVa-1.4.5) | Added: RLVa-1.4.5 - if ( (new_msg == text) && (rlv_handler_t::isEnabled()) ) +// [RLVa:KB] - Checked: RLVa-1.4.5 + if ( (new_msg == text) && (RlvActions::isRlvEnabled()) ) { - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + if (!RlvActions::canShowLocation()) RlvUtil::filterLocation(new_msg); - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + if (!RlvActions::canShowName(RlvActions::SNC_DEFAULT)) RlvUtil::filterNames(new_msg); } // [/RLVa:KB] @@ -7882,12 +7884,12 @@ void process_alert_core(const std::string& message, BOOL modal) { LLSD args; std::string new_msg =LLNotifications::instance().getGlobalString(message); -// [RLVa:KB] - Checked: 2012-02-07 (RLVa-1.4.5) | Added: RLVa-1.4.5 - if ( (new_msg == message) && (rlv_handler_t::isEnabled()) ) +// [RLVa:KB] - Checked: RLVa-1.4.5 + if ( (new_msg == message) && (RlvActions::isRlvEnabled()) ) { - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + if (!RlvActions::canShowLocation()) RlvUtil::filterLocation(new_msg); - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + if (!RlvActions::canShowName(RlvActions::SNC_DEFAULT)) RlvUtil::filterNames(new_msg); } // [/RLVa:KB] @@ -7906,12 +7908,12 @@ void process_alert_core(const std::string& message, BOOL modal) std::string localized_msg; bool is_message_localized = LLTrans::findString(localized_msg, new_msg); -// [RLVa:KB] - Checked: 2012-02-07 (RLVa-1.4.5) | Added: RLVa-1.4.5 - if ( (new_msg == message) && (rlv_handler_t::isEnabled()) ) +// [RLVa:KB] - Checked: RLVa-1.4.5 + if ( (new_msg == message) && (RlvActions::isRlvEnabled()) ) { - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + if (!RlvActions::canShowLocation()) RlvUtil::filterLocation(new_msg); - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + if (!RlvActions::canShowName(RlvActions::SNC_DEFAULT)) RlvUtil::filterNames(new_msg); } // [/RLVa:KB] @@ -8975,8 +8977,8 @@ void send_lures(const LLSD& notification, const LLSD& response) // Record the offer. { -// [RLVa:KB] - Checked: 2014-03-31 (Catznip-3.6) - bool fRlvHideName = notification["payload"]["rlv_shownames"].asBoolean(); +// [RLVa:KB] - Checked: RLVa-2.0.1 + bool fRlvCanShowName = (!notification["payload"].has("rlv_shownames")) ? true : !notification["payload"]["rlv_shownames"].asBoolean(); // [/RLVa:KB] // Show complete name for TP lures //std::string target_name; @@ -8984,7 +8986,7 @@ void send_lures(const LLSD& notification, const LLSD& response) LLSD args; //args["TO_NAME"] = LLSLURL("agent", target_id, "displayname").getSLURLString();; // [RLVa:KB] - Checked: 2014-03-31 (Catznip-3.6) - args["TO_NAME"] = LLSLURL("agent", target_id, (!fRlvHideName) ? "completename" : "rlvanonym").getSLURLString();; + args["TO_NAME"] = LLSLURL("agent", target_id, (fRlvCanShowName) ? "completename" : "rlvanonym").getSLURLString();; // [/RLVa:KB] // args["TO_NAME"] = LLSLURL("agent", target_id, "completename").getSLURLString(); // @@ -8997,8 +8999,8 @@ void send_lures(const LLSD& notification, const LLSD& response) LLNotificationsUtil::add("TeleportOfferSent", args, payload); // Add the recepient to the recent people list. -// [RLVa:KB] - Checked: 2014-03-31 (Catznip-3.6) - if (!fRlvHideName) +// [RLVa:KB] - Checked: RLVa-2.0.1 + if (fRlvCanShowName) LLRecentPeople::instance().add(target_id); // [/RLVa:KB] // LLRecentPeople::instance().add(target_id); @@ -9052,25 +9054,32 @@ void handle_lure(const uuid_vec_t& ids) // edit_args["REGION"] = gAgent.getRegion()->getName(); LLSD payload; - for (std::vector::const_iterator it = ids.begin(); - it != ids.end(); - ++it) +// [RLVa:KB] - Checked: RLVa-2.0.1 + bool fRlvShouldHideNames = false; + for (const LLUUID& idAgent : ids) { -// [RLVa:KB] - Checked: 2010-04-07 (RLVa-1.2.0d) | Modified: RLVa-1.0.0a // Only allow offering teleports if everyone is a @tplure exception or able to map this avie under @showloc=n if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) { - const LLRelationship* pBuddyInfo = LLAvatarTracker::instance().getBuddyInfo(*it); - if ( (!gRlvHandler.isException(RLV_BHVR_TPLURE, *it, RLV_CHECK_PERMISSIVE)) && + const LLRelationship* pBuddyInfo = LLAvatarTracker::instance().getBuddyInfo(idAgent); + if ( (!gRlvHandler.isException(RLV_BHVR_TPLURE, idAgent, RLV_CHECK_PERMISSIVE)) && ((!pBuddyInfo) || (!pBuddyInfo->isOnline()) || (!pBuddyInfo->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION))) ) { + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_TELEPORT_OFFER); return; } } - payload["rlv_shownames"] = !RlvActions::canShowName(RlvActions::SNC_TELEPORTOFFER); -// [/RLVa:KB] - payload["ids"].append(*it); + fRlvShouldHideNames |= !RlvActions::canShowName(RlvActions::SNC_TELEPORTOFFER, idAgent); + payload["ids"].append(idAgent); } + payload["rlv_shownames"] = fRlvShouldHideNames; +// [/RLVa:KB] +// for (std::vector::const_iterator it = ids.begin(); +// it != ids.end(); +// ++it) +// { +// payload["ids"].append(*it); +// } if (gAgent.isGodlike()) { LLNotificationsUtil::add("OfferTeleportFromGod", edit_args, payload, handle_lure_callback); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index fadcbdb4b2..e91822fa33 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -103,6 +103,7 @@ #include "llfloaterperms.h" #include "llvocache.h" // [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1a) +#include "rlvactions.h" #include "rlvhandler.h" #include "rlvlocks.h" // [/RLVa:KB] @@ -5890,7 +5891,7 @@ BOOL LLViewerObject::permTransfer() const BOOL LLViewerObject::allowOpen() const { // [RLVa:KB] - Checked: 2010-11-29 (RLVa-1.3.0c) | Modified: RLVa-1.3.0c - return !flagInventoryEmpty() && (permYouOwner() || permModify()) && ((!rlv_handler_t::isEnabled()) || (gRlvHandler.canEdit(this))); + return !flagInventoryEmpty() && (permYouOwner() || permModify()) && ((!RlvActions::isRlvEnabled()) || (RlvActions::canEdit(this))); // [/RLVa:KB] // return !flagInventoryEmpty() && (permYouOwner() || permModify()); } diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 31663e1c57..590198ce9e 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -766,6 +766,29 @@ void LLViewerObjectList::dirtyAllObjectInventory() } } +// [SL:KB] - Patch: Render-TextureToggle (Catznip-4.0) +void LLViewerObjectList::setAllObjectDefaultTextures(U32 nChannel, bool fShowDefault) +{ + LLPipeline::sRenderTextures = !fShowDefault; + + for (LLViewerObject* pObj : mObjects) + { + LLDrawable* pDrawable = pObj->mDrawable; + if ( (pDrawable) && (!pDrawable->isDead()) ) + { + for (int idxFace = 0, cntFace = pDrawable->getNumFaces(); idxFace < cntFace; idxFace++) + { + if (LLFace* pFace = pDrawable->getFace(idxFace)) + pFace->setDefaultTexture(nChannel, fShowDefault); + } + + if (LLVOVolume* pVoVolume = pDrawable->getVOVolume()) + pVoVolume->markForUpdate(true); + } + } +} +// [/SL:KB] + void LLViewerObjectList::updateApparentAngles(LLAgent &agent) { S32 i; diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index a0a65b91fa..96bbf4a4b1 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -124,6 +124,9 @@ public: void resetObjectBeacons(); void dirtyAllObjectInventory(); +// [SL:KB] - Patch: Render-TextureToggle (Catznip-4.0) + void setAllObjectDefaultTextures(U32 nChannel, bool fShowDefault); +// [/SL:KB] void removeFromActiveList(LLViewerObject* objectp); void updateActive(LLViewerObject *objectp); diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 4370059995..6b60879548 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -85,6 +85,9 @@ LLPointer LLViewerFetchedTexture::sWhiteImagep = NULL; LLPointer LLViewerFetchedTexture::sDefaultImagep = NULL; LLPointer LLViewerFetchedTexture::sSmokeImagep = NULL; LLPointer LLViewerFetchedTexture::sFlatNormalImagep = NULL; +// [SL:KB] - Patch: Render-TextureToggle (Catznip-4.0) +LLPointer LLViewerFetchedTexture::sDefaultDiffuseImagep = NULL; +// [/SL:KB] LLViewerMediaTexture::media_map_t LLViewerMediaTexture::sMediaMap; LLTexturePipelineTester* LLViewerTextureManager::sTesterp = NULL; const std::string sTesterName("TextureTester"); diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index 8fcd0660d8..04afa120e4 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -561,6 +561,9 @@ public: static LLPointer sDefaultImagep; // "Default" texture for error cases, the only case of fetched texture which is generated in local. static LLPointer sSmokeImagep; // Old "Default" translucent texture static LLPointer sFlatNormalImagep; // Flat normal map denoting no bumpiness on a surface +// [SL:KB] - Patch: Render-TextureToggle (Catznip-4.0) + static LLPointer sDefaultDiffuseImagep; +// [/SL:KB] }; // diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 4dc8fafe13..fc463638cb 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -98,7 +98,8 @@ #include "llanimstatelabels.h" #include "lltrans.h" #include "llappearancemgr.h" -// [RLVa:KB] - Checked: 2010-04-01 (RLVa-1.2.0c) +// [RLVa:KB] - Checked: RLVa-2.0.1 +#include "rlvactions.h" #include "rlvhandler.h" // [/RLVa:KB] @@ -2794,8 +2795,13 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) const F32 time_visible = mTimeVisible.getElapsedTimeF32(); const F32 NAME_SHOW_TIME = F32(renderNameShowTime); // seconds const F32 FADE_DURATION = F32(renderNameFadeDuration); // seconds -// [RLVa:KB] - Checked: 2010-04-04 (RLVa-1.2.2a) | Added: RLVa-0.2.0b - bool fRlvShowNames = gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES); +// [RLVa:KB] - Checked: RLVa-2.0.1 + bool fRlvShowAvTag = true, fRlvShowAvName = true; + if (RlvActions::isRlvEnabled()) + { + fRlvShowAvTag = RlvActions::canShowName(RlvActions::SNC_NAMETAG, getID()); + fRlvShowAvName = (fRlvShowAvTag) && (RlvActions::canShowName(RlvActions::SNC_DEFAULT, getID())); + } // [/RLVa:KB] BOOL visible_avatar = isVisible() || mNeedsAnimUpdate; BOOL visible_chat = useChatBubbles && (mChats.size() || mTyping); @@ -2803,8 +2809,8 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) BOOL render_name = visible_chat || visible_typing || (visible_avatar && -// [RLVa:KB] - Checked: 2010-04-04 (RLVa-1.2.2a) | Added: RLVa-1.0.0h - ( (!fRlvShowNames) || (RlvSettings::getShowNameTags()) ) && +// [RLVa:KB] - Checked: RLVa-2.0.1 + (fRlvShowAvTag) && // [/RLVa:KB] ((sRenderName == RENDER_NAME_ALWAYS) || (sRenderName == RENDER_NAME_FADE && time_visible < NAME_SHOW_TIME))); @@ -2842,8 +2848,8 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) new_name = TRUE; } -// [RLVa:KB] - Checked: 2010-04-04 (RLVa-1.2.2a) | Added: RLVa-0.2.0b - if (fRlvShowNames) +// [RLVa:KB] - Checked: RLVa-0.2.0 + if (!fRlvShowAvName) { if (mRenderGroupTitles) { @@ -2928,8 +2934,8 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) static const F32 chat_range_shout_squared = LFSimFeatureHandler::getInstance()->shoutRange() * LFSimFeatureHandler::getInstance()->shoutRange(); // -// [RLVa:KB] - Checked: 2010-10-31 (RLVa-1.2.2a) | Added: RLVa-1.2.2a - bool fRlvShowNames = gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES); +// [RLVa:KB] - Checked: RLVa-2.0.1 + bool fRlvShowAvName = RlvActions::canShowName(RlvActions::SNC_DEFAULT, getID()); // [/RLVa:KB] // Show auto-response in nametag static LLCachedControl fsAutorespondMode(gSavedPerAccountSettings, "FSAutorespondMode"); @@ -2954,8 +2960,8 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) is_muted = isInMuteList(); } // bool is_friend = LLAvatarTracker::instance().isBuddy(getID()); -// [RLVa:KB] - Checked: 2010-10-31 (RLVa-1.2.2a) | Added: RLVa-1.2.2a - bool is_friend = (!fRlvShowNames) && (LLAvatarTracker::instance().isBuddy(getID())); +// [RLVa:KB] - Checked: RLVa-1.2.2 + bool is_friend = (fRlvShowAvName) && (LLAvatarTracker::instance().isBuddy(getID())); // [/RLVa:KB] bool is_cloud = getIsCloud(); @@ -3128,8 +3134,8 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) } // if (sRenderGroupTitles -// [RLVa:KB] - Checked: 2010-10-31 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a - if (sRenderGroupTitles && !fRlvShowNames +// [RLVa:KB] - Checked: RLVa-1.2.2 + if (sRenderGroupTitles && fRlvShowAvName // [/RLVa:KB] && title && title->getString() && title->getString()[0] != '\0') { @@ -3154,8 +3160,8 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) clearNameTag(); } -// [RLVa:KB] - Checked: 2010-10-31 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a - if ( (!fRlvShowNames) || (isSelf()) ) +// [RLVa:KB] - Checked: RLVa-1.2.2 + if ( (fRlvShowAvName) || (isSelf()) ) { // [/RLVa:KB] // Might be blank if name not available yet, that's OK @@ -3192,7 +3198,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) addNameTagLine(username, username_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerifSmall()); } -// [RLVa:KB] - Checked: 2010-10-31 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a +// [RLVa:KB] - Checked: RLVa-1.2.2 } else { @@ -3204,8 +3210,8 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) { const LLFontGL* font = LLFontGL::getFontSansSerif(); std::string full_name = LLCacheName::buildFullName( firstname->getString(), lastname->getString() ); -// [RLVa:KB] - Checked: 2010-10-31 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a - if ( (fRlvShowNames) && (!isSelf()) ) +// [RLVa:KB] - Checked: RLVa-1.2.2 + if ( (!fRlvShowAvName) && (!isSelf()) ) { full_name = RlvStrings::getAnonym(full_name); addNameTagLine(full_name, name_tag_color, LLFontGL::NORMAL, font, true); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index a57aee677a..f1c7a0092d 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -78,8 +78,9 @@ #include "llstartup.h" #include "llsdserialize.h" #include "llcorehttputil.h" -// [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1a) +// [RLVa:KB] - Checked: RLVa-2.0.2 #include "rlvhandler.h" +#include "rlvhelper.h" #include "rlvlocks.h" // [/RLVa:KB] @@ -1266,12 +1267,25 @@ void LLVOAvatarSelf::updateAttachmentVisibility(U32 camera_mode) } else { +// [RLVa:KB] - Checked: RLVa-2.0.2 + bool fRlvCanShowAttachment = true; + if (rlv_handler_t::isEnabled()) + { + fRlvCanShowAttachment = + (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWSELF)) && + ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWSELFHEAD)) || (RLV_ATTACHGROUP_HEAD != rlvAttachGroupFromIndex(attachment->getGroup())) ); + } +// [/RLVa:KB] + switch (camera_mode) { case CAMERA_MODE_MOUSELOOK: if (LLVOAvatar::sVisibleInFirstPerson && attachment->getVisibleInFirstPerson()) { - attachment->setAttachmentVisibility(TRUE); +// [RLVa:KB] - Checked: RLVa-2.0.2 + attachment->setAttachmentVisibility(fRlvCanShowAttachment); +// [/RLVa:KB] +// attachment->setAttachmentVisibility(TRUE); } else { @@ -1279,7 +1293,10 @@ void LLVOAvatarSelf::updateAttachmentVisibility(U32 camera_mode) } break; default: - attachment->setAttachmentVisibility(TRUE); +// [RLVa:KB] - Checked: RLVa-2.0.2 + attachment->setAttachmentVisibility(fRlvCanShowAttachment); +// [/RLVa:KB] +// attachment->setAttachmentVisibility(TRUE); break; } } diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index b7ce5d2655..2f6aefb2be 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -77,8 +77,8 @@ #include "llvoavatar.h" #include "llvocache.h" #include "llmaterialmgr.h" -// [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1a) -#include "rlvhandler.h" +// [RLVa:KB] - Checked: RLVa-2.0.0 +#include "rlvactions.h" #include "rlvlocks.h" // [/RLVa:KB] @@ -4554,10 +4554,10 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, // if (facep->getViewerObject()->isSelected() && LLSelectMgr::getInstance()->mHideSelectedObjects) // [RLVa:KB] - Checked: 2010-11-29 (RLVa-1.3.0c) | Modified: RLVa-1.3.0c const LLViewerObject* pObj = facep->getViewerObject(); - if ( (pObj->isSelected() && LLSelectMgr::getInstance()->mHideSelectedObjects) && - ( (!rlv_handler_t::isEnabled()) || - ( ((!pObj->isHUDAttachment()) || (!gRlvAttachmentLocks.isLockedAttachment(pObj->getRootEdit()))) && - (gRlvHandler.canEdit(pObj)) ) ) ) + if ( (pObj->isSelected() && LLSelectMgr::getInstance()->mHideSelectedObjects) && + ( (!RlvActions::isRlvEnabled()) || + ( ((!pObj->isHUDAttachment()) || (!gRlvAttachmentLocks.isLockedAttachment(pObj->getRootEdit()))) && + (RlvActions::canEdit(pObj)) ) ) ) // [/RVLa:KB] { return; diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 72174b14df..641ca5c2af 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -1855,6 +1855,35 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector* positi } } +// [RLVa:KB] - Checked: RLVa-2.0.1 +bool LLWorld::getAvatar(const LLUUID& idAvatar, LLVector3d& posAvatar) const +{ + for (const LLCharacter* pCharacter : LLCharacter::sInstances) + { + const LLVOAvatar* pAvatar = static_cast(pCharacter); + if ( (!pAvatar->isDead()) && (!pAvatar->mIsDummy) && (!pAvatar->isOrphaned()) && (idAvatar == pAvatar->getID()) ) + { + posAvatar = pAvatar->getPositionGlobal(); + return true; + } + } + + for (const LLViewerRegion* pRegion : LLWorld::getInstance()->getRegionList()) + { + for (S32 idxAgent = 0, cntAgent = pRegion->mMapAvatarIDs.size(); idxAgent < cntAgent; ++idxAgent) + { + if (idAvatar == pRegion->mMapAvatarIDs[idxAgent]) + { + posAvatar = unpackLocalToGlobalPosition(pRegion->mMapAvatars[idxAgent], pRegion->getOriginGlobal()); + return true; + } + } + } + + return false; +} +// [/RLVa:KB] + bool LLWorld::isRegionListed(const LLViewerRegion* region) const { region_list_t::const_iterator it = find(mRegionList.begin(), mRegionList.end(), region); diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h index 08d368a91e..bfa668eae8 100644 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -235,6 +235,9 @@ public: // Make radar more exact and prevent false region crossing notifications //const LLVector3d& relative_to = LLVector3d(), F32 radius = FLT_MAX) const; const LLVector3d& relative_to = LLVector3d(), F32 radius = FLT_MAX, std::map* region_assignments = NULL) const; +// [RLVa:KB] - Checked: RLVa-2.0.1 + bool getAvatar(const LLUUID& idAvatar, LLVector3d& posAvatar) const; +// [/RLVa:KB] // Returns 'true' if the region is in mRegionList, // 'false' if the region has been removed due to region change diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 8871cbe8e3..87b4ee99e0 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -114,8 +114,8 @@ #include "llpathfindingpathtool.h" #include "llscenemonitor.h" #include "llprogressview.h" -// [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1a) -#include "rlvhandler.h" +// [RLVa:KB] - Checked: RLVa-2.0.0 +#include "rlvactions.h" #include "rlvlocks.h" // [/RLVa:KB] #include "exopostprocess.h" // Import Vignette from Exodus @@ -408,6 +408,9 @@ BOOL LLPipeline::sRenderingHUDs; F32 LLPipeline::sVolumeSAFrame = 0.f; // ZK LBG bool LLPipeline::sRenderParticles; // flag to hold correct, user selected, status of particles +// [SL:KB] - Patch: Render-TextureToggle (Catznip-4.0) +bool LLPipeline::sRenderTextures = true; +// [/SL:KB] // EventHost API LLPipeline listener. static LLPipelineListener sPipelineListener; @@ -3618,9 +3621,9 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera) // [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.2.1f const LLViewerObject* pObj = drawablep->getVObj(); if ( (pObj) && (pObj->isSelected()) && - ( (!rlv_handler_t::isEnabled()) || + ( (!RlvActions::isRlvEnabled()) || ( ((!pObj->isHUDAttachment()) || (!gRlvAttachmentLocks.isLockedAttachment(pObj->getRootEdit()))) && - (gRlvHandler.canEdit(pObj)) ) ) ) + (RlvActions::canEdit(pObj)) ) ) ) // [/RVLa:KB] { return; diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 8347864eef..cb8e918dcc 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -591,6 +591,9 @@ public: static F32 sVolumeSAFrame; static bool sRenderParticles; // flag to hold correct, user selected, status of particles +// [SL:KB] - Patch: Render-TextureToggle (Catznip-4.0) + static bool sRenderTextures; +// [/SL:KB] static LLTrace::EventStatHandle sStatBatchSize; diff --git a/indra/newview/rlvactions.cpp b/indra/newview/rlvactions.cpp index 102729a68b..1def8205fb 100644 --- a/indra/newview/rlvactions.cpp +++ b/indra/newview/rlvactions.cpp @@ -1,70 +1,209 @@ -/** +/** * - * Copyright (c) 2009-2013, Kitty Barnett - * - * The source code in this file is provided to you under the terms of the + * Copyright (c) 2009-2016, Kitty Barnett + * + * The source code in this file is provided to you under the terms of the * GNU Lesser General Public License, version 2.1, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. Terms of the LGPL can be found in doc/LGPL-licence.txt + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. Terms of the LGPL can be found in doc/LGPL-licence.txt * in this distribution, or online at http://www.gnu.org/licenses/lgpl-2.1.txt - * + * * By copying, modifying or distributing this software, you acknowledge that - * you have read and understood your obligations described above, and agree to + * you have read and understood your obligations described above, and agree to * abide by those obligations. - * + * */ #include "llviewerprecompiledheaders.h" #include "llagent.h" #include "llimview.h" +#include "llviewercamera.h" #include "llvoavatarself.h" +#include "llworld.h" #include "rlvactions.h" #include "rlvhelper.h" #include "rlvhandler.h" +// ============================================================================ +// Camera +// + +bool RlvActions::canChangeCameraFOV(const LLUUID& idRlvObject) +{ + // NOTE: if an object has exclusive camera control then all other objects are locked out + return (!gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM)) || (gRlvHandler.hasBehaviour(idRlvObject, RLV_BHVR_SETCAM)); +} + +bool RlvActions::canChangeCameraPreset(const LLUUID& idRlvObject) +{ + // NOTE: if an object has exclusive camera control then all other objects are locked out + return + ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM)) || (gRlvHandler.hasBehaviour(idRlvObject, RLV_BHVR_SETCAM)) ) && + (!gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM_EYEOFFSET)) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM_FOCUSOFFSET)); +} + +bool RlvActions::canChangeToMouselook() +{ + // User can switch to mouselook if: + // - not specifically prevented from going into mouselook (NOTE: if an object has exclusive camera control only that object can prevent mouselook) + // - there is no minimum camera distance defined (or it's higher than > 0m) + const RlvBehaviourModifier* pCamDistMinModifier = RlvBehaviourDictionary::instance().getModifier(RLV_MODIFIER_SETCAM_AVDISTMIN); + return + ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM)) ? !gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM_MOUSELOOK) : !gRlvHandler.hasBehaviour(pCamDistMinModifier->getPrimaryObject(), RLV_BHVR_SETCAM_MOUSELOOK) ) && + ( (!pCamDistMinModifier->hasValue()) || (pCamDistMinModifier->getValue() == 0.f) ); +} + +bool RlvActions::isCameraDistanceClamped() +{ + return + (gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM_AVDISTMIN)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM_AVDISTMAX)) || + (gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM_ORIGINDISTMIN)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM_ORIGINDISTMAX)); +} + +bool RlvActions::isCameraFOVClamped() +{ + return (gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM_FOVMIN)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM_FOVMAX)); +} + +bool RlvActions::isCameraPresetLocked() +{ + return (gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM_EYEOFFSET)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM_FOCUSOFFSET)); +} + +bool RlvActions::getCameraAvatarDistanceLimits(float& nDistMin, float& nDistMax) +{ + bool fDistMin = gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM_AVDISTMIN), fDistMax = gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM_AVDISTMAX); + if ( (fDistMin) || (fDistMax) ) + { + static RlvCachedBehaviourModifier sCamDistMin(RLV_MODIFIER_SETCAM_AVDISTMIN); + static RlvCachedBehaviourModifier sCamDistMax(RLV_MODIFIER_SETCAM_AVDISTMAX); + + nDistMax = (fDistMax) ? sCamDistMax : F32_MAX; + nDistMin = (fDistMin) ? sCamDistMin : 0.0; + return true; + } + return false; +} + +bool RlvActions::getCameraOriginDistanceLimits(float& nDistMin, float& nDistMax) +{ + bool fDistMin = gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM_ORIGINDISTMIN), fDistMax = gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM_ORIGINDISTMAX); + if ( (fDistMin) || (fDistMax) ) + { + static RlvCachedBehaviourModifier sCamDistMin(RLV_MODIFIER_SETCAM_ORIGINDISTMIN); + static RlvCachedBehaviourModifier sCamDistMax(RLV_MODIFIER_SETCAM_ORIGINDISTMAX); + + nDistMax = (fDistMax) ? sCamDistMax : F32_MAX; + nDistMin = (fDistMin) ? sCamDistMin : 0.0; + return true; + } + return false; +} + +bool RlvActions::getCameraFOVLimits(F32& nFOVMin, F32& nFOVMax) +{ + bool fClampMin = gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM_FOVMIN), fClampMax = gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM_FOVMAX); + if ( (fClampMin) || (fClampMax) ) + { + static RlvCachedBehaviourModifier sCamFovMin(RLV_MODIFIER_SETCAM_FOVMIN); + static RlvCachedBehaviourModifier sCamFovMax(RLV_MODIFIER_SETCAM_FOVMAX); + + nFOVMin = (fClampMin) ? sCamFovMin : LLViewerCamera::getInstance()->getMinView(); + nFOVMax = (fClampMax) ? sCamFovMax : LLViewerCamera::getInstance()->getMaxView(); + return true; + } + return false; +} + // ============================================================================ // Communication/Avatar interaction -// +// bool RlvActions::s_BlockNamesContexts[SNC_COUNT] = { 0 }; -// Checked: 2010-11-30 (RLVa-1.3.0) +// Little helper function to check the IM exclusion range for @recvim, @sendim and @startim (returns: min_dist <= (pos user - pos target) <= max_dist) +static bool rlvCheckAvatarIMDistance(const LLUUID& idAvatar, ERlvBehaviourModifier eModDistMin, ERlvBehaviourModifier eModDistMax) +{ + LLVector3d posAgent; + const RlvBehaviourModifier *pBhvrModDistMin = RlvBehaviourDictionary::instance().getModifier(eModDistMin), *pBhvrModDistMax = RlvBehaviourDictionary::instance().getModifier(eModDistMax); + if ( ((pBhvrModDistMin->hasValue()) || (pBhvrModDistMax->hasValue())) && (LLWorld::getInstance()->getAvatar(idAvatar, posAgent)) ) + { + float nDist = llabs(dist_vec_squared(gAgent.getPositionGlobal(), posAgent)); + return (nDist >= pBhvrModDistMin->getValue()) && (nDist <= pBhvrModDistMax->getValue()); + } + return false; +} + bool RlvActions::canReceiveIM(const LLUUID& idSender) { // User can receive an IM from "sender" (could be an agent or a group) if: - // - not generally restricted from receiving IMs (or the sender is an exception) + // - not generally restricted from receiving IMs (or the sender is an exception or inside the exclusion range) // - not specifically restricted from receiving an IM from the sender - return - (!rlv_handler_t::isEnabled()) || - ( ( (!gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM)) || (gRlvHandler.isException(RLV_BHVR_RECVIM, idSender)) ) && + return + (!isRlvEnabled()) || + ( ( (!gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM)) || (gRlvHandler.isException(RLV_BHVR_RECVIM, idSender)) || (rlvCheckAvatarIMDistance(idSender, RLV_MODIFIER_RECVIMDISTMIN, RLV_MODIFIER_RECVIMDISTMAX)) ) && ( (!gRlvHandler.hasBehaviour(RLV_BHVR_RECVIMFROM)) || (!gRlvHandler.isException(RLV_BHVR_RECVIMFROM, idSender)) ) ); } -// Checked: 2010-11-30 (RLVa-1.3.0) +bool RlvActions::canPlayGestures() +{ + return (!gRlvHandler.hasBehaviour(RLV_BHVR_SENDGESTURE)); +} + +bool RlvActions::canSendChannel(int nChannel) +{ + return + ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SENDCHANNEL)) || (gRlvHandler.isException(RLV_BHVR_SENDCHANNEL, nChannel)) ) && + ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SENDCHANNELEXCEPT)) || (!gRlvHandler.isException(RLV_BHVR_SENDCHANNELEXCEPT, nChannel)) ); +} + bool RlvActions::canSendIM(const LLUUID& idRecipient) { // User can send an IM to "recipient" (could be an agent or a group) if: - // - not generally restricted from sending IMs (or the recipient is an exception) + // - not generally restricted from sending IMs (or the recipient is an exception or inside the exclusion range) // - not specifically restricted from sending an IM to the recipient - return - (!rlv_handler_t::isEnabled()) || - ( ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SENDIM)) || (gRlvHandler.isException(RLV_BHVR_SENDIM, idRecipient)) ) && + return + (!isRlvEnabled()) || + ( ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SENDIM)) || (gRlvHandler.isException(RLV_BHVR_SENDIM, idRecipient)) || (rlvCheckAvatarIMDistance(idRecipient, RLV_MODIFIER_SENDIMDISTMIN, RLV_MODIFIER_SENDIMDISTMAX)) ) && ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SENDIMTO)) || (!gRlvHandler.isException(RLV_BHVR_SENDIMTO, idRecipient)) ) ); } bool RlvActions::canStartIM(const LLUUID& idRecipient) { // User can start an IM session with "recipient" (could be an agent or a group) if: - // - not generally restricted from starting IM sessions (or the recipient is an exception) + // - not generally restricted from starting IM sessions (or the recipient is an exception or inside the exclusion range) // - not specifically restricted from starting an IM session with the recipient // - the session already exists - return - (!rlv_handler_t::isEnabled()) || - ( ( (!gRlvHandler.hasBehaviour(RLV_BHVR_STARTIM)) || (gRlvHandler.isException(RLV_BHVR_STARTIM, idRecipient)) ) && + return + (!isRlvEnabled()) || + ( ( (!gRlvHandler.hasBehaviour(RLV_BHVR_STARTIM)) || (gRlvHandler.isException(RLV_BHVR_STARTIM, idRecipient)) || (rlvCheckAvatarIMDistance(idRecipient, RLV_MODIFIER_STARTIMDISTMIN, RLV_MODIFIER_STARTIMDISTMAX)) ) && ( (!gRlvHandler.hasBehaviour(RLV_BHVR_STARTIMTO)) || (!gRlvHandler.isException(RLV_BHVR_STARTIMTO, idRecipient)) ) ) || ( (hasOpenP2PSession(idRecipient)) || (hasOpenGroupSession(idRecipient)) ); } +bool RlvActions::canShowName(EShowNamesContext eContext, const LLUUID& idAgent) +{ + // Handle most common case upfront + if (!s_BlockNamesContexts[eContext]) + return true; + + if (idAgent.notNull()) + { + switch (eContext) + { + // Show/hide avatar nametag + case SNC_NAMETAG: + return (gRlvHandler.isException(RLV_BHVR_SHOWNAMETAGS, idAgent)) || (gAgentID == idAgent); + // Show/hide avatar name + case SNC_DEFAULT: + case SNC_TELEPORTOFFER: + case SNC_TELEPORTREQUEST: + return gRlvHandler.isException(RLV_BHVR_SHOWNAMES, idAgent); + } + } + return false; +} + // ============================================================================ // Movement // @@ -93,28 +232,76 @@ bool RlvActions::autoAcceptTeleportRequest(const LLUUID& idRequester) // Teleporting // -bool RlvActions::canTeleportToLocal() +bool RlvActions::canTeleportToLocal(const LLVector3d& posGlobal) { - return (!gRlvHandler.hasBehaviour(RLV_BHVR_SITTP)) && (!gRlvHandler.hasBehaviour(RLV_BHVR_TPLOCAL)) && (RlvActions::canStand()); + // User can initiate a local teleport if: + // - not restricted from "sit teleporting" (or the destination is within the allowed xy-radius) + // - not restricted from teleporting locally (or the destination is within the allowed xy-radius) + // - can stand up (or isn't sitting) + // NOTE: if we're teleporting due to an active command we should disregard any restrictions from the same object + const LLUUID& idRlvObjExcept = gRlvHandler.getCurrentObject(); + bool fCanStand = RlvActions::canStand(idRlvObjExcept); + if ( (fCanStand) && ((gRlvHandler.hasBehaviourExcept(RLV_BHVR_SITTP, gRlvHandler.getCurrentObject())) || (gRlvHandler.hasBehaviourExcept(RLV_BHVR_TPLOCAL, gRlvHandler.getCurrentObject()))) ) + { + // User can stand up but is either @sittp or @tplocal restricted so we need to distance check + const F32 nDistSq = (LLVector2(posGlobal.mdV[0], posGlobal.mdV[1]) - LLVector2(gAgent.getPositionGlobal().mdV[0], gAgent.getPositionGlobal().mdV[1])).lengthSquared(); + F32 nMaxDist = llmin(RlvBehaviourDictionary::instance().getModifier(RLV_MODIFIER_TPLOCALDIST)->getValue(), RLV_MODIFIER_TPLOCAL_DEFAULT); + if (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP)) + nMaxDist = llmin(nMaxDist, RlvBehaviourDictionary::instance().getModifier(RLV_MODIFIER_SITTPDIST)->getValue()); + return (nDistSq < nMaxDist * nMaxDist); + } + return fCanStand; } bool RlvActions::canTeleportToLocation() { // NOTE: if we're teleporting due to an active command we should disregard any restrictions from the same object const LLUUID& idRlvObjExcept = gRlvHandler.getCurrentObject(); - return (!gRlvHandler.hasBehaviourExcept(RLV_BHVR_TPLOC, idRlvObjExcept)) && (!gRlvHandler.hasBehaviourExcept(RLV_BHVR_TPLOCAL, idRlvObjExcept)) && (RlvActions::canStand(idRlvObjExcept)); + return (!gRlvHandler.hasBehaviourExcept(RLV_BHVR_TPLOC, idRlvObjExcept)) && (RlvActions::canStand(idRlvObjExcept)); } bool RlvActions::isLocalTp(const LLVector3d& posGlobal) { - F32 nDistSq = (LLVector2(posGlobal.mdV[0], posGlobal.mdV[1]) - LLVector2(gAgent.getPositionGlobal().mdV[0], gAgent.getPositionGlobal().mdV[1])).lengthSquared(); - return nDistSq < RLV_TELEPORT_LOCAL_RADIUS * RLV_TELEPORT_LOCAL_RADIUS; + const F32 nDistSq = (LLVector2(posGlobal.mdV[0], posGlobal.mdV[1]) - LLVector2(gAgent.getPositionGlobal().mdV[0], gAgent.getPositionGlobal().mdV[1])).lengthSquared(); + return nDistSq < RLV_MODIFIER_TPLOCAL_DEFAULT * RLV_MODIFIER_TPLOCAL_DEFAULT; } // ============================================================================ // World interaction // +bool RlvActions::canEdit(const LLViewerObject* pObj) +{ + // User can edit the specified object if: + // - not generally restricted from editing (or the object's root is an exception) + // - not specifically restricted from editing this object's root + return + (pObj) && + ((!hasBehaviour(RLV_BHVR_EDIT)) || (gRlvHandler.isException(RLV_BHVR_EDIT, pObj->getRootEdit()->getID()))) && + ((!hasBehaviour(RLV_BHVR_EDITOBJ)) || (!gRlvHandler.isException(RLV_BHVR_EDITOBJ, pObj->getRootEdit()->getID()))); +} + + +bool RlvActions::canSit(const LLViewerObject* pObj, const LLVector3& posOffset /*= LLVector3::zero*/) +{ + // User can sit on the specified object if: + // - not prevented from sitting + // - not prevented from standing up or not currently sitting + // - not standtp restricted or not currently sitting (if the user is sitting and tried to sit elsewhere the tp would just kick in) + // - not a regular sit (i.e. due to @sit:=force) + // - not @sittp=n or @fartouch=n restricted or if they clicked on a point within the allowed radius + static RlvCachedBehaviourModifier s_nFarTouchDist(RLV_MODIFIER_FARTOUCHDIST); + static RlvCachedBehaviourModifier s_nSitTpDist(RLV_MODIFIER_SITTPDIST); + return + ( (pObj) && (LL_PCODE_VOLUME == pObj->getPCode()) ) && + (!hasBehaviour(RLV_BHVR_SIT)) && + ( ((!hasBehaviour(RLV_BHVR_UNSIT)) && (!hasBehaviour(RLV_BHVR_STANDTP))) || + ((isAgentAvatarValid()) && (!gAgentAvatarp->isSitting())) ) && + ( ( (NULL != gRlvHandler.getCurrentCommand()) && (RLV_BHVR_SIT == gRlvHandler.getCurrentCommand()->getBehaviourType()) ) || + ( ((!hasBehaviour(RLV_BHVR_SITTP)) || (dist_vec_squared(gAgent.getPositionGlobal(), pObj->getPositionGlobal() + LLVector3d(posOffset)) < s_nSitTpDist * s_nSitTpDist)) && + ((!hasBehaviour(RLV_BHVR_FARTOUCH)) || (dist_vec_squared(gAgent.getPositionGlobal(), pObj->getPositionGlobal() + LLVector3d(posOffset)) < s_nFarTouchDist * s_nFarTouchDist)) ) ); +} + bool RlvActions::canStand() { // NOTE: return FALSE only if we're @unsit=n restricted and the avie is currently sitting on something and TRUE for everything else @@ -135,7 +322,13 @@ bool RlvActions::canShowLocation() // ============================================================================ // Helper functions -// +// + +template<> +const float& RlvActions::getModifierValue(ERlvBehaviourModifier eBhvrMod) +{ + return RlvBehaviourDictionary::instance().getModifier(eBhvrMod)->getValue(); +} // Checked: 2013-05-10 (RLVa-1.4.9) bool RlvActions::hasBehaviour(ERlvBehaviour eBhvr) diff --git a/indra/newview/rlvactions.h b/indra/newview/rlvactions.h index 9d616f0925..e11066e25a 100644 --- a/indra/newview/rlvactions.h +++ b/indra/newview/rlvactions.h @@ -1,17 +1,17 @@ -/** +/** * - * Copyright (c) 2009-2013, Kitty Barnett - * - * The source code in this file is provided to you under the terms of the + * Copyright (c) 2009-2016, Kitty Barnett + * + * The source code in this file is provided to you under the terms of the * GNU Lesser General Public License, version 2.1, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. Terms of the LGPL can be found in doc/LGPL-licence.txt + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. Terms of the LGPL can be found in doc/LGPL-licence.txt * in this distribution, or online at http://www.gnu.org/licenses/lgpl-2.1.txt - * + * * By copying, modifying or distributing this software, you acknowledge that - * you have read and understood your obligations described above, and agree to + * you have read and understood your obligations described above, and agree to * abide by those obligations. - * + * */ #ifndef RLV_ACTIONS_H @@ -25,6 +25,51 @@ class RlvActions { + // ====== + // Camera + // ====== +public: + /* + * Returns true if the specified object cannot manipulate the camera FOV + */ + static bool canChangeCameraFOV(const LLUUID& idRlvObject); + + /* + * Returns true if the specified object can manipulate the camera offset and/or focus offset values + */ + static bool canChangeCameraPreset(const LLUUID& idRlvObject); + + /* + * Returns true if the user can switch to mouselook + */ + static bool canChangeToMouselook(); + + /* + * Returns true if the camera's distance (from either the avatar of the focus) is currently restricted/clamped + */ + static bool isCameraDistanceClamped(); + + /* + * Returns true if the camera's FOV is currently restricted/clamped + */ + static bool isCameraFOVClamped(); + + /* + * Returns true if the camera offset and focus offset are locked (prevents changing the current camera preset) + */ + static bool isCameraPresetLocked(); + + /* + * Retrieves the current (avatar or focus) camera distance limits + */ + static bool getCameraAvatarDistanceLimits(float& nDistMin, float& nDistMax); + static bool getCameraOriginDistanceLimits(float& nDistMin, float& nDistMax); + + /* + * Retrieves the current camera FOV limits - returns isCameraFOVClamped() + */ + static bool getCameraFOVLimits(float& nFOVMin, float& nFOVMax); + // ================================ // Communication/Avatar interaction // ================================ @@ -34,6 +79,16 @@ public: */ static bool canReceiveIM(const LLUUID& idSender); + /* + * Returns true if the user is allowed to send/play gestures (whether active ones from the chat bar or using the gesture preview floater) + */ + static bool canPlayGestures(); + + /* + * Returns true if the user is allowed to chat on the specified channel + */ + static bool canSendChannel(int nChannel); + /* * Returns true if the user is allowed to send IMs to the specified recipient (can be an avatar or a group) */ @@ -49,9 +104,9 @@ public: * (This is used to hide an avatar name in one case but not a near-identical case - such as teleporting a friend vs a nearby agent - * in a way that limits the amount of code that needs to be changed to carry context from one function to another) */ - enum EShowNamesContext { SNC_TELEPORTOFFER = 0, SNC_TELEPORTREQUEST, SNC_COUNT }; - static bool canShowName(EShowNamesContext eContext) { return (eContext < SNC_COUNT) ? !s_BlockNamesContexts[eContext] : false; } - static void setShowName(EShowNamesContext eContext, bool fShowName) { if ( (eContext < SNC_COUNT) && (isRlvEnabled()) ) { s_BlockNamesContexts[eContext] = !fShowName; } } + enum EShowNamesContext { SNC_DEFAULT = 0, SNC_NAMETAG, SNC_TELEPORTOFFER, SNC_TELEPORTREQUEST, SNC_COUNT }; + static bool canShowName(EShowNamesContext eContext, const LLUUID& idAgent = LLUUID::null); + static void setShowName(EShowNamesContext eContext, bool fCanShowName) { if ( (eContext < SNC_COUNT) && (isRlvEnabled()) ) { s_BlockNamesContexts[eContext] = !fCanShowName; } } protected: // Backwards logic so that we can initialize to 0 and it won't block when we forget to/don't check if RLVa is disabled @@ -90,7 +145,7 @@ public: /* * Returns true if the user can teleport locally (short distances) */ - static bool canTeleportToLocal(); + static bool canTeleportToLocal(const LLVector3d& posGlobal); /* * Returns true if the user can teleport to a (remote) location @@ -106,6 +161,16 @@ public: // World interaction // ================= public: + /* + * Returns true if the user can edit the specified object + */ + static bool canEdit(const LLViewerObject* pObj); + + /* + * Returns true if the user can sit up on the specified object + */ + static bool canSit(const LLViewerObject* pObj, const LLVector3& posOffset = LLVector3::zero); + /* * Returns true if the user can stand up (returns true if the user isn't currently sitting) */ @@ -122,13 +187,18 @@ public: // ================ public: /* - * Convenience function to check for a behaviour without having to include rlvhandler.h. + * Convenience function to get the current/active value of a behaviour modifier + */ + template static const T& getModifierValue(ERlvBehaviourModifier eBhvrMod); + + /* + * Convenience function to check for a behaviour without having to include rlvhandler.h. * Do NOT call this function if speed is important (i.e. per-frame) */ static bool hasBehaviour(ERlvBehaviour eBhvr); /* - * Returns true if a - P2P or group - IM session is open with the specified UUID. + * Returns true if a - P2P or group - IM session is open with the specified UUID */ static bool hasOpenP2PSession(const LLUUID& idAgent); static bool hasOpenGroupSession(const LLUUID& idGroup); diff --git a/indra/newview/rlvcommon.cpp b/indra/newview/rlvcommon.cpp index 9347b4a6ab..1375110ae6 100644 --- a/indra/newview/rlvcommon.cpp +++ b/indra/newview/rlvcommon.cpp @@ -20,6 +20,7 @@ #include "llavatarnamecache.h" #include "llinstantmessage.h" #include "llnotificationsutil.h" +#include "llregionhandle.h" #include "llsdserialize.h" #include "lltrans.h" #include "llviewerparcelmgr.h" @@ -36,6 +37,13 @@ #include "llscriptruntimeperms.h" #include +// ============================================================================ +// Forward declarations +// + +// llviewermenu.cpp +LLVOAvatar* find_avatar_from_object(LLViewerObject* object); + // ============================================================================ // RlvNotifications // @@ -71,7 +79,6 @@ bool RlvSettings::fCompositeFolders = false; bool RlvSettings::fCanOOC = true; bool RlvSettings::fLegacyNaming = true; bool RlvSettings::fNoSetEnv = false; -bool RlvSettings::fShowNameTags = false; // Checked: 2010-02-27 (RLVa-1.2.0a) | Modified: RLVa-1.1.0i void RlvSettings::initClass() @@ -92,10 +99,6 @@ void RlvSettings::initClass() fCanOOC = rlvGetSetting(RLV_SETTING_CANOOC, true); fNoSetEnv = rlvGetSetting(RLV_SETTING_NOSETENV, false); - fShowNameTags = rlvGetSetting(RLV_SETTING_SHOWNAMETAGS, false); - if (gSavedSettings.controlExists(RLV_SETTING_SHOWNAMETAGS)) - gSavedSettings.getControl(RLV_SETTING_SHOWNAMETAGS)->getSignal()->connect(boost::bind(&onChangedSettingBOOL, _2, &fShowNameTags)); - // Don't allow toggling RLVaLoginLastLocation from the debug settings floater if (gSavedPerAccountSettings.controlExists(RLV_SETTING_LOGINLASTLOCATION)) gSavedPerAccountSettings.getControl(RLV_SETTING_LOGINLASTLOCATION)->setHiddenFromSettingsEditor(true); @@ -381,7 +384,7 @@ void RlvUtil::filterNames(std::string& strUTF8Text, bool fFilterLegacy) for (int idxAgent = 0, cntAgent = idAgents.size(); idxAgent < cntAgent; idxAgent++) { LLAvatarName avName; - if (LLAvatarNameCache::get(idAgents[idxAgent], &avName)) + if ( (LLAvatarNameCache::get(idAgents[idxAgent], &avName)) && (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, idAgents[idxAgent])) ) { const std::string& strDisplayName = avName.getDisplayName(); bool fFilterDisplay = (strDisplayName.length() > 2); @@ -529,6 +532,18 @@ bool RlvUtil::sendChatReply(S32 nChannel, const std::string& strUTF8Text) return true; } +void RlvUtil::teleportCallback(U64 hRegion, const LLVector3& posRegion, const LLVector3& vecLookAt) +{ + if (hRegion) + { + const LLVector3d posGlobal = from_region_handle(hRegion) + (LLVector3d)posRegion; + if (vecLookAt.isExactlyZero()) + gAgent.teleportViaLocation(posGlobal); + else + gAgent.teleportViaLocationLookAt(posGlobal, vecLookAt); + } +} + // ============================================================================ // Generic menu enablers // @@ -575,6 +590,12 @@ void rlvMenuToggleVisible() } } +bool rlvMenuCanShowName() +{ + const LLVOAvatar* pAvatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()); + return (pAvatar) && (RlvActions::canShowName(RlvActions::SNC_DEFAULT, pAvatar->getID())); +} + // Checked: 2010-04-23 (RLVa-1.2.0g) | Modified: RLVa-1.2.0g bool rlvMenuEnableIfNot(const LLSD& sdParam) { @@ -625,7 +646,7 @@ bool RlvSelectHasLockedAttach::apply(LLSelectNode* pNode) bool RlvSelectIsEditable::apply(LLSelectNode* pNode) { const LLViewerObject* pObj = pNode->getObject(); - return (pObj) && (!gRlvHandler.canEdit(pObj)); + return (pObj) && (!RlvActions::canEdit(pObj)); } // Checked: 2011-05-28 (RLVa-1.4.0a) | Modified: RLVa-1.4.0a diff --git a/indra/newview/rlvcommon.h b/indra/newview/rlvcommon.h index 89da91c9d0..9d586e1724 100644 --- a/indra/newview/rlvcommon.h +++ b/indra/newview/rlvcommon.h @@ -56,7 +56,7 @@ class RlvObject; struct RlvException; typedef boost::variant RlvExceptionOption; -typedef boost::variant RlvBehaviourModifierValue; +typedef boost::variant RlvBehaviourModifierValue; class RlvGCTimer; @@ -97,7 +97,6 @@ public: static bool getHideLockedAttach() { return rlvGetSetting(RLV_SETTING_HIDELOCKEDATTACH, false); } static bool getHideLockedInventory() { return rlvGetSetting(RLV_SETTING_HIDELOCKEDINVENTORY, false); } static bool getSharedInvAutoRename() { return rlvGetSetting(RLV_SETTING_SHAREDINVAUTORENAME, true); } - static bool getShowNameTags() { return fShowNameTags; } static bool getLoginLastLocation() { return rlvGetPerUserSetting(RLV_SETTING_LOGINLASTLOCATION, true); } static void updateLoginLastLocation(); @@ -114,7 +113,6 @@ protected: static bool fCanOOC; static bool fLegacyNaming; static bool fNoSetEnv; - static bool fShowNameTags; }; // ============================================================================ @@ -174,6 +172,7 @@ public: static bool sendChatReply(S32 nChannel, const std::string& strUTF8Text); static bool sendChatReply(const std::string& strChannel, const std::string& strUTF8Text); + static void teleportCallback(U64 hRegion, const LLVector3& posRegion, const LLVector3& vecLookAt); protected: static bool m_fForceTp; // @standtp }; @@ -199,6 +198,7 @@ typedef bool (RlvExtCommandHandler::*rlvExtCommandHandler)(const RlvCommand& rlv bool rlvMenuMainToggleVisible(LLUICtrl* pMenuItem); void rlvMenuToggleVisible(); +bool rlvMenuCanShowName(); bool rlvMenuEnableIfNot(const LLSD& sdParam); // ============================================================================ diff --git a/indra/newview/rlvdefines.h b/indra/newview/rlvdefines.h index c6e752b2bc..9d7ceec8bf 100644 --- a/indra/newview/rlvdefines.h +++ b/indra/newview/rlvdefines.h @@ -22,9 +22,9 @@ // // Version of the specifcation we support -const S32 RLV_VERSION_MAJOR = 2; -const S32 RLV_VERSION_MINOR = 8; -const S32 RLV_VERSION_PATCH = 0; +const S32 RLV_VERSION_MAJOR = 3; +const S32 RLV_VERSION_MINOR = 1; +const S32 RLV_VERSION_PATCH = 4; const S32 RLV_VERSION_BUILD = 0; // Implementation version @@ -66,13 +66,15 @@ const S32 RLVa_VERSION_BUILD = 0; #define RLV_ROOT_FOLDER "#RLV" #define RLV_CMD_PREFIX '@' +#define RLV_MODIFIER_TPLOCAL_DEFAULT 256.f // Any teleport that's more than a region away is non-local +#define RLV_MODIFIER_FARTOUCH_DEFAULT 1.5f // Specifies the default @fartouch distance +#define RLV_MODIFIER_SITTP_DEFAULT 1.5f // Specifies the default @sittp distance #define RLV_OPTION_SEPARATOR ";" // Default separator used in command options #define RLV_PUTINV_PREFIX "#RLV/~" #define RLV_PUTINV_SEPARATOR "/" #define RLV_PUTINV_MAXDEPTH 4 #define RLV_SETROT_OFFSET F_PI_BY_TWO // @setrot is off by 90° with the rest of SL #define RLV_STRINGS_FILE "rlva_strings.xml" -#define RLV_TELEPORT_LOCAL_RADIUS 256 // Any teleport that's more than a region away is non-local #define RLV_FOLDER_FLAG_NOSTRIP "nostrip" #define RLV_FOLDER_PREFIX_HIDDEN '.' @@ -104,13 +106,15 @@ enum ERlvBehaviour { RLV_BHVR_CHATWHISPER, // "chatwhisper" RLV_BHVR_CHATNORMAL, // "chatnormal" RLV_BHVR_CHATSHOUT, // "chatshout" - RLV_BHVR_SENDCHANNEL, // "sendchannel" + RLV_BHVR_SENDCHANNEL, + RLV_BHVR_SENDCHANNELEXCEPT, RLV_BHVR_SENDIM, // "sendim" RLV_BHVR_SENDIMTO, // "sendimto" RLV_BHVR_RECVIM, // "recvim" RLV_BHVR_RECVIMFROM, // "recvimfrom" RLV_BHVR_STARTIM, // "startim" RLV_BHVR_STARTIMTO, // "startimto" + RLV_BHVR_SENDGESTURE, RLV_BHVR_PERMISSIVE, // "permissive" RLV_BHVR_NOTIFY, // "notify" RLV_BHVR_SHOWINV, // "showinv" @@ -118,10 +122,13 @@ enum ERlvBehaviour { RLV_BHVR_SHOWWORLDMAP, // "showworldmap" RLV_BHVR_SHOWLOC, // "showloc" RLV_BHVR_SHOWNAMES, // "shownames" + RLV_BHVR_SHOWNAMETAGS, // "shownametags" RLV_BHVR_SHOWHOVERTEXT, // "showhovertext" RLV_BHVR_SHOWHOVERTEXTHUD, // "showhovertexthud" RLV_BHVR_SHOWHOVERTEXTWORLD, // "showhovertextworld" RLV_BHVR_SHOWHOVERTEXTALL, // "showhovertextall" + RLV_BHVR_SHOWSELF, + RLV_BHVR_SHOWSELFHEAD, RLV_BHVR_TPLM, // "tplm" RLV_BHVR_TPLOC, // "tploc" RLV_BHVR_TPLOCAL, @@ -188,13 +195,59 @@ enum ERlvBehaviour { RLV_BHVR_GETSTATUSALL, // "getstatusall" RLV_CMD_FORCEWEAR, // Internal representation of all force wear commands + // Camera (behaviours) + RLV_BHVR_SETCAM, // Gives an object exclusive control of the user's camera + RLV_BHVR_SETCAM_AVDISTMIN, // Enforces a minimum distance from the avatar (in m) + RLV_BHVR_SETCAM_AVDISTMAX, // Enforces a maximum distance from the avatar (in m) + RLV_BHVR_SETCAM_ORIGINDISTMIN, // Enforces a minimum distance from the camera origin (in m) + RLV_BHVR_SETCAM_ORIGINDISTMAX, // Enforces a maximum distance from the camera origin (in m) + RLV_BHVR_SETCAM_EYEOFFSET, // Changes the default camera offset + RLV_BHVR_SETCAM_FOCUSOFFSET, // Changes the default camera focus offset + RLV_BHVR_SETCAM_FOCUS, // Forces the camera focus and/or position to a specific object, avatar or position + RLV_BHVR_SETCAM_FOV, // Changes the current - vertical - field of view + RLV_BHVR_SETCAM_FOVMIN, // Enforces a minimum - vertical - FOV (in degrees) + RLV_BHVR_SETCAM_FOVMAX, // Enforces a maximum - vertical - FOV (in degrees) + RLV_BHVR_SETCAM_MOUSELOOK, // Prevent the user from going into mouselook + RLV_BHVR_SETCAM_TEXTURES, // Replaces all textures with the specified texture (or the default unrezzed one) + RLV_BHVR_SETCAM_UNLOCK, // Forces the camera focus to the user's avatar + // Camera (behaviours - deprecated) + RLV_BHVR_CAMZOOMMIN, // Enforces a minimum - vertical - FOV angle of 60° / multiplier + RLV_BHVR_CAMZOOMMAX, // Enforces a maximum - vertical - FOV angle of 60° / multiplier + // Camera (reply) + RLV_BHVR_GETCAM_AVDIST, // Returns the current minimum distance between the camera and the user's avatar + RLV_BHVR_GETCAM_AVDISTMIN, // Returns the active (if any) minimum distance between the camera and the user's avatar + RLV_BHVR_GETCAM_AVDISTMAX, // Returns the active (if any) maxmimum distance between the camera and the user's avatar + RLV_BHVR_GETCAM_FOV, // Returns the current field of view angle (in radians) + RLV_BHVR_GETCAM_FOVMIN, // Returns the active (if any) minimum field of view angle (in radians) + RLV_BHVR_GETCAM_FOVMAX, // Enforces a maximum (if any) maximum field of view angle (in radians) + RLV_BHVR_GETCAM_TEXTURES, // Returns the active (if any) replace texture UUID + // Camera (force) + RLV_BHVR_SETCAM_MODE, // Switch the user's camera into the specified mode (e.g. mouselook or thirdview) + RLV_BHVR_COUNT, RLV_BHVR_UNKNOWN }; enum ERlvBehaviourModifier { - RLV_MODIFIER_PLACEHOLDER, + RLV_MODIFIER_FARTOUCHDIST, // Radius of a sphere around the user in which they can interact with the world + RLV_MODIFIER_RECVIMDISTMIN, // Minimum distance to receive an IM from an otherwise restricted sender (squared value) + RLV_MODIFIER_RECVIMDISTMAX, // Maximum distance to receive an IM from an otherwise restricted sender (squared value) + RLV_MODIFIER_SENDIMDISTMIN, // Minimum distance to send an IM to an otherwise restricted recipient (squared value) + RLV_MODIFIER_SENDIMDISTMAX, // Maximum distance to send an IM to an otherwise restricted recipient (squared value) + RLV_MODIFIER_STARTIMDISTMIN, // Minimum distance to start an IM to an otherwise restricted recipient (squared value) + RLV_MODIFIER_STARTIMDISTMAX, // Maximum distance to start an IM to an otherwise restricted recipient (squared value) + RLV_MODIFIER_SETCAM_AVDISTMIN, // Minimum distance between the camera position and the user's avatar (normal value) + RLV_MODIFIER_SETCAM_AVDISTMAX, // Maximum distance between the camera position and the user's avatar (normal value) + RLV_MODIFIER_SETCAM_ORIGINDISTMIN, // Minimum distance between the camera position and the origin point (normal value) + RLV_MODIFIER_SETCAM_ORIGINDISTMAX, // Maximum distance between the camera position and the origin point (normal value) + RLV_MODIFIER_SETCAM_EYEOFFSET, // Specifies the default camera's offset from the camera (vector) + RLV_MODIFIER_SETCAM_FOCUSOFFSET, // Specifies the default camera's focus (vector) + RLV_MODIFIER_SETCAM_FOVMIN, // Minimum value for the camera's field of view (angle in radians) + RLV_MODIFIER_SETCAM_FOVMAX, // Maximum value for the camera's field of view (angle in radians) + RLV_MODIFIER_SETCAM_TEXTURE, // Specifies the UUID of the texture used to texture the world view + RLV_MODIFIER_SITTPDIST, + RLV_MODIFIER_TPLOCALDIST, RLV_MODIFIER_COUNT, RLV_MODIFIER_UNKNOWN @@ -294,7 +347,6 @@ enum ERlvAttachGroupType #define RLV_SETTING_LOGINLASTLOCATION "RLVaLoginLastLocation" #define RLV_SETTING_SHAREDINVAUTORENAME "RLVaSharedInvAutoRename" #define RLV_SETTING_SHOWASSERTIONFAIL "RLVaShowAssertionFailures" -#define RLV_SETTING_SHOWNAMETAGS "RLVaShowNameTags" #define RLV_SETTING_TOPLEVELMENU "RLVaTopLevelMenu" #define RLV_SETTING_WEARREPLACEUNLOCKED "RLVaWearReplaceUnlocked" @@ -309,6 +361,7 @@ enum ERlvAttachGroupType #define RLV_STRING_HIDDEN_PARCEL "hidden_parcel" #define RLV_STRING_HIDDEN_REGION "hidden_region" +#define RLV_STRING_BLOCKED_AUTOPILOT "blocked_autopilot" #define RLV_STRING_BLOCKED_GENERIC "blocked_generic" #define RLV_STRING_BLOCKED_PERMATTACH "blocked_permattach" #define RLV_STRING_BLOCKED_PERMTELEPORT "blocked_permteleport" @@ -318,6 +371,7 @@ enum ERlvAttachGroupType #define RLV_STRING_BLOCKED_STARTCONF "blocked_startconf" #define RLV_STRING_BLOCKED_STARTIM "blocked_startim" #define RLV_STRING_BLOCKED_TELEPORT "blocked_teleport" +#define RLV_STRING_BLOCKED_TELEPORT_OFFER "blocked_teleport_offer" #define RLV_STRING_BLOCKED_TPLUREREQ_REMOTE "blocked_tplurerequest_remote" #define RLV_STRING_BLOCKED_VIEWXXX "blocked_viewxxx" #define RLV_STRING_BLOCKED_WIREFRAME "blocked_wireframe" diff --git a/indra/newview/rlvfloaters.cpp b/indra/newview/rlvfloaters.cpp index 2ff3722797..f33fcc7220 100644 --- a/indra/newview/rlvfloaters.cpp +++ b/indra/newview/rlvfloaters.cpp @@ -74,20 +74,26 @@ std::string rlvGetItemType(const LLViewerInventoryItem* pItem) return "Unknown"; } -// Checked: 2010-03-11 (RLVa-1.2.0a) | Modified: RLVa-1.2.0g std::string rlvGetItemNameFromObjID(const LLUUID& idObj, bool fIncludeAttachPt = true) { const LLViewerObject* pObj = gObjectList.findObject(idObj); + if ( (pObj) && (pObj->isAvatar()) ) + { + LLAvatarName avName; + if (LLAvatarNameCache::get(pObj->getID(), &avName)) + return avName.getCompleteName(); + return ((LLVOAvatar*)pObj)->getFullname(); + } + const LLViewerObject* pObjRoot = (pObj) ? pObj->getRootEdit() : NULL; const LLViewerInventoryItem* pItem = ((pObjRoot) && (pObjRoot->isAttachment())) ? gInventory.getItem(pObjRoot->getAttachmentItemID()) : NULL; - std::string strItemName = (pItem) ? pItem->getName() : idObj.asString(); + const std::string strItemName = (pItem) ? pItem->getName() : idObj.asString(); if ( (!fIncludeAttachPt) || (!pObj) || (!pObj->isAttachment()) || (!isAgentAvatarValid()) ) return strItemName; - const LLViewerJointAttachment* pAttachPt = - get_if_there(gAgentAvatarp->mAttachmentPoints, RlvAttachPtLookup::getAttachPointIndex(pObjRoot), (LLViewerJointAttachment*)NULL); - std::string strAttachPtName = (pAttachPt) ? pAttachPt->getName() : std::string("Unknown"); + const LLViewerJointAttachment* pAttachPt = get_if_there(gAgentAvatarp->mAttachmentPoints, RlvAttachPtLookup::getAttachPointIndex(pObjRoot), (LLViewerJointAttachment*)NULL); + const std::string strAttachPtName = (pAttachPt) ? pAttachPt->getName() : std::string("Unknown"); return llformat("%s (%s%s)", strItemName.c_str(), strAttachPtName.c_str(), (pObj == pObjRoot) ? "" : ", child"); } @@ -105,6 +111,8 @@ bool rlvGetShowException(ERlvBehaviour eBhvr) case RLV_BHVR_TPREQUEST: case RLV_BHVR_ACCEPTTP: case RLV_BHVR_ACCEPTTPREQUEST: + case RLV_BHVR_SHOWNAMES: + case RLV_BHVR_SHOWNAMETAGS: return true; default: return false; @@ -275,15 +283,16 @@ BOOL RlvFloaterBehaviours::postBuild() return TRUE; } -// Checked: 2011-05-23 (RLVa-1.3.1c) | Modified: RLVa-1.3.1c void RlvFloaterBehaviours::refreshAll() { LLCtrlListInterface* pBhvrList = childGetListInterface("behaviour_list"); LLCtrlListInterface* pExceptList = childGetListInterface("exception_list"); - if ( (!pBhvrList) || (!pExceptList) ) + LLCtrlListInterface* pModifierList = childGetListInterface("modifier_list"); + if ( (!pBhvrList) || (!pExceptList) || (!pModifierList) ) return; pBhvrList->operateOnAll(LLCtrlListInterface::OP_DELETE); pExceptList->operateOnAll(LLCtrlListInterface::OP_DELETE); + pModifierList->operateOnAll(LLCtrlListInterface::OP_DELETE); if (!isAgentAvatarValid()) return; @@ -300,6 +309,11 @@ void RlvFloaterBehaviours::refreshAll() sdExceptColumns[1] = LLSD().with("column", "option").with("type", "text"); sdExceptColumns[2] = LLSD().with("column", "issuer").with("type", "text"); + LLSD sdModifierRow; LLSD& sdModifierColumns = sdModifierRow["columns"]; + sdModifierColumns[0] = LLSD().with("column", "modifier").with("type", "text"); + sdModifierColumns[1] = LLSD().with("column", "value").with("type", "text"); + sdModifierColumns[2] = LLSD().with("column", "primary").with("type", "text"); + // // List behaviours // @@ -353,6 +367,35 @@ void RlvFloaterBehaviours::refreshAll() } } } + + // + // List modifiers + // + for (int idxModifier = 0; idxModifier < RLV_MODIFIER_COUNT; idxModifier++) + { + const RlvBehaviourModifier* pBhvrModifier = RlvBehaviourDictionary::instance().m_BehaviourModifiers[idxModifier]; + if (pBhvrModifier) + { + sdModifierRow["enabled"] = (pBhvrModifier->hasValue()); + sdModifierColumns[0]["value"] = pBhvrModifier->getName(); + + if (pBhvrModifier->hasValue()) + { + const RlvBehaviourModifierValue& modValue = pBhvrModifier->getValue(); + if (typeid(float) == modValue.type()) + sdModifierColumns[1]["value"] = llformat("%f", boost::get(modValue)); + else if (typeid(int) == modValue.type()) + sdModifierColumns[1]["value"] = llformat("%d", boost::get(modValue)); + } + else + { + sdModifierColumns[1]["value"] = "(default)"; + } + + sdModifierColumns[2]["value"] = (pBhvrModifier->getPrimaryObject().notNull()) ? rlvGetItemNameFromObjID(pBhvrModifier->getPrimaryObject()) : LLStringUtil::null; + pModifierList->addElement(sdModifierRow, ADD_BOTTOM); + } + } } // ============================================================================ @@ -703,6 +746,11 @@ BOOL RlvFloaterConsole::postBuild() return TRUE; } +void RlvFloaterConsole::onClose(bool fQuitting) +{ + gRlvHandler.processCommand(gAgent.getID(), "clear", true); +} + void RlvFloaterConsole::addCommandReply(const std::string& strCommand, const std::string& strReply) { m_pOutputText->appendText(llformat("%s: ", strCommand.c_str()), true); diff --git a/indra/newview/rlvfloaters.h b/indra/newview/rlvfloaters.h index 683464694f..8238aa6888 100644 --- a/indra/newview/rlvfloaters.h +++ b/indra/newview/rlvfloaters.h @@ -142,6 +142,7 @@ private: */ public: BOOL postBuild() override; + void onClose(bool fQuitting) override; /* * Member functions diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index 8fc3b851c2..d162dc4bcc 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -24,21 +24,32 @@ #include "llmoveview.h" #include "llstartup.h" #include "llviewermessage.h" +#include "llviewermenu.h" #include "llviewerobjectlist.h" #include "llviewerparcelmgr.h" #include "llviewerregion.h" // Command specific includes +#include "llagentcamera.h" // @setcam and related +#include "llavatarnamecache.h" // @shownames +#include "llavatarlist.h" // @shownames #include "llenvmanager.h" // @setenv +#include "llfloatersidepanelcontainer.h"// @shownames #include "lloutfitslist.h" // @showinv - "Appearance / My Outfits" panel #include "llpaneloutfitsinventory.h" // @showinv - "Appearance" floater +#include "llpanelpeople.h" // @shownames #include "llpanelwearing.h" // @showinv - "Appearance / Current Outfit" panel #include "llsidepanelappearance.h" // @showinv - "Appearance / Edit appearance" panel #include "lltabcontainer.h" // @showinv - Tab container control for inventory tabs #include "lltoolmgr.h" // @edit +#include "llviewercamera.h" // @setcam and related +#include "llworldmapmessage.h" // @tpto +#include "llviewertexturelist.h" // @setcam_texture // RLVa includes +#include "rlvactions.h" #include "rlvfloaters.h" +#include "rlvactions.h" #include "rlvhandler.h" #include "rlvhelper.h" #include "rlvinventory.h" @@ -135,6 +146,23 @@ RlvHandler::~RlvHandler() // Behaviour related functions // +bool RlvHandler::findBehaviour(ERlvBehaviour eBhvr, std::list& lObjects) const +{ + lObjects.clear(); + for (const auto& objEntry : m_Objects) + if (objEntry.second.hasBehaviour(eBhvr, false)) + lObjects.push_back(&objEntry.second); + return !lObjects.empty(); +} + +bool RlvHandler::hasBehaviour(const LLUUID& idRlvObj, ERlvBehaviour eBhvr, const std::string& strOption) const +{ + rlv_object_map_t::const_iterator itObj = m_Objects.find(idRlvObj); + if (m_Objects.end() != itObj) + return itObj->second.hasBehaviour(eBhvr, strOption, false); + return false; +} + bool RlvHandler::hasBehaviourExcept(ERlvBehaviour eBhvr, const std::string& strOption, const LLUUID& idObj) const { for (rlv_object_map_t::const_iterator itObj = m_Objects.begin(); itObj != m_Objects.end(); ++itObj) @@ -293,7 +321,7 @@ ERlvCmdRet RlvHandler::processCommand(const RlvCommand& rlvCmd, bool fFromObj) case RLV_TYPE_ADD: // Checked: 2009-11-26 (RLVa-1.1.0f) | Modified: RLVa-1.1.0f { if ( (m_Behaviours[rlvCmd.getBehaviourType()]) && - ( (RLV_BHVR_SETDEBUG == rlvCmd.getBehaviourType()) || (RLV_BHVR_SETENV == rlvCmd.getBehaviourType()) ) ) + ( (RLV_BHVR_SETCAM == rlvCmd.getBehaviourType()) || (RLV_BHVR_SETDEBUG == rlvCmd.getBehaviourType()) || (RLV_BHVR_SETENV == rlvCmd.getBehaviourType()) ) ) { // Some restrictions can only be held by one single object to avoid deadlocks RLV_DEBUGS << "\t- " << rlvCmd.getBehaviour() << " is already set by another object => discarding" << RLV_ENDL; @@ -682,25 +710,6 @@ void RlvHandler::onTeleportFinished(const LLVector3d& posArrival) // String/chat censoring functions // -// Checked: 2010-03-06 (RLVa-1.2.0c) | Added: RLVa-1.1.0j -bool RlvHandler::canSit(LLViewerObject* pObj, const LLVector3& posOffset /*= LLVector3::zero*/) const -{ - // The user can sit on the specified object if: - // - not prevented from sitting - // - not prevented from standing up or not currently sitting - // - not standtp restricted or not currently sitting (if the user is sitting and tried to sit elsewhere the tp would just kick in) - // - not a regular sit (i.e. due to @sit:=force) - // - not @sittp=n or @fartouch=n restricted or if they clicked on a point within 1.5m of the avie's current position - return - ( (pObj) && (LL_PCODE_VOLUME == pObj->getPCode()) ) && - (!hasBehaviour(RLV_BHVR_SIT)) && - ( ((!hasBehaviour(RLV_BHVR_UNSIT)) && (!hasBehaviour(RLV_BHVR_STANDTP))) || - ((isAgentAvatarValid()) && (!gAgentAvatarp->isSitting())) ) && - ( ( (NULL != getCurrentCommand()) && (RLV_BHVR_SIT == getCurrentCommand()->getBehaviourType()) ) || - ( (!hasBehaviour(RLV_BHVR_SITTP)) && (!hasBehaviour(RLV_BHVR_FARTOUCH)) ) || - (dist_vec_squared(gAgent.getPositionGlobal(), pObj->getPositionGlobal() + LLVector3d(posOffset)) < 1.5f * 1.5f) ); -} - // Checked: 2010-04-11 (RLVa-1.3.0h) | Modified: RLVa-1.3.0h bool RlvHandler::canTouch(const LLViewerObject* pObj, const LLVector3& posOffset /*=LLVector3::zero*/) const { @@ -708,16 +717,17 @@ bool RlvHandler::canTouch(const LLViewerObject* pObj, const LLVector3& posOffset bool fCanTouch = (idRoot.notNull()) && ((pObj->isHUDAttachment()) || (!hasBehaviour(RLV_BHVR_TOUCHALL))) && ((!hasBehaviour(RLV_BHVR_TOUCHTHIS)) || (!isException(RLV_BHVR_TOUCHTHIS, idRoot, RLV_CHECK_PERMISSIVE))); + static RlvCachedBehaviourModifier s_nFartouchDist(RLV_MODIFIER_FARTOUCHDIST); if (fCanTouch) { if ( (!pObj->isAttachment()) || (!pObj->permYouOwner()) ) { // Rezzed prim or attachment worn by another avie - fCanTouch = + fCanTouch = ( (!hasBehaviour(RLV_BHVR_TOUCHWORLD)) || (isException(RLV_BHVR_TOUCHWORLD, idRoot, RLV_CHECK_PERMISSIVE)) ) && ( (!pObj->isAttachment()) || (!hasBehaviour(RLV_BHVR_TOUCHATTACHOTHER)) ) && - ( (!hasBehaviour(RLV_BHVR_FARTOUCH)) || - (dist_vec_squared(gAgent.getPositionGlobal(), pObj->getPositionGlobal() + LLVector3d(posOffset)) <= 1.5f * 1.5f) ); + ( (!hasBehaviour(RLV_BHVR_FARTOUCH)) || + (dist_vec_squared(gAgent.getPositionGlobal(), pObj->getPositionGlobal() + LLVector3d(posOffset)) <= s_nFartouchDist * s_nFartouchDist) ); } else if (!pObj->isHUDAttachment()) { @@ -832,7 +842,7 @@ bool RlvHandler::redirectChatOrEmote(const std::string& strUTF8Text) const endRedir = m_Exceptions.upper_bound(eBhvr); itRedir != endRedir; ++itRedir) { S32 nChannel = boost::get(itRedir->second.varOption); - if ( (!hasBehaviour(RLV_BHVR_SENDCHANNEL)) || (isException(RLV_BHVR_SENDCHANNEL, nChannel)) ) + if (RlvActions::canSendChannel(nChannel)) RlvUtil::sendChatReply(nChannel, strUTF8Text); } @@ -1268,6 +1278,7 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd) if (rlvCmd.isStrict()) addException(rlvCmd.getObjectID(), RLV_BHVR_PERMISSIVE, eBhvr); m_Behaviours[eBhvr]++; + rlvCmd.markRefCounted(); } else { @@ -1300,6 +1311,7 @@ ERlvCmdRet RlvCommandHandlerBaseImpl::processCommand(const RlvC if (rlvCmd.isStrict()) gRlvHandler.addException(rlvCmd.getObjectID(), RLV_BHVR_PERMISSIVE, eBhvr); gRlvHandler.m_Behaviours[eBhvr]++; + rlvCmd.markRefCounted(); } else { @@ -1369,10 +1381,19 @@ ERlvCmdRet RlvBehaviourGenericHandler::onCommand(const RlvC if ( (!rlvCmd.hasOption()) || (!pBhvrModifier) || (!pBhvrModifier->convertOptionValue(rlvCmd.getOption(), modValue)) ) return RLV_RET_FAILED_OPTION; + // HACK-RLVa: reference counting doesn't happen until control returns to our caller but the modifier callbacks will happen now so we need to adjust the reference counts here if (RLV_TYPE_ADD == rlvCmd.getParamType()) + { + gRlvHandler.m_Behaviours[rlvCmd.getBehaviourType()]++; pBhvrModifier->addValue(modValue, rlvCmd.getObjectID()); + gRlvHandler.m_Behaviours[rlvCmd.getBehaviourType()]--; + } else + { + gRlvHandler.m_Behaviours[rlvCmd.getBehaviourType()]--; pBhvrModifier->removeValue(modValue, rlvCmd.getObjectID()); + gRlvHandler.m_Behaviours[rlvCmd.getBehaviourType()]++; + } fRefCount = true; return RLV_RET_SUCCESS; @@ -1389,10 +1410,19 @@ ERlvCmdRet RlvBehaviourGenericHandler::onCommand(co RlvBehaviourModifier* pBhvrModifier = RlvBehaviourDictionary::instance().getModifierFromBehaviour(rlvCmd.getBehaviourType()); if ( (pBhvrModifier) && (pBhvrModifier->getAddDefault()) ) { + // HACK-RLVa: reference counting doesn't happen until control returns to our caller but the modifier callbacks will happen now so we need to adjust the reference counts here if (RLV_TYPE_ADD == rlvCmd.getParamType()) + { + gRlvHandler.m_Behaviours[rlvCmd.getBehaviourType()]++; pBhvrModifier->addValue(pBhvrModifier->getDefaultValue(), rlvCmd.getObjectID()); + gRlvHandler.m_Behaviours[rlvCmd.getBehaviourType()]--; + } else + { + gRlvHandler.m_Behaviours[rlvCmd.getBehaviourType()]--; pBhvrModifier->removeValue(pBhvrModifier->getDefaultValue(), rlvCmd.getObjectID()); + gRlvHandler.m_Behaviours[rlvCmd.getBehaviourType()]++; + } } fRefCount = true; @@ -1569,9 +1599,9 @@ void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour eBh RlvUIEnabler::instance().removeGenericFloaterFilter("beacons"); } -// Handles: @sendchannel[:]=n|y +// Handles: @sendchannel[:]=n|y and @sendchannel_except[:]=n|y template<> template<> -ERlvCmdRet RlvBehaviourHandler::onCommand(const RlvCommand& rlvCmd, bool& fRefCount) +ERlvCmdRet RlvBehaviourSendChannelHandler::onCommand(const RlvCommand& rlvCmd, bool& fRefCount) { // If there's an option then it should be a valid (= positive and non-zero) chat channel if (rlvCmd.hasOption()) @@ -1592,6 +1622,59 @@ ERlvCmdRet RlvBehaviourHandler::onCommand(const RlvCommand return RLV_RET_SUCCESS; } +// Handles: @recvim[:]=n|y, @sendim[:]=n|y and @startim[:]=n|y +template<> template<> +ERlvCmdRet RlvBehaviourRecvSendStartIMHandler::onCommand(const RlvCommand& rlvCmd, bool& fRefCount) +{ + ERlvCmdRet eRet = RlvBehaviourGenericHandler::onCommand(rlvCmd, fRefCount); + if ( (RLV_RET_SUCCESS != eRet) && (rlvCmd.hasOption()) ) + { + // Check for [;] option + std::vector optionList; float nDistMin = F32_MAX, nDistMax = F32_MAX; + if ( (!RlvCommandOptionHelper::parseStringList(rlvCmd.getOption(), optionList)) || (optionList.size() > 2) || + (!RlvCommandOptionHelper::parseOption(optionList[0], nDistMin)) || (nDistMin < 0) || + ( (optionList.size() >= 2) && (!RlvCommandOptionHelper::parseOption(optionList[1], nDistMax)) ) || (nDistMax < 0) ) + { + return RLV_RET_FAILED_OPTION; + } + + // Valid option(s) - figure out which modifier(s) to change + ERlvBehaviourModifier eModDistMin, eModDistMax; + switch (rlvCmd.getBehaviourType()) + { + case RLV_BHVR_RECVIM: + eModDistMin = RLV_MODIFIER_RECVIMDISTMIN; eModDistMax = RLV_MODIFIER_RECVIMDISTMAX; + break; + case RLV_BHVR_SENDIM: + eModDistMin = RLV_MODIFIER_SENDIMDISTMIN; eModDistMax = RLV_MODIFIER_SENDIMDISTMAX; + break; + case RLV_BHVR_STARTIM: + eModDistMin = RLV_MODIFIER_STARTIMDISTMIN; eModDistMax = RLV_MODIFIER_STARTIMDISTMAX; + break; + default: + return RLV_RET_FAILED_OPTION; + } + + RlvBehaviourModifier *pBhvrModDistMin = RlvBehaviourDictionary::instance().getModifier(eModDistMin), *pBhvrModDistMax = RlvBehaviourDictionary::instance().getModifier(eModDistMax); + if (RLV_TYPE_ADD == rlvCmd.getParamType()) + { + pBhvrModDistMin->addValue(nDistMin * nDistMin, rlvCmd.getObjectID()); + if (optionList.size() >= 2) + pBhvrModDistMax->addValue(nDistMax * nDistMax, rlvCmd.getObjectID()); + } + else + { + pBhvrModDistMin->removeValue(nDistMin * nDistMin, rlvCmd.getObjectID()); + if (optionList.size() >= 2) + pBhvrModDistMax->removeValue(nDistMax * nDistMax, rlvCmd.getObjectID()); + } + + fRefCount = true; + return RLV_RET_SUCCESS; + } + return eRet; +} + // Handles: @sendim=n|y toggles template<> template<> void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour eBhvr, bool fHasBhvr) @@ -1599,7 +1682,153 @@ void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour e gSavedPerAccountSettings.getControl("DoNotDisturbModeResponse")->setHiddenFromSettingsEditor(fHasBhvr); } -// Handles: @edit=n|y toggles +// Handles: @setcam_avdistmin:=n|y changes +template<> +void RlvBehaviourModifierHandler::onValueChange() const +{ + if ( (gAgentCamera.cameraMouselook()) && (!RlvActions::canChangeToMouselook()) ) + gAgentCamera.changeCameraToThirdPerson(); +} + +// Handles: @setcam_eyeoffset:=n|y and @setcam_focusoffset:=n|y toggles +template<> template<> +void RlvBehaviourCamEyeFocusOffsetHandler::onCommandToggle(ERlvBehaviour eBhvr, bool fHasBhvr) +{ + if (fHasBhvr) + { + gAgentCamera.switchCameraPreset(CAMERA_RLV_SETCAM_VIEW); + } + else + { + const RlvBehaviourModifier* pBhvrEyeModifier = RlvBehaviourDictionary::instance().getModifier(RLV_MODIFIER_SETCAM_EYEOFFSET); + const RlvBehaviourModifier* pBhvrOffsetModifier = RlvBehaviourDictionary::instance().getModifier(RLV_MODIFIER_SETCAM_FOCUSOFFSET); + if ( (!pBhvrEyeModifier->hasValue()) && (!pBhvrOffsetModifier->hasValue()) ) + gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW); + } +} + +// Handles: @setcam_eyeoffset:=n|y changes +template<> +void RlvBehaviourModifierHandler::onValueChange() const +{ + if (RlvBehaviourModifier* pBhvrModifier = RlvBehaviourDictionary::instance().getModifier(RLV_MODIFIER_SETCAM_EYEOFFSET)) + { + LLControlVariable* pControl = gSavedSettings.getControl("CameraOffsetRLVaView"); + if (pBhvrModifier->hasValue()) + pControl->setValue(pBhvrModifier->getValue().getValue()); + else + pControl->resetToDefault(); + } +} + +// Handles: @setcam_focusoffset:=n|y changes +template<> +void RlvBehaviourModifierHandler::onValueChange() const +{ + if (RlvBehaviourModifier* pBhvrModifier = RlvBehaviourDictionary::instance().getModifier(RLV_MODIFIER_SETCAM_FOCUSOFFSET)) + { + LLControlVariable* pControl = gSavedSettings.getControl("FocusOffsetRLVaView"); + if (pBhvrModifier->hasValue()) + pControl->setValue(pBhvrModifier->getValue().getValue()); + else + pControl->resetToDefault(); + } +} + +// Handles: @setcam_fovmin:=n|y changes +template<> +void RlvBehaviourModifierHandler::onValueChange() const +{ + LLViewerCamera::instance().setDefaultFOV(LLViewerCamera::instance().getDefaultFOV()); +} + +// Handles: @setcam_fovmax:=n|y changes +template<> +void RlvBehaviourModifierHandler::onValueChange() const +{ + LLViewerCamera::instance().setDefaultFOV(LLViewerCamera::instance().getDefaultFOV()); +} + +// Handles: @setcam_mouselook=n|y toggles +template<> template<> +void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour eBhvr, bool fHasBhvr) +{ + if ((fHasBhvr) && (gAgentCamera.cameraMouselook())) + gAgentCamera.changeCameraToThirdPerson(); +} + +// Handles: @setcam_textures[:=n|y changes +template<> +void RlvBehaviourModifierHandler::onValueChange() const +{ + if (RlvBehaviourModifier* pBhvrModifier = RlvBehaviourDictionary::instance().getModifier(RLV_MODIFIER_SETCAM_TEXTURE)) + { + if (pBhvrModifier->hasValue()) + { + RLV_INFOS << "Toggling diffuse textures for @setcam_textures" << RLV_ENDL; + LLViewerFetchedTexture::sDefaultDiffuseImagep = LLViewerTextureManager::getFetchedTexture(pBhvrModifier->getValue(), FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + gObjectList.setAllObjectDefaultTextures(LLRender::DIFFUSE_MAP, true); + } + else + { + RLV_INFOS << "Restoring diffuse textures for @setcam_textures" << RLV_ENDL; + gObjectList.setAllObjectDefaultTextures(LLRender::DIFFUSE_MAP, false); + LLViewerFetchedTexture::sDefaultDiffuseImagep = nullptr; + } + } +} + +// Handles: @setcam_unlock=n|y toggles +template<> template<> +void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour eBhvr, bool fHasBhvr) +{ + if (fHasBhvr) + handle_reset_view(); +} + +// Handles: @setcam=n|y toggles +template<> template<> +void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour eBhvr, bool fHasBhvr) +{ + // Once an object has exclusive control over the camera only its behaviours should be active. This affects: + // - behaviour modifiers => it's all handled for us once we set the primary object + // - RLV_BHVR_SETCAM_UNLOCK => manually (re)set the reference count (and possibly invoke the toggle handler) + + LLUUID idRlvObject; bool fHasCamUnlock = gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM_UNLOCK); + if (fHasBhvr) + { + // Get the UUID of the primary object + std::list lObjects; + gRlvHandler.findBehaviour(RLV_BHVR_SETCAM, lObjects); + idRlvObject = lObjects.front()->getObjectID(); + // Reset the @setcam_unlock reference count + gRlvHandler.m_Behaviours[RLV_BHVR_SETCAM_UNLOCK] = (lObjects.front()->hasBehaviour(RLV_BHVR_SETCAM_UNLOCK, false)) ? 1 : 0; + } + else + { + std::list lObjects; + // Restore the @setcam_unlock reference count + gRlvHandler.findBehaviour(RLV_BHVR_SETCAM_UNLOCK, lObjects); + gRlvHandler.m_Behaviours[RLV_BHVR_SETCAM_UNLOCK] = lObjects.size(); + } + + // Manually invoke the @setcam_unlock toggle handler if we toggled it on/off + if (fHasCamUnlock != gRlvHandler.hasBehaviour(RLV_BHVR_SETCAM_UNLOCK)) + RlvBehaviourToggleHandler::onCommandToggle(RLV_BHVR_SETCAM_UNLOCK, !fHasCamUnlock); + + gAgentCamera.switchCameraPreset( (fHasBhvr) ? CAMERA_RLV_SETCAM_VIEW : CAMERA_PRESET_REAR_VIEW ); + RlvBehaviourDictionary::instance().getModifier(RLV_MODIFIER_SETCAM_AVDISTMIN)->setPrimaryObject(idRlvObject); + RlvBehaviourDictionary::instance().getModifier(RLV_MODIFIER_SETCAM_AVDISTMAX)->setPrimaryObject(idRlvObject); + RlvBehaviourDictionary::instance().getModifier(RLV_MODIFIER_SETCAM_ORIGINDISTMIN)->setPrimaryObject(idRlvObject); + RlvBehaviourDictionary::instance().getModifier(RLV_MODIFIER_SETCAM_ORIGINDISTMAX)->setPrimaryObject(idRlvObject); + RlvBehaviourDictionary::instance().getModifier(RLV_MODIFIER_SETCAM_EYEOFFSET)->setPrimaryObject(idRlvObject); + RlvBehaviourDictionary::instance().getModifier(RLV_MODIFIER_SETCAM_FOCUSOFFSET)->setPrimaryObject(idRlvObject); + RlvBehaviourDictionary::instance().getModifier(RLV_MODIFIER_SETCAM_FOVMIN)->setPrimaryObject(idRlvObject); + RlvBehaviourDictionary::instance().getModifier(RLV_MODIFIER_SETCAM_FOVMAX)->setPrimaryObject(idRlvObject); + RlvBehaviourDictionary::instance().getModifier(RLV_MODIFIER_SETCAM_TEXTURE)->setPrimaryObject(idRlvObject); +} + +// Handles: @setdebug=n|y toggles template<> template<> void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour eBhvr, bool fHasBhvr) { @@ -1718,6 +1947,100 @@ void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour RlvUIEnabler::instance().removeGenericFloaterFilter("inventory"); } +// Handles: @shownames[:]=n|y toggles +template<> template<> +void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour eBhvr, bool fHasBhvr) +{ + if (LLApp::isQuitting()) + return; // Nothing to do if the viewer is shutting down + + // Update the shownames context + RlvActions::setShowName(RlvActions::SNC_DEFAULT, !fHasBhvr); + + // Refresh the nearby people list + LLPanelPeople* pPeoplePanel = LLFloaterSidePanelContainer::getPanel("people", "panel_people"); + RLV_ASSERT( (pPeoplePanel) && (pPeoplePanel->getNearbyList()) ); + if ( (pPeoplePanel) && (pPeoplePanel->getNearbyList()) ) + { + if (pPeoplePanel->getNearbyList()->isInVisibleChain()) + pPeoplePanel->onCommit(); + pPeoplePanel->getNearbyList()->updateAvatarNames(); + } + + // Force the use of the "display name" cache so we can filter both display and legacy names (or return back to the user's preference) + if (fHasBhvr) + { + LLAvatarNameCache::setForceDisplayNames(true); + } + else + { + LLAvatarNameCache::setForceDisplayNames(false); + LLAvatarNameCache::setUseDisplayNames(gSavedSettings.getBOOL("UseDisplayNames")); + } + + // Refresh all name tags and HUD text + LLVOAvatar::invalidateNameTags(); + LLHUDText::refreshAllObjectText(); +} + +// Handles: @shownames[:]=n|y +template<> template<> +ERlvCmdRet RlvBehaviourHandler::onCommand(const RlvCommand& rlvCmd, bool& fRefCount) +{ + ERlvCmdRet eRet = RlvBehaviourGenericHandler::onCommand(rlvCmd, fRefCount); + if ( (RLV_RET_SUCCESS == eRet) && (rlvCmd.hasOption()) && (!LLApp::isQuitting()) ) + { + const LLUUID idAgent = RlvCommandOptionHelper::parseOption(rlvCmd.getOption()); + + // Refresh the nearby people list (if necessary) + LLPanelPeople* pPeoplePanel = LLFloaterSidePanelContainer::getPanel("people", "panel_people"); + RLV_ASSERT( (pPeoplePanel) && (pPeoplePanel->getNearbyList()) ); + if ( (pPeoplePanel) && (pPeoplePanel->getNearbyList()) && (pPeoplePanel->getNearbyList()->contains(idAgent)) ) + { + if (pPeoplePanel->getNearbyList()->isInVisibleChain()) + pPeoplePanel->onCommit(); + pPeoplePanel->getNearbyList()->updateAvatarNames(); + } + + // Refresh that avatar's name tag and all HUD text + LLVOAvatar::invalidateNameTag(idAgent); + LLHUDText::refreshAllObjectText(); + } + return eRet; +} + +// Handles: @shownametags[:]=n|y toggles +template<> template<> +void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour eBhvr, bool fHasBhvr) +{ + if (LLApp::isQuitting()) + return; // Nothing to do if the viewer is shutting down + + // Update the shownames context + RlvActions::setShowName(RlvActions::SNC_NAMETAG, !fHasBhvr); + + // Refresh all name tags + LLVOAvatar::invalidateNameTags(); +} + +// Handles: @shownametags[:]=n|y +template<> template<> +ERlvCmdRet RlvBehaviourHandler::onCommand(const RlvCommand& rlvCmd, bool& fRefCount) +{ + ERlvCmdRet eRet = RlvBehaviourGenericHandler::onCommand(rlvCmd, fRefCount); + if ( (RLV_RET_SUCCESS == eRet) && (rlvCmd.hasOption()) ) + LLVOAvatar::invalidateNameTag(RlvCommandOptionHelper::parseOption(rlvCmd.getOption())); + return eRet; +} + +// Handles: @showself=n|y and @showselfhead=n|y toggles +template<> template<> +void RlvBehaviourShowSelfToggleHandler::onCommandToggle(ERlvBehaviour eBvhr, bool fHasBhvr) +{ + if (isAgentAvatarValid()) + gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode()); +} + // ============================================================================ // Command handlers (RLV_TYPE_FORCE) // @@ -1877,6 +2200,140 @@ ERlvCmdRet RlvForceHandler::onCommand(const RlvCommand& rlvC return RLV_RET_SUCCESS; } +// Handles: @setcam_eyeoffset[:]=force and @setcam_focusoffset[:]=force +template<> template<> +ERlvCmdRet RlvForceCamEyeFocusOffsetHandler::onCommand(const RlvCommand& rlvCmd) +{ + // Enforce exclusive camera locks + if (!RlvActions::canChangeCameraPreset(rlvCmd.getObjectID())) + return RLV_RET_FAILED_LOCK; + + LLControlVariable* pOffsetControl = gSavedSettings.getControl("CameraOffsetRLVaView"); + LLControlVariable* pFocusControl = gSavedSettings.getControl("FocusOffsetRLVaView"); + LLControlVariable* pControl = (rlvCmd.getBehaviourType() == RLV_BHVR_SETCAM_EYEOFFSET) ? pOffsetControl : pFocusControl; + if (rlvCmd.hasOption()) + { + LLVector3 vecOffset; + if (!RlvCommandOptionHelper::parseOption(rlvCmd.getOption(), vecOffset)) + return RLV_RET_FAILED_OPTION; + pControl->setValue(vecOffset.getValue()); + } + else + { + pControl->resetToDefault(); + } + + gAgentCamera.switchCameraPreset( ((pOffsetControl->isDefault()) && (pFocusControl->isDefault())) ? CAMERA_PRESET_REAR_VIEW : CAMERA_RLV_SETCAM_VIEW); + return RLV_RET_SUCCESS; +} + +// Handles: @setcam_focus:[;[;]]=force +template<> template<> +ERlvCmdRet RlvForceHandler::onCommand(const RlvCommand& rlvCmd) +{ + std::vector optionList; + if (!RlvCommandOptionHelper::parseStringList(rlvCmd.getOption(), optionList)) + return RLV_RET_FAILED_OPTION; + + LLVector3 posAgent; + LLVector3d posGlobal; + F32 camDistance; + + // Get the focus position/object (and verify it is known) + LLUUID idObject; LLVector3 posRegion; + if (RlvCommandOptionHelper::parseOption(optionList[0], idObject)) + { + const LLViewerObject* pObj = gObjectList.findObject(idObject); + if (!pObj) + return RLV_RET_FAILED_OPTION; + if (!pObj->isAvatar()) + { + posAgent = pObj->getPositionAgent(); + posGlobal = pObj->getPositionGlobal(); + } + else + { + /*const*/ LLVOAvatar* pAvatar = (/*const*/ LLVOAvatar*)pObj; + if (pAvatar->mHeadp) + { + posAgent = pAvatar->mHeadp->getWorldPosition(); + posGlobal = pAvatar->getPosGlobalFromAgent(posAgent); + } + } + camDistance = pObj->getScale().magVec(); + } + else if (RlvCommandOptionHelper::parseOption(optionList[0], posRegion)) + { + const LLViewerRegion* pRegion = gAgent.getRegion(); + if (!pRegion) + return RLV_RET_FAILED_UNKNOWN; + posAgent = pRegion->getPosAgentFromRegion(posRegion); + posGlobal = pRegion->getPosGlobalFromRegion(posRegion); + camDistance = 0.0f; + } + else + { + return RLV_RET_FAILED_OPTION; + } + + // Get the camera distance + if ( (optionList.size() > 1) && (!optionList[1].empty()) ) + { + if (!RlvCommandOptionHelper::parseOption(optionList[1], camDistance)) + return RLV_RET_FAILED_OPTION; + } + + // Get the directional vector (or calculate it from the current camera position) + LLVector3 camDirection; + if ( (optionList.size() > 2) && (!optionList[2].empty()) ) + { + if (!RlvCommandOptionHelper::parseOption(optionList[2], camDirection)) + return RLV_RET_FAILED_OPTION; + } + else + { + camDirection = LLViewerCamera::getInstance()->getOrigin() - posAgent; + } + camDirection.normVec(); + + // Move the camera in place + gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); + gAgentCamera.setCameraPosAndFocusGlobal(posGlobal + LLVector3d(camDirection * llmax(F_APPROXIMATELY_ZERO, camDistance)), posGlobal, idObject); + + return RLV_RET_SUCCESS; +} + +// Handles: @setcam_fov[:]=force +template<> template<> +ERlvCmdRet RlvForceHandler::onCommand(const RlvCommand& rlvCmd) +{ + if (!RlvActions::canChangeCameraFOV(rlvCmd.getObjectID())) + return RLV_RET_FAILED_LOCK; + + F32 nFOV = DEFAULT_FIELD_OF_VIEW; + if ( (rlvCmd.hasOption()) && (!RlvCommandOptionHelper::parseOption(rlvCmd.getOption(), nFOV)) ) + return RLV_RET_FAILED_OPTION; + + LLViewerCamera::getInstance()->setDefaultFOV(nFOV); + return RLV_RET_SUCCESS; +} + +// Handles: @setcam_mode[: + blocked_autopilot + + value + Unable to use the autopilot due to RLV restrictions + blocked_generic value @@ -76,6 +81,11 @@ value Unable to initiate teleport due to RLV restrictions + blocked_teleport_offer + + value + Unable to offer teleport due to RLV restrictions + blocked_viewxxx value