diff --git a/indra/llcommon/llchat.h b/indra/llcommon/llchat.h index 620a75cdb..f7456eda0 100644 --- a/indra/llcommon/llchat.h +++ b/indra/llcommon/llchat.h @@ -75,14 +75,15 @@ public: : mText(text), mFromName(), mFromID(), -// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) - mRlvLocFiltered(FALSE), - mRlvNamesFiltered(FALSE), -// [/RLVa:KB] + mSourceType(CHAT_SOURCE_AGENT), mChatType(CHAT_TYPE_NORMAL), mAudible(CHAT_AUDIBLE_FULLY), mMuted(FALSE), +// [RLVa:KB] - Checked: 2010-04-22 (RLVa-1.2.0f) | Modified: RLVa-1.0.0a + mRlvLocFiltered(FALSE), + mRlvNamesFiltered(FALSE), +// [/RLVa:KB] mTime(0.0), mPosAgent(), mURL() @@ -104,14 +105,14 @@ public: std::string mText; // UTF-8 line of text std::string mFromName; // agent or object name LLUUID mFromID; // agent id or object id -// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) - BOOL mRlvLocFiltered; - BOOL mRlvNamesFiltered; -// [/RLVa:KB] EChatSourceType mSourceType; EChatType mChatType; EChatAudible mAudible; BOOL mMuted; // pass muted chat to maintain list of chatters +// [RLVa:KB] - Checked: 2010-04-22 (RLVa-1.2.0f) | Modified: RLVa-1.0.0a + BOOL mRlvLocFiltered; + BOOL mRlvNamesFiltered; +// [/RLVa:KB] F64 mTime; // viewer only, seconds from viewer start LLVector3 mPosAgent; std::string mURL; diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index 4add3009f..07d4854c4 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -48,7 +48,7 @@ namespace LLAvatarNameCache // supports it. bool sUseDisplayNames = true; -// [RLVa:KB] - Checked: 2010-12-08 (RLVa-1.2.2c) | Added: RLVa-1.2.2c +// [RLVa:KB] - Checked: 2010-12-08 (RLVa-1.4.0a) | Added: RLVa-1.2.2c // RLVa override for display names bool sForceDisplayNames = false; // [/RLVa:KB] @@ -733,7 +733,7 @@ void LLAvatarNameCache::get(const LLUUID& agent_id, callback_slot_t slot) } } -// [RLVa:KB] - Checked: 2010-12-08 (RLVa-1.2.2c) | Added: RLVa-1.2.2c +// [RLVa:KB] - Checked: 2010-12-08 (RLVa-1.4.0a) | Added: RLVa-1.2.2c bool LLAvatarNameCache::getForceDisplayNames() { return sForceDisplayNames; @@ -751,7 +751,7 @@ void LLAvatarNameCache::setForceDisplayNames(bool force) void LLAvatarNameCache::setUseDisplayNames(bool use) { -// [RLVa:KB] - Checked: 2010-12-08 (RLVa-1.2.2c) | Added: RLVa-1.2.2c +// [RLVa:KB] - Checked: 2010-12-08 (RLVa-1.4.0a) | Added: RLVa-1.2.2c // We need to force the use of the "display names" cache when @shownames=n restricted (and disallow toggling it) use |= getForceDisplayNames(); // [/RLVa:KB] diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h index 41eb64a06..3846463f1 100644 --- a/indra/llmessage/llavatarnamecache.h +++ b/indra/llmessage/llavatarnamecache.h @@ -80,7 +80,7 @@ namespace LLAvatarNameCache void setUseDisplayNames(bool use); bool useDisplayNames(); -// [RLVa:KB] - Checked: 2010-12-08 (RLVa-1.2.2c) | Added: RLVa-1.2.2c +// [RLVa:KB] - Checked: 2010-12-08 (RLVa-1.4.0a) | Added: RLVa-1.2.2c bool getForceDisplayNames(); void setForceDisplayNames(bool force); // [/RLVa:KB] diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 485ab205f..eac3d57ab 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -755,6 +755,11 @@ bool LLGLManager::initGL() } #endif + if (mIsIntel && mGLVersion <= 3.f) + { //never try to use framebuffer objects on older intel drivers (crashy) + mHasFramebufferObject = FALSE; + } + if (mHasFramebufferObject) { glGetIntegerv(GL_MAX_SAMPLES, &mMaxSamples); @@ -1891,7 +1896,7 @@ void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask) glClientActiveTextureARB(GL_TEXTURE0_ARB); gGL.getTexUnit(0)->activate(); - if (gGLManager.mHasVertexShader) + if (gGLManager.mHasVertexShader && LLGLSLShader::sNoFixedFunction) { //make sure vertex attribs are all disabled GLint count; glGetIntegerv(GL_MAX_VERTEX_ATTRIBS_ARB, &count); diff --git a/indra/llrender/llgltypes.h b/indra/llrender/llgltypes.h index 9b0e81fae..6c217ef72 100644 --- a/indra/llrender/llgltypes.h +++ b/indra/llrender/llgltypes.h @@ -2,31 +2,25 @@ * @file llgltypes.h * @brief LLGL definition * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index dc0cf9c87..89b43f212 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -731,6 +731,13 @@ std::string LLNotification::getLabel() const return label; } +// [SL:KB] - Patch: UI-Notifications | Checked: 2011-04-11 (Catznip-2.5.0a) | Added: Catznip-2.5.0a +bool LLNotification::hasLabel() const +{ + return !mTemplatep->mLabel.empty(); +} +// [/SL:KB] + std::string LLNotification::getURL() const { if (!mTemplatep) diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index aac44ddf1..b6ee760f3 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -385,6 +385,10 @@ public: return mTimestamp; } +// [SL:KB] - Patch: UI-Notifications | Checked: 2011-04-11 (Catznip-2.5.0a) | Added: Catznip-2.5.0a + bool hasLabel() const; +// [/SL:KB] + std::string getType() const; std::string getMessage() const; std::string getLabel() const; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 96169caf2..14e6235b4 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -147,7 +147,6 @@ set(viewer_SOURCE_FILES llcolorswatch.cpp llcommandhandler.cpp llcommandlineparser.cpp - llcompass.cpp llcompilequeue.cpp llconfirmationmanager.cpp llconsole.cpp @@ -557,7 +556,7 @@ set(viewer_SOURCE_FILES rlvinventory.cpp rlvextensions.cpp rlvfloaterbehaviour.cpp - rlvviewer2.cpp + rlvui.cpp shcommandhandler.cpp shfloatermediaticker.cpp ) @@ -638,7 +637,6 @@ set(viewer_HEADER_FILES llcolorswatch.h llcommandhandler.h llcommandlineparser.h - llcompass.h llcompilequeue.h llconfirmationmanager.h llconsole.h @@ -1060,8 +1058,8 @@ set(viewer_HEADER_FILES rlvinventory.h rlvextensions.h rlvfloaterbehaviour.h - rlvviewer2.h - shcommandhandler.h + rlvui.h + shcommandhandler.h shfloatermediaticker.h ) diff --git a/indra/newview/app_settings/settings_rlv.xml b/indra/newview/app_settings/settings_rlv.xml index 598f05fe8..bb385a033 100644 --- a/indra/newview/app_settings/settings_rlv.xml +++ b/indra/newview/app_settings/settings_rlv.xml @@ -24,6 +24,28 @@ Value 0 + RestrainedLoveCanOOC + + Comment + Allows sending OOC chat when send chat restricted, or seeing OOC chat when receive chat restricted + Persist + 1 + Type + Boolean + Value + 1 + + RestrainedLoveForbidGiveToRLV + + Comment + When TRUE, forbids to give sub-folders to the #RLV RestrainedLove folder. + Persist + 1 + Type + Boolean + Value + 0 + RestrainedLoveNoSetEnv Comment @@ -54,12 +76,23 @@ 1 Type String - Value - - - RestrainedLoveStackWhenFolderBeginsWith - - Comment + Value + + + RestrainedLoveShowEllipsis + + Comment + When TRUE, show "..." when someone speaks, while the avatar is prevented from hearing. When FALSE, don't show anything. + Persist + 1 + Type + Boolean + Value + 1 + + RestrainedLoveStackWhenFolderBeginsWith + + Comment If a folder name begins with this string, its attach behavior will always be "stack", never "replace". Default is "+". Persist 1 @@ -79,17 +112,6 @@ Value 0 - RestrainedLoveForbidGiveToRLV - - Comment - When FALSE, allows to give sub-folders to the #RLV RestrainedLove folder. - Persist - 1 - Type - Boolean - Value - 1 - RLVaEnableCompositeFolders Comment @@ -121,7 +143,7 @@ Type Boolean Value - 0 + 1 RLVaHideLockedLayers @@ -156,6 +178,17 @@ Value 1 + RLVaShowAssertionFailures + + Comment + Notify the user when an assertion fails + Persist + 1 + Type + Boolean + Value + 1 + RLVaShowNameTags Comment @@ -167,6 +200,28 @@ Value 0 + RLVaTopLevelMenu + + Comment + Show the RLVa specific menu as a top level menu + Persist + 1 + Type + Boolean + Value + 1 + + RLVaWearReplaceUnlocked + + Comment + Don't block wear replace when at least one attachment on the target attachment point is non-detachable + Persist + 1 + Type + Boolean + Value + 0 + WarnFirstRLVGiveToRLV Comment @@ -178,6 +233,39 @@ Value 1 + ForceInitialCOFDelay + + Comment + Number of seconds to delay initial processing of COF contents + Persist + 1 + Type + F32 + Value + 0.0 + + ForceMissingType + + Comment + Force this wearable type to be missing from COF + Persist + 1 + Type + U32 + Value + 255 + + VerifyInitialWearables + + Comment + Compares the initial wearables to the COF contents to determine which one to use for the intial outfit + Persist + 1 + Type + Boolean + Value + 0 + diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index f2150ae2d..2f878c450 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -2,31 +2,25 @@ * @file llagent.cpp * @brief LLAgent class implementation * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -165,6 +159,14 @@ void LLAgentFriendObserver::changed(U32 mask) } } +// static +void LLAgent::parcelChangedCallback() +{ + bool can_edit = LLToolMgr::getInstance()->canEdit(); + + gAgent.mCanEditParcel = can_edit; +} + // ************************************************************ // Enabled this definition to compile a 'hacked' viewer that // locally believes the end user has godlike powers. @@ -191,7 +193,10 @@ LLAgent::LLAgent() : mDoubleTapRunMode(DOUBLETAP_NONE), mbAlwaysRun(false), - mbRunning(false), +// mbRunning(false), +// [RLVa:KB] - Checked: 2011-05-11 (RLVa-1.3.0i) | Added: RLVa-1.3.0i + mbTempRun(false), +// [/RLVa:KB] mbTeleportKeepsLookAt(false), mAgentAccess(new LLAgentAccess(gSavedSettings)), @@ -270,7 +275,9 @@ void LLAgent::init() gSavedSettings.getControl("PreferredMaturity")->getValidateSignal()->connect(boost::bind(&LLAgent::validateMaturity, this, _2)); gSavedSettings.getControl("PreferredMaturity")->getSignal()->connect(boost::bind(&LLAgent::handleMaturity, this, _2)); - + + LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback(boost::bind(&LLAgent::parcelChangedCallback)); + mInitialized = TRUE; } @@ -486,7 +493,7 @@ void LLAgent::movePitch(F32 mag) // Does this parcel allow you to fly? BOOL LLAgent::canFly() { -// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0c) +// [RLVa:KB] - Checked: 2010-03-02 (RLVa-1.2.0d) | Modified: RLVa-1.0.0c if (gRlvHandler.hasBehaviour(RLV_BHVR_FLY)) return FALSE; // [/RLVa:KB] if (isGodlike()) return TRUE; @@ -564,7 +571,7 @@ void LLAgent::setFlying(BOOL fly) if (fly) { -// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0c) +// [RLVa:KB] - Checked: 2010-03-02 (RLVa-1.2.0d) | Modified: RLVa-1.0.0c if (gRlvHandler.hasBehaviour(RLV_BHVR_FLY)) { return; @@ -623,7 +630,14 @@ bool LLAgent::enableFlying() void LLAgent::standUp() { - setControlFlags(AGENT_CONTROL_STAND_UP); +// setControlFlags(AGENT_CONTROL_STAND_UP); +// [RLVa:KB] - Checked: 2010-03-07 (RLVa-1.2.0c) | Added: RLVa-1.2.0a + // RELEASE-RLVa: [SL-2.0.0] Check this function's callers since usually they require explicit blocking + if ( (!rlv_handler_t::isEnabled()) || (gRlvHandler.canStand()) ) + { + setControlFlags(AGENT_CONTROL_STAND_UP); + } +// [/RLVa:KB] } void LLAgent::togglePhantom() @@ -943,7 +957,14 @@ LLVector3d LLAgent::getPosGlobalFromAgent(const LLVector3 &pos_agent) const void LLAgent::sitDown() { - setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); +// setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); +// [RLVa:KB] - Checked: 2010-08-28 (RLVa-1.2.1a) | Added: RLVa-1.2.1a + // RELEASE-RLVa: [SL-2.0.0] Check this function's callers since usually they require explicit blocking + if ( (!rlv_handler_t::isEnabled()) || ((gRlvHandler.canStand()) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SIT))) ) + { + setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); + } +// [/RLVa:KB] } @@ -2203,8 +2224,8 @@ void LLAgent::onAnimStop(const LLUUID& id) } else if (id == ANIM_AGENT_AWAY) { - //clearAFK(); -// [RLVa:KB] - Checked: 2009-10-19 (RLVa-1.1.0g) | Added: RLVa-1.1.0g +// clearAFK(); +// [RLVa:KB] - Checked: 2010-05-03 (RLVa-1.2.0g) | Added: RLVa-1.1.0g #ifdef RLV_EXTENSION_CMD_ALLOWIDLE if (!gRlvHandler.hasBehaviour(RLV_BHVR_ALLOWIDLE)) clearAFK(); @@ -2652,7 +2673,36 @@ void LLAgent::sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request) sendReliableMessage(); } -void LLAgent::sendWalkRun(bool running) +// [RLVa:KB] - Checked: 2011-05-11 (RLVa-1.3.0i) | Added: RLVa-1.3.0i +void LLAgent::setAlwaysRun() +{ + mbAlwaysRun = true;//(!rlv_handler_t::isEnabled()) || (!gRlvHandler.hasBehaviour(RLV_BHVR_ALWAYSRUN)); + sendWalkRun(); +} + +void LLAgent::setTempRun() +{ + mbTempRun = true;//(!rlv_handler_t::isEnabled()) || (!gRlvHandler.hasBehaviour(RLV_BHVR_TEMPRUN)); + sendWalkRun(); +} + +void LLAgent::clearAlwaysRun() +{ + mbAlwaysRun = false; + sendWalkRun(); +} + +void LLAgent::clearTempRun() +{ + mbTempRun = false; + sendWalkRun(); +} +// [/RLVa:KB] + +//void LLAgent::sendWalkRun(bool running) +// [RLVa:KB] - Checked: 2011-05-11 (RLVa-1.3.0i) | Added: RLVa-1.3.0i +void LLAgent::sendWalkRun() +// [/RLVa:KB] { LLMessageSystem* msgsys = gMessageSystem; if (msgsys) @@ -2661,7 +2711,10 @@ void LLAgent::sendWalkRun(bool running) msgsys->nextBlockFast(_PREHASH_AgentData); msgsys->addUUIDFast(_PREHASH_AgentID, getID()); msgsys->addUUIDFast(_PREHASH_SessionID, getSessionID()); - msgsys->addBOOLFast(_PREHASH_AlwaysRun, BOOL(running) ); +// msgsys->addBOOLFast(_PREHASH_AlwaysRun, BOOL(running) ); +// [RLVa:KB] - Checked: 2011-05-11 (RLVa-1.3.0i) | Added: RLVa-1.3.0i + msgsys->addBOOLFast(_PREHASH_AlwaysRun, BOOL(getRunning()) ); +// [/RLVa:KB] sendReliableMessage(); } } @@ -3257,7 +3310,7 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void * return; } - if (isAgentAvatarValid() && gAgentCamera.cameraCustomizeAvatar()) + if (isAgentAvatarValid() && !gAgentAvatarp->isUsingBakedTextures()) { // ignore baked textures when in customize mode return; @@ -3307,6 +3360,7 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void * } llinfos << "Received cached texture response for " << num_results << " textures." << llendl; + gAgentAvatarp->outputRezTiming("Fetched agent wearables textures from cache. Will now load them"); gAgentAvatarp->updateMeshTextures(); @@ -3499,12 +3553,14 @@ void LLAgent::teleportRequest( // Landmark ID = LLUUID::null means teleport home void LLAgent::teleportViaLandmark(const LLUUID& landmark_asset_id) { -// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) +// [RLVa:KB] - Checked: 2010-08-22 (RLVa-1.2.1a) | Modified: RLVa-1.2.1a + // NOTE: we'll allow teleporting home unless both @tplm=n *and* @tploc=n restricted if ( (rlv_handler_t::isEnabled()) && - ( (gRlvHandler.hasBehaviour(RLV_BHVR_TPLM)) || - ((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (gAgentAvatarp) && (gAgentAvatarp->isSitting())) )) + ( ( (landmark_asset_id.notNull()) ? gRlvHandler.hasBehaviour(RLV_BHVR_TPLM) + : gRlvHandler.hasBehaviour(RLV_BHVR_TPLM) && gRlvHandler.hasBehaviour(RLV_BHVR_TPLOC) ) || + ((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (isAgentAvatarValid()) && (gAgentAvatarp->isSitting())) )) { - RlvNotifications::notifyBlockedTeleport(); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_TELEPORT); return; } // [/RLVa:KB] @@ -3573,17 +3629,15 @@ void LLAgent::teleportCancel() void LLAgent::teleportViaLocation(const LLVector3d& pos_global) { - if(!isAgentAvatarValid()) - return; -// [RLVa:KB] - Alternate: Snowglobe-1.2.4 | Checked: 2010-03-02 (RLVa-1.1.1a) | Modified: RLVa-1.2.0a - if (rlv_handler_t::isEnabled()) +// [RLVa:KB] - Checked: 2010-03-02 (RLVa-1.2.0c) | Modified: RLVa-1.2.0a + if ( (rlv_handler_t::isEnabled()) && (!RlvUtil::isForceTp()) ) { // If we're getting teleported due to @tpto we should disregard any @tploc=n or @unsit=n restrictions from the same object if ( (gRlvHandler.hasBehaviourExcept(RLV_BHVR_TPLOC, gRlvHandler.getCurrentObject())) || - ( (gAgentAvatarp) && (gAgentAvatarp->isSitting()) && + ( (isAgentAvatarValid()) && (gAgentAvatarp->isSitting()) && (gRlvHandler.hasBehaviourExcept(RLV_BHVR_UNSIT, gRlvHandler.getCurrentObject()))) ) { - RlvNotifications::notifyBlockedTeleport(); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_TELEPORT); return; } @@ -3650,7 +3704,7 @@ void LLAgent::teleportViaLocationLookAt(const LLVector3d& pos_global) if ( (rlv_handler_t::isEnabled()) && (!RlvUtil::isForceTp()) && ((gRlvHandler.hasBehaviour(RLV_BHVR_SITTP)) || (!gRlvHandler.canStand())) ) { - RlvNotifications::notifyBlockedTeleport(); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_TELEPORT); return; } // [/RLVa:KB] @@ -3855,9 +3909,15 @@ void LLAgent::sendAgentSetAppearance() // to tweak this number again LLVector3 body_size = gAgentAvatarp->mBodySize; +// [RLVa:KB] - Checked: 2010-10-11 (RLVa-1.2.0e) | Added: RLVa-1.2.0e + F32 offset_z = RlvSettings::getAvatarOffsetZ(); + if(fabs(offset_z) < .1) + offset_z = gSavedSettings.getF32("AscentAvatarZModifier"); +// [/RLVa:KB] + body_size.mV[VX] = body_size.mV[VX] + gSavedSettings.getF32("AscentAvatarXModifier"); body_size.mV[VY] = body_size.mV[VY] + gSavedSettings.getF32("AscentAvatarYModifier"); - body_size.mV[VZ] = body_size.mV[VZ] + gSavedSettings.getF32("AscentAvatarZModifier"); + body_size.mV[VZ] = body_size.mV[VZ] + offset_z; msg->addVector3Fast(_PREHASH_Size, body_size); diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 145644f7b..2d4231ef1 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -366,19 +366,31 @@ public: DOUBLETAP_SLIDERIGHT }; - void setAlwaysRun() { mbAlwaysRun = true; } - void clearAlwaysRun() { mbAlwaysRun = false; } - void setRunning() { mbRunning = true; } - void clearRunning() { mbRunning = false; } - void sendWalkRun(bool running); +// [RLVa:KB] - Checked: 2011-05-11 (RLVa-1.3.0i) | Added: RLVa-1.3.0i + void setAlwaysRun(); + void setTempRun(); + void clearAlwaysRun(); + void clearTempRun(); + void sendWalkRun(); + bool getTempRun() { return mbTempRun; } + bool getRunning() const { return (mbAlwaysRun) || (mbTempRun); } +// [/RLVa:KB] +// void setAlwaysRun() { mbAlwaysRun = true; } +// void clearAlwaysRun() { mbAlwaysRun = false; } +// void setRunning() { mbRunning = true; } +// void clearRunning() { mbRunning = false; } +// void sendWalkRun(bool running); bool getAlwaysRun() const { return mbAlwaysRun; } - bool getRunning() const { return mbRunning; } +// bool getRunning() const { return mbRunning; } public: LLFrameTimer mDoubleTapRunTimer; EDoubleTapRunMode mDoubleTapRunMode; private: bool mbAlwaysRun; // Should the avatar run by default rather than walk? - bool mbRunning; // Is the avatar trying to run right now? +// [RLVa:KB] - Checked: 2011-05-11 (RLVa-1.3.0i) | Added: RLVa-1.3.0i + bool mbTempRun; +// [/RLVa:KB] +// bool mbRunning; // Is the avatar trying to run right now? bool mbTeleportKeepsLookAt; // Try to keep look-at after teleport is complete //-------------------------------------------------------------------- @@ -605,6 +617,14 @@ private: ** ** *******************************************************************************/ + // Build +public: + bool canEditParcel() const { return mCanEditParcel; } +private: + bool mCanEditParcel; + + static void parcelChangedCallback(); + /******************************************************************************** ** ** ** ACCESS diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 5a18f0ea3..8dc34b6ab 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -51,6 +51,9 @@ #include "llfloatertools.h" //For gFloaterTools #include "floaterao.h" //For LLFloaterAO #include "llfloatercustomize.h" //For gFloaterCustomize +// [RLVa:KB] - Checked: 2010-05-10 (RLVa-1.2.0g) +#include "rlvhandler.h" +// [/RLVa:KB] using namespace LLVOAvatarDefines; @@ -249,7 +252,7 @@ void LLAgentCamera::cleanup() setFocusObject(NULL); } -void LLAgentCamera::setAvatarObject(LLVOAvatar* avatar) +void LLAgentCamera::setAvatarObject(LLVOAvatarSelf* avatar) { if (!mLookAt) { @@ -2119,7 +2122,8 @@ void LLAgentCamera::resetCamera() //----------------------------------------------------------------------------- void LLAgentCamera::changeCameraToMouselook(BOOL animate) { - if (!gSavedSettings.getBOOL("EnableMouselook") || LLViewerJoystick::getInstance()->getOverrideCamera()) + if (!gSavedSettings.getBOOL("EnableMouselook") + || LLViewerJoystick::getInstance()->getOverrideCamera()) { return; } @@ -2348,7 +2352,7 @@ void LLAgentCamera::changeCameraToThirdPerson(BOOL animate) //----------------------------------------------------------------------------- // changeCameraToCustomizeAvatar() //----------------------------------------------------------------------------- -void LLAgentCamera::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL camera_animate) +void LLAgentCamera::changeCameraToCustomizeAvatar() { if (LLViewerJoystick::getInstance()->getOverrideCamera()) { @@ -2370,13 +2374,10 @@ void LLAgentCamera::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL came gSavedSettings.setBOOL("ThirdPersonBtnState", FALSE); gSavedSettings.setBOOL("BuildBtnState", FALSE); - if (camera_animate) - { - // - if(gSavedSettings.getBOOL("AppearanceCameraMovement")) - // - startCameraAnimation(); - } + // + if(gSavedSettings.getBOOL("AppearanceCameraMovement")) + // + startCameraAnimation(); if (mCameraMode != CAMERA_MODE_CUSTOMIZE_AVATAR) { @@ -2396,41 +2397,27 @@ void LLAgentCamera::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL came if (isAgentAvatarValid()) { - if(avatar_animate) + // Remove any pitch or rotation from the avatar + LLVector3 at = gAgent.getAtAxis(); + at.mV[VZ] = 0.f; + at.normalize(); + gAgent.resetAxes(at); + + gAgent.sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_START); + gAgent.setCustomAnim(TRUE); + gAgentAvatarp->startMotion(ANIM_AGENT_CUSTOMIZE); + LLMotion* turn_motion = gAgentAvatarp->findMotion(ANIM_AGENT_CUSTOMIZE); + + if (turn_motion) { - // Remove any pitch or rotation from the avatar - LLVector3 at = gAgent.getAtAxis(); - at.mV[VZ] = 0.f; - at.normalize(); - gAgent.resetAxes(at); - - gAgent.sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_START); - gAgent.setCustomAnim(TRUE); - gAgentAvatarp->startMotion(ANIM_AGENT_CUSTOMIZE); - LLMotion* turn_motion = gAgentAvatarp->findMotion(ANIM_AGENT_CUSTOMIZE); - - if (turn_motion) - { - // delay camera animation long enough to play through turn animation - setAnimationDuration(turn_motion->getDuration() + CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP); - } - else - { - setAnimationDuration(gSavedSettings.getF32("ZoomTime")); - } + // delay camera animation long enough to play through turn animation + setAnimationDuration(turn_motion->getDuration() + CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP); } - + gAgentAvatarp->invalidateAll(); gAgentAvatarp->updateMeshTextures(); - - gAgentCamera.setFocusGlobal(LLVector3d::zero); } } - else - { - mCameraAnimating = FALSE; - gAgent.endAnimationUpdateUI(); - } // if(!gSavedSettings.getBOOL("AppearanceCameraMovement")) diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h index 33938d30d..86b2d84fd 100644 --- a/indra/newview/llagentcamera.h +++ b/indra/newview/llagentcamera.h @@ -32,10 +32,9 @@ #include "llhudeffectpointat.h" // ELookAtType class LLPickInfo; -class LLVOAvatar; +class LLVOAvatarSelf; class LLControlVariable; - //-------------------------------------------------------------------- // Types //-------------------------------------------------------------------- @@ -63,7 +62,7 @@ public: virtual ~LLAgentCamera(); void init(); void cleanup(); - void setAvatarObject(LLVOAvatar* avatar); + void setAvatarObject(LLVOAvatarSelf* avatar); bool isInitialized() { return mInitialized; } private: bool mInitialized; @@ -76,7 +75,7 @@ public: void changeCameraToDefault(); void changeCameraToMouselook(BOOL animate = TRUE); void changeCameraToThirdPerson(BOOL animate = TRUE); - void changeCameraToCustomizeAvatar(BOOL avatar_animate = TRUE, BOOL camera_animate = TRUE); // trigger transition animation + void changeCameraToCustomizeAvatar(); // trigger transition animation F32 calcCustomizeAvatarUIOffset( const LLVector3d& camera_pos_global ); // Ventrella void changeCameraToFollow(BOOL animate = TRUE); diff --git a/indra/newview/llagentlanguage.cpp b/indra/newview/llagentlanguage.cpp index 90845d946..04e1228c7 100644 --- a/indra/newview/llagentlanguage.cpp +++ b/indra/newview/llagentlanguage.cpp @@ -2,31 +2,25 @@ * @file llagentlanguage.cpp * @brief Transmit language information to server * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/newview/llagentlanguage.h b/indra/newview/llagentlanguage.h index 596c58423..f13a016a6 100644 --- a/indra/newview/llagentlanguage.h +++ b/indra/newview/llagentlanguage.h @@ -2,31 +2,25 @@ * @file llagentlanguage.h * @brief Transmit language information to server * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/newview/llagentui.cpp b/indra/newview/llagentui.cpp index c187edf7f..55152cf19 100644 --- a/indra/newview/llagentui.cpp +++ b/indra/newview/llagentui.cpp @@ -36,7 +36,8 @@ #include "llviewercontrol.h" #include "llviewerregion.h" #include "llviewerparcelmgr.h" -// [RLVa:KB] - Checked: 2010-09-27 (RLVa-1.1.3b) +#include "llvoavatarself.h" +// [RLVa:KB] - Checked: 2010-04-04 (RLVa-1.2.0d) #include "rlvhandler.h" // [/RLVa:KB] @@ -70,13 +71,6 @@ BOOL LLAgentUI::checkAgentDistance(const LLVector3& pole, F32 radius) } BOOL LLAgentUI::buildLocationString(std::string& str, ELocationFormat fmt,const LLVector3& agent_pos_region) { -// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) - { - str = RlvStrings::getString(RLV_STRING_HIDDEN); - return TRUE; - } -// [/RLVa:KB] LLViewerRegion* region = gAgent.getRegion(); LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); @@ -108,6 +102,18 @@ BOOL LLAgentUI::buildLocationString(std::string& str, ELocationFormat fmt,const // create a default name and description for the landmark std::string parcel_name = LLViewerParcelMgr::getInstance()->getAgentParcelName(); std::string region_name = region->getName(); +// [RLVa:KB] - Checked: 2010-04-04 (RLVa-1.2.0d) | Modified: RLVa-1.2.0d + // RELEASE-RLVa: [SL-2.0.0] Check ELocationFormat to make sure our switch still makes sense + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + { + parcel_name = RlvStrings::getString(RLV_STRING_HIDDEN_PARCEL); + region_name = RlvStrings::getString(RLV_STRING_HIDDEN_REGION); + if (LOCATION_FORMAT_NO_MATURITY == fmt) + fmt = LOCATION_FORMAT_LANDMARK; + else if (LOCATION_FORMAT_FULL == fmt) + fmt = LOCATION_FORMAT_NO_COORDS; + } +// [/RLVa:KB] std::string sim_access_string = region->getSimAccessString(); std::string buffer; if( parcel_name.empty() ) diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index a76b0215e..c085d34bb 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -2,33 +2,26 @@ * @file llagentwearables.cpp * @brief LLAgentWearables class implementation * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2010, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlife.com/developers/opensource/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ - * */ #include "llviewerprecompiledheaders.h" @@ -59,7 +52,7 @@ #include "llfloatercustomize.h" -// [RLVa:KB] - Checked: 2010-09-27 (RLVa-1.1.3b) +// [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1a) #include "rlvhandler.h" #include "rlvinventory.h" #include "llattachmentsmgr.h" @@ -72,6 +65,9 @@ LLAgentWearables gAgentWearables; BOOL LLAgentWearables::mInitialWearablesUpdateReceived = FALSE; +// [SL:KB] - Patch: Appearance-InitialWearablesLoadedCallback | Checked: 2010-08-14 (Catznip-3.0.0a) | Added: Catznip-2.1.1d +bool LLAgentWearables::mInitialWearablesLoaded = false; +// [/SL:KB] using namespace LLVOAvatarDefines; @@ -538,9 +534,8 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type, old_wearable->revertValues(); } -void LLAgentWearables::revertWearable(const LLWearableType::EType type, const U32 index, bool set_by_user) +void LLAgentWearables::revertWearable(const LLWearableType::EType type, const U32 index) { - //llassert_always(index == 0); LLWearable* wearable = getWearable(type, index); llassert(wearable); if (wearable) @@ -789,12 +784,28 @@ U32 LLAgentWearables::pushWearable(const LLWearableType::EType type, LLWearable llwarns << "Null wearable sent for type " << type << llendl; return MAX_CLOTHING_PER_TYPE; } - if (type < LLWearableType::WT_COUNT || mWearableDatas[type].size() < MAX_CLOTHING_PER_TYPE) +// if (type < LLWearableType::WT_COUNT || mWearableDatas[type].size() < MAX_CLOTHING_PER_TYPE) +// { +// mWearableDatas[type].push_back(wearable); +// wearableUpdated(wearable); +// checkWearableAgainstInventory(wearable); +// return mWearableDatas[type].size()-1; +// } +// [RLVa:KB] - Checked: 2010-06-08 (RLVa-1.2.0g) | Added: RLVa-1.2.0g + if ( (type < LLWearableType::WT_COUNT) && (mWearableDatas[type].size() < MAX_CLOTHING_PER_TYPE) ) { - mWearableDatas[type].push_back(wearable); + // Don't add the same wearable twice + U32 idxWearable = getWearableIndex(wearable); + RLV_ASSERT(MAX_CLOTHING_PER_TYPE == idxWearable); // pushWearable() on an already added wearable is a bug *somewhere* + if (MAX_CLOTHING_PER_TYPE == idxWearable) + { + mWearableDatas[type].push_back(wearable); + idxWearable = mWearableDatas[type].size() - 1; + } wearableUpdated(wearable); checkWearableAgainstInventory(wearable); - return mWearableDatas[type].size()-1; + return idxWearable; +// [/RLVa:KB] } return MAX_CLOTHING_PER_TYPE; } @@ -947,7 +958,6 @@ U32 LLAgentWearables::itemUpdatePendingCount() const const LLUUID LLAgentWearables::getWearableItemID(LLWearableType::EType type, U32 index) const { - //llassert_always(index == 0); const LLWearable *wearable = getWearable(type,index); if (wearable) return wearable->getItemID(); @@ -955,9 +965,32 @@ const LLUUID LLAgentWearables::getWearableItemID(LLWearableType::EType type, U32 return LLUUID(); } +// [RLVa:KB] - Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f +void LLAgentWearables::getWearableItemIDs(uuid_vec_t& idItems) const +{ + for (wearableentry_map_t::const_iterator itWearableType = mWearableDatas.begin(); + itWearableType != mWearableDatas.end(); ++itWearableType) + { + getWearableItemIDs(itWearableType->first, idItems); + } +} + +void LLAgentWearables::getWearableItemIDs(LLWearableType::EType eType, uuid_vec_t& idItems) const +{ + wearableentry_map_t::const_iterator itWearableType = mWearableDatas.find(eType); + if (mWearableDatas.end() != itWearableType) + { + for (wearableentry_vec_t::const_iterator itWearable = itWearableType->second.begin(), endWearable = itWearableType->second.end(); + itWearable != endWearable; ++itWearable) + { + idItems.push_back((*itWearable)->getItemID()); + } + } +} +// [/RLVa:KB] + const LLUUID LLAgentWearables::getWearableAssetID(LLWearableType::EType type, U32 index) const { - //llassert_always(index == 0); const LLWearable *wearable = getWearable(type,index); if (wearable) return wearable->getAssetID(); @@ -1317,7 +1350,6 @@ void LLAgentWearables::addWearableToAgentInventory(LLPointerisDirty()) { @@ -1397,20 +1433,30 @@ void LLAgentWearables::removeWearableFinal( LLWearableType::EType type, bool do_ { LLWearable* old_wearable = getWearable(type,i); //queryWearableCache(); // moved below - if (old_wearable) +// if (old_wearable) +// [RLVa:KB] - Checked: 2010-05-14 (RLVa-1.2.0g) | Added: RLVa-1.2.0g + if ( (old_wearable) && ((!rlv_handler_t::isEnabled()) || (!gRlvWearableLocks.isLockedWearable(old_wearable))) ) +// [/RLVa:KB] { popWearable(old_wearable); old_wearable->removeFromAvatar(TRUE); } } - mWearableDatas[type].clear(); +// mWearableDatas[type].clear(); +// [RLVa:KB] - Checked: 2010-05-14 (RLVa-1.2.0g) | Added: RLVa-1.2.0g + // The line above shouldn't be needed and would cause issues if we block removing one of the wearables + RLV_VERIFY( ((!rlv_handler_t::isEnabled()) || (!gRlvWearableLocks.hasLockedWearable(type))) ? mWearableDatas[type].empty() : true ); +// [/RLVa:KB] } else { LLWearable* old_wearable = getWearable(type, index); //queryWearableCache(); // moved below - if (old_wearable) +// if (old_wearable) +// [RLVa:KB] - Checked: 2010-05-14 (RLVa-1.2.0g) | Added: RLVa-1.2.0g + if ( (old_wearable) && ((!rlv_handler_t::isEnabled()) || (!gRlvWearableLocks.isLockedWearable(old_wearable))) ) +// [/RLVa:KB] { popWearable(old_wearable); old_wearable->removeFromAvatar(TRUE); @@ -1472,6 +1518,12 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it S32 count = wearables.count(); llassert(items.count() == count); +// [RLVa:KB] - Checked: 2010-06-08 (RLVa-1.2.0g) | Added: RLVa-1.2.0g + // If the user is @add/remoutfit restricted in any way then this function won't just work as-is, so instead of removing and re-adding + // we're stuck with any wearable type potentially having left-over (remove locked) clothing that we'll need to reorder in-place + S32 idxCurPerType[LLWearableType::WT_COUNT] = { 0 }; +// [/RLVa:KB] + S32 i; for (i = 0; i < count; i++) { @@ -1496,10 +1548,51 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it // exactly one wearable per body part setWearable(type,0,new_wearable); } - else +// else +// { +// pushWearable(type,new_wearable); +// } +// [RLVa:KB] - Checked: 2010-06-08 (RLVa-1.2.0g) | Added: RLVa-1.2.0g + else if ( (!rlv_handler_t::isEnabled()) || (!gRlvWearableLocks.hasLockedWearable(type)) || (!remove) ) { + // Sanity check: there shouldn't be any worn wearables for this type the first time we encounter it + RLV_ASSERT( (!remove) || (0 != idxCurPerType[type]) || (0 == getWearableCount(type)) ); pushWearable(type,new_wearable); } + else + { + // Get the current index of the wearable (or add it if doesn't exist yet) + S32 idxCur = getWearableIndex(new_wearable); + if (MAX_CLOTHING_PER_TYPE == idxCur) + { + // Skip adding if @addoutfit=n restricted *unless* the wearable made it into COF [see LLAppMgr::updateAgentWearables()] + if ( (RLV_WEAR_LOCKED == gRlvWearableLocks.canWear(type)) && + (!gInventory.isObjectDescendentOf(new_item->getUUID(), LLAppearanceMgr::instance().getCOF())) ) + { + continue; + } + idxCur = pushWearable(type,new_wearable); + } + + // Since we're moving up from index 0 we just swap the two wearables and things will work out in the end (hopefully) + if (idxCurPerType[type] != idxCur) + { + wearableentry_map_t::iterator itWearable = mWearableDatas.find(type); + RLV_ASSERT(itWearable != mWearableDatas.end()); + if (itWearable == mWearableDatas.end()) continue; + wearableentry_vec_t& typeWearable = itWearable->second; + RLV_ASSERT(typeWearable.size() >= 2); + if (typeWearable.size() < 2) continue; + + typeWearable[idxCur] = typeWearable[idxCurPerType[type]]; + typeWearable[idxCurPerType[type]] = new_wearable; + //wearableUpdated(new_wearable); + //checkWearableAgainstInventory(new_wearable); + } + } + idxCurPerType[type]++; +// [/RLVa:KB] + wearableUpdated(new_wearable); checkWearableAgainstInventory(new_wearable); } @@ -1517,6 +1610,13 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it // Start rendering & update the server mWearablesLoaded = TRUE; checkWearablesLoaded(); +// [SL:KB] - Patch: Appearance-InitialWearablesLoadedCallback | Checked: 2010-09-22 (Catznip-3.0.0a) | Modified: Catznip-2.2.0a + if (!mInitialWearablesLoaded) + { + mInitialWearablesLoaded = true; + mInitialWearablesLoadedSignal(); + } +// [/SL:KB] notifyLoadingFinished(); queryWearableCache(); updateServer(); @@ -1539,11 +1639,16 @@ void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLWearable* ne const LLWearableType::EType type = new_wearable->getType(); - /*if (isFirstPhysicsWearable(type, new_item, new_wearable)) +// [RLVa:KB] - Checked: 2010-03-19 (RLVa-1.2.0a) | Modified: RLVa-1.2.0g + // TODO-RLVa: [RLVa-1.2.1] This looks like dead code in SL-2.0.2 so we can't really check to see if it works :| + if (rlv_handler_t::isEnabled()) { - return; - }*/ - + ERlvWearMask eWear = gRlvWearableLocks.canWear(type); + if ( (RLV_WEAR_LOCKED == eWear) || ((!do_append) && (!(eWear & RLV_WEAR_REPLACE))) ) + return; + } +// [/RLVa:KB] + if (!do_append) { // Remove old wearable, if any @@ -1751,28 +1856,31 @@ LLUUID LLAgentWearables::computeBakedTextureHash(LLVOAvatarDefines::EBakedTextur // User has picked "remove from avatar" from a menu. // static -void LLAgentWearables::userRemoveWearable(const LLWearableType::EType &type, const U32 &index) -{ - if( !(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES) ) //&& - //!((!gAgent.isTeen()) && ( type==WT_UNDERPANTS || type==WT_UNDERSHIRT )) ) - { - gAgentWearables.removeWearable(type,false,index); - } -} +//void LLAgentWearables::userRemoveWearable(const LLWearableType::EType &type, const U32 &index) +//{ +// if (!(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES)) //&& +// //!((!gAgent.isTeen()) && (type==LLWearableType::WT_UNDERPANTS || type==LLWearableType::WT_UNDERSHIRT))) +// { +// gAgentWearables.removeWearable(type,false,index); +// } +//} //static -void LLAgentWearables::userRemoveWearablesOfType(const LLWearableType::EType &type) -{ - if (!(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES)) //&& - //!((!gAgent.isTeen()) && (type==LLWearableType::WT_UNDERPANTS || type==LLWearableType::WT_UNDERSHIRT))) - { - gAgentWearables.removeWearable(type,true,0); - } -} +//void LLAgentWearables::userRemoveWearablesOfType(const LLWearableType::EType &type) +//{ +// if (!(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES)) //&& +// //!((!gAgent.isTeen()) && (type==LLWearableType::WT_UNDERPANTS || type==LLWearableType::WT_UNDERSHIRT))) +// { +// gAgentWearables.removeWearable(type,true,0); +// } +//} // Combines userRemoveAllAttachments() and userAttachMultipleAttachments() logic to // get attachments into desired state with minimal number of adds/removes. -void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj_item_array) +//void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj_item_array) +// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-22 (Catznip-3.0.0a) | Added: Catznip-2.2.0a +void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj_item_array, bool fAttachOnly) +// [/SL:KB] { // Possible cases: // already wearing but not in request set -> take off. @@ -1838,8 +1946,8 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj // Remove everything in objects_to_remove // userRemoveMultipleAttachments(objects_to_remove); -// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-22 (Catznip-2.2.0a) | Added: Catznip-2.2.0a - if (!gAgentAvatarp->isFullyLoaded()) +// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-22 (Catznip-3.0.0a) | Added: Catznip-2.2.0a + if (!fAttachOnly) { userRemoveMultipleAttachments(objects_to_remove); } @@ -1853,6 +1961,34 @@ void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remo { if (!isAgentAvatarValid()) return; +// [RLVa:KB] - Checked: 2010-03-04 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a + // RELEASE-RLVa: [SL-2.0.0] Check our callers and verify that erasing elements from the passed vector won't break random things + if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_REMOVE)) ) + { + llvo_vec_t::iterator itObj = objects_to_remove.begin(); + while (itObj != objects_to_remove.end()) + { + const LLViewerObject* pAttachObj = *itObj; + if (gRlvAttachmentLocks.isLockedAttachment(pAttachObj)) + { + itObj = objects_to_remove.erase(itObj); + + // Fall-back code: re-add the attachment if it got removed from COF somehow (compensates for possible bugs elsewhere) + LLInventoryModel::cat_array_t folders; LLInventoryModel::item_array_t items; + LLLinkedItemIDMatches f(pAttachObj->getAttachmentItemID()); + gInventory.collectDescendentsIf(LLAppearanceMgr::instance().getCOF(), folders, items, LLInventoryModel::EXCLUDE_TRASH, f); + RLV_ASSERT( 0 != items.count() ); + if (0 == items.count()) + LLAppearanceMgr::instance().registerAttachment(pAttachObj->getAttachmentItemID()); + } + else + { + ++itObj; + } + } + } +// [/RLVa:KB] + if (objects_to_remove.empty()) return; @@ -1899,9 +2035,11 @@ void LLAgentWearables::userRemoveAllAttachments() void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_array_t& obj_item_array) { -// [RLVa:KB] - Checked: 2010-03-04 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a - // RELEASE-RLVa: [SL-2.0.0] Check our callers and verify that erasing elements from the passed vector won't break random things - if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) ) +// [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1b) | Added: RLVa-1.3.1b + static bool sInitialAttachmentsRequested = false; + + // RELEASE-RLVa: [SL-2.5.2] Check our callers and verify that erasing elements from the passed vector won't break random things + if ( (rlv_handler_t::isEnabled()) && (sInitialAttachmentsRequested) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) ) { // Fall-back code: everything should really already have been pruned before we get this far for (S32 idxItem = obj_item_array.count() - 1; idxItem >= 0; idxItem--) @@ -1954,6 +2092,12 @@ void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_arra msg->addUUIDFast(_PREHASH_ItemID, item->getLinkedUUID()); msg->addUUIDFast(_PREHASH_OwnerID, item->getPermissions().getOwner()); msg->addU8Fast(_PREHASH_AttachmentPt, replace? 0 : ATTACHMENT_ADD); // Wear at the previous or default attachment point +// [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1b) | Added: RLVa-1.3.1b + if ( (rlv_handler_t::isEnabled()) && (sInitialAttachmentsRequested) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) ) + { + RlvAttachmentLockWatchdog::instance().onWearAttachment(item, RLV_WEAR_ADD); + } +// [/RLVa:KB] pack_permissions_slam(msg, item->getFlags(), item->getPermissions()); msg->addStringFast(_PREHASH_Name, item->getName()); msg->addStringFast(_PREHASH_Description, item->getDescription()); @@ -1964,6 +2108,10 @@ void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_arra msg->sendReliable( gAgent.getRegion()->getHost() ); } } + +// [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1b) | Added: RLVa-1.3.1b + sInitialAttachmentsRequested = true; +// [/RLVa:KB] } void LLAgentWearables::checkWearablesLoaded() const @@ -2179,6 +2327,13 @@ boost::signals2::connection LLAgentWearables::addLoadedCallback(loaded_callback_ return mLoadedSignal.connect(cb); } +// [SL:KB] - Patch: Appearance-InitialWearablesLoadedCallback | Checked: 2010-08-14 (Catznip-3.0.0a) | Added: Catznip-2.1.1d +boost::signals2::connection LLAgentWearables::addInitialWearablesLoadedCallback(loaded_callback_t cb) +{ + return mInitialWearablesLoadedSignal.connect(cb); +} +// [/SL:KB] + void LLAgentWearables::notifyLoadingStarted() { mCOFChangeInProgress = true; diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h index c84daa4ec..36ec572eb 100644 --- a/indra/newview/llagentwearables.h +++ b/indra/newview/llagentwearables.h @@ -76,6 +76,9 @@ public: BOOL isWearableCopyable(LLWearableType::EType type, U32 index /*= 0*/) const; BOOL areWearablesLoaded() const; +// [SL:KB] - Patch: Appearance-InitialWearablesLoadedCallback | Checked: 2010-08-14 (Catznip-3.0.0a) | Added: Catznip-2.1.1d + bool areInitalWearablesLoaded() const { return mInitialWearablesLoaded; } +// [/SL:KB] bool isCOFChangeInProgress() const { return mCOFChangeInProgress; } void updateWearablesLoaded(); void checkWearablesLoaded() const; @@ -90,6 +93,10 @@ public: // Accessors //-------------------------------------------------------------------- public: +// [RLVa:KB] - Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f + void getWearableItemIDs(uuid_vec_t& idItems) const; + void getWearableItemIDs(LLWearableType::EType eType, uuid_vec_t& idItems) const; +// [/RLVa:KB] const LLUUID getWearableItemID(LLWearableType::EType type, U32 index /*= 0*/) const; const LLUUID getWearableAssetID(LLWearableType::EType type, U32 index /*= 0*/) const; const LLWearable* getWearableFromItemID(const LLUUID& item_id) const; @@ -202,18 +209,22 @@ public: void saveWearable(const LLWearableType::EType type, const U32 index, BOOL send_update = TRUE, const std::string new_name = ""); void saveAllWearables(); - void revertWearable(const LLWearableType::EType type, const U32 index, bool set_by_user=false); + void revertWearable(const LLWearableType::EType type, const U32 index); //-------------------------------------------------------------------- // Static UI hooks //-------------------------------------------------------------------- public: - static void userRemoveWearable(const LLWearableType::EType &type, const U32 &index); - static void userRemoveWearablesOfType(const LLWearableType::EType &type); +// static void userRemoveWearable(const LLWearableType::EType &type, const U32 &index); +// static void userRemoveWearablesOfType(const LLWearableType::EType &type); typedef std::vector llvo_vec_t; - static void userUpdateAttachments(LLInventoryModel::item_array_t& obj_item_array); +// static void userUpdateAttachments(LLInventoryModel::item_array_t& obj_item_array); +// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-22 (Catznip-3.0.0a) | Added: Catznip-2.2.0a + // Not the best way to go about this but other attempts changed far too much LL code to be a viable solution + static void userUpdateAttachments(LLInventoryModel::item_array_t& obj_item_array, bool fAttachOnly = false); +// [/SL:KB] static void userRemoveMultipleAttachments(llvo_vec_t& llvo_array); static void userRemoveAllAttachments(); static void userAttachMultipleAttachments(LLInventoryModel::item_array_t& obj_item_array); @@ -232,6 +243,9 @@ public: typedef boost::function loaded_callback_t; typedef boost::signals2::signal loaded_signal_t; boost::signals2::connection addLoadedCallback(loaded_callback_t cb); +// [SL:KB] - Patch: Appearance-InitialWearablesLoadedCallback | Checked: 2010-08-14 (Catznip-3.0.0a) | Added: Catznip-2.1.1d + boost::signals2::connection addInitialWearablesLoadedCallback(loaded_callback_t cb); +// [/SL:KB] void notifyLoadingStarted(); void notifyLoadingFinished(); @@ -239,6 +253,9 @@ public: private: loading_started_signal_t mLoadingStartedSignal; // should be called before wearables are changed loaded_signal_t mLoadedSignal; // emitted when all agent wearables get loaded +// [SL:KB] - Patch: Appearance-InitialWearablesLoadedCallback | Checked: 2010-08-14 (Catznip-3.0.0a) | Added: Catznip-2.1.1d + loaded_signal_t mInitialWearablesLoadedSignal; // emitted once when the initial wearables are loaded +// [/SL:KB] //-------------------------------------------------------------------- // Member variables @@ -249,6 +266,9 @@ private: wearableentry_map_t mWearableDatas; static BOOL mInitialWearablesUpdateReceived; +// [SL:KB] - Patch: Appearance-InitialWearablesLoadedCallback | Checked: 2010-08-14 (Catznip-3.0.0a) | Added: Catznip-2.2.0a + static bool mInitialWearablesLoaded; +// [/SL:KB] BOOL mWearablesLoaded; std::set mItemsAwaitingWearableUpdate; diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp index 8cba54347..ec645e9a1 100644 --- a/indra/newview/llagentwearablesfetch.cpp +++ b/indra/newview/llagentwearablesfetch.cpp @@ -33,7 +33,12 @@ #include "llinventoryfunctions.h" #include "llstartup.h" #include "llvoavatarself.h" - +// [SL:KB] - Patch: Appearance-MixedViewers | Checked: 2011-09-10 (Catznip-3.0.0a) +#include "llviewercontrol.h" +// [/SL:KB] +// [RLVa:KB] - Checked: 2010-12-15 (RLVa-1.2.2c) +#include "rlvhelper.h" +// [/RLVa:KB] class LLOrderMyOutfitsOnDestroy: public LLInventoryCallback { @@ -104,7 +109,14 @@ void LLInitialWearablesFetch::done() // gInventory.notifyObservers. The results will be handled in the next // idle tick instead. gInventory.removeObserver(this); - doOnIdleOneTime(boost::bind(&LLInitialWearablesFetch::processContents,this)); +// doOnIdleOneTime(boost::bind(&LLInitialWearablesFetch::processContents,this)); +// [RLVa:KB] - Checked: 2010-12-15 (RLVa-1.2.2c) | Added: RLVa-1.2.2c + F32 nDelay = gSavedSettings.getF32("ForceInitialCOFDelay"); + if (0.0f == nDelay) + doOnIdleOneTime(boost::bind(&LLInitialWearablesFetch::processContents,this)); + else + rlvCallbackTimerOnce(nDelay, boost::bind(&LLInitialWearablesFetch::processContents,this)); +// [/RLVa:KB] if (isAgentAvatarValid()) { gAgentAvatarp->outputRezTiming("Initial wearables fetch done"); @@ -133,8 +145,40 @@ void LLInitialWearablesFetch::processContents() gInventory.collectDescendentsIf(mComplete.front(), cat_array, wearable_array, LLInventoryModel::EXCLUDE_TRASH, is_wearable); +// [SL:KB] - Patch: Appearance-MixedViewers | Checked: 2010-05-18 (Catznip-3.0.0a) | Modified: Catznip-2.0.0h + // NOTE: don't use the current COF contents if 'wearable_array' is empty (ie first logon with 2.0 or some other problem) + bool fUpdateFromCOF = !wearable_array.empty(); + if ( (fUpdateFromCOF) && (gSavedSettings.getBOOL("VerifyInitialWearables")) ) + { + LLAppearanceMgr::wearables_by_type_t items_by_type(LLWearableType::WT_COUNT); + LLAppearanceMgr::sortItemsByActualDescription(wearable_array); + LLAppearanceMgr::divvyWearablesByType(wearable_array, items_by_type); + + // Compare the COF wearables against the initial wearables + for (initial_wearable_data_vec_t::const_iterator itWearableData = mAgentInitialWearables.begin(); + (itWearableData != mAgentInitialWearables.end()) && (fUpdateFromCOF); ++itWearableData) + { + const LLUUID& idItem = itWearableData->mItemID; bool fFound = false; + for (S32 idxItem = 0, cntItem = items_by_type[itWearableData->mType].size(); idxItem < cntItem; idxItem++) + { + const LLViewerInventoryItem* pCOFItem = items_by_type[itWearableData->mType].get(idxItem); + if (idItem == pCOFItem->getLinkedUUID()) + { + fFound = true; + break; + } + } + if (!fFound) + fUpdateFromCOF = false; + } + } +// [/SL:KB] + LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true); - if (wearable_array.count() > 0) +// if (wearable_array.count() > 0) +// [SL:KB] - Patch: Appearance-MixedViewers | Checked: 2010-04-28 (Catznip-3.0.0a) | Modified: Catznip-2.0.0e + if (fUpdateFromCOF) +// [/SL:KB] { gAgentWearables.notifyLoadingStarted(); LLAppearanceMgr::instance().updateAppearanceFromCOF(); @@ -162,29 +206,54 @@ public: { gInventory.removeObserver(this); - // Link to all fetched items in COF. - LLPointer link_waiter = new LLUpdateAppearanceOnDestroy; - for (uuid_vec_t::iterator it = mIDs.begin(); - it != mIDs.end(); - ++it) +// // Link to all fetched items in COF. +// LLPointer link_waiter = new LLUpdateAppearanceOnDestroy; +// for (uuid_vec_t::iterator it = mIDs.begin(); +// it != mIDs.end(); +// ++it) +// { +// LLUUID id = *it; +// LLViewerInventoryItem *item = gInventory.getItem(*it); +// if (!item) +// { +// llwarns << "fetch failed!" << llendl; +// continue; +// } +// +// link_inventory_item(gAgent.getID(), +// item->getLinkedUUID(), +// LLAppearanceMgr::instance().getCOF(), +// item->getName(), +// item->getDescription(), +// LLAssetType::AT_LINK, +// link_waiter); +// } +// [SL:KB] - Patch: Appearance-MixedViewers | Checked: 2010-08-14 (Catznip-3.0.0a) | Added: Catznip-2.1.1d + doOnIdleOneTime(boost::bind(&LLFetchAndLinkObserver::doneIdle, this)); +// [/SL:KB] + } + +// [SL:KB] - Patch: Appearance-MixedViewers | Checked: 2010-04-02 (Catznip-3.0.0a) | Added: Catznip-2.0.0a + void doneIdle() + { + // NOTE: the code above makes the assumption that COF is empty which won't be the case the way it's used now + LLInventoryModel::item_array_t initial_items; + for (uuid_vec_t::iterator itItem = mIDs.begin(); itItem != mIDs.end(); ++itItem) { - LLUUID id = *it; - LLViewerInventoryItem *item = gInventory.getItem(*it); - if (!item) + LLViewerInventoryItem* pItem = gInventory.getItem(*itItem); + if (!pItem) { llwarns << "fetch failed!" << llendl; continue; } - - link_inventory_item(gAgent.getID(), - item->getLinkedUUID(), - LLAppearanceMgr::instance().getCOF(), - item->getName(), - item->getDescription(), - LLAssetType::AT_LINK, - link_waiter); + initial_items.push_back(pItem); } + + LLAppearanceMgr::instance().updateAppearanceFromInitialWearables(initial_items); + + delete this; } +// [/SL:KB] }; void LLInitialWearablesFetch::processWearablesMessage() @@ -196,7 +265,11 @@ void LLInitialWearablesFetch::processWearablesMessage() for (U8 i = 0; i < mAgentInitialWearables.size(); ++i) { // Populate the current outfit folder with links to the wearables passed in the message - InitialWearableData *wearable_data = new InitialWearableData(mAgentInitialWearables[i]); // This will be deleted in the callback. +// InitialWearableData *wearable_data = new InitialWearableData(mAgentInitialWearables[i]); // This will be deleted in the callback. +// [SL:KB] - Patch: Appearance-MixedViewers | Checked: 2010-05-02 (Catznip-3.0.0a) | Added: Catznip-2.0.0f + // Fixes minor leak: since COF is used onInitialWearableAssetArrived() will never get called and "wearable_data" leaks + InitialWearableData* wearable_data = &mAgentInitialWearables[i]; +// [/SL:KB] if (wearable_data->mAssetID.notNull()) { @@ -206,7 +279,7 @@ void LLInitialWearablesFetch::processWearablesMessage() { llinfos << "Invalid wearable, type " << wearable_data->mType << " itemID " << wearable_data->mItemID << " assetID " << wearable_data->mAssetID << llendl; - delete wearable_data; +// delete wearable_data; } } diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 3db65ae72..29c73ac52 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -47,7 +47,11 @@ #include "llvoavatarself.h" #include "llviewerregion.h" #include "llwearablelist.h" +// [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1a) #include "rlvhandler.h" +#include "rlvhelper.h" +#include "rlvlocks.h" +// [/RLVa:KB] // RAII thingy to guarantee that a variable gets reset when the Setter // goes out of scope. More general utility would be handy - TODO: @@ -287,11 +291,15 @@ public: void onWearableAssetFetch(LLWearable *wearable); void onAllComplete(); +// [SL:KB] - Patch: Appearance-COFCorruption | Checked: 2010-04-14 (Catznip-3.0.0a) | Added: Catznip-2.0.0a + bool pollStopped(); +// [/SL:KB] + typedef std::list found_list_t; found_list_t& getFoundList(); void eraseTypeToLink(LLWearableType::EType type); void eraseTypeToRecover(LLWearableType::EType type); - void setObjItems(const LLInventoryModel::item_array_t& items); +// void setObjItems(const LLInventoryModel::item_array_t& items); void setGestItems(const LLInventoryModel::item_array_t& items); bool isMostRecent(); void handleLateArrivals(); @@ -299,7 +307,7 @@ public: private: found_list_t mFoundList; - LLInventoryModel::item_array_t mObjItems; +// LLInventoryModel::item_array_t mObjItems; LLInventoryModel::item_array_t mGestItems; typedef std::set type_set_t; type_set_t mTypesToRecover; @@ -365,10 +373,11 @@ void LLWearableHoldingPattern::eraseTypeToRecover(LLWearableType::EType type) mTypesToRecover.erase(type); } -void LLWearableHoldingPattern::setObjItems(const LLInventoryModel::item_array_t& items) -{ - mObjItems = items; -} +// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-06-19 (Catznip-3.0.0a) | Added: Catznip-2.1.2a +//void LLWearableHoldingPattern::setObjItems(const LLInventoryModel::item_array_t& items) +//{ +// mObjItems = items; +//} void LLWearableHoldingPattern::setGestItems(const LLInventoryModel::item_array_t& items) { @@ -470,12 +479,13 @@ void LLWearableHoldingPattern::onAllComplete() llinfos << "Updating agent wearables with " << mResolved << " wearable items " << llendl; LLAppearanceMgr::instance().updateAgentWearables(this, false); - // Update attachments to match those requested. - if (isAgentAvatarValid()) - { - llinfos << "Updating " << mObjItems.count() << " attachments" << llendl; - LLAgentWearables::userUpdateAttachments(mObjItems); - } +// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-03-22 (Catznip-3.0.0a) | Added: Catznip-2.1.2a +// // Update attachments to match those requested. +// if (isAgentAvatarValid()) +// { +// llinfos << "Updating " << mObjItems.count() << " attachments" << llendl; +// LLAgentWearables::userUpdateAttachments(mObjItems); +// } if (isFetchCompleted() && isMissingCompleted()) { @@ -505,6 +515,12 @@ bool LLWearableHoldingPattern::pollFetchCompletion() if (!isMostRecent()) { llwarns << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl; + +// [SL:KB] - Patch: Appearance-COFCorruption | Checked: 2010-04-14 (Catznip-3.0.0a) | Added: Catznip-2.0.0a + // If we were signalled to stop then we shouldn't do anything else except poll for when it's safe to delete ourselves + doOnIdleRepeating(boost::bind(&LLWearableHoldingPattern::pollStopped, this)); + return true; +// [/SL:KB] } bool completed = isFetchCompleted(); @@ -596,6 +612,11 @@ public: if (!mHolder->isMostRecent()) { llwarns << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl; + +// [SL:KB] - Patch: Appearance-COFCorruption | Checked: 2010-04-14 (Catznip-3.0.0a) | Added: Catznip-2.0.0a + // If we were signalled to stop then we shouldn't do anything else except poll for when it's safe to delete ourselves + return; +// [/SL:KB] } llinfos << "Recovered item for type " << mType << llendl; @@ -670,11 +691,30 @@ void LLWearableHoldingPattern::clearCOFLinksForMissingWearables() } } +// [SL:KB] - Patch: Appearance-COFCorruption | Checked: 2010-04-14 (Catznip-3.0.0a) | Added: Catznip-2.0.0a +bool LLWearableHoldingPattern::pollStopped() +{ + // We have to keep on polling until we're sure that all callbacks have completed or they'll cause a crash + if ( (isFetchCompleted()) && (isMissingCompleted()) ) + { + delete this; + return true; + } + return false; +} +// [/SL:KB] + bool LLWearableHoldingPattern::pollMissingWearables() { if (!isMostRecent()) { llwarns << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl; + +// [SL:KB] - Patch: Appearance-COFCorruption | Checked: 2010-04-14 (Catznip-3.0.0a) | Added: Catznip-2.0.0a + // If we were signalled to stop then we shouldn't do anything else except poll for when it's safe to delete ourselves + doOnIdleRepeating(boost::bind(&LLWearableHoldingPattern::pollStopped, this)); + return true; +// [/SL:KB] } bool timed_out = isTimedOut(); @@ -885,6 +925,23 @@ static void removeDuplicateItems(LLInventoryModel::item_array_t& items) items = new_items; } +// [SL:KB] - Patch: Appearance-WearableDuplicateAssets | Checked: 2011-07-24 (Catznip-2.6.0e) | Added: Catznip-2.6.0e +static void removeDuplicateWearableItemsByAssetID(LLInventoryModel::item_array_t& items) +{ + std::set idsAsset; + for (S32 idxItem = items.count() - 1; idxItem >= 0; idxItem--) + { + const LLViewerInventoryItem* pItem = items.get(idxItem); + if (!pItem->isWearableType()) + continue; + if (idsAsset.end() == idsAsset.find(pItem->getAssetUUID())) + idsAsset.insert(pItem->getAssetUUID()); + else + items.remove(idxItem); + } +} +// [/SL:KB] + const LLUUID LLAppearanceMgr::getCOF() const { return gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); @@ -995,6 +1052,33 @@ bool LLAppearanceMgr::wearItemOnAvatar(const LLUUID& item_id_to_wear, bool do_up return false; } +// [RLVa:KB] - Checked: 2010-09-04 (RLVa-1.2.1a) | Modified: RLVa-1.2.1a + if ( (rlv_handler_t::isEnabled()) && + ((gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) || (gRlvWearableLocks.hasLockedWearableType(RLV_LOCK_ANY))) ) + { + switch (item_to_wear->getType()) + { + case LLAssetType::AT_BODYPART: + case LLAssetType::AT_CLOTHING: + { + ERlvWearMask eWear = gRlvWearableLocks.canWear(item_to_wear); + if ( (RLV_WEAR_LOCKED == eWear) || ((replace) && ((RLV_WEAR_REPLACE & eWear) == 0)) ) + return false; + } + break; + case LLAssetType::AT_OBJECT: + { + ERlvWearMask eWear = gRlvAttachmentLocks.canAttach(item_to_wear); + if ( (RLV_WEAR_LOCKED == eWear) || ((replace) && ((RLV_WEAR_REPLACE & eWear) == 0)) ) + return false; + } + break; + default: + return false; + } + } +// [/RLVa:KB] + switch (item_to_wear->getType()) { case LLAssetType::AT_CLOTHING: @@ -1307,7 +1391,10 @@ bool LLAppearanceMgr::getCanReplaceCOF(const LLUUID& outfit_cat_id) } // Check whether it's the base outfit. - if (outfit_cat_id.isNull() || outfit_cat_id == getBaseOutfitUUID()) +// if (outfit_cat_id.isNull() || outfit_cat_id == getBaseOutfitUUID()) +// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-09-21 (Catznip-3.0.0a) | Added: Catznip-2.1.2d + if ( (outfit_cat_id.isNull()) || ((outfit_cat_id == getBaseOutfitUUID()) && (!isOutfitDirty())) ) +// [/SL:KB] { return false; } @@ -1364,6 +1451,45 @@ void LLAppearanceMgr::purgeCategory(const LLUUID& category, bool keep_outfit_lin } } +// [SL:KB] - Checked: 2010-04-24 (RLVa-1.2.0f) | Added: RLVa-1.2.0f +void LLAppearanceMgr::syncCOF(const LLInventoryModel::item_array_t& items, LLAssetType::EType type, LLPointer cb) +{ + const LLUUID idCOF = getCOF(); + LLInventoryModel::item_array_t cur_cof_items, new_cof_items = items; + + // Grab the current COF contents + LLIsType f(type); + LLInventoryModel::cat_array_t cats; + gInventory.collectDescendentsIf(getCOF(), cats, cur_cof_items, LLInventoryModel::EXCLUDE_TRASH, f); + + // Purge everything in cur_cof_items that isn't part of new_cof_items + for (S32 idxCurItem = 0, cntCurItem = cur_cof_items.count(); idxCurItem < cntCurItem; idxCurItem++) + { + const LLViewerInventoryItem* pItem = cur_cof_items.get(idxCurItem); + if (std::find_if(new_cof_items.begin(), new_cof_items.end(), RlvPredIsEqualOrLinkedItem(pItem)) == new_cof_items.end()) + { + // Item doesn't exist in new_cof_items => purge (if it's a link) + if (pItem->getIsLinkType()) + gInventory.purgeObject(pItem->getUUID()); + } + else + { + // Item exists in new_cof_items => remove *all* occurances in new_cof_items (removes duplicate COF links to this item as well) + new_cof_items.erase( + std::remove_if(new_cof_items.begin(), new_cof_items.end(), RlvPredIsEqualOrLinkedItem(pItem)), new_cof_items.end()); + } + } + + // Link to whatever remains in new_cof_items + for (S32 idxNewItem = 0, cntNewItem = new_cof_items.count(); idxNewItem < cntNewItem; idxNewItem++) + { + const LLInventoryItem* pItem = new_cof_items.get(idxNewItem); + link_inventory_item( + gAgent.getID(), pItem->getLinkedUUID(), idCOF, pItem->getName(), pItem->LLInventoryItem::getDescription(), LLAssetType::AT_LINK, cb); + } +} +// [/SL:KB] + // Keep the last N wearables of each type. For viewer 2.0, N is 1 for // both body parts and clothing items. void LLAppearanceMgr::filterWearableItems( @@ -1380,7 +1506,11 @@ void LLAppearanceMgr::filterWearableItems( S32 size = items_by_type[i].size(); if (size <= 0) continue; - S32 start_index = llmax(0,size-max_per_type); +// S32 start_index = llmax(0,size-max_per_type); +// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-05-11 (Catznip-3.0.0a) | Added: Catznip-2.0.0h + S32 start_index = + llmax(0, size - ((LLAssetType::AT_BODYPART == LLWearableType::getAssetType((LLWearableType::EType)i)) ? 1 : max_per_type)); +// [/SL:KB[ for (S32 j = start_index; jgetName() : "[UNKNOWN]") << llendl; +// LLViewerInventoryCategory *pcat = gInventory.getCategory(category); +// llinfos << "starting, cat " << (pcat ? pcat->getName() : "[UNKNOWN]") << llendl; +// [RLVa:KB] - Checked: 2010-03-26 (RLVa-1.2.0b) | Added: RLVa-1.2.0b + // RELEASE-RLVa: [SL-2.0.0] If pcat ever gets used for anything further down the beta we'll know about it + llinfos << "starting" << llendl; +// [/RLVa:KB] const LLUUID cof = getCOF(); @@ -1494,11 +1628,13 @@ void LLAppearanceMgr::updateCOF(LLInventoryModel::item_array_t& body_items_new, // Reduce wearables to max of one per type. removeDuplicateItems(wear_items); // [SL:KB] - Patch: Appearance-WearableDuplicateAssets | Checked: 2011-07-24 (Catznip-2.6.0e) | Added: Catznip-2.6.0e - //removeDuplicateWearableItemsByAssetID(wear_items); + removeDuplicateWearableItemsByAssetID(wear_items); // [/SL:KB] filterWearableItems(wear_items, LLAgentWearables::MAX_CLOTHING_PER_TYPE); + // // - Attachments: include COF contents only if appending. + // LLInventoryModel::item_array_t obj_items; if (append) getDescendentsOfAssetType(cof, obj_items, LLAssetType::AT_OBJECT, false); @@ -1536,35 +1672,35 @@ void LLAppearanceMgr::updateCOF(LLInventoryModel::item_array_t& body_items_new, LLPointer link_waiter = new LLUpdateAppearanceOnDestroy(!append); // [SL:KB] - Checked: 2010-04-24 (RLVa-1.2.0f) | Added: RLVa-1.2.0f - //if (!append) + if (!append) { // [/SL:KB] // Remove current COF contents. - bool keep_outfit_links = append; - purgeCategory(cof, keep_outfit_links); - gInventory.notifyObservers(); -#ifndef LL_RELEASE_FOR_DOWNLOAD - llinfos << "Linking body items" << llendl; -#endif - linkAll(cof, body_items, link_waiter); + bool keep_outfit_links = append; + purgeCategory(cof, keep_outfit_links); + gInventory.notifyObservers(); + #ifndef LL_RELEASE_FOR_DOWNLOAD + llinfos << "Linking body items" << llendl; + #endif + linkAll(cof, body_items, link_waiter); -#ifndef LL_RELEASE_FOR_DOWNLOAD - llinfos << "Linking wear items" << llendl; -#endif - linkAll(cof, wear_items, link_waiter); + #ifndef LL_RELEASE_FOR_DOWNLOAD + llinfos << "Linking wear items" << llendl; + #endif + linkAll(cof, wear_items, link_waiter); -#ifndef LL_RELEASE_FOR_DOWNLOAD - llinfos << "Linking obj items" << llendl; -#endif - linkAll(cof, obj_items, link_waiter); + #ifndef LL_RELEASE_FOR_DOWNLOAD + llinfos << "Linking obj items" << llendl; + #endif + linkAll(cof, obj_items, link_waiter); -#ifndef LL_RELEASE_FOR_DOWNLOAD - llinfos << "Linking gesture items" << llendl; -#endif + #ifndef LL_RELEASE_FOR_DOWNLOAD + llinfos << "Linking gesture items" << llendl; + #endif linkAll(cof, gest_items, link_waiter); // [SL:KB] - Checked: 2010-04-24 (RLVa-1.2.0f) | Added: RLVa-1.2.0f } - /*else + else { // Synchronize COF // -> it's possible that we don't link to any new items in which case 'link_waiter' fires when it goes out of scope below @@ -1573,20 +1709,21 @@ void LLAppearanceMgr::updateCOF(LLInventoryModel::item_array_t& body_items_new, syncCOF(obj_items, LLAssetType::AT_OBJECT, link_waiter); syncCOF(gest_items, LLAssetType::AT_GESTURE, link_waiter); gInventory.notifyObservers(); - }*/ + } // [/SL:KB] // Add link to outfit if category is an outfit. // [RLVa:KB] - Checked: 2010-03-05 (RLVa-1.2.0z) | Added: RLVa-1.2.0b - /*if ( (!append) && (idOutfit.notNull()) ) - { - createBaseOutfitLink(idOutfit, link_waiter); - }*/ -// [/RLVa:KB] - if (!append) + if ( (!append) && (idOutfit.notNull()) ) { createBaseOutfitLink(idOutfit, link_waiter); } +// [/RLVa:KB] +// if (!append) +// { +// createBaseOutfitLink(category, link_waiter); +// } + llinfos << "waiting for LLUpdateAppearanceOnDestroy" << llendl; } @@ -1624,6 +1761,14 @@ void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder, boo lldebugs << "updateAgentWearables()" << llendl; LLInventoryItem::item_array_t items; LLDynamicArray< LLWearable* > wearables; +// [RLVa:KB] - Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f + uuid_vec_t idsCurrent; LLInventoryModel::item_array_t itemsNew; + if (rlv_handler_t::isEnabled()) + { + // Collect the item UUIDs of all currently worn wearables + gAgentWearables.getWearableItemIDs(idsCurrent); + } +// [/RLVa:KB] // For each wearable type, find the wearables of that type. for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ ) @@ -1638,13 +1783,60 @@ void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder, boo LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(data.mItemID); if( item && (item->getAssetUUID() == wearable->getAssetID()) ) { +// [RLVa:KB] - Checked: 2010-03-19 (RLVa-1.2.0g) | Modified: RLVa-1.2.0g + // TODO-RLVa: [RLVa-1.2.1] This is fall-back code so if we don't ever trigger this code it can just be removed + // -> one way to trigger the assertion: + // 1) "Replace Outfit" on a folder with clothing and an attachment that goes @addoutfit=n + // 2) updateCOF will add/link the items into COF => no @addoutfit=n present yet => allowed + // 3) llOwnerSay("@addoutfit=n") executes + // 4) code below runs => @addoutfit=n conflicts with adding new wearables + // => if it's left as-is then the wearables won't get worn (but remain in COF which causes issues of its own) + // => if it's changed to debug-only then we make tge assumption that anything that makes it into COF is always OK +#ifdef RLV_DEBUG + // NOTE: make sure we don't accidentally block setting the initial wearables + if ( (rlv_handler_t::isEnabled()) && (RLV_WEAR_LOCKED == gRlvWearableLocks.canWear(wearable->getType())) && + (!gAgentWearables.getWearableFromItemID(item->getUUID())) && (gAgentWearables.areWearablesLoaded()) ) + { + RLV_VERIFY(RLV_WEAR_LOCKED == gRlvWearableLocks.canWear(wearable->getType())); + continue; + } +#endif // RLV_DEBUG +// [/RLVa:KB] items.put(item); wearables.put(wearable); +// [RLVa:KB] - Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f + if ( (rlv_handler_t::isEnabled()) && (gAgentWearables.areInitalWearablesLoaded()) ) + { + // Remove the wearable from current item UUIDs if currently worn and requested, otherwise mark it as a new item + uuid_vec_t::iterator itItemID = std::find(idsCurrent.begin(), idsCurrent.end(), item->getUUID()); + if (idsCurrent.end() != itItemID) + idsCurrent.erase(itItemID); + else + itemsNew.push_back(item); + } +// [/RLVa:KB] } } } } +// [RLVa:KB] - Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f + if ( (rlv_handler_t::isEnabled()) && (gAgentWearables.areInitalWearablesLoaded()) ) + { + // We need to report removals before additions or scripts will get confused + for (uuid_vec_t::const_iterator itItemID = idsCurrent.begin(); itItemID != idsCurrent.end(); ++itItemID) + { + const LLWearable* pWearable = gAgentWearables.getWearableFromItemID(*itItemID); + if (pWearable) + RlvBehaviourNotifyHandler::onTakeOff(pWearable->getType(), true); + } + for (S32 idxItem = 0, cntItem = itemsNew.count(); idxItem < cntItem; idxItem++) + { + RlvBehaviourNotifyHandler::onWear(itemsNew.get(idxItem)->getWearableType(), true); + } + } +// [/RLVa:KB] + if(wearables.count() > 0) { gAgentWearables.setWearableOutfit(items, wearables, !append); @@ -1791,10 +1983,49 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) remove_non_link_items(wear_items); remove_non_link_items(obj_items); remove_non_link_items(gest_items); +// [SL:KB] - Patch: Apperance-Misc | Checked: 2010-11-24 (Catznip-3.0.0a) | Added: Catzip-2.4.0f + // Since we're following folder links we might have picked up new duplicates, or exceeded MAX_CLOTHING_PER_TYPE + removeDuplicateItems(wear_items); + removeDuplicateItems(obj_items); + removeDuplicateItems(gest_items); + filterWearableItems(wear_items, LLAgentWearables::MAX_CLOTHING_PER_TYPE); +// [/SL:KB] +// [SL:KB] - Patch: Appearance-WearableDuplicateAssets | Checked: 2011-07-24 (Catznip-2.6.0e) | Added: Catznip-2.6.0e + // Wearing two wearables that share the same asset causes some issues + removeDuplicateWearableItemsByAssetID(wear_items); +// [/SL:KB] dumpItemArray(wear_items,"asset_dump: wear_item"); dumpItemArray(obj_items,"asset_dump: obj_item"); +// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-22 (Catznip-3.0.0a) | Added: Catznip-2.2.0a + // Update attachments to match those requested. + if (isAgentAvatarValid()) + { + // Include attachments which should be in COF but don't have their link created yet + uuid_vec_t::iterator itPendingAttachLink = mPendingAttachLinks.begin(); + while (itPendingAttachLink != mPendingAttachLinks.end()) + { + const LLUUID& idItem = *itPendingAttachLink; + if ( (!gAgentAvatarp->isWearingAttachment(idItem)) || (isLinkInCOF(idItem)) ) + { + itPendingAttachLink = mPendingAttachLinks.erase(itPendingAttachLink); + continue; + } + + LLViewerInventoryItem* pItem = gInventory.getItem(idItem); + if (pItem) + obj_items.push_back(pItem); + + ++itPendingAttachLink; + } + + // Don't remove attachments until avatar is fully loaded (should reduce random attaching/detaching/reattaching at log-on) + llinfos << "Updating " << obj_items.count() << " attachments" << llendl; + LLAgentWearables::userUpdateAttachments(obj_items, !gAgentAvatarp->isFullyLoaded()); + } +// [/SL:KB] + if(!wear_items.count()) { LLNotificationsUtil::add("CouldNotPutOnOutfit"); @@ -1807,7 +2038,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) LLWearableHoldingPattern* holder = new LLWearableHoldingPattern; - holder->setObjItems(obj_items); +// holder->setObjItems(obj_items); holder->setGestItems(gest_items); // Note: can't do normal iteration, because if all the @@ -1824,6 +2055,9 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) // fetch failures (should be replaced by new defaults in // lost&found). U32 skip_type = gSavedSettings.getU32("ForceAssetFail"); +// [RLVa:KB] - Checked: 2010-12-11 (RLVa-1.2.2c) | Added: RLVa-1.2.2c + U32 missing_type = gSavedSettings.getU32("ForceMissingType"); +// [/RLVa:KB] if (item && item->getIsLinkType() && linked_item) { @@ -1834,10 +2068,25 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) linked_item->isWearableType() ? linked_item->getWearableType() : LLWearableType::WT_INVALID ); +// [RLVa:KB] - Checked: 2010-12-15 (RLVa-1.2.2c) | Modified: RLVa-1.2.2c +#ifdef LL_RELEASE_FOR_DOWNLOAD + // Don't allow forcing an invalid wearable if the initial wearables aren't set yet, or if any wearable type is currently locked + if ( (!rlv_handler_t::isEnabled()) || + ((gAgentWearables.areInitalWearablesLoaded()) && (!gRlvWearableLocks.hasLockedWearableType(RLV_LOCK_REMOVE))) ) +#endif // LL_RELEASE_FOR_DOWNLOAD + { + if (missing_type != LLWearableType::WT_INVALID && missing_type == found.mWearableType) + { + continue; + } +// [/RLVa:KB] if (skip_type != LLWearableType::WT_INVALID && skip_type == found.mWearableType) { found.mAssetID.generate(); // Replace with new UUID, guaranteed not to exist in DB } +// [RLVa:KB] - Checked: 2010-12-15 (RLVa-1.2.2c) | Modified: RLVa-1.2.2c + } +// [/RLVa:KB] //pushing back, not front, to preserve order of wearables for LLAgentWearables holder->getFoundList().push_back(found); } @@ -1877,6 +2126,21 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) } } +// [SL:KB] - Patch: Appearance-MixedViewers | Checked: 2010-04-02 (Catznip-3.0.0a) | Added: Catznip-2.0.0a +void LLAppearanceMgr::updateAppearanceFromInitialWearables(LLInventoryModel::item_array_t& initial_items) +{ + const LLUUID& idCOF = getCOF(); + + // Remove current COF contents + purgeCategory(idCOF, false); + gInventory.notifyObservers(); + + // Create links to new COF contents + LLPointer link_waiter = new LLUpdateAppearanceOnDestroy(); + linkAll(idCOF, initial_items, link_waiter); +} +// [/SL:KB] + void LLAppearanceMgr::getDescendentsOfAssetType(const LLUUID& category, LLInventoryModel::item_array_t& items, LLAssetType::EType type, @@ -2735,7 +2999,7 @@ void LLAppearanceMgr::removeItemFromAvatar(const LLUUID& id_to_remove) gInventory.notifyObservers(); // [RLVa:KB] - Checked: 2011-06-07 (RLVa-1.3.1b) | Added: RLVa-1.3.1b - //RlvBehaviourNotifyHandler::onTakeOff(pWearable->getType(), true); + RlvBehaviourNotifyHandler::onTakeOff(pWearable->getType(), true); // [/RLVa:KB] } } @@ -2886,6 +3150,12 @@ void LLAppearanceMgr::setAttachmentInvLinkEnable(bool val) { llinfos << "setAttachmentInvLinkEnable => " << (int) val << llendl; mAttachmentInvLinkEnabled = val; +// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-10-05 (Catznip-3.0.0a) | Added: Catznip-2.2.0a + if (mAttachmentInvLinkEnabled) + { + linkPendingAttachments(); + } +// [/SL:KB] } void dumpAttachmentSet(const std::set& atts, const std::string& msg) @@ -2908,13 +3178,24 @@ void dumpAttachmentSet(const std::set& atts, const std::string& msg) void LLAppearanceMgr::registerAttachment(const LLUUID& item_id) { gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); +// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-10-05 (Catznip-3.0.0a) | Added: Catznip-2.2.0a + if (isLinkInCOF(item_id)) + { + return; + } + mPendingAttachLinks.push_back(item_id); +// [/SL:KB] if (mAttachmentInvLinkEnabled) { // we have to pass do_update = true to call LLAppearanceMgr::updateAppearanceFromCOF. // it will trigger gAgentWariables.notifyLoadingFinished() // But it is not acceptable solution. See EXT-7777 - LLAppearanceMgr::addCOFItemLink(item_id, false); // Add COF link for item. +// LLAppearanceMgr::addCOFItemLink(item_id, false); // Add COF link for item. +// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-10-05 (Catznip-3.0.0a) | Modified: Catznip-2.2.0a + LLPointer cb = new LLRegisterAttachmentCallback(); + LLAppearanceMgr::addCOFItemLink(item_id, false, cb); // Add COF link for item. +// [/SL:KB] } else { @@ -2925,6 +3206,13 @@ void LLAppearanceMgr::registerAttachment(const LLUUID& item_id) void LLAppearanceMgr::unregisterAttachment(const LLUUID& item_id) { gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); +// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-10-05 (Catznip-3.0.0a) | Added: Catznip-2.2.0a + uuid_vec_t::iterator itPendingAttachLink = std::find(mPendingAttachLinks.begin(), mPendingAttachLinks.end(), item_id); + if (itPendingAttachLink != mPendingAttachLinks.end()) + { + mPendingAttachLinks.erase(itPendingAttachLink); + } +// [/SL:KB] if (mAttachmentInvLinkEnabled) { @@ -2936,6 +3224,38 @@ void LLAppearanceMgr::unregisterAttachment(const LLUUID& item_id) } } +// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-18 (Catznip-3.0.0a) | Modified: Catznip-2.2.0a +void LLAppearanceMgr::linkPendingAttachments() +{ + LLPointer cb = NULL; + for (uuid_vec_t::const_iterator itPendingAttachLink = mPendingAttachLinks.begin(); + itPendingAttachLink != mPendingAttachLinks.end(); ++itPendingAttachLink) + { + const LLUUID& idAttachItem = *itPendingAttachLink; + if ( (gAgentAvatarp->isWearingAttachment(idAttachItem)) && (!isLinkInCOF(idAttachItem)) ) + { + if (!cb) + cb = new LLRegisterAttachmentCallback(); + LLAppearanceMgr::addCOFItemLink(idAttachItem, false, cb); + } + } +} + +void LLAppearanceMgr::onRegisterAttachmentComplete(const LLUUID& idItem) +{ + const LLUUID& idItemBase = gInventory.getLinkedItemID(idItem); + + // Remove the attachment from the pending list + uuid_vec_t::iterator itPendingAttachLink = std::find(mPendingAttachLinks.begin(), mPendingAttachLinks.end(), idItemBase); + if (itPendingAttachLink != mPendingAttachLinks.end()) + mPendingAttachLinks.erase(itPendingAttachLink); + + // It may have been detached already in which case we should remove the COF link + if ( (isAgentAvatarValid()) && (!gAgentAvatarp->isWearingAttachment(idItemBase)) ) + removeCOFItemLinks(idItemBase, false); +} +// [/SL:KB] + BOOL LLAppearanceMgr::getIsInCOF(const LLUUID& obj_id) const { return gInventory.isObjectDescendentOf(obj_id, getCOF()); diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 6b072075e..0e83fe73e 100644 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -51,6 +51,9 @@ public: typedef std::vector wearables_by_type_t; void updateAppearanceFromCOF(bool update_base_outfit_ordering = false); +// [SL:KB] - Patch: Appearance-MixedViewers | Checked: 2010-04-02 (Catznip-3.0.0a) | Added: Catznip-2.0.0a + void updateAppearanceFromInitialWearables(LLInventoryModel::item_array_t& initial_items); +// [/SL:KB] bool needToSaveCOF(); void updateCOF(const LLUUID& category, bool append = false); // [RLVa:KB] - Checked: 2010-03-05 (RLVa-1.2.0a) | Added: RLVa-1.2.0a @@ -213,6 +216,10 @@ private: void setOutfitLocked(bool locked); +// [SL:KB] - Checked: 2010-04-24 (RLVa-1.2.0f) | Added: RLVa-1.2.0f + void syncCOF(const LLInventoryModel::item_array_t& items, LLAssetType::EType type, LLPointer cb); +// [/SL:KB] + bool mAttachmentInvLinkEnabled; bool mOutfitIsDirty; bool mIsInUpdateAppearanceFromCOF; // to detect recursive calls. @@ -225,6 +232,14 @@ private: std::auto_ptr mUnlockOutfitTimer; +// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-18 (Catznip-3.0.0a) | Modified: Catznip-2.1.2e +public: + void linkPendingAttachments(); + void onRegisterAttachmentComplete(const LLUUID& idItem); +private: + uuid_vec_t mPendingAttachLinks; +// [/SL:KB] + ////////////////////////////////////////////////////////////////////////////////// // Item-specific convenience functions public: @@ -251,6 +266,16 @@ private: bool mUpdateBaseOrder; }; +// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-08-31 (Catznip-3.0.0a) | Added: Catznip-2.1.2a +class LLRegisterAttachmentCallback : public LLInventoryCallback +{ +public: + /*virtual*/ void fire(const LLUUID& idItem) + { + LLAppearanceMgr::instance().onRegisterAttachmentComplete(idItem); + } +}; +// [/SL:KB] #define SUPPORT_ENSEMBLES 0 diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index a37af3ad3..0ab9fdefa 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -162,7 +162,7 @@ #include "llsurface.h" #include "llvosky.h" #include "llvotree.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llfolderview.h" #include "lltoolbar.h" #include "llframestats.h" @@ -1374,6 +1374,14 @@ extern void cleanup_pose_stand(void); bool LLAppViewer::cleanup() { + + //HACK: the selectmgr may hold a ref to gAgentAvatarp, which will defer the actual + // destruction until LLSelectMgr::cleanupGlobals() is called AFTER the UI has been destroyed. + // This presents issue, as ~LLVOAvatarSelf spawns notifications if DebugAvatarRezTime is true, which will + // crash if the UI has been destroyed before then. + LLSelectMgr::getInstance()->remove(gAgentAvatarp, SELECT_ALL_TES, false); + //ditch LLVOAvatarSelf instance + gAgentAvatarp = NULL; cleanup_pose_stand(); //flag all elements as needing to be destroyed immediately diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index 56490162b..abca74796 100644 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -35,6 +35,7 @@ #include "message.h" // [RLVa:KB] - Checked: 2010-09-13 (RLVa-1.2.1c) #include "rlvhandler.h" +#include "rlvlocks.h" // [/RLVa:KB] LLAttachmentsMgr::LLAttachmentsMgr() diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp index b91ad1f4d..4eb4ce97e 100644 --- a/indra/newview/llchatbar.cpp +++ b/indra/newview/llchatbar.cpp @@ -75,6 +75,7 @@ // [/RLVa:KB] #if SHY_MOD //Command handler +#include "llvoavatarself.h" #include "shcommandhandler.h" #endif //shy_mod diff --git a/indra/newview/llcompass.cpp b/indra/newview/llcompass.cpp deleted file mode 100644 index be4db43a8..000000000 --- a/indra/newview/llcompass.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/** - * @file llcompass.cpp - * @brief A little map of the world with network information - * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llmath.h" // clampf() -#include "llmath.h" -#include "llgl.h" - -#include "llui.h" - -#include "llcircuit.h" -#include "message.h" -#include "llagent.h" -#include "llcompass.h" - -#include "llviewertexturelist.h" -#include "llviewercontrol.h" -#include "llviewercamera.h" - -//#include "llglheaders.h" - -// -// Imported globals -// -extern LLMessageSystem* gMessageSystem; - -// -// Constants -// - -///---------------------------------------------------------------------------- -/// LLCompass -///---------------------------------------------------------------------------- - -LLCompass::LLCompass( const std::string& name, const LLRect& rect) - : LLView(name, rect, FALSE) -{ - mTexture = NULL; - mBkgndTexture = NULL; - - BOOL state = gSavedSettings.getBOOL( "ShowCompass" ); - - setVisible( state ); -} - -void LLCompass::setTexture(LLUUID image_id) -{ - mTexture = LLViewerTextureManager::getFetchedTexture(image_id, FALSE, LLViewerTexture::BOOST_UI); -} - -void LLCompass::setBkgndTexture(LLUUID image_id) -{ - mBkgndTexture = LLViewerTextureManager::getFetchedTexture(image_id, FALSE, LLViewerTexture::BOOST_UI); -} - -// -// Functions -// - -///---------------------------------------------------------------------------- -/// LLHorizontalCompass -///---------------------------------------------------------------------------- - -LLHorizontalCompass::LLHorizontalCompass( const std::string& name, const LLRect& rect, - const LLColor4& focus_color, - const LLUUID& image_id ) : - LLView( name, rect, TRUE ), - mFocusColor( focus_color ), - mTexture( NULL ) -{ - setTexture( image_id ); - - BOOL state = gSavedSettings.getBOOL( "ShowCompass" ); - setVisible( state ); -} - -void LLHorizontalCompass::setTexture( const LLUUID& image_id ) -{ - mTexture = LLViewerTextureManager::getFetchedTexture(image_id, FALSE, LLViewerTexture::BOOST_UI); -} diff --git a/indra/newview/llcompass.h b/indra/newview/llcompass.h deleted file mode 100644 index 1734a8a42..000000000 --- a/indra/newview/llcompass.h +++ /dev/null @@ -1,92 +0,0 @@ -/** - * @file llcompass.h - * @brief A little map of the world with network information - * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#ifndef LL_LLCOMPASS_H -#define LL_LLCOMPASS_H - -#include "llmath.h" -#include "llview.h" -#include "llviewertexture.h" -#ifndef LL_V4COLOR_H -#include "v4color.h" -#endif - -class LLCompass : public LLView -{ -protected: - LLPointer mTexture; - LLPointer mBkgndTexture; -public: - LLCompass( const std::string& name, const LLRect& rect); - - void setTexture(LLUUID image_id); - void setBkgndTexture(LLUUID image_id); - virtual void draw(); - - inline friend std::ostream& operator<<(std::ostream& s, LLCompass &compass) - { -#if 0 - s << "X,Y" << TAB; - s.width(10); s << "In (new/total)"; - s.width(0); s << DIVIDER; - s.width(10); s << "Lost (new/total)"; - s.width(0); s << DIVIDER; - s.width(5); s << "Ping"; - s.width(0); s << DIVIDER; - s.width(6); s << "Bandwidth"; - s.width(0); s << TAB << "IP:port" << endl; - for (LLCompassInfo* p = compass.mCompassList.getFirstData(); p != NULL; p = compass.mCompassList.getNextData()) - { - s << *p; - } -#endif - return s; - } -}; - -class LLHorizontalCompass : public LLView -{ -protected: - LLColor4 mFocusColor; - LLPointer mTexture; - -public: - LLHorizontalCompass( const std::string& name, const LLRect& rect, - const LLColor4& focus_color, - const LLUUID& image_id ); - virtual ~LLHorizontalCompass( void ) {} - - void setTexture( const LLUUID& image_id ); - virtual void draw(); -}; - -#endif diff --git a/indra/newview/lldaycyclemanager.cpp b/indra/newview/lldaycyclemanager.cpp index d027d6557..b5ed0facc 100644 --- a/indra/newview/lldaycyclemanager.cpp +++ b/indra/newview/lldaycyclemanager.cpp @@ -32,6 +32,10 @@ #include "lldaycyclemanager.h" #include "lldiriterator.h" +// [RLVa:KB] - Checked: 2011-09-04 (RLVa-1.4.1a) | Added: RLVa-1.4.1a +#include +// [/RLVa:KB] + void LLDayCycleManager::getPresetNames(preset_name_list_t& names) const { names.clear(); @@ -62,6 +66,18 @@ void LLDayCycleManager::getPresetNames(preset_name_list_t& user, preset_name_lis } } +// [RLVa:KB] - Checked: 2011-09-04 (RLVa-1.4.1a) | Added: RLVa-1.4.1a +const std::string& LLDayCycleManager::findPreset(const std::string& strPresetName) +{ + for (dc_map_t::const_iterator itCycle = mDayCycleMap.begin(); itCycle != mDayCycleMap.end(); ++itCycle) + { + if (boost::iequals(itCycle->first, strPresetName)) + return itCycle->first; + } + return LLStringUtil::null; +} +// [/RLVa:KB] + void LLDayCycleManager::getUserPresetNames(preset_name_list_t& user) const { preset_name_list_t sys; // unused diff --git a/indra/newview/lldaycyclemanager.h b/indra/newview/lldaycyclemanager.h index 3d2144960..81b31dc71 100644 --- a/indra/newview/lldaycyclemanager.h +++ b/indra/newview/lldaycyclemanager.h @@ -51,6 +51,9 @@ public: void getPresetNames(preset_name_list_t& names) const; void getPresetNames(preset_name_list_t& user, preset_name_list_t& sys) const; void getUserPresetNames(preset_name_list_t& user) const; +// [RLVa:KB] - Checked: 2011-09-04 (RLVa-1.4.1a) | Added: RLVa-1.4.1a + const std::string& findPreset(const std::string& strPresetName); +// [/RLVa:KB] bool getPreset(const std::string name, LLWLDayCycle& day_cycle) const; bool getPreset(const std::string name, LLSD& day_cycle) const; diff --git a/indra/newview/lldriverparam.cpp b/indra/newview/lldriverparam.cpp index 8332a6221..93c437d2d 100644 --- a/indra/newview/lldriverparam.cpp +++ b/indra/newview/lldriverparam.cpp @@ -139,7 +139,7 @@ void LLDriverParamInfo::toStream(std::ostream &out) } else { - llwarns << "could not get parameter " << driven.mDrivenID << " from avatar " << gAgentAvatarp << " for driver parameter " << getID() << llendl; + llwarns << "could not get parameter " << driven.mDrivenID << " from avatar " << gAgentAvatarp.get() << " for driver parameter " << getID() << llendl; } out << std::endl; } diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index 51120f5b7..be90667cf 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -1,40 +1,38 @@ /** * @file lldynamictexture.cpp - * @brief Implementation of LLDynamicTexture class + * @brief Implementation of LLViewerDynamicTexture class * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ #include "llviewerprecompiledheaders.h" #include "lldynamictexture.h" + +// Linden library includes #include "llglheaders.h" #include "llwindow.h" // getPosition() + +// Viewer includes #include "llviewerwindow.h" #include "llviewercamera.h" #include "llviewercontrol.h" @@ -42,8 +40,8 @@ #include "llvertexbuffer.h" #include "llviewerdisplay.h" #include "llrender.h" -#include "llglslshader.h" #include "pipeline.h" +#include "llglslshader.h" // static LLViewerDynamicTexture::instance_list_t LLViewerDynamicTexture::sInstances[ LLViewerDynamicTexture::ORDER_COUNT ]; @@ -152,8 +150,8 @@ void LLViewerDynamicTexture::preRender(BOOL clear_depth) mOrigin.mY += window_pos.mY; mOrigin.mY = llmax(mOrigin.mY, 0) ; } - } + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); // Set up camera LLViewerCamera* camera = LLViewerCamera::getInstance(); diff --git a/indra/newview/lldynamictexture.h b/indra/newview/lldynamictexture.h index 14b8e582d..398a41cef 100644 --- a/indra/newview/lldynamictexture.h +++ b/indra/newview/lldynamictexture.h @@ -1,32 +1,26 @@ /** * @file lldynamictexture.h - * @brief Implementation of LLDynamicTexture class + * @brief Implementation of LLViewerDynamicTexture class * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -37,6 +31,7 @@ #include "llgl.h" #include "llcoord.h" #include "llviewertexture.h" +#include "llcamera.h" class LLViewerDynamicTexture : public LLViewerTexture { diff --git a/indra/newview/llenvmanager.cpp b/indra/newview/llenvmanager.cpp index afbf505aa..56e73fe83 100644 --- a/indra/newview/llenvmanager.cpp +++ b/indra/newview/llenvmanager.cpp @@ -41,9 +41,11 @@ #include "llwaterparammanager.h" #include "llwlhandlers.h" #include "llwlparammanager.h" -//#include "kcwlinterface.h" #include "m7wlinterface.h" +// [RLVa:KB] - Checked: 2011-09-04 (RLVa-1.4.1a) | Added: RLVa-1.4.1a +#include #include "rlvhandler.h" +// [/RLVa:KB] std::string LLEnvPrefs::getWaterPresetName() const { @@ -492,21 +494,15 @@ void LLEnvManagerNew::onRegionSettingsResponse(const LLSD& content) // Load region sky presets. LLWLParamManager::getInstance()->refreshRegionPresets(); - // Use the region settings if parcel settings didnt override it already -KC - if (!M7WindlightInterface::getInstance()->hasOverride()) + bool bOverridden = M7WindlightInterface::getInstance()->hasOverride(); + + // If using server settings, update managers. +// if (getUseRegionSettings()) +// [RLVa:KB] - Checked: 2011-08-29 (RLVa-1.4.1a) | Added: RLVa-1.4.1a + if (!bOverridden && (getUseRegionSettings()) && (LLWLParamManager::getInstance()->mAnimator.getIsRunning()) ) +// [/RLVa:KB] { - // If using server settings, update managers. - if (getUseRegionSettings()) - { - updateManagersFromPrefs(mInterpNextChangeMessage); - } - //bit of a hacky override since I've repurposed many of the settings and methods here -KC - //NOTE* It might not be a good idea to do this if under RLV_BHVR_SETENV -KC - else if (gSavedSettings.getBOOL("UseEnvironmentFromRegionAlways") - && !(rlv_handler_t::isEnabled() && gRlvHandler.hasBehaviour(RLV_BHVR_SETENV))) - { - setUseRegionSettings(true, mInterpNextChangeMessage); - } + updateManagersFromPrefs(mInterpNextChangeMessage); } // Let interested parties know about the region settings update. @@ -614,6 +610,12 @@ void LLEnvManagerNew::updateWaterFromPrefs(bool interpolate) void LLEnvManagerNew::updateManagersFromPrefs(bool interpolate) { +// [RLVa:KB] - Checked: 2011-09-04 (RLVa-1.4.1a) | Added: RLVa-1.4.1a + if (gRlvHandler.hasBehaviour(RLV_BHVR_SETENV)) + { + return; + } +// [/RLVa:KB] // Apply water settings. updateWaterFromPrefs(interpolate); diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp index fd78d69bc..9a629d7d4 100644 --- a/indra/newview/llfloatergodtools.cpp +++ b/indra/newview/llfloatergodtools.cpp @@ -230,6 +230,12 @@ void LLFloaterGodTools::show(void *) } } +void LLFloaterGodTools::hide(void *) +{ + if(sGodTools) + sGodTools->setVisible(FALSE);; +} + void LLFloaterGodTools::showPanel(const std::string& panel_name) { childShowTab("GodTools Tabs", panel_name); diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 410910aaa..07f73ac7a 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -58,7 +58,6 @@ #include "llviewerobjectlist.h" #include "lltoolselectrect.h" #include "llviewerwindow.h" -#include "llcompass.h" #include "llsurface.h" #include "llwind.h" #include "llworld.h" @@ -152,7 +151,7 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) LLViewerCamera::getInstance()->setFar(new_far); LLViewerCamera::getInstance()->setNear(new_near); } -// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) +// [RLVa:KB] - Checked: 2010-04-11 (RLVa-1.2.0e) | Modified: RLVa-1.0.0g if (gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) { // We'll allow drag selection under fartouch, but only within the fartouch range @@ -287,126 +286,7 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) gViewerWindow->setup3DRender(); } - -const F32 COMPASS_SIZE = 64; -static const F32 COMPASS_RANGE = 0.33f; - -void LLCompass::draw() -{ - gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.pushMatrix(); - - S32 width = 32; - S32 height = 32; - - LLGLSUIDefault gls_ui; - - gGL.translatef( COMPASS_SIZE/2.f, COMPASS_SIZE/2.f, 0.f); - - if (mBkgndTexture) - { - gGL.getTexUnit(0)->bind(mBkgndTexture.get()); - - gGL.color4f(1.0f, 1.0f, 1.0f, 1.0f); - - gGL.begin(LLRender::QUADS); - - gGL.texCoord2f(1.f, 1.f); - gGL.vertex2i(width, height); - - gGL.texCoord2f(0.f, 1.f); - gGL.vertex2i(-width, height); - - gGL.texCoord2f(0.f, 0.f); - gGL.vertex2i(-width, -height); - - gGL.texCoord2f(1.f, 0.f); - gGL.vertex2i(width, -height); - - gGL.end(); - } - - // rotate subsequent draws to agent rotation - F32 rotation = atan2( gAgent.getFrameAgent().getAtAxis().mV[VX], gAgent.getFrameAgent().getAtAxis().mV[VY] ); - gGL.rotatef( - rotation * RAD_TO_DEG, 0.f, 0.f, -1.f); - - if (mTexture) - { - gGL.getTexUnit(0)->bind(mTexture.get()); - gGL.color4f(1.0f, 1.0f, 1.0f, 1.0f); - - gGL.begin(LLRender::QUADS); - - gGL.texCoord2f(1.f, 1.f); - gGL.vertex2i(width, height); - - gGL.texCoord2f(0.f, 1.f); - gGL.vertex2i(-width, height); - - gGL.texCoord2f(0.f, 0.f); - gGL.vertex2i(-width, -height); - - gGL.texCoord2f(1.f, 0.f); - gGL.vertex2i(width, -height); - - gGL.end(); - } - - gGL.popMatrix(); - -} - - - -void LLHorizontalCompass::draw() -{ - LLGLSUIDefault gls_ui; - - S32 width = getRect().getWidth(); - S32 height = getRect().getHeight(); - S32 half_width = width / 2; - - if( mTexture ) - { - const LLVector3& at_axis = LLViewerCamera::getInstance()->getAtAxis(); - F32 center = atan2( at_axis.mV[VX], at_axis.mV[VY] ); - - center += F_PI; - center = llclamp( center, 0.0f, F_TWO_PI ); // probably not necessary... - center /= F_TWO_PI; - F32 left = center - COMPASS_RANGE; - F32 right = center + COMPASS_RANGE; - - gGL.getTexUnit(0)->bind(mTexture.get()); - gGL.color4f(1.0f, 1.0f, 1.0f, 1.0f ); - gGL.begin( LLRender::QUADS ); - - gGL.texCoord2f(right, 1.f); - gGL.vertex2i(width, height); - - gGL.texCoord2f(left, 1.f); - gGL.vertex2i(0, height); - - gGL.texCoord2f(left, 0.f); - gGL.vertex2i(0, 0); - - gGL.texCoord2f(right, 0.f); - gGL.vertex2i(width, 0); - - gGL.end(); - } - - // Draw the focus line - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.color4fv( mFocusColor.mV ); - gl_line_2d( half_width, 0, half_width, height ); - } -} - - -const F32 WIND_ALTITUDE = 180.f; - +const F32 WIND_RELATIVE_ALTITUDE = 25.f; void LLWind::renderVectors() { @@ -420,13 +300,13 @@ void LLWind::renderVectors() gGL.pushMatrix(); LLVector3 origin_agent; origin_agent = gAgent.getPosAgentFromGlobal(mOriginGlobal); - gGL.translatef(origin_agent.mV[VX], origin_agent.mV[VY], WIND_ALTITUDE); + gGL.translatef(origin_agent.mV[VX], origin_agent.mV[VY], gAgent.getPositionAgent().mV[VZ] + WIND_RELATIVE_ALTITUDE); for (j = 0; j < mSize; j++) { for (i = 0; i < mSize; i++) { - x = mCloudVelX[i + j*mSize] * WIND_SCALE_HACK; - y = mCloudVelY[i + j*mSize] * WIND_SCALE_HACK; + x = mVelX[i + j*mSize] * WIND_SCALE_HACK; + y = mVelY[i + j*mSize] * WIND_SCALE_HACK; gGL.pushMatrix(); gGL.translatef((F32)i * region_width_meters/mSize, (F32)j * region_width_meters/mSize, 0.0); gGL.color3f(0,1,0); diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index 56cd70a7a..338bf45cf 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -54,11 +54,10 @@ #include "llstatusbar.h" #include "llmenugl.h" #include "pipeline.h" -#include - -// [RLVa:KB] +// [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.4.0a) #include "rlvhandler.h" // [/RLVa:KB] +#include const F32 SPRING_STRENGTH = 0.7f; const F32 RESTORATION_SPRING_TIME_CONSTANT = 0.1f; @@ -266,27 +265,31 @@ void LLHUDText::renderText() void LLHUDText::setString(const std::string &text_utf8) { -//[RLVa:KB] - Checked: 2010-03-02 (RLVa-1.2.0a) | Modified: RLVa-1.0.0f -// NOTE: setString() is only called for debug beacons and the floating name tags (which we don't want to censor -// because you'd see "(Region hidden) LastName" if you happen to go to a sim who's name is your first name :p - std::string text(text_utf8); - mPreFilteredText = text; + mTextSegments.clear(); +// 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()) { + std::string text(text_utf8); if (gRlvHandler.canShowHoverText(mSourceObject)) { if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) RlvUtil::filterLocation(text); + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + RlvUtil::filterNames(text); } else { text = ""; } + addLine(text, mColor); } -//[/RLVa:KB] - - mTextSegments.clear(); - addLine(text, mColor); + else + { + addLine(text_utf8, mColor); + } +// [/RLVa:KB] } void LLHUDText::clearString() diff --git a/indra/newview/llhudtext.h b/indra/newview/llhudtext.h index 9084a5164..9bdbc0c31 100644 --- a/indra/newview/llhudtext.h +++ b/indra/newview/llhudtext.h @@ -2,31 +2,25 @@ * @file llhudtext.h * @brief LLHUDText class definition * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/newview/llinventoryactions.cpp b/indra/newview/llinventoryactions.cpp index 0cb51a4bb..c01dae99d 100644 --- a/indra/newview/llinventoryactions.cpp +++ b/indra/newview/llinventoryactions.cpp @@ -666,9 +666,9 @@ class LLAttachObject : public inventory_panel_listener_t if(item && gInventory.isObjectDescendentOf(id, gInventory.getRootFolderID())) { - rez_attachment(item, attachmentp); + rez_attachment(item, attachmentp); // don't replace if called from an "Attach To..." menu } - else if(item && item->isComplete()) + else if(item && item->isFinished()) { // must be in library. copy it to our inventory and put it on. LLPointer cb = new RezAttachmentCallback(attachmentp); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 2bc5fcfaa..507fddca9 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -48,6 +48,7 @@ #include "llagent.h" #include "llagentwearables.h" #include "llappearancemgr.h" +#include "llattachmentsmgr.h" #include "llagentcamera.h" #include "llcallingcard.h" #include "llcheckboxctrl.h" // for radio buttons @@ -127,7 +128,7 @@ // [RLVa:KB] #include "rlvhandler.h" -#include "llattachmentsmgr.h" +#include "rlvlocks.h" // [/RLVa:KB] bool InventoryLinksEnabled() @@ -198,9 +199,6 @@ void gotAssetForSaveItemAs(LLVFS *vfs, // -// [RLVa:KB] - Made this part of LLWearableHoldingPattern -//BOOL gAddToOutfit = FALSE; -// [/RLVa:KB] // +=================================================+ // | LLInvFVBridge | @@ -759,11 +757,10 @@ void LLInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags) addOpenRightClickMenuOption(items); items.push_back(std::string("Properties")); -// [RLVa:KB] - Checked: 2009-11-11 (RLVa-1.1.0a) | Modified: RLVa-1.1.0a +// [RLVa:KB] - Checked: 2010-03-01 (RLVa-1.2.0b) | Modified: RLVa-1.1.0a if (rlv_handler_t::isEnabled()) { - LLInventoryPanel* panel = dynamic_cast(mInventoryPanel.get()); - LLInventoryObject* pItem = (panel && panel->getModel()) ? panel->getModel()->getObject(mUUID) : NULL; + const LLInventoryObject* pItem = getInventoryObject(); if ( (pItem) && ( ((LLAssetType::AT_NOTECARD == pItem->getType()) && (gRlvHandler.hasBehaviour(RLV_BHVR_VIEWNOTE))) || ((LLAssetType::AT_LSL_TEXT == pItem->getType()) && (gRlvHandler.hasBehaviour(RLV_BHVR_VIEWSCRIPT))) || @@ -1455,7 +1452,9 @@ BOOL LLItemBridge::isItemRenameable() const // [RLVa:KB] - Checked: 2011-03-29 (RLVa-1.3.0g) | Modified: RLVa-1.3.0g if ( (rlv_handler_t::isEnabled()) && (!RlvFolderLocks::instance().canRenameItem(mUUID)) ) + { return FALSE; + } // [/RLVa:KB] return (item->getPermissions().allowModifyBy(gAgent.getID())); @@ -1972,6 +1971,13 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } } +// [RLVa:KB] - Checked: 2011-03-29 (RLVa-1.3.0g) | Added: RLVa-1.3.0g + if ( (is_movable) && (rlv_handler_t::isEnabled()) && (RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_ANY)) ) + { + is_movable = RlvFolderLocks::instance().canMoveFolder(cat_id, mUUID); + } +// [/RLVa:KB] + accept = is_movable; if (accept && drop) @@ -2827,6 +2833,9 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags) LLFolderType::EType type = category->getPreferredType(); const bool is_system_folder = LLFolderType::lookupIsProtectedType(type); // calling card related functionality for folders. +// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-11-24 (Catznip-3.0.0a) | Added: Catznip-2.4.0e + const bool is_outfit = (type == LLFolderType::FT_OUTFIT); +// [/SL:KB] // Only enable calling-card related options for non-default folders. if (!is_system_folder) @@ -2883,7 +2892,11 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags) { mDisabledItems.push_back(std::string("Remove From Outfit")); } - if (!LLAppearanceMgr::instance().getCanReplaceCOF(mUUID)) +// if (!LLAppearanceMgr::instance().getCanReplaceCOF(mUUID)) +// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-11-24 (Catznip-3.0.0a) | Added: Catznip-2.4.0e + if ( ((is_outfit) && (!LLAppearanceMgr::instance().getCanReplaceCOF(mUUID))) || + ((!is_outfit) && (gAgentWearables.isCOFChangeInProgress())) ) +// [/SL:KB] { mDisabledItems.push_back(std::string("Replace Outfit")); } @@ -3306,6 +3319,24 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, { is_movable = FALSE; } + +// [RLVa:KB] - Checked: 2011-03-29 (RLVa-1.3.0g) | Modified: RLVa-1.3.0g + if ( (rlv_handler_t::isEnabled()) && (is_movable) ) + { + if (move_is_into_current_outfit) + { + // RELEASE-RLVa: [RLVa-1.3.0] Keep sync'ed with code below => LLAppearanceMgr::wearItemOnAvatar() with "replace == true" + const LLViewerInventoryItem* pItem = dynamic_cast(inv_item); + is_movable = rlvPredCanWearItem(pItem, RLV_WEAR_REPLACE); + } + if (is_movable) + { + is_movable = (!RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_ANY)) || + (RlvFolderLocks::instance().canMoveItem(inv_item->getUUID(), mUUID)); + } + } +// [/RLVa:KB] + if (move_is_into_trash) { is_movable &= inv_item->getIsLinkType() || !get_is_item_worn(inv_item->getUUID()); @@ -3548,7 +3579,7 @@ void open_texture(const LLUUID& item_id, // [RLVa:KB] - Checked: 2009-11-11 (RLVa-1.1.0a) | Modified: RLVa-1.1.0a if (gRlvHandler.hasBehaviour(RLV_BHVR_VIEWTEXTURE)) { - RlvNotifications::notifyBlockedViewTexture(); + RlvUtil::notifyBlockedViewXXX(LLAssetType::AT_TEXTURE); return; } // [/RLVa:KB] @@ -4088,7 +4119,7 @@ void open_notecard(LLViewerInventoryItem* inv_item, // [RLVa:KB] - Checked: 2009-11-11 (RLVa-1.1.0a) | Modified: RLVa-1.1.0a if (gRlvHandler.hasBehaviour(RLV_BHVR_VIEWNOTE)) { - RlvNotifications::notifyBlockedViewNote(); + RlvUtil::notifyBlockedViewXXX(LLAssetType::AT_NOTECARD); return; } // [/RLVa:KB] @@ -4555,13 +4586,24 @@ std::string LLObjectBridge::getLabelSuffix() const LLStringUtil::format_map_t args; args["[ATTACHMENT_POINT]"] = attachment_point_name; - return LLItemBridge::getLabelSuffix() + LLTrans::getString("WornOnAttachmentPoint", args); + if(gRlvAttachmentLocks.canDetach(getItem())) + return LLItemBridge::getLabelSuffix() + LLTrans::getString("WornOnAttachmentPoint", args); + else + return LLItemBridge::getLabelSuffix() + LLTrans::getString("LockedOnAttachmentPoint", args); } return LLItemBridge::getLabelSuffix(); } void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attachment, bool replace) { +// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.1a) | Added: RLVa-1.2.1a + // If no attachment point was specified, try looking it up from the item name + if ( (rlv_handler_t::isEnabled()) && (!attachment) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) ) + { + attachment = RlvAttachPtLookup::getAttachPoint(item); + } +// [/RLVa:KB] + const LLUUID& item_id = item->getLinkedUUID(); // Check for duplicate request. @@ -4596,10 +4638,20 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach if (replace && (attachment && attachment->getNumObjects() > 0)) { +// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.1a) | Modified: RLVa-1.2.1a + // Block if we can't "replace wear" what's currently there + if ( (rlv_handler_t::isEnabled()) && ((gRlvAttachmentLocks.canAttach(attachment) & RLV_WEAR_REPLACE) == 0) ) + return; +// [/RLVa:KB] LLNotificationsUtil::add("ReplaceAttachment", LLSD(), payload, confirm_attachment_rez); } else { +// [RLVa:KB] - Checked: 2010-08-07 (RLVa-1.2.0i) | Modified: RLVa-1.2.0i + // Block wearing anything on a non-attachable attachment point + if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.isLockedAttachmentPoint(attach_pt, RLV_LOCK_ADD)) ) + return; +// [/RLVa:KB] LLNotifications::instance().forceResponse(LLNotification::Params("ReplaceAttachment").payload(payload), 0/*YES*/); } } @@ -4658,6 +4710,13 @@ bool confirm_attachment_rez(const LLSD& notification, const LLSD& response) } static LLNotificationFunctorRegistration confirm_replace_attachment_rez_reg("ReplaceAttachment", confirm_attachment_rez); +BOOL rlvAttachToEnabler(void* pParam) +{ + return (pParam != NULL) && + //(!gRlvAttachmentLocks.hasLockedAttachment((LLViewerJointAttachment*)pParam)) && //Attach To should only add to worn. (LLAttachObject::handleEvent) + (!gRlvAttachmentLocks.isLockedAttachmentPoint((LLViewerJointAttachment*)pParam, RLV_LOCK_ADD)); +} + void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { menuentry_vec_t items; @@ -4715,16 +4774,16 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) disabled_items.push_back(std::string("Attach To")); disabled_items.push_back(std::string("Attach To HUD")); } -/*// [RLVa:KB] - Checked: 2010-09-03 (RLVa-1.2.1a) | Modified: RLVa-1.2.1a | OK +// [RLVa:KB] - Checked: 2010-09-03 (RLVa-1.2.1a) | Modified: RLVa-1.2.1a else if (rlv_handler_t::isEnabled()) { ERlvWearMask eWearMask = gRlvAttachmentLocks.canAttach(item); if ((eWearMask & RLV_WEAR_REPLACE) == 0) - disabled_items.push_back(std::string("Object Wear")); + disabled_items.push_back(std::string("Wearable And Object Wear")); if ((eWearMask & RLV_WEAR_ADD) == 0) - disabled_items.push_back(std::string("Object Add")); + disabled_items.push_back(std::string("Wearable Add")); } -// [/RLVa:KB]*/ +// [/RLVa:KB] LLMenuGL* attach_menu = menu.getChildMenuByName("Attach To", TRUE); LLMenuGL* attach_hud_menu = menu.getChildMenuByName("Attach To HUD", TRUE); @@ -4740,25 +4799,15 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) LLVOAvatar::attachment_map_t::iterator curiter = iter++; LLViewerJointAttachment* attachment = curiter->second; LLMenuItemCallGL *new_item; - if (attachment->getIsHUDAttachment()) - { + LLMenuGL* target_menu = attachment->getIsHUDAttachment() ? attach_hud_menu : attach_menu; + // [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) - attach_hud_menu->addChild(new_item = new LLMenuItemCallGL(attachment->getName(), + target_menu->addChild(new_item = new LLMenuItemCallGL(attachment->getName(), NULL, //&LLObjectBridge::attachToAvatar, (rlv_handler_t::isEnabled()) ? &rlvAttachToEnabler : NULL, &attach_label, (void*)attachment)); // [/RLVa:KB] - } - else - { -// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) - attach_menu->addChild(new_item = new LLMenuItemCallGL(attachment->getName(), - NULL, //&LLObjectBridge::attachToAvatar, - (rlv_handler_t::isEnabled()) ? &rlvAttachToEnabler : NULL, - &attach_label, (void*)attachment)); -// [/RLVa:KB] - } - + LLSimpleListener* callback = mInventoryPanel.get()->getListenerByName("Inventory.AttachObject"); if (callback) @@ -4857,14 +4906,14 @@ void remove_inventory_category_from_avatar( LLInventoryCategory* category ) remove_inventory_category_from_avatar_step2(TRUE, category->getUUID() ); } -struct OnRemoveStruct -{ - LLUUID mUUID; - OnRemoveStruct(const LLUUID& uuid): - mUUID(uuid) - { - } -}; +//struct OnRemoveStruct +//{ +// LLUUID mUUID; +// OnRemoveStruct(const LLUUID& uuid): +// mUUID(uuid) +// { +// } +//}; void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_id) { @@ -4917,11 +4966,18 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_ continue; if (get_is_item_worn(item->getUUID())) { - LLWearableList::instance().getAsset(item->getAssetUUID(), - item->getName(), - item->getType(), - LLWearableBridge::onRemoveFromAvatarArrived, - new OnRemoveStruct(item->getLinkedUUID())); +// [RLVa:KB] - Checked: 2010-04-04 (RLVa-1.2.0c) | Modified: RLVa-0.2.2a +// if ( (rlv_handler_t::isEnabled()) && (!gRlvWearableLocks.canRemove(item)) ) +// continue; +// [/RLVa:KB] +// LLWearableList::instance().getAsset(item->getAssetUUID(), +// item->getName(), +// item->getType(), +// LLWearableBridge::onRemoveFromAvatarArrived, +// new OnRemoveStruct(item->getLinkedUUID())); +// [SL:KB] - Patch: Appearance-RemoveWearableFromAvatar | Checked: 2010-08-13 (Catznip-3.0.0a) | Added: Catznip-2.1.1d + LLAppearanceMgr::instance().removeItemFromAvatar(item->getUUID()); +// [/SL:KB] } } } @@ -5098,18 +5154,37 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { disabled_items.push_back(std::string("Wearable And Object Wear")); disabled_items.push_back(std::string("Wearable Add")); +// [RLVa:KB] - Checked: 2010-04-04 (RLVa-1.2.0c) | Added: RLVa-1.2.0c + if ( (rlv_handler_t::isEnabled()) && (!gRlvWearableLocks.canRemove(item)) ) + disabled_items.push_back(std::string("Take Off")); +// [/RLVa:KB] } else { items.push_back(std::string("Wearable And Object Wear")); disabled_items.push_back(std::string("Take Off")); disabled_items.push_back(std::string("Wearable Edit")); + +// [RLVa:KB] - Checked: 2010-06-09 (RLVa-1.2.0g) | Modified: RLVa-1.2.0g + if (rlv_handler_t::isEnabled()) + { + ERlvWearMask eWearMask = gRlvWearableLocks.canWear(item); + if ((eWearMask & RLV_WEAR_REPLACE) == 0) + disabled_items.push_back(std::string("Wearable And Object Wear")); + if ((eWearMask & RLV_WEAR_ADD) == 0) + disabled_items.push_back(std::string("Wearable Add")); + } +// [/RLVa:KB] } if (LLWearableType::getAllowMultiwear(mWearableType)) { items.push_back(std::string("Wearable Add")); - if (gAgentWearables.getWearableCount(mWearableType) >= LLAgentWearables::MAX_CLOTHING_PER_TYPE) +// if (gAgentWearables.getWearableCount(mWearableType) >= LLAgentWearables::MAX_CLOTHING_PER_TYPE) +// [SL:KB] - Patch: Appearance-WearableDuplicateAssets | Checked: 2011-07-24 (Catznip-2.6.0e) | Added: Catznip-2.6.0e + if ( (gAgentWearables.getWearableCount(mWearableType) >= LLAgentWearables::MAX_CLOTHING_PER_TYPE) || + (gAgentWearables.getWearableFromAssetID(item->getAssetUUID())) ) +// [/SL:KB] { disabled_items.push_back(std::string("Wearable Add")); } @@ -5182,56 +5257,56 @@ void LLWearableBridge::wearAddOnAvatar() } // static -void LLWearableBridge::onWearOnAvatarArrived( LLWearable* wearable, void* userdata ) -{ - LLUUID* item_id = (LLUUID*) userdata; - if(wearable) - { - LLViewerInventoryItem* item = NULL; - item = (LLViewerInventoryItem*)gInventory.getItem(*item_id); - if(item) - { - if(item->getAssetUUID() == wearable->getAssetID()) - { - gAgentWearables.setWearableItem(item, wearable); - gInventory.notifyObservers(); - //self->getFolderItem()->refreshFromRoot(); - } - else - { - llinfos << "By the time wearable asset arrived, its inv item already pointed to a different asset." << llendl; - } - } - } - delete item_id; -} +//void LLWearableBridge::onWearOnAvatarArrived( LLWearable* wearable, void* userdata ) +//{ +// LLUUID* item_id = (LLUUID*) userdata; +// if(wearable) +// { +// LLViewerInventoryItem* item = NULL; +// item = (LLViewerInventoryItem*)gInventory.getItem(*item_id); +// if(item) +// { +// if(item->getAssetUUID() == wearable->getAssetID()) +// { +// gAgentWearables.setWearableItem(item, wearable); +// gInventory.notifyObservers(); +// //self->getFolderItem()->refreshFromRoot(); +// } +// else +// { +// llinfos << "By the time wearable asset arrived, its inv item already pointed to a different asset." << llendl; +// } +// } +// } +// delete item_id; +//} // static // BAP remove the "add" code path once everything is fully COF-ified. -void LLWearableBridge::onWearAddOnAvatarArrived( LLWearable* wearable, void* userdata ) -{ - LLUUID* item_id = (LLUUID*) userdata; - if(wearable) - { - LLViewerInventoryItem* item = NULL; - item = (LLViewerInventoryItem*)gInventory.getItem(*item_id); - if(item) - { - if(item->getAssetUUID() == wearable->getAssetID()) - { - bool do_append = true; - gAgentWearables.setWearableItem(item, wearable, do_append); - gInventory.notifyObservers(); - //self->getFolderItem()->refreshFromRoot(); - } - else - { - llinfos << "By the time wearable asset arrived, its inv item already pointed to a different asset." << llendl; - } - } - } - delete item_id; -} +//void LLWearableBridge::onWearAddOnAvatarArrived( LLWearable* wearable, void* userdata ) +//{ +// LLUUID* item_id = (LLUUID*) userdata; +// if(wearable) +// { +// LLViewerInventoryItem* item = NULL; +// item = (LLViewerInventoryItem*)gInventory.getItem(*item_id); +// if(item) +// { +// if(item->getAssetUUID() == wearable->getAssetID()) +// { +// bool do_append = true; +// gAgentWearables.setWearableItem(item, wearable, do_append); +// gInventory.notifyObservers(); +// //self->getFolderItem()->refreshFromRoot(); +// } +// else +// { +// llinfos << "By the time wearable asset arrived, its inv item already pointed to a different asset." << llendl; +// } +// } +// } +// delete item_id; +//} // static BOOL LLWearableBridge::canEditOnAvatar(void* user_data) @@ -5268,55 +5343,61 @@ BOOL LLWearableBridge::canRemoveFromAvatar(void* user_data) return FALSE; } -// static -void LLWearableBridge::onRemoveFromAvatar(void* user_data) -{ - LLWearableBridge* self = (LLWearableBridge*)user_data; - if(!self) return; - if(get_is_item_worn(self->mUUID)) - { - LLViewerInventoryItem* item = self->getItem(); - if (item) - { - LLUUID parent_id = item->getParentUUID(); - LLWearableList::instance().getAsset(item->getAssetUUID(), - item->getName(), - item->getType(), - onRemoveFromAvatarArrived, - new OnRemoveStruct(LLUUID(self->mUUID))); - } - } -} +// static +//void LLWearableBridge::onRemoveFromAvatar(void* user_data) +//{ +// LLWearableBridge* self = (LLWearableBridge*)user_data; +// if(!self) return; +// if(get_is_item_worn(self->mUUID)) +// { +// LLViewerInventoryItem* item = self->getItem(); +// if (item) +// { +// LLUUID parent_id = item->getParentUUID(); +// LLWearableList::instance().getAsset(item->getAssetUUID(), +// item->getName(), +// item->getType(), +// onRemoveFromAvatarArrived, +// new OnRemoveStruct(LLUUID(self->mUUID))); +// } +// } +//} // static -void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable, - void* userdata) -{ - OnRemoveStruct *on_remove_struct = (OnRemoveStruct*) userdata; - const LLUUID &item_id = gInventory.getLinkedItemID(on_remove_struct->mUUID); - if(wearable) - { - if( get_is_item_worn( item_id ) ) - { - LLWearableType::EType type = wearable->getType(); - - if( !(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES) ) //&& - //!((!gAgent.isTeen()) && ( type==LLWearableType::WT_UNDERPANTS || type==LLWearableType::WT_UNDERSHIRT )) ) - { - bool do_remove_all = false; - U32 index = gAgentWearables.getWearableIndex(wearable); - gAgentWearables.removeWearable( type, do_remove_all, index ); - } - } - } - - // Find and remove this item from the COF. - LLAppearanceMgr::instance().removeCOFItemLinks(item_id,false); - gInventory.notifyObservers(); - - delete on_remove_struct; -} - +//void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable, +// void* userdata) +//{ +// OnRemoveStruct *on_remove_struct = (OnRemoveStruct*) userdata; +// const LLUUID &item_id = gInventory.getLinkedItemID(on_remove_struct->mUUID); +// [RLVa:KB] - Checked: 2010-03-20 (RLVa-1.2.0c) | Modified: RLVa-1.2.0a +// if ( (rlv_handler_t::isEnabled()) && ((!wearable) || (!gRlvWearableLocks.canRemove(gInventory.getItem(item_id)))) ) +// { +// delete on_remove_struct; +// return; +// } +// [/RLVa:KB] +// if(wearable) +// { +// if( get_is_item_worn( item_id ) ) +// { +// LLWearableType::EType type = wearable->getType(); +// +// if( !(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES ) ) //&& +// //!((!gAgent.isTeen()) && ( type==LLWearableType::WT_UNDERPANTS || type==LLWearableType::WT_UNDERSHIRT )) ) +// { +// bool do_remove_all = false; +// U32 index = gAgentWearables.getWearableIndex(wearable); +// gAgentWearables.removeWearable( type, do_remove_all, index ); +// } +// } +// } +// +// // Find and remove this item from the COF. +// LLAppearanceMgr::instance().removeCOFItemLinks(item_id,false); +// gInventory.notifyObservers(); +// +// delete on_remove_struct; +//} // static void LLWearableBridge::removeAllClothesFromAvatar() @@ -5335,6 +5416,10 @@ void LLWearableBridge::removeAllClothesFromAvatar() // Take them off by removing from COF. for (LLInventoryModel::item_array_t::const_iterator it = clothing_items.begin(); it != clothing_items.end(); ++it) { +// [RLVa:KB] - Checked: 2010-05-14 (RLVa-1.2.0g) | Modified: RLVa-1.2.0g + if ( (rlv_handler_t::isEnabled()) && (!gRlvWearableLocks.canRemove(*it)) ) + continue; +// [/RLVa:KB] LLAppearanceMgr::instance().removeItemFromAvatar((*it)->getUUID()); } } @@ -5344,11 +5429,14 @@ void LLWearableBridge::removeItemFromAvatar(LLViewerInventoryItem *item) { if (item) { - LLWearableList::instance().getAsset(item->getAssetUUID(), - item->getName(), - item->getType(), - LLWearableBridge::onRemoveFromAvatarArrived, - new OnRemoveStruct(item->getUUID())); +// LLWearableList::instance().getAsset(item->getAssetUUID(), +// item->getName(), +// item->getType(), +// LLWearableBridge::onRemoveFromAvatarArrived, +// new OnRemoveStruct(item->getUUID())); +// [SL:KB] - Patch: Appearance-RemoveWearableFromAvatar | Checked: 2010-08-13 (Catznip-3.0.0a) | Added: Catznip-2.1.1d + LLAppearanceMgr::instance().removeItemFromAvatar(item->getUUID()); +// [/SL:KB] } } @@ -5791,7 +5879,7 @@ public: // [RLVa:KB] - Checked: 2009-11-11 (RLVa-1.1.0a) | Modified: RLVa-1.1.0a if (gRlvHandler.hasBehaviour(RLV_BHVR_VIEWSCRIPT)) { - RlvNotifications::notifyBlockedViewScript(); + RlvUtil::notifyBlockedViewXXX(LLAssetType::AT_NOTECARD); return; } // [/RLVa:KB] diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 62ab2d8e7..3cee5dad6 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -48,8 +48,9 @@ #include "llvoavatarself.h" #include "statemachine/aievent.h" -// [RLVa:KB] +// [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1a) #include "rlvhandler.h" +#include "rlvlocks.h" // [/RLVa:KB] //#define DIFF_INVENTORY_FILES diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index 43b29fe6d..6b7204a26 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -62,7 +62,7 @@ #include "llviewerjoint.h" #include "llviewerobject.h" #include "llviewerwindow.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llworld.h" #include "llui.h" #include "pipeline.h" diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp index 8bdd7b376..ebbe2d114 100644 --- a/indra/newview/lloverlaybar.cpp +++ b/indra/newview/lloverlaybar.cpp @@ -64,7 +64,7 @@ #include "llviewercontrol.h" #include "llviewerwindow.h" #include "llvoiceclient.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llvoiceremotectrl.h" #include "llmediactrl.h" #include "llselectmgr.h" diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp index e5219fd99..cd03f92c6 100644 --- a/indra/newview/llpanelcontents.cpp +++ b/indra/newview/llpanelcontents.cpp @@ -71,6 +71,7 @@ #include "llpanelobjectinventory.h" // [RLVa:KB] - Checked: 2010-03-31 (RLVa-1.2.0c) #include "rlvhandler.h" +#include "rlvlocks.h" // [/RLVa:KB] // @@ -119,7 +120,7 @@ void LLPanelContents::getState(LLViewerObject *objectp ) LLSelectMgr::getInstance()->selectGetGroup(group_id); // sets group_id as a side effect SL-23488 // BUG? Check for all objects being editable? - BOOL editable = gAgent.isGodlike() + bool editable = gAgent.isGodlike() || (objectp->permModify() && ( objectp->permYouOwner() || ( !group_id.isNull() && gAgent.isInGroup(group_id) ))); // solves SL-23488 BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); @@ -137,8 +138,8 @@ void LLPanelContents::getState(LLViewerObject *objectp ) // Only check the first (non-)root object because nothing else would result in enabling the button (see below) LLViewerObject* pObj = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(TRUE); - LLVOAvatar* pAvatar = gAgentAvatarp; - editable = (pObj) && (pAvatar) && ((!pAvatar->isSitting()) || (pAvatar->getRoot() != pObj->getRootEdit())); + editable = + (pObj) && (isAgentAvatarValid()) && ((!gAgentAvatarp->isSitting()) || (gAgentAvatarp->getRoot() != pObj->getRootEdit())); } } // [/RLVa:KB] @@ -186,8 +187,7 @@ void LLPanelContents::onClickNewScript(void *userdata) } else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP)) ) { - LLVOAvatar* pAvatar = gAgentAvatarp; - if ( (pAvatar) && (pAvatar->isSitting()) && (pAvatar->getRoot() == object->getRootEdit()) ) + if ( (isAgentAvatarValid()) && (gAgentAvatarp->isSitting()) && (gAgentAvatarp->getRoot() == object->getRootEdit()) ) return; // .. or in a linkset the avie is sitting on under @unsit=n/@sittp=n } } diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index bee2b1bd2..7843a9e97 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -83,6 +83,7 @@ // [RLVa:KB] #include "rlvhandler.h" +#include "llvoavatarself.h" // [/RLVa:KB] // @@ -493,11 +494,10 @@ void LLPanelObject::getState( ) enable_rotate = FALSE; } -// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) +// [RLVa:KB] - Checked: 2010-03-31 (RLVa-1.2.0c) | Modified: RLVa-1.0.0g if ( (rlv_handler_t::isEnabled()) && ((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP))) ) { - LLVOAvatar* pAvatar = gAgentAvatarp; - if ( (pAvatar) && (pAvatar->isSitting()) && (pAvatar->getRoot() == objectp->getRootEdit()) ) + if ( (isAgentAvatarValid()) && (gAgentAvatarp->isSitting()) && (gAgentAvatarp->getRoot() == objectp->getRootEdit()) ) enable_move = enable_scale = enable_rotate = FALSE; } // [/RLVa:KB] diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 83889fb4a..31cb8bcc8 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -66,6 +66,7 @@ #include "llviewermessage.h" // [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.2.0b) #include "rlvhandler.h" +#include "rlvlocks.h" // [/RLVa:KB] #include "hippogridmanager.h" @@ -982,7 +983,7 @@ void LLTaskTextureBridge::openItem() // [RLVa:KB] - Checked: 2009-11-11 (RLVa-1.1.0a) | Modified: RLVa-1.1.0a if (gRlvHandler.hasBehaviour(RLV_BHVR_VIEWTEXTURE)) { - RlvNotifications::notifyBlockedViewTexture(); + RlvUtil::notifyBlockedViewXXX(LLAssetType::AT_TEXTURE); return; } // [/RLVa:KB] @@ -1218,7 +1219,7 @@ void LLTaskLSLBridge::openItem() // [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.1.3b) | Modified: RLVa-1.1.0a if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.isLockedAttachment(object->getRootEdit())) ) { - RlvNotifications::notifyBlockedViewScript(); + RlvUtil::notifyBlockedViewXXX(LLAssetType::AT_SCRIPT); return; } // [/RLVa:KB] @@ -1304,7 +1305,7 @@ void LLTaskNotecardBridge::openItem() if ( (rlv_handler_t::isEnabled()) && ((gRlvHandler.hasBehaviour(RLV_BHVR_VIEWNOTE)) || (gRlvAttachmentLocks.isLockedAttachment(object->getRootEdit()))) ) { - RlvNotifications::notifyBlockedViewNote(); + RlvUtil::notifyBlockedViewXXX(LLAssetType::AT_NOTECARD); return; } // [/RLVa:KB] diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 0bd4c3ea0..c7850b9c9 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -94,6 +94,7 @@ #include "llpanelobjectinventory.h" // [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) #include "rlvhandler.h" +#include "rlvlocks.h" // [/RLVa:KB] const std::string HELLO_LSL = diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 7a9abeaf6..8cad1d048 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -87,7 +87,7 @@ #include "llviewerobjectlist.h" #include "llviewerregion.h" #include "llviewerstats.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llvovolume.h" #include "pipeline.h" #include "llviewershadermgr.h" @@ -618,16 +618,6 @@ bool LLSelectMgr::linkObjects() bool LLSelectMgr::unlinkObjects() { -// [RLVa:KB] - Checked: 2010-04-01 (RLVa-1.1.3b) | Modified: RLVa-0.2.0g | OK - if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStand()) ) - { - // Allow only if the avie isn't sitting on any of the selected objects - LLObjectSelectionHandle hSel = LLSelectMgr::getInstance()->getSelection(); - RlvSelectIsSittingOn f(gAgentAvatarp->getRoot()); - if ( (hSel.notNull()) && (hSel->getFirstRootNode(&f, TRUE)) ) - return true; - } -// [/RLVa:KB] LLSelectMgr::getInstance()->sendDelink(); return true; } @@ -662,6 +652,16 @@ bool LLSelectMgr::enableLinkObjects() new_value = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly); } } +// [RLVa:KB] - Checked: 2011-03-19 (RLVa-1.3.0f) | Modified: RLVa-0.2.0g + if ( (new_value) && ((rlv_handler_t::isEnabled()) && (!gRlvHandler.canStand())) ) + { + // Allow only if the avie isn't sitting on any of the selected objects + LLObjectSelectionHandle hSel = LLSelectMgr::getInstance()->getSelection(); + RlvSelectIsSittingOn f(gAgentAvatarp); + if (hSel->getFirstRootNode(&f, TRUE) != NULL) + new_value = false; + } +// [/RLVa:KB] return new_value; } @@ -672,14 +672,15 @@ bool LLSelectMgr::enableUnlinkObjects() bool new_value = LLSelectMgr::getInstance()->selectGetAllRootsValid() && first_editable_object && !first_editable_object->isAttachment(); -// [RLVa:KB] - Checked: 2010-04-01 (RLVa-1.1.3b) | Modified: RLVa-0.2.0g | OK - if ( (new_value) && (!gRlvHandler.canStand()) ) - { - // Allow only if the avie isn't sitting on any of the selected objects - LLObjectSelectionHandle handleSel = LLSelectMgr::getInstance()->getSelection(); - RlvSelectIsSittingOn f(gAgentAvatarp->getRoot()); - new_value = handleSel->getFirstRootNode(&f, TRUE) == NULL; - } +// [RLVa:KB] - Checked: 2011-03-19 (RLVa-1.3.0f) | Modified: RLVa-0.2.0g + if ( (new_value) && ((rlv_handler_t::isEnabled()) && (!gRlvHandler.canStand())) ) + { + // Allow only if the avie isn't sitting on any of the selected objects + LLObjectSelectionHandle hSel = LLSelectMgr::getInstance()->getSelection(); + RlvSelectIsSittingOn f(gAgentAvatarp); + if (hSel->getFirstRootNode(&f, TRUE) != NULL) + new_value = false; + } // [/RLVa:KB] return new_value; } @@ -2943,6 +2944,15 @@ BOOL LLSelectMgr::selectGetPermissions(LLPermissions& result_perm) void LLSelectMgr::selectDelete() { +// [RLVa:KB] - Checked: 2010-03-23 (RLVa-1.2.0e) | Added: RLVa-1.2.0a + if ( (rlv_handler_t::isEnabled()) && (!rlvCanDeleteOrReturn()) ) + { + make_ui_sound("UISndInvalidOp"); + if (!gFloaterTools->getVisible()) + deselectAll(); + return; + } +// [/RLVa:KB] S32 deleteable_count = 0; BOOL locked_but_deleteable_object = FALSE; @@ -3258,7 +3268,10 @@ struct LLDuplicateData void LLSelectMgr::selectDuplicate(const LLVector3& offset, BOOL select_copy) { - if (mSelectedObjects->isAttachment()) +// if (mSelectedObjects->isAttachment()) +// [RLVa:KB] - Checked: 2010-03-24 (RLVa-1.2.0e) | Added: RLVa-1.2.0a + if ( (mSelectedObjects->isAttachment()) || ((rlv_handler_t::isEnabled()) && (!rlvCanDeleteOrReturn())) ) +// [/RLVa:KB] { //RN: do not duplicate attachments make_ui_sound("UISndInvalidOp"); @@ -3714,11 +3727,6 @@ void LLSelectMgr::convertTransient() void LLSelectMgr::deselectAllIfTooFar() { - if (mSelectedObjects->isEmpty() || mSelectedObjects->mSelectType == SELECT_TYPE_HUD) - { - return; - } - // [RLVa:KB] - Checked: 2010-11-29 (RLVa-1.3.0c) | Modified: RLVa-1.3.0c if ( (!mSelectedObjects->isEmpty()) && ((gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_EDITOBJ))) ) { @@ -3733,6 +3741,14 @@ void LLSelectMgr::deselectAllIfTooFar() if (mSelectedObjects->getFirstRootNode(&f, TRUE)) deselectAll(); } +// [/RLVa:KB] + + if (mSelectedObjects->isEmpty() || mSelectedObjects->mSelectType == SELECT_TYPE_HUD) + { + return; + } + +// [RLVa:KB] - Checked: 2010-05-03 (RLVa-1.2.0g) | Modified: RLVa-1.1.0l #ifdef RLV_EXTENSION_CMD_INTERACT // [Fall-back code] Don't allow an active selection (except for HUD attachments - see above) when @interact=n restricted if (gRlvHandler.hasBehaviour(RLV_BHVR_INTERACT)) @@ -6167,7 +6183,10 @@ BOOL LLSelectMgr::canDoDelete() const can_delete = true; } } - +// [RLVa:KB] - Checked: 2010-03-23 (RLVa-1.2.0e) | Added: RLVa-1.2.0a + can_delete &= (!rlv_handler_t::isEnabled()) || (rlvCanDeleteOrReturn()); +// [/RLVa:KB] + return can_delete; } @@ -6199,7 +6218,12 @@ void LLSelectMgr::deselect() //----------------------------------------------------------------------------- BOOL LLSelectMgr::canDuplicate() const { - return const_cast(this)->mSelectedObjects->getFirstCopyableObject() != NULL; // HACK: casting away constness - MG +// return const_cast(this)->mSelectedObjects->getFirstCopyableObject() != NULL; // HACK: casting away constness - MG +// [RLVa:KB] - Checked: 2010-03-24 (RLVa-1.2.0e) | Added: RLVa-1.2.0a + return + (const_cast(this)->mSelectedObjects->getFirstCopyableObject() != NULL) && + ( (!rlv_handler_t::isEnabled()) || (rlvCanDeleteOrReturn()) ); +// [/RLVa:KB] } //----------------------------------------------------------------------------- // duplicate() diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 76375440d..3b010868a 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -184,7 +184,7 @@ #include "llviewerstats.h" #include "llviewerthrottle.h" #include "llviewerwindow.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llvoclouds.h" #include "llweb.h" #include "llwind.h" diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 6adecfeb4..f594b4579 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -60,7 +60,7 @@ #include "llviewerstats.h" #include "llviewerwindow.h" #include "llframetimer.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llresmgr.h" #include "llworld.h" #include "llstatgraph.h" diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 478094d39..58c9afbde 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -1415,22 +1415,21 @@ void LLTextureCache::readHeaderCache() } } } - if (num_entries > sCacheMaxEntries) + if (num_entries - empty_entries > sCacheMaxEntries) { // Special case: cache size was reduced, need to remove entries // Note: After we prune entries, we will call this again and create the LRU U32 entries_to_purge = (num_entries - empty_entries) - sCacheMaxEntries; llinfos << "Texture Cache Entries: " << num_entries << " Max: " << sCacheMaxEntries << " Empty: " << empty_entries << " Purging: " << entries_to_purge << llendl; - if (entries_to_purge > 0) - { - for (std::set::iterator iter = lru.begin(); iter != lru.end(); ++iter) + // We can exit the following loop with the given condition, since if we'd reach the end of the lru set we'd have: + // purge_list.size() = lru.size() = num_entries - empty_entries = entries_to_purge + sCacheMaxEntries >= entries_to_purge + // So, it's certain that iter will never reach lru.end() first. + std::set::iterator iter = lru.begin(); + while (purge_list.size() < entries_to_purge) { purge_list.insert(iter->second); - if (purge_list.size() >= entries_to_purge) - break; + ++iter; } - } - llassert_always(purge_list.size() >= entries_to_purge); } else { @@ -1636,9 +1635,9 @@ void LLTextureCache::purgeTextures(bool validate) if (purge_entry) { purge_count++; - LL_DEBUGS("TextureCache") << "PURGING: " << filename << LL_ENDL; - removeEntry(idx, entries[idx], filename) ; + LL_DEBUGS("TextureCache") << "PURGING: " << filename << LL_ENDL; cache_size -= entries[idx].mBodySize; + removeEntry(idx, entries[idx], filename) ; } } @@ -1652,7 +1651,7 @@ void LLTextureCache::purgeTextures(bool validate) LL_INFOS("TextureCache") << "TEXTURE CACHE:" << " PURGED: " << purge_count << " ENTRIES: " << num_entries - << " CACHE SIZE: " << mTexturesSizeTotal / 1024*1024 << " MB" + << " CACHE SIZE: " << mTexturesSizeTotal / (1024 * 1024) << " MB" << llendl; } @@ -1875,14 +1874,13 @@ void LLTextureCache::removeEntry(S32 idx, Entry& entry, std::string& filename) file_maybe_exists = false; } } + mTexturesSizeTotal -= entry.mBodySize; entry.mImageSize = -1; entry.mBodySize = 0; mHeaderIDMap.erase(entry.mID); - mTexturesSizeMap.erase(entry.mID); - - mTexturesSizeTotal -= entry.mBodySize; - mFreeList.insert(idx); + mTexturesSizeMap.erase(entry.mID); + mFreeList.insert(idx); } if (file_maybe_exists) diff --git a/indra/newview/lltoolbar.cpp b/indra/newview/lltoolbar.cpp index 93d39fe5a..5678aa236 100644 --- a/indra/newview/lltoolbar.cpp +++ b/indra/newview/lltoolbar.cpp @@ -42,13 +42,14 @@ #include "llagent.h" #include "llagentcamera.h" +#include "llagentwearables.h" #include "llbutton.h" #include "llfocusmgr.h" #include "llviewercontrol.h" #include "llmenucommands.h" #include "llimview.h" #include "lluiconstants.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "lltooldraganddrop.h" #include "llfloaterchatterbox.h" #include "llfloaterfriends.h" @@ -288,6 +289,9 @@ void LLToolBar::reshape(S32 width, S32 height, BOOL called_from_parent) // Per-frame updates of visibility void LLToolBar::refresh() { + if(!isAgentAvatarValid()) + return; + BOOL show = gSavedSettings.getBOOL("ShowToolBar"); BOOL mouselook = gAgentCamera.cameraMouselook(); setVisible(show && !mouselook); diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 3872337ed..61a5ef769 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -86,6 +86,7 @@ // [RLVa:KB] - Checked: 2010-03-04 (RLVa-1.2.0a) #include "rlvhandler.h" +#include "rlvlocks.h" // [/RLVa:KB] // MAX ITEMS is based on (sizeof(uuid)+2) * count must be < MTUBYTES @@ -1581,8 +1582,7 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL } else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP)) ) { - LLVOAvatar* pAvatar = gAgentAvatarp; - if ( (pAvatar) && (pAvatar->isSitting()) && (pAvatar->getRoot() == pObjRoot) ) + if ( (isAgentAvatarValid()) && (gAgentAvatarp->isSitting()) && (gAgentAvatarp->getRoot() == pObjRoot) ) return ACCEPT_NO_LOCKED; // ... or on a linkset the avie is sitting on under @unsit=n/@sittp=n } } @@ -1734,11 +1734,10 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv( { if(mSource == SOURCE_LIBRARY) { - LLPointer cb = new RezAttachmentCallback(0); - //Reapply this patch later. -// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-09-08 (Catznip-2.2.0a) | Added: Catznip-2.2.0a +// LLPointer cb = new RezAttachmentCallback(0); +// [SL:KB] - Patch: Appearance-DnDWear | Checked: 2010-09-28 (Catznip-3.0.0a) | Added: Catznip-2.2.0a // Make this behave consistent with dad3dWearItem - //LLPointer cb = new RezAttachmentCallback(0, !(mask & MASK_CONTROL)); // MULTI-WEARABLES TODO + LLPointer cb = new RezAttachmentCallback(0, !(mask & MASK_CONTROL)); // [/SL:KB] copy_inventory_item( gAgent.getID(), @@ -2062,9 +2061,11 @@ EAcceptance LLToolDragAndDrop::dad3dWearItem( } // [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.2.1f - if ( (rlv_handler_t::isEnabled()) && (RLV_WEAR_REPLACE != gRlvWearableLocks.canWear(item)) ) + if ( (rlv_handler_t::isEnabled()) && (gRlvWearableLocks.hasLockedWearableType(RLV_LOCK_ANY)) ) { - return ACCEPT_NO_LOCKED; + ERlvWearMask eWearMask = gRlvWearableLocks.canWear(item); bool fReplace = !(mask & MASK_CONTROL); + if ( ((!fReplace) && ((RLV_WEAR_ADD & eWearMask) == 0)) || ((fReplace) && ((RLV_WEAR_REPLACE & eWearMask) == 0)) ) + return ACCEPT_NO_LOCKED; } // [/RLVa:KB] diff --git a/indra/newview/lltoolgrab.cpp b/indra/newview/lltoolgrab.cpp index 5f356b547..4fcad123f 100644 --- a/indra/newview/lltoolgrab.cpp +++ b/indra/newview/lltoolgrab.cpp @@ -61,7 +61,7 @@ #include "llviewerobjectlist.h" #include "llviewerregion.h" #include "llviewerwindow.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llworld.h" // [RLVa:KB] diff --git a/indra/newview/lltoolmgr.cpp b/indra/newview/lltoolmgr.cpp index c407a6cb4..0ad252cae 100644 --- a/indra/newview/lltoolmgr.cpp +++ b/indra/newview/lltoolmgr.cpp @@ -51,6 +51,7 @@ #include "lltoolselectland.h" #include "lltoolobjpicker.h" #include "lltoolpipette.h" +#include "llviewerparcelmgr.h" #include "llagent.h" #include "llagentcamera.h" #include "llviewercontrol.h" @@ -240,6 +241,10 @@ BOOL LLToolMgr::inEdit() return mBaseTool != LLToolPie::getInstance() && mBaseTool != gToolNull; } +bool LLToolMgr::canEdit() +{ + return LLViewerParcelMgr::getInstance()->allowAgentBuild(); +} bool LLToolMgr::inBuildMode() { // when entering mouselook inEdit() immediately returns true before diff --git a/indra/newview/lltoolmgr.h b/indra/newview/lltoolmgr.h index 2abba2220..e3fdb129a 100644 --- a/indra/newview/lltoolmgr.h +++ b/indra/newview/lltoolmgr.h @@ -59,6 +59,7 @@ public: LLTool* getBaseTool(); // returns active tool when overrides are deactivated BOOL inEdit(); + bool canEdit(); /* Determines if we are in Build mode or not. */ bool inBuildMode(); diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 32e7c2777..580f05314 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -66,7 +66,7 @@ #include "llwindow.h" #include "llviewermedia.h" #include "llviewermediafocus.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llworld.h" #include "llui.h" #include "llweb.h" @@ -206,7 +206,7 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) // touch behavior down below... break; case CLICK_ACTION_SIT: - if ((gAgentAvatarp != NULL) && (!gAgentAvatarp->isSitting()) + if ((isAgentAvatarValid()) && (!gAgentAvatarp->isSitting()) && (!gSavedSettings.getBOOL("DisableClickSit"))) // agent not already sitting { handle_sit_or_stand(); @@ -561,7 +561,7 @@ ECursorType cursor_from_object(LLViewerObject* object) case CLICK_ACTION_SIT: // if ((gAgentAvatarp != NULL) && (!gAgentAvatarp->isSitting())) // not already sitting? // [RLVa:KB] - Checked: 2009-12-22 (RLVa-1.1.0k) | Added: RLVa-1.1.0j - if ( ((gAgentAvatarp != NULL) && (!gAgentAvatarp->isSitting())) && // not already sitting? + if ( ((isAgentAvatarValid()) && (!gAgentAvatarp->isSitting())) && // not already sitting? ((!rlv_handler_t::isEnabled()) || (gRlvHandler.canSit(object, gViewerWindow->getHoverPick().mObjectOffset))) ) // [/RLVa:KB] { diff --git a/indra/newview/lltoolplacer.cpp b/indra/newview/lltoolplacer.cpp index 9556ff27c..9ae84c2e1 100644 --- a/indra/newview/lltoolplacer.cpp +++ b/indra/newview/lltoolplacer.cpp @@ -55,6 +55,7 @@ #include "llui.h" //Headers added for functions moved from viewer.cpp +#include "llvoavatarself.h" #include "llvograss.h" #include "llvotree.h" #include "llvolumemessage.h" diff --git a/indra/newview/lltoolselect.cpp b/indra/newview/lltoolselect.cpp index 5cfd6c59e..15eb7ea00 100644 --- a/indra/newview/lltoolselect.cpp +++ b/indra/newview/lltoolselect.cpp @@ -49,7 +49,7 @@ #include "llviewerobjectlist.h" #include "llviewerregion.h" #include "llviewerwindow.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llworld.h" // [RLVa:KB] diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 2c5e115eb..a7dea4d74 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -64,7 +64,7 @@ #include "llviewerobjectlist.h" #include "llviewerparcelmgr.h" #include "llviewerwindow.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llvograss.h" #include "llworld.h" #include "pipeline.h" @@ -87,6 +87,7 @@ // [RLVa:KB] #include "rlvhandler.h" +#include "rlvlocks.h" // [/RLVa:KB] LLPointer gDisconnectedImagep = NULL; diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 88f7e1976..c932de258 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -818,9 +818,13 @@ void ModifiedCOFCallback::fire(const LLUUID& inv_item) } } -RezAttachmentCallback::RezAttachmentCallback(LLViewerJointAttachment *attachmentp) +//RezAttachmentCallback::RezAttachmentCallback(LLViewerJointAttachment *attachmentp) +// [SL:KB] - Patch: Appearance-DnDWear | Checked: 2010-09-28 (Catznip-3.0.0a) | Added: Catznip-2.2.0a +RezAttachmentCallback::RezAttachmentCallback(LLViewerJointAttachment *attachmentp, bool replace) + : mAttach(attachmentp), mReplace(replace) +// [/SL:KB] { - mAttach = attachmentp; +// mAttach = attachmentp; } RezAttachmentCallback::~RezAttachmentCallback() { @@ -834,7 +838,10 @@ void RezAttachmentCallback::fire(const LLUUID& inv_item) LLViewerInventoryItem *item = gInventory.getItem(inv_item); if (item) { - rez_attachment(item, mAttach); +// rez_attachment(item, mAttach); +// [SL:KB] - Patch: Appearance-DnDWear | Checked: 2010-09-28 (Catznip-3.0.0a) | Added: Catznip-2.2.0a + rez_attachment(item, mAttach, mReplace); +// [/SL:KB] } } diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 1939def08..2eb67cc62 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -261,7 +261,10 @@ class LLViewerJointAttachment; class RezAttachmentCallback : public LLInventoryCallback { public: - RezAttachmentCallback(LLViewerJointAttachment *attachmentp); +// RezAttachmentCallback(LLViewerJointAttachment *attachmentp); +// [SL:KB] - Patch: Appearance-DnDWear | Checked: 2010-09-28 (Catznip-3.0.0a) | Added: Catznip-2.2.0a + RezAttachmentCallback(LLViewerJointAttachment *attachmentp, bool replace = false); +// [/SL:KB] void fire(const LLUUID& inv_item); protected: @@ -269,6 +272,9 @@ protected: private: LLViewerJointAttachment* mAttach; +// [SL:KB] - Patch: Appearance-DnDWear | Checked: 2010-09-28 (Catznip-3.0.0a) | Added: Catznip-2.2.0a + bool mReplace; +// [/SL:KB] }; class ActivateGestureCallback : public LLInventoryCallback diff --git a/indra/newview/llviewerjointattachment.cpp b/indra/newview/llviewerjointattachment.cpp index 4e14824e6..bae777c1d 100644 --- a/indra/newview/llviewerjointattachment.cpp +++ b/indra/newview/llviewerjointattachment.cpp @@ -158,7 +158,7 @@ void LLViewerJointAttachment::setupDrawable(LLViewerObject *object) //----------------------------------------------------------------------------- BOOL LLViewerJointAttachment::addObject(LLViewerObject* object) { - object->extractAttachmentItemID(); +// object->extractAttachmentItemID(); // Same object reattached if (isObjectAttached(object)) @@ -169,6 +169,10 @@ BOOL LLViewerJointAttachment::addObject(LLViewerObject* object) // re-connect object to the joint correctly } +// [SL:KB] - Patch: Appearance-Misc | Checked: Catznip-3.0.0a (2011-01-13) | Added: Catznip-2.4.0h + // LLViewerJointAttachment::removeObject() sets the object's item to the NULL UUID so we need to extract it *after* the block above + object->extractAttachmentItemID(); +// [/SL:KB] // Two instances of the same inventory item attached -- // Request detach, and kill the object in the meantime. if (getAttachedObject(object->getAttachmentItemID())) diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index 722c31492..36099abe8 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -338,8 +338,11 @@ void LLViewerJoystick::handleRun(F32 inc) if (1 == mJoystickRun) { ++mJoystickRun; - gAgent.setRunning(); - gAgent.sendWalkRun(gAgent.getRunning()); +// gAgent.setRunning(); +// gAgent.sendWalkRun(gAgent.getRunning()); +// [RLVa:KB] - Checked: 2011-05-11 (RLVa-1.3.0i) | Added: RLVa-1.3.0i + gAgent.setTempRun(); +// [/RLVa:KB] } else if (0 == mJoystickRun) { @@ -354,8 +357,11 @@ void LLViewerJoystick::handleRun(F32 inc) --mJoystickRun; if (0 == mJoystickRun) { - gAgent.clearRunning(); - gAgent.sendWalkRun(gAgent.getRunning()); +// gAgent.clearRunning(); +// gAgent.sendWalkRun(gAgent.getRunning()); +// [RLVa:KB] - Checked: 2011-05-11 (RLVa-1.3.0i) | Added: RLVa-1.3.0i + gAgent.clearTempRun(); +// [/RLVa:KB] } } } diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp index 5b3312371..dc9a4afd1 100644 --- a/indra/newview/llviewerkeyboard.cpp +++ b/indra/newview/llviewerkeyboard.cpp @@ -104,14 +104,18 @@ static void agent_handle_doubletap_run(EKeystate s, LLAgent::EDoubleTapRunMode m { if (KEYSTATE_UP == s) { - if (gAgent.mDoubleTapRunMode == mode && - gAgent.getRunning() && - !gAgent.getAlwaysRun()) - { - // Turn off temporary running. - gAgent.clearRunning(); - gAgent.sendWalkRun(gAgent.getRunning()); - } +// if (gAgent.mDoubleTapRunMode == mode && +// gAgent.getRunning() && +// !gAgent.getAlwaysRun()) +// { +// // Turn off temporary running. +// gAgent.clearRunning(); +// gAgent.sendWalkRun(gAgent.getRunning()); +// } +// [RLVa:KB] - Checked: 2011-05-11 (RLVa-1.3.0i) | Added: RLVa-1.3.0i + if ( (gAgent.mDoubleTapRunMode == mode) && (gAgent.getTempRun()) ) + gAgent.clearTempRun(); +// [/RLVa:KB] } else if (gAllowTapTapHoldRun && KEYSTATE_DOWN == s && @@ -122,8 +126,11 @@ static void agent_handle_doubletap_run(EKeystate s, LLAgent::EDoubleTapRunMode m { // Same walk-key was pushed again quickly; this is a // double-tap so engage temporary running. - gAgent.setRunning(); - gAgent.sendWalkRun(gAgent.getRunning()); +// gAgent.setRunning(); +// gAgent.sendWalkRun(gAgent.getRunning()); +// [RLVa:KB] - Checked: 2011-05-11 (RLVa-1.3.0i) | Added: RLVa-1.3.0i + gAgent.setTempRun(); +// [/RLVa:KB] } // Pressing any walk-key resets the double-tap timer @@ -521,8 +528,9 @@ void start_chat( EKeystate s ) void start_gesture( EKeystate s ) { + LLUICtrl* focus_ctrlp = dynamic_cast(gFocusMgr.getKeyboardFocus()); if (KEYSTATE_UP == s && - !(gFocusMgr.getKeyboardFocus() && dynamic_cast(gFocusMgr.getKeyboardFocus())->acceptsTextInput())) + ! (focus_ctrlp && focus_ctrlp->acceptsTextInput())) { if (gChatBar->getCurrentChat().empty()) { @@ -859,7 +867,7 @@ EKeyboardMode LLViewerKeyboard::getMode() { return MODE_EDIT_AVATAR; } - else if (gAgentAvatarp && gAgentAvatarp->isSitting()) + else if (isAgentAvatarValid() && gAgentAvatarp->isSitting()) { return MODE_SITTING; } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index cbf225ea7..e7265eb8e 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -227,7 +227,7 @@ #include "llviewerregion.h" #include "llviewerstats.h" #include "llviewerwindow.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llvolume.h" #include "llweb.h" #include "llworld.h" @@ -267,6 +267,8 @@ using namespace LLVOAvatarDefines; void init_client_menu(LLMenuGL* menu); void init_server_menu(LLMenuGL* menu); +typedef LLPointer LLViewerObjectPtr; + void init_debug_world_menu(LLMenuGL* menu); void init_debug_rendering_menu(LLMenuGL* menu); void init_debug_ui_menu(LLMenuGL* menu); @@ -275,6 +277,7 @@ void init_debug_avatar_menu(LLMenuGL* menu); // [RLVa:KB] #include "rlvhandler.h" #include "rlvfloaterbehaviour.h" +#include "rlvlocks.h" void init_debug_rlva_menu(LLMenuGL* menu); // [/RLVa:KB] @@ -1186,7 +1189,7 @@ void init_client_menu(LLMenuGL* menu) // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-1.0.0e | OK #ifdef RLV_ADVANCED_TOGGLE_RLVA if (gSavedSettings.controlExists(RLV_SETTING_MAIN)) - menu->addChild(new LLMenuItemCheckGL("RestrainedLove API", &rlvToggleEnabled, NULL, &rlvGetEnabled, NULL)); + menu->addChild(new LLMenuItemCheckGL("RestrainedLove API", &rlvMenuToggleEnabled, NULL, &rlvMenuCheckEnabled, NULL)); #endif // RLV_ADVANCED_TOGGLE_RLVA // [/RLVa:KB] @@ -1725,7 +1728,8 @@ void init_debug_rlva_menu(LLMenuGL* menu) #ifdef RLV_EXTENSION_FLOATER_RESTRICTIONS // TODO-RLVa: figure out a way to tell if floater_rlv_behaviour.xml exists - menu->addChild(new LLMenuItemCallGL("Restrictions...", RlvFloaterBehaviour::show, NULL, NULL)); + menu->addChild(new LLMenuItemCheckGL("Restrictions...", &RlvFloaterBehaviours::toggle, NULL, &RlvFloaterBehaviours::visible, NULL)); + menu->addChild(new LLMenuItemCheckGL("Locks...", &RlvFloaterLocks::toggle, NULL, &RlvFloaterLocks::visible, NULL)); #endif // RLV_EXTENSION_FLOATER_RESTRICTIONS } // [/RLVa:KB] @@ -2482,11 +2486,10 @@ class LLSelfEnableRemoveAllAttachments : public view_listener_t bool handleEvent(LLPointer event, const LLSD& userdata) { bool new_value = false; - if (gAgentAvatarp) + if (isAgentAvatarValid()) { - LLVOAvatar* avatarp = gAgentAvatarp; - for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); - iter != avatarp->mAttachmentPoints.end(); ) + for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); + iter != gAgentAvatarp->mAttachmentPoints.end(); ) { LLVOAvatar::attachment_map_t::iterator curiter = iter++; LLViewerJointAttachment* attachment = curiter->second; @@ -4582,22 +4585,21 @@ void handle_show_overlay_title(void*) gSavedSettings.setBOOL("ShowOverlayTitle", gShowOverlayTitle); } -void derez_objects(EDeRezDestination dest, const LLUUID& dest_id) +static bool get_derezzable_objects( + EDeRezDestination dest, + std::string& error, + LLViewerRegion*& first_region, + LLDynamicArray* derez_objectsp, + bool only_check = false) { - if(gAgentCamera.cameraMouselook()) - { - gAgentCamera.changeCameraToDefault(); - } - //gInventoryView->setPanelOpen(TRUE); + bool found = false; - std::string error; - LLDynamicArray derez_objects; + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); // Check conditions that we can't deal with, building a list of // everything that we'll actually be derezzing. - LLViewerRegion* first_region = NULL; - for (LLObjectSelection::valid_root_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_root_begin(); - iter != LLSelectMgr::getInstance()->getSelection()->valid_root_end(); iter++) + for (LLObjectSelection::valid_root_iterator iter = selection->valid_root_begin(); + iter != selection->valid_root_end(); iter++) { LLSelectNode* node = *iter; LLViewerObject* object = node->getObject(); @@ -4667,10 +4669,55 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id) } if(can_derez_current) { - derez_objects.put(object); + found = true; + + if (only_check) + // one found, no need to traverse to the end + break; + + if (derez_objectsp) + derez_objectsp->put(object); + } } + return found; +} + +static bool can_derez(EDeRezDestination dest) +{ + LLViewerRegion* first_region = NULL; + std::string error; + return get_derezzable_objects(dest, error, first_region, NULL, true); +} + +static void derez_objects( + EDeRezDestination dest, + const LLUUID& dest_id, + LLViewerRegion*& first_region, + std::string& error, + LLDynamicArray* objectsp) +{ + LLDynamicArray derez_objects; + + if (!objectsp) // if objects to derez not specified + { + // get them from selection + if (!get_derezzable_objects(dest, error, first_region, &derez_objects, false)) + { + llwarns << "No objects to derez" << llendl; + return; + } + + objectsp = &derez_objects; + } + + + if(gAgentCamera.cameraMouselook()) + { + gAgentCamera.changeCameraToDefault(); + } + // This constant is based on (1200 - HEADER_SIZE) / 4 bytes per // root. I lopped off a few (33) to provide a bit // pad. HEADER_SIZE is currently 67 bytes, most of which is UUIDs. @@ -4678,13 +4725,13 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id) // satisfy anybody. const S32 MAX_ROOTS_PER_PACKET = 250; const S32 MAX_PACKET_COUNT = 254; - F32 packets = ceil((F32)derez_objects.count() / (F32)MAX_ROOTS_PER_PACKET); + F32 packets = ceil((F32)objectsp->count() / (F32)MAX_ROOTS_PER_PACKET); if(packets > (F32)MAX_PACKET_COUNT) { error = "AcquireErrorTooManyObjects"; } - if(error.empty() && derez_objects.count() > 0) + if(error.empty() && objectsp->count() > 0) { U8 d = (U8)dest; LLUUID tid; @@ -4709,11 +4756,11 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id) msg->addU8Fast(_PREHASH_PacketCount, packet_count); msg->addU8Fast(_PREHASH_PacketNumber, packet_number); objects_in_packet = 0; - while((object_index < derez_objects.count()) + while((object_index < objectsp->count()) && (objects_in_packet++ < MAX_ROOTS_PER_PACKET)) { - LLViewerObject* object = derez_objects.get(object_index++); + LLViewerObject* object = objectsp->get(object_index++); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID()); // @@ -4741,19 +4788,31 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id) } else if(!error.empty()) { - LLNotifications::instance().add(error); + LLNotificationsUtil::add(error); } } +static void derez_objects(EDeRezDestination dest, const LLUUID& dest_id) +{ + LLViewerRegion* first_region = NULL; + std::string error; + derez_objects(dest, dest_id, first_region, error, NULL); +} + class LLToolsTakeCopy : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return true; -// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b) | Modified: RLVa-1.0.0b | OK - // NOTE: we need to handle "Take Copy" because it will force a sim-side unsit if we're sitting on the selection, - // but we do want to allow "Take Copy" under @rez=n so that's why we explicitly check for @unsit=n here - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (!rlvCanDeleteOrReturn()) ) return true; +// [RLVa:KB] - Checked: 2010-03-07 (RLVa-1.2.0c) | Modified: RLVa-1.2.0a + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStand()) ) + { + // Allow only if the avie isn't sitting on any of the selected objects + LLObjectSelectionHandle hSel = LLSelectMgr::getInstance()->getSelection(); + RlvSelectIsSittingOn f(gAgentAvatarp); + if ( (hSel.notNull()) && (hSel->getFirstRootNode(&f, TRUE) != NULL) ) + return true; + } // [/RLVa:KB] const LLUUID& category_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT); @@ -4763,10 +4822,11 @@ class LLToolsTakeCopy : public view_listener_t } }; - // You can return an object to its owner if it is on your land. class LLObjectReturn : public view_listener_t { +public: + LLObjectReturn() : mFirstRegion(NULL) {} bool handleEvent(LLPointer event, const LLSD& userdata) { if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return true; @@ -4776,26 +4836,36 @@ class LLObjectReturn : public view_listener_t mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); + // Save selected objects, so that we still know what to return after the confirmation dialog resets selection. + get_derezzable_objects(DRD_RETURN_TO_OWNER, mError, mFirstRegion, &mReturnableObjects); + LLNotificationsUtil::add("ReturnToOwner", LLSD(), LLSD(), boost::bind(&LLObjectReturn::onReturnToOwner, this, _1, _2)); return true; } bool onReturnToOwner(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (0 == option) { // Ignore category ID for this derez destination. - derez_objects(DRD_RETURN_TO_OWNER, LLUUID::null); + derez_objects(DRD_RETURN_TO_OWNER, LLUUID::null, mFirstRegion, mError, &mReturnableObjects); } + mReturnableObjects.clear(); + mError.clear(); + mFirstRegion = NULL; + // drop reference to current selection mObjectSelection = NULL; return false; } -protected: LLObjectSelectionHandle mObjectSelection; + + LLDynamicArray mReturnableObjects; + std::string mError; + LLViewerRegion* mFirstRegion; }; @@ -4805,6 +4875,17 @@ class LLObjectEnableReturn : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { + if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) + { + // Do not enable if nothing selected + return false; + } +// [RLVa:KB] - Checked: 2011-05-28 (RLVa-1.4.0a) | Modified: RLVa-1.4.0a + if ( (rlv_handler_t::isEnabled()) && (!rlvCanDeleteOrReturn()) ) + { + return false; + } +// [/RLVa:KB] #ifdef HACKED_GODLIKE_VIEWER bool new_value = true; #else @@ -4815,34 +4896,9 @@ class LLObjectEnableReturn : public view_listener_t } else { - LLViewerRegion* region = gAgent.getRegion(); - if (region) - { - // Estate owners and managers can always return objects. - if (region->canManageEstate()) - { - new_value = true; - } - else - { - struct f : public LLSelectedObjectFunctor - { - virtual bool apply(LLViewerObject* obj) - { - return (obj->isOverAgentOwnedLand() || - obj->isOverGroupOwnedLand() || - obj->permModify()); - } - } func; - const bool firstonly = true; - new_value = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly); - } - } + new_value = can_derez(DRD_RETURN_TO_OWNER); } #endif -// [RLVa:KB] - Checked: 2010-03-24 (RLVa-1.2.0e) | Modified: RLVa-1.0.0b | OK - new_value &= (!rlv_handler_t::isEnabled()) || (rlvCanDeleteOrReturn()); -// [/RLVa:KB] gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4915,8 +4971,7 @@ void handle_take() if(category_id.notNull()) { // check trash - LLUUID trash; - trash = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); + const LLUUID trash = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); if(category_id == trash || gInventory.isObjectDescendentOf(category_id, trash)) { category_id.setNull(); @@ -4968,7 +5023,7 @@ void handle_take() bool confirm_take(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if(enable_take() && (option == 0)) { derez_objects(DRD_TAKE_INTO_AGENT_INVENTORY, notification["payload"]["folder_id"].asUUID()); @@ -5222,13 +5277,9 @@ BOOL sitting_on_selection() } // Need to determine if avatar is sitting on this object - LLVOAvatar* avatar = gAgentAvatarp; - if (!avatar) - { - return FALSE; - } + if (!isAgentAvatarValid()) return FALSE; - return (avatar->isSitting() && avatar->getRoot() == root_object); + return (gAgentAvatarp->isSitting() && gAgentAvatarp->getRoot() == root_object); } class LLToolsSaveToInventory : public view_listener_t @@ -5958,16 +6009,16 @@ class LLWorldAlwaysRun : public view_listener_t if (gAgent.getAlwaysRun()) { gAgent.clearAlwaysRun(); - gAgent.clearRunning(); +// gAgent.clearRunning(); } else { gAgent.setAlwaysRun(); - gAgent.setRunning(); +// gAgent.setRunning(); } // tell the simulator. - gAgent.sendWalkRun(gAgent.getAlwaysRun()); +// gAgent.sendWalkRun(gAgent.getAlwaysRun()); return true; } @@ -6136,6 +6187,10 @@ class LLToolsLookAtSelection : public view_listener_t } if (zoom) { + // Make sure we are not increasing the distance between the camera and object + LLVector3d orig_distance = gAgentCamera.getCameraPositionGlobal() - LLSelectMgr::getInstance()->getSelectionCenterGlobal(); + distance = llmin(distance, (F32) orig_distance.length()); + gAgentCamera.setCameraPosAndFocusGlobal(LLSelectMgr::getInstance()->getSelectionCenterGlobal() + LLVector3d(obj_to_cam * distance), LLSelectMgr::getInstance()->getSelectionCenterGlobal(), object_id ); @@ -6757,13 +6812,6 @@ class LLShowAgentProfile : public view_listener_t } else if (userdata.asString() == "hit object") { -// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) - { - return true; - } -// [/RLVa:KB] - LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); if (objectp) { @@ -6776,7 +6824,10 @@ class LLShowAgentProfile : public view_listener_t } LLVOAvatar* avatar = find_avatar_from_object(agent_id); - if (avatar) +// 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] { LLFloaterAvatarInfo::show( avatar->getID() ); } @@ -6901,6 +6952,7 @@ void handle_move(void*) class LLObjectAttachToAvatar : public view_listener_t { public: + LLObjectAttachToAvatar(bool replace) : mReplace(replace) {} static void setObjectSelection(LLObjectSelectionHandle selection) { sObjectSelection = selection; } private: @@ -6927,27 +6979,43 @@ private: } // [/RLVa:KB] - confirm_replace_attachment(0, attachment_point); + confirmReplaceAttachment(0, attachment_point); } return true; } + static void onNearAttachObject(BOOL success, void *user_data); + void confirmReplaceAttachment(S32 option, LLViewerJointAttachment* attachment_point); + + struct CallbackData + { + CallbackData(LLViewerJointAttachment* point, bool replace) : mAttachmentPoint(point), mReplace(replace) {} + + LLViewerJointAttachment* mAttachmentPoint; + bool mReplace; + }; + protected: static LLObjectSelectionHandle sObjectSelection; + bool mReplace; }; LLObjectSelectionHandle LLObjectAttachToAvatar::sObjectSelection; -void near_attach_object(BOOL success, void *user_data) +// static +void LLObjectAttachToAvatar::onNearAttachObject(BOOL success, void *user_data) { + if (!user_data) return; + CallbackData* cb_data = static_cast(user_data); + if (success) { - LLViewerJointAttachment *attachment = (LLViewerJointAttachment *)user_data; + const LLViewerJointAttachment *attachment = cb_data->mAttachmentPoint; U8 attachment_id = 0; if (attachment) { - for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); + for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter) { if (iter->second == attachment) @@ -6962,12 +7030,15 @@ void near_attach_object(BOOL success, void *user_data) // interpret 0 as "default location" attachment_id = 0; } - LLSelectMgr::getInstance()->sendAttach(attachment_id); + LLSelectMgr::getInstance()->sendAttach(attachment_id, cb_data->mReplace); } LLObjectAttachToAvatar::setObjectSelection(NULL); + + delete cb_data; } -void confirm_replace_attachment(S32 option, void* user_data) +// static +void LLObjectAttachToAvatar::confirmReplaceAttachment(S32 option, LLViewerJointAttachment* attachment_point) { if (option == 0/*YES*/) { @@ -6992,48 +7063,66 @@ void confirm_replace_attachment(S32 option, void* user_data) delta = delta * 0.5f; walkToSpot -= delta; - gAgent.startAutoPilotGlobal(gAgent.getPosGlobalFromAgent(walkToSpot), "Attach", NULL, near_attach_object, user_data, stop_distance); + // The callback will be called even if avatar fails to get close enough to the object, so we won't get a memory leak. + CallbackData* user_data = new CallbackData(attachment_point, mReplace); + gAgent.startAutoPilotGlobal(gAgent.getPosGlobalFromAgent(walkToSpot), "Attach", NULL, onNearAttachObject, user_data, stop_distance); gAgentCamera.clearFocusObject(); } } } +void callback_attachment_drop(const LLSD& notification, const LLSD& response) +{ + // Ensure user confirmed the drop + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option != 0) return; + + // Called when the user clicked on an object attached to them + // and selected "Drop". + LLUUID object_id = notification["payload"]["object_id"].asUUID(); + LLViewerObject *object = gObjectList.findObject(object_id); + + if (!object) + { + llwarns << "handle_drop_attachment() - no object to drop" << llendl; + return; + } + + LLViewerObject *parent = (LLViewerObject*)object->getParent(); + while (parent) + { + if(parent->isAvatar()) + { + break; + } + object = parent; + parent = (LLViewerObject*)parent->getParent(); + } + + if (!object) + { + llwarns << "handle_detach() - no object to detach" << llendl; + return; + } + + if (object->isAvatar()) + { + llwarns << "Trying to detach avatar from avatar." << llendl; + return; + } + + // reselect the object + LLSelectMgr::getInstance()->selectObjectAndFamily(object); + + LLSelectMgr::getInstance()->sendDropAttachment(); + + return; +} + class LLAttachmentDrop : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - // Called when the user clicked on an object attached to them - // and selected "Drop". - LLViewerObject *object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); - if (!object) - { - llwarns << "handle_drop_attachment() - no object to drop" << llendl; - return true; - } - - LLViewerObject *parent = (LLViewerObject*)object->getParent(); - while (parent) - { - if(parent->isAvatar()) - { - break; - } - object = parent; - parent = (LLViewerObject*)parent->getParent(); - } - - if (!object) - { - llwarns << "handle_detach() - no object to detach" << llendl; - return true; - } - - if (object->isAvatar()) - { - llwarns << "Trying to detach avatar from avatar." << llendl; - return true; - } - // [RLVa:KB] - Checked: 2010-03-15 (RLVa-1.2.0e) | Modified: RLVa-1.0.5 | OK if (rlv_handler_t::isEnabled()) { @@ -7052,11 +7141,20 @@ class LLAttachmentDrop : public view_listener_t } // [/RLVa:KB] - // The sendDropAttachment() method works on the list of selected - // objects. Thus we need to clear the list, make sure it only - // contains the object the user clicked, send the message, - // then clear the list. - LLSelectMgr::getInstance()->sendDropAttachment(); + LLSD payload; + LLViewerObject *object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); + + if (object) + { + payload["object_id"] = object->getID(); + } + else + { + llwarns << "Drop object not found" << llendl; + return true; + } + + LLNotificationsUtil::add("AttachmentDrop", LLSD(), payload, &callback_attachment_drop); return true; } }; @@ -7334,6 +7432,8 @@ BOOL object_selected_and_point_valid(void *user_data) // [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.2.1f | OK if (rlv_handler_t::isEnabled()) { + if (!isAgentAvatarValid()) + return FALSE; // RELEASE-RLVa: look at the caller graph for this function on every new release // -> 1.22.11 and 1.23.4 // - object_is_wearable() => dead code [user_data == NULL => default attach point => OK!] @@ -9155,6 +9255,22 @@ class LLEditTakeOff : public view_listener_t { // MULTI-WEARABLES: assuming user wanted to remove top shirt. U32 wearable_index = gAgentWearables.getWearableCount(type) - 1; + +// [RLVa:KB] - Checked: 2010-06-09 (RLVa-1.2.0g) | Added: RLVa-1.2.0g + if ( (rlv_handler_t::isEnabled()) && (gRlvWearableLocks.hasLockedWearable(type)) ) + { + // We'll use the first wearable we come across that can be removed (moving from top to bottom) + for (; wearable_index >= 0; wearable_index--) + { + const LLWearable* pWearable = gAgentWearables.getWearable(type, wearable_index); + if (!gRlvWearableLocks.isLockedWearable(pWearable)) + break; + } + if (wearable_index < 0) + return true; // No wearable found that can be removed + } +// [/RLVa:KB] + LLViewerInventoryItem *item = dynamic_cast(gAgentWearables.getWearableInventoryItem(type,wearable_index)); LLWearableBridge::removeItemFromAvatar(item); } @@ -9513,10 +9629,9 @@ void initialize_menus() addMenu(new LLObjectTouch(), "Object.Touch"); addMenu(new LLObjectSitOrStand(), "Object.SitOrStand"); addMenu(new LLObjectDelete(), "Object.Delete"); - addMenu(new LLObjectAttachToAvatar(), "Object.AttachToAvatar"); + addMenu(new LLObjectAttachToAvatar(true), "Object.AttachToAvatar"); addMenu(new LLObjectReturn(), "Object.Return"); addMenu(new LLObjectReportAbuse(), "Object.ReportAbuse"); - addMenu(new LLObjectReportAbuse(), "Object.ReportAbuse"); // addMenu(new LLObjectMeasure(), "Object.Measure"); addMenu(new LLObjectData(), "Object.Data"); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 3084cb892..2948a324b 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -153,9 +153,11 @@ // [RLVa:KB] #include "rlvhandler.h" #include "rlvinventory.h" +#include "rlvui.h" +#include "rlvcommon.h" // [/RLVa:KB] -#if SHY_MOD //Group Title script access +#if SHY_MOD //Command handler # include "shcommandhandler.h" #endif //shy_mod @@ -2677,7 +2679,8 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) ) && (RlvInventory::instance().getSharedRoot()) ) { - RlvNotifications::warnGiveToRLV(); + + RlvUtil::warnGiveToRLV(); } // [/RLVa:KB] @@ -4336,7 +4339,10 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) } // send walk-vs-run status - gAgent.sendWalkRun(gAgent.getRunning() || gAgent.getAlwaysRun()); +// gAgent.sendWalkRun(gAgent.getRunning() || gAgent.getAlwaysRun()); +// [RLVa:KB] - Checked: 2011-05-11 (RLVa-1.3.0i) | Added: RLVa-1.3.0i + gAgent.sendWalkRun(); +// [/RLVa:KB] // If the server version has changed, display an info box and offer // to display the release notes, unless this is the initial log in. diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 03af48630..4de7a503a 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -2,31 +2,25 @@ * @file llviewerobject.cpp * @brief Base class for viewer objects * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -52,6 +46,7 @@ #include "llprimitive.h" #include "llquantize.h" #include "llregionhandle.h" +#include "llsdserialize.h" #include "lltree_common.h" #include "llxfermanager.h" #include "message.h" @@ -69,6 +64,7 @@ #include "llfloaterproperties.h" #include "llfloatertools.h" #include "llfollowcam.h" +#include "llhudtext.h" #include "llselectmgr.h" #include "llrendersphere.h" #include "lltooldraganddrop.h" @@ -82,6 +78,7 @@ #include "llviewerstats.h" #include "llviewertextureanim.h" #include "llviewerwindow.h" // For getSpinAxis +#include "llvoavatar.h" #include "llvoavatarself.h" #include "llvoclouds.h" #include "llvograss.h" @@ -104,6 +101,7 @@ // [RLVa:KB] #include "rlvhandler.h" +#include "rlvlocks.h" // [/RLVa:KB] //#define DEBUG_UPDATE_TYPE @@ -534,23 +532,139 @@ void LLViewerObject::setNameValueList(const std::string& name_value_list) } } - // This method returns true if the object is over land owned by the // agent. -BOOL LLViewerObject::isOverAgentOwnedLand() const +bool LLViewerObject::isReturnable() { - return mRegionp - && mRegionp->getParcelOverlay() - && mRegionp->getParcelOverlay()->isOwnedSelf(getPositionRegion()); + if (isAttachment()) + { + return false; + } + +// [RLVa:KB] - Checked: 2011-05-28 (RLVa-1.4.0a) | Added: RLVa-1.4.0a + // Block if: @rez=n restricted and owned by us or a group *or* @unsit=n restricted and being sat on by us + if ( (rlv_handler_t::isEnabled()) && + ( ((gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) && ((permYouOwner() || permGroupOwner()))) || + ((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (isAgentAvatarValid()) && (getRootEdit()->isChild(gAgentAvatarp))) ) ) + { + return false; + } +// [/RLVa:KB] + std::vector boxes; + boxes.push_back(LLBBox(getPositionRegion(), getRotationRegion(), getScale() * -0.5f, getScale() * 0.5f).getAxisAligned()); + for (child_list_t::iterator iter = mChildList.begin(); + iter != mChildList.end(); iter++) + { + LLViewerObject* child = *iter; + boxes.push_back( LLBBox(child->getPositionRegion(), child->getRotationRegion(), child->getScale() * -0.5f, child->getScale() * 0.5f).getAxisAligned()); + } + + bool result = (mRegionp && mRegionp->objectIsReturnable(getPositionRegion(), boxes)) ? 1 : 0; + + if ( !result ) + { + //Get list of neighboring regions relative to this vo's region + std::vector uniqueRegions; + mRegionp->getNeighboringRegions( uniqueRegions ); + + //Build aabb's - for root and all children + std::vector returnables; + typedef std::vector::iterator RegionIt; + RegionIt regionStart = uniqueRegions.begin(); + RegionIt regionEnd = uniqueRegions.end(); + + for (; regionStart != regionEnd; ++regionStart ) + { + LLViewerRegion* pTargetRegion = *regionStart; + //Add the root vo as there may be no children and we still want + //to test for any edge overlap + buildReturnablesForChildrenVO( returnables, this, pTargetRegion ); + //Add it's children + for (child_list_t::iterator iter = mChildList.begin(); iter != mChildList.end(); iter++) + { + LLViewerObject* pChild = *iter; + buildReturnablesForChildrenVO( returnables, pChild, pTargetRegion ); + } + } + + //TBD#Eventually create a region -> box list map + typedef std::vector::iterator ReturnablesIt; + ReturnablesIt retCurrentIt = returnables.begin(); + ReturnablesIt retEndIt = returnables.end(); + + for ( ; retCurrentIt !=retEndIt; ++retCurrentIt ) + { + boxes.clear(); + LLViewerRegion* pRegion = (*retCurrentIt).pRegion; + boxes.push_back( (*retCurrentIt).box ); + bool retResult = pRegion + && pRegion->childrenObjectReturnable( boxes ) + && pRegion->canManageEstate(); + if ( retResult ) + { + result = true; + break; + } + } + } + return result; } -// This method returns true if the object is over land owned by the -// agent. -BOOL LLViewerObject::isOverGroupOwnedLand() const +void LLViewerObject::buildReturnablesForChildrenVO( std::vector& returnables, LLViewerObject* pChild, LLViewerRegion* pTargetRegion ) { - return mRegionp - && mRegionp->getParcelOverlay() - && mRegionp->getParcelOverlay()->isOwnedGroup(getPositionRegion()); + if ( !pChild ) + { + llerrs<<"child viewerobject is NULL "<mChildList.begin(); iter != pChild->mChildList.end(); iter++) + { + LLViewerObject* pChildofChild = *iter; + buildReturnablesForChildrenVO( returnables, pChildofChild, pTargetRegion ); + } +} + +void LLViewerObject::constructAndAddReturnable( std::vector& returnables, LLViewerObject* pChild, LLViewerRegion* pTargetRegion ) +{ + + LLVector3 targetRegionPos; + targetRegionPos.setVec( pChild->getPositionGlobal() ); + + LLBBox childBBox = LLBBox( targetRegionPos, pChild->getRotationRegion(), pChild->getScale() * -0.5f, + pChild->getScale() * 0.5f).getAxisAligned(); + + LLVector3 edgeA = targetRegionPos + childBBox.getMinLocal(); + LLVector3 edgeB = targetRegionPos + childBBox.getMaxLocal(); + + LLVector3d edgeAd, edgeBd; + edgeAd.setVec(edgeA); + edgeBd.setVec(edgeB); + + //Only add the box when either of the extents are in a neighboring region + if ( pTargetRegion->pointInRegionGlobal( edgeAd ) || pTargetRegion->pointInRegionGlobal( edgeBd ) ) + { + PotentialReturnableObject returnableObj; + returnableObj.box = childBBox; + returnableObj.pRegion = pTargetRegion; + returnables.push_back( returnableObj ); + } +} + +bool LLViewerObject::crossesParcelBounds() +{ + std::vector boxes; + boxes.push_back(LLBBox(getPositionRegion(), getRotationRegion(), getScale() * -0.5f, getScale() * 0.5f).getAxisAligned()); + for (child_list_t::iterator iter = mChildList.begin(); + iter != mChildList.end(); iter++) + { + LLViewerObject* child = *iter; + boxes.push_back(LLBBox(child->getPositionRegion(), child->getRotationRegion(), child->getScale() * -0.5f, child->getScale() * 0.5f).getAxisAligned()); + } + + return mRegionp && mRegionp->objectsCrossParcel(boxes); } BOOL LLViewerObject::setParent(LLViewerObject* parent) @@ -653,7 +767,10 @@ void LLViewerObject::addThisAndNonJointChildren(std::vector& ob } } -BOOL LLViewerObject::isChild(LLViewerObject *childp) const +//BOOL LLViewerObject::isChild(LLViewerObject *childp) const +// [RLVa:KB] - Checked: 2011-05-28 (RLVa-1.4.0a) | Added: RLVa-1.4.0a +BOOL LLViewerObject::isChild(const LLViewerObject *childp) const +// [/RLVa:KB] { for (child_list_t::const_iterator iter = mChildList.begin(); iter != mChildList.end(); ++iter) diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index fea65a635..190b7c884 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -117,6 +117,12 @@ public: LLColor4 mColor; }; +struct PotentialReturnableObject +{ + LLBBox box; + LLViewerRegion* pRegion; +}; + //============================================================================ class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate @@ -233,12 +239,16 @@ public: virtual BOOL isMesh() const { return FALSE; } // This method returns true if the object is over land owned by - // the agent. - BOOL isOverAgentOwnedLand() const; + // the agent, one of its groups, or it encroaches and + // anti-encroachment is enabled + bool isReturnable(); - // True if over land owned by group of which the agent is - // either officer or member. - BOOL isOverGroupOwnedLand() const; + void buildReturnablesForChildrenVO( std::vector& returnables, LLViewerObject* pChild, LLViewerRegion* pTargetRegion ); + void constructAndAddReturnable( std::vector& returnables, LLViewerObject* pChild, LLViewerRegion* pTargetRegion ); + + // This method returns true if the object crosses + // any parcel bounds in the region. + bool crossesParcelBounds(); /* // This method will scan through this object, and then query the @@ -256,7 +266,10 @@ public: S32 numChildren() const { return mChildList.size(); } void addThisAndAllChildren(std::vector& objects); void addThisAndNonJointChildren(std::vector& objects); - BOOL isChild(LLViewerObject *childp) const; +// BOOL isChild(LLViewerObject *childp) const; +// [RLVa:KB] - Checked: 2011-05-28 (RLVa-1.4.0a) | Added: RLVa-1.4.0a + BOOL isChild(const LLViewerObject *childp) const; +// [/RLVa:KB] BOOL isSeat() const; diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 12ae059a4..72bf54c21 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -105,7 +105,7 @@ public: // [RLVa:KB] - Checked: 2009-11-11 (RLVa-1.1.0a) | Modified: RLVa-1.1.0a if (gRlvHandler.hasBehaviour(RLV_BHVR_VIEWNOTE)) { - RlvNotifications::notifyBlockedViewNote(); + RlvUtil::notifyBlockedViewXXX(LLAssetType::AT_NOTECARD); return; } // [/RLVa:KB] @@ -1427,7 +1427,7 @@ void LLViewerTextEditor::openEmbeddedTexture( LLInventoryItem* item, llwchar wc // [RLVa:KB] - Checked: 2009-11-11 (RLVa-1.1.0a) | Modified: RLVa-1.1.0a if (gRlvHandler.hasBehaviour(RLV_BHVR_VIEWTEXTURE)) { - RlvNotifications::notifyBlockedViewTexture(); + RlvUtil::notifyBlockedViewXXX(LLAssetType::AT_TEXTURE); return; } // [/RLVa:KB] diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 4af09d967..4f5f3272f 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -275,8 +275,8 @@ void LLViewerTextureList::shutdown() if (++count >= max_count) break; } - - if (count > 0 && !gDirUtilp->getLindenUserDir(true).empty()) + + if (count > 0 && !gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "").empty()) { std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, get_texture_list_name()); llofstream file; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 13fee0704..c4ac2e4ee 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -177,7 +177,7 @@ #include "llviewerregion.h" #include "llviewershadermgr.h" #include "llviewerstats.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llvovolume.h" #include "llworld.h" #include "llworldmapview.h" @@ -2057,6 +2057,12 @@ void LLViewerWindow::shutdownGL() gSky.cleanup(); stop_glerror(); + llinfos << "Cleaning up pipeline" << llendl; + gPipeline.cleanup(); + stop_glerror(); + + //MUST clean up pipeline before cleaning up wearables + llinfos << "Cleaning up wearables" << llendl; LLWearableList::instance().cleanup() ; gTextureList.shutdown(); @@ -2067,10 +2073,6 @@ void LLViewerWindow::shutdownGL() LLWorldMapView::cleanupTextures(); - llinfos << "Cleaning up pipeline" << llendl; - gPipeline.cleanup(); - stop_glerror(); - LLViewerTextureManager::cleanup() ; LLImageGL::cleanupClass() ; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index d20086930..e10ae247a 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -690,7 +690,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mWindFreq(0.f), mRipplePhase( 0.f ), mBelowWater(FALSE), - mAppearanceAnimSetByUser(FALSE), mLastAppearanceBlendTime(0.f), mAppearanceAnimating(FALSE), mNameString(), @@ -2001,11 +2000,6 @@ void LLVOAvatar::buildCharacter() return; } -// [RLVa:KB] - Checked: 2010-12-12 (RLVa-1.2.2c) | Added: RLVa-1.2.2c - if (isSelf()) - RlvAttachPtLookup::initLookupTable(); -// [/RLVa:KB] - //------------------------------------------------------------------------- // initialize "well known" joint pointers //------------------------------------------------------------------------- @@ -2823,7 +2817,7 @@ void LLVOAvatar::idleUpdateAppearanceAnimation() { if (param->isTweakable()) { - param->stopAnimating(mAppearanceAnimSetByUser); + param->stopAnimating(FALSE); } } updateVisualParams(); @@ -2849,7 +2843,7 @@ void LLVOAvatar::idleUpdateAppearanceAnimation() { if (param->isTweakable()) { - param->animate(morph_amt, mAppearanceAnimSetByUser); + param->animate(morph_amt, FALSE); } } } @@ -3319,6 +3313,9 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) BOOL visible_chat = use_chat_bubbles && (mChats.size() || mTyping); BOOL render_name = visible_chat || (visible_avatar && +// [RLVa:KB] - Checked: 2010-04-04 (RLVa-1.2.2a) | Added: RLVa-1.0.0h + ( (!fRlvShowNames) || (RlvSettings::getShowNameTags()) ) && +// [/RLVa:KB] ((sRenderName == RENDER_NAME_ALWAYS) || (sRenderName == RENDER_NAME_FADE && time_visible < NAME_SHOW_TIME) || mNameFromChatOverride)); @@ -5608,8 +5605,15 @@ BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset) LLMemType mt(LLMemType::MTYPE_AVATAR); + lldebugs << "motion requested " << id.asString() << " " << gAnimLibrary.animationName(id) << llendl; + LLUUID remap_id = remapMotionID(id); + if (remap_id != id) + { + lldebugs << "motion resultant " << remap_id.asString() << " " << gAnimLibrary.animationName(remap_id) << llendl; + } + if (isSelf() && remap_id == ANIM_AGENT_AWAY) { gAgent.setAFK(); @@ -5623,9 +5627,15 @@ BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset) //----------------------------------------------------------------------------- BOOL LLVOAvatar::stopMotion(const LLUUID& id, BOOL stop_immediate) { + lldebugs << "motion requested " << id.asString() << " " << gAnimLibrary.animationName(id) << llendl; LLUUID remap_id = remapMotionID(id); + if (remap_id != id) + { + lldebugs << "motion resultant " << remap_id.asString() << " " << gAnimLibrary.animationName(remap_id) << llendl; + } + if (isSelf()) { gAgent.onAnimStop(remap_id); @@ -6760,10 +6770,7 @@ void LLVOAvatar::removeChild(LLViewerObject *childp) } } -//LLViewerJointAttachment* LLVOAvatar::getTargetAttachmentPoint(LLViewerObject* viewer_object) -// [RLVa:KB] - Checked: 2009-12-18 (RLVa-1.1.0i) | Added: RLVa-1.1.0i -LLViewerJointAttachment* LLVOAvatar::getTargetAttachmentPoint(const LLViewerObject* viewer_object) const -// [/RLVa:KB] +LLViewerJointAttachment* LLVOAvatar::getTargetAttachmentPoint(LLViewerObject* viewer_object) { S32 attachmentID = ATTACHMENT_ID_FROM_STATE(viewer_object->getState()); @@ -7061,6 +7068,13 @@ void LLVOAvatar::sitDown(BOOL bSitting) if (isSelf()) { LLFloaterAO::ChangeStand(); + +// [RLVa:KB] - Checked: 2010-08-29 (RLVa-1.2.1c) | Modified: RLVa-1.2.1c + if (rlv_handler_t::isEnabled()) + { + gRlvHandler.onSitOrStand(bSitting); + } +// [/RLVa:KB] } } @@ -7071,13 +7085,6 @@ void LLVOAvatar::sitOnObject(LLViewerObject *sit_object) { if (isSelf()) { -// [RLVa:KB] - Checked: 2010-08-29 (RLVa-1.2.1c) | Modified: RLVa-1.2.1c - if (rlv_handler_t::isEnabled()) - { - gRlvHandler.onSitOrStand(true); - } -// [/RLVa:KB] - // Might be first sit LLFirstUse::useSit(); @@ -7168,13 +7175,6 @@ void LLVOAvatar::getOffObject() if (isSelf()) { -// [RLVa:KB] - Checked: 2010-08-29 (RLVa-1.2.1c) | Modified: RLVa-1.2.1c - if (rlv_handler_t::isEnabled()) - { - gRlvHandler.onSitOrStand(false); - } -// [/RLVa:KB] - LLQuaternion av_rot = gAgent.getFrameAgent().getQuaternion(); LLQuaternion obj_rot = sit_object ? sit_object->getRenderRotation() : LLQuaternion::DEFAULT; av_rot = av_rot * obj_rot; @@ -7284,20 +7284,6 @@ LLViewerObject* LLVOAvatar::getWornAttachment( const LLUUID& inv_item_id ) return NULL; } -// [RLVa:KB] - Checked: 2010-03-14 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a -LLViewerJointAttachment* LLVOAvatar::getWornAttachmentPoint(const LLUUID& idItem) const -{ - const LLUUID& idItemBase = gInventory.getLinkedItemID(idItem); - for (attachment_map_t::const_iterator itAttachPt = mAttachmentPoints.begin(); itAttachPt != mAttachmentPoints.end(); ++itAttachPt) - { - LLViewerJointAttachment* pAttachPt = itAttachPt->second; - if (pAttachPt->getAttachedObject(idItemBase)) - return pAttachPt; - } - return NULL; -} -// [/RLVa:KB] - const std::string LLVOAvatar::getAttachedPointName(const LLUUID& inv_item_id) { const LLUUID& base_inv_item_id = gInventory.getLinkedItemID(inv_item_id); @@ -8363,7 +8349,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { if (interp_params) { - startAppearanceAnimation(FALSE, FALSE); + startAppearanceAnimation(); } updateVisualParams(); @@ -8760,11 +8746,10 @@ void LLVOAvatar::cullAvatarsByPixelArea() } } -void LLVOAvatar::startAppearanceAnimation(BOOL set_by_user, BOOL play_sound) +void LLVOAvatar::startAppearanceAnimation() { if(!mAppearanceAnimating) { - mAppearanceAnimSetByUser = set_by_user; mAppearanceAnimating = TRUE; mAppearanceMorphTimer.reset(); mLastAppearanceBlendTime = 0.f; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index af2afd025..10789219f 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -665,7 +665,7 @@ protected: public: void processAvatarAppearance(LLMessageSystem* mesgsys); void hideSkirt(); - void startAppearanceAnimation(BOOL set_by_user, BOOL play_sound); + void startAppearanceAnimation(); LLPolyMesh* getMesh(LLPolyMeshSharedData* shared_data); //-------------------------------------------------------------------- @@ -677,7 +677,6 @@ private: BOOL mAppearanceAnimating; LLFrameTimer mAppearanceMorphTimer; F32 mLastAppearanceBlendTime; - BOOL mAppearanceAnimSetByUser; //1.23 public: typedef std::map lod_mesh_map_t; @@ -735,9 +734,7 @@ public: void cleanupAttachedMesh( LLViewerObject* pVO ); static LLVOAvatar* findAvatarFromAttachment(LLViewerObject* obj); protected: -// [RLVa:KB] - Checked: 2009-12-18 (RLVa-1.1.0i) | Added: RLVa-1.1.0i - LLViewerJointAttachment* getTargetAttachmentPoint(const LLViewerObject* viewer_object) const; -// [/RLVa:KB] + LLViewerJointAttachment* getTargetAttachmentPoint(LLViewerObject* viewer_object); void lazyAttach(); void rebuildRiggedAttachments( void ); @@ -772,9 +769,7 @@ public: BOOL isWearingUnsupportedAttachment( const LLUUID& inv_item_id ); // LLViewerObject* getWornAttachment( const LLUUID& inv_item_id ); -// [RLVa:KB] - Checked: 2010-03-14 (RLVa-1.2.0a) | Added: RLVa-1.1.0i - LLViewerJointAttachment* getWornAttachmentPoint(const LLUUID& inv_item_id) const; -// [/RLVa:KB] + const std::string getAttachedPointName(const LLUUID& inv_item_id); // diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 42d200695..d9f22b24e 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -59,6 +59,10 @@ #include "llappearancemgr.h" #include "llmeshrepository.h" #include "llvovolume.h" +// [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1a) +#include "rlvhandler.h" +#include "rlvlocks.h" +// [/RLVa:KB] #if LL_MSVC // disable boost::lexical_cast warning @@ -67,10 +71,11 @@ #include -LLVOAvatarSelf *gAgentAvatarp = NULL; +LLPointer gAgentAvatarp = NULL; + BOOL isAgentAvatarValid() { - return (gAgentAvatarp && + return (gAgentAvatarp.notNull() && (gAgentAvatarp->getRegion() != NULL) && (!gAgentAvatarp->isDead())); } @@ -167,6 +172,10 @@ void LLVOAvatarSelf::initInstance() mDebugBakedTextureTimes[i][1] = -1.0f; } +// [RLVa:KB] - Checked: 2010-12-12 (RLVa-1.2.2c) | Added: RLVa-1.2.2c + RlvAttachPtLookup::initLookupTable(); +// [/RLVa:KB] + status &= buildMenus(); if (!status) { @@ -1067,6 +1076,20 @@ LLViewerObject* LLVOAvatarSelf::getWornAttachment(const LLUUID& inv_item_id) return NULL; } +// [RLVa:KB] - Checked: 2010-03-14 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a +LLViewerJointAttachment* LLVOAvatarSelf::getWornAttachmentPoint(const LLUUID& idItem) const +{ + const LLUUID& idItemBase = gInventory.getLinkedItemID(idItem); + for (attachment_map_t::const_iterator itAttachPt = mAttachmentPoints.begin(); itAttachPt != mAttachmentPoints.end(); ++itAttachPt) + { + LLViewerJointAttachment* pAttachPt = itAttachPt->second; + if (pAttachPt->getAttachedObject(idItemBase)) + return pAttachPt; + } + return NULL; +} +// [/RLVa:KB] + const std::string LLVOAvatarSelf::getAttachedPointName(const LLUUID& inv_item_id) const { const LLUUID& base_inv_item_id = gInventory.getLinkedItemID(inv_item_id); @@ -1105,6 +1128,18 @@ const LLViewerJointAttachment *LLVOAvatarSelf::attachObject(LLViewerObject *view // Clear any pending requests once the attachment arrives. removeAttachmentRequest(attachment_id); updateLODRiggedAttachments(); + +// [RLVa:KB] - Checked: 2010-08-22 (RLVa-1.2.1a) | Modified: RLVa-1.2.1a + // NOTE: RLVa event handlers should be invoked *after* LLVOAvatar::attachObject() calls LLViewerJointAttachment::addObject() + if (rlv_handler_t::isEnabled()) + { + RlvAttachmentLockWatchdog::instance().onAttach(viewer_object, attachment); + gRlvHandler.onAttach(viewer_object, attachment); + + if ( (attachment->getIsHUDAttachment()) && (!gRlvAttachmentLocks.hasLockedHUD()) ) + gRlvAttachmentLocks.updateLockedHUD(); + } +// [/RLVa:KB] } return attachment; @@ -1114,6 +1149,23 @@ const LLViewerJointAttachment *LLVOAvatarSelf::attachObject(LLViewerObject *view BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object) { const LLUUID attachment_id = viewer_object->getAttachmentItemID(); + +// [RLVa:KB] - Checked: 2010-03-05 (RLVa-1.2.0a) | Added: RLVa-1.2.0a + // NOTE: RLVa event handlers should be invoked *before* LLVOAvatar::detachObject() calls LLViewerJointAttachment::removeObject() + if (rlv_handler_t::isEnabled()) + { + for (attachment_map_t::const_iterator itAttachPt = mAttachmentPoints.begin(); itAttachPt != mAttachmentPoints.end(); ++itAttachPt) + { + const LLViewerJointAttachment* pAttachPt = itAttachPt->second; + if (pAttachPt->isObjectAttached(viewer_object)) + { + RlvAttachmentLockWatchdog::instance().onDetach(viewer_object, pAttachPt); + gRlvHandler.onDetach(viewer_object, pAttachPt); + } + } + } +// [/RLVa:KB] + if ( LLVOAvatar::detachObject(viewer_object) ) { LLVOAvatar::cleanupAttachedMesh( viewer_object ); @@ -1148,6 +1200,11 @@ BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object) LLAppearanceMgr::instance().unregisterAttachment(attachment_id); } +// [RLVa:KB] - Checked: 2010-08-22 (RLVa-1.2.1a) | Added: RLVa-1.2.1a + if ( (rlv_handler_t::isEnabled()) && (viewer_object->isHUDAttachment()) && (gRlvAttachmentLocks.hasLockedHUD()) ) + gRlvAttachmentLocks.updateLockedHUD(); +// [/RLVa:KB] + return TRUE; } return FALSE; @@ -1157,7 +1214,10 @@ BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object) BOOL LLVOAvatarSelf::detachAttachmentIntoInventory(const LLUUID &item_id) { LLInventoryItem* item = gInventory.getItem(item_id); - if (item) +// if (item) +// [RLVa:KB] - Checked: 2010-09-04 (RLVa-1.2.1c) | Added: RLVa-1.2.1c + if ( (item) && ((!rlv_handler_t::isEnabled()) || (gRlvAttachmentLocks.canDetach(item))) ) +// [/RLVa:KB] { gMessageSystem->newMessageFast(_PREHASH_DetachAttachmentIntoInv); gMessageSystem->nextBlockFast(_PREHASH_ObjectData); diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 2ee684799..adb2874eb 100644 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -291,6 +291,9 @@ public: void addAttachmentRequest(const LLUUID& inv_item_id); void removeAttachmentRequest(const LLUUID& inv_item_id); LLViewerObject* getWornAttachment(const LLUUID& inv_item_id); +// [RLVa:KB] - Checked: 2009-12-18 (RLVa-1.1.0i) | Added: RLVa-1.1.0i + LLViewerJointAttachment* getWornAttachmentPoint(const LLUUID& inv_item_id) const; +// [/RLVa:KB] const std::string getAttachedPointName(const LLUUID& inv_item_id) const; /*virtual*/ const LLViewerJointAttachment *attachObject(LLViewerObject *viewer_object); /*virtual*/ BOOL detachObject(LLViewerObject *viewer_object); @@ -385,7 +388,7 @@ public: void setInvisible(bool invisible); }; -extern LLVOAvatarSelf *gAgentAvatarp; +extern LLPointer gAgentAvatarp; BOOL isAgentAvatarValid(); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index d487567b1..11fa5bb69 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -79,6 +79,7 @@ // [RLVa:KB] - Checked: 2010-04-04 (RLVa-1.2.0d) #include "rlvhandler.h" +#include "rlvlocks.h" // [/RLVa:KB] const S32 MIN_QUIET_FRAMES_COALESCE = 30; @@ -3159,10 +3160,12 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); // if (facep->getViewerObject()->isSelected() && gHideSelectedObjects) -// [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.1.3b) | Modified: RLVa-1.2.1f +// [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()))) ) + ( (!rlv_handler_t::isEnabled()) || + ( ((!pObj->isHUDAttachment()) || (!gRlvAttachmentLocks.isLockedAttachment(pObj->getRootEdit()))) && + (gRlvHandler.canEdit(pObj)) ) ) ) // [/RLVa:KB] { return; diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp index f8d001452..1e12feb84 100644 --- a/indra/newview/llwearable.cpp +++ b/indra/newview/llwearable.cpp @@ -264,7 +264,7 @@ void LLWearable::createVisualParams() param->resetDrivenParams(); if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false)) { - if( !param->linkDrivenParams(boost::bind(avatar_function,gAgentAvatarp,_1 ), true)) + if( !param->linkDrivenParams(boost::bind(avatar_function,gAgentAvatarp.get(),_1 ), true)) { llwarns << "could not link driven params for wearable " << getName() << " id: " << param->getID() << llendl; continue; diff --git a/indra/newview/llwearabletype.cpp b/indra/newview/llwearabletype.cpp index fce8b2ba3..66ac79a12 100644 --- a/indra/newview/llwearabletype.cpp +++ b/indra/newview/llwearabletype.cpp @@ -61,6 +61,12 @@ class LLWearableDictionary : public LLSingleton, { public: LLWearableDictionary(); + +// [RLVa:KB] - Checked: 2010-03-03 (RLVa-1.2.0a) | Added: RLVa-1.2.0a +protected: + // The default implementation asserts on 'notFound()' and returns -1 which isn't a valid EWearableType + virtual LLWearableType::EType notFound() const { return LLWearableType::WT_INVALID; } +// [/RLVa:KB] }; LLWearableDictionary::LLWearableDictionary() diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp index 7845165b3..a87487f55 100644 --- a/indra/newview/llwlparammanager.cpp +++ b/indra/newview/llwlparammanager.cpp @@ -80,6 +80,10 @@ #include "curl/curl.h" #include "llstreamtools.h" +// [RLVa:KB] - Checked: 2011-09-04 (RLVa-1.4.1a) | Added: RLVa-1.4.1a +#include +// [/RLVa:KB] + LLWLParamManager::LLWLParamManager() : //set the defaults for the controls @@ -722,6 +726,18 @@ void LLWLParamManager::getPresetNames(preset_name_list_t& region, preset_name_li } } +// [RLVa:KB] - Checked: 2011-09-04 (RLVa-1.4.1a) | Added: RLVa-1.4.1a +const std::string& LLWLParamManager::findPreset(const std::string& strPresetName, LLEnvKey::EScope eScope) +{ + for (std::map::const_iterator itList = mParamList.begin(); itList != mParamList.end(); itList++) + { + const LLWLParamKey& wlKey = itList->first; + if ( (wlKey.scope == eScope) && (boost::iequals(wlKey.name, strPresetName)) ) + return wlKey.name; + } + return LLStringUtil::null; +} +// [/RLVa:KB] void LLWLParamManager::getUserPresetNames(preset_name_list_t& user) const { preset_name_list_t region, sys; // unused diff --git a/indra/newview/llwlparammanager.h b/indra/newview/llwlparammanager.h index 62df522cf..c65cbcb36 100644 --- a/indra/newview/llwlparammanager.h +++ b/indra/newview/llwlparammanager.h @@ -227,6 +227,10 @@ public: /// @return user and system preset names as a single list void getPresetNames(preset_name_list_t& region, preset_name_list_t& user, preset_name_list_t& sys) const; +// [RLVa:KB] - Checked: 2011-09-04 (RLVa-1.4.1a) | Added: RLVa-1.4.1a + const std::string& findPreset(const std::string& strPresetName, LLEnvKey::EScope eScope); +// [/RLVa:KB] + /// @return user preset names void getUserPresetNames(preset_name_list_t& user) const; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 0472606f1..1f7575091 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -111,6 +111,7 @@ // [RLVa:KB] #include "rlvhandler.h" +#include "rlvlocks.h" // [/RLVa:KB] void check_stack_depth(S32 stack_depth) diff --git a/indra/newview/rlvcommon.cpp b/indra/newview/rlvcommon.cpp index 78f5e05e3..4a4e1ff81 100644 --- a/indra/newview/rlvcommon.cpp +++ b/indra/newview/rlvcommon.cpp @@ -16,20 +16,25 @@ #include "llviewerprecompiledheaders.h" #include "llagent.h" -#include "llappviewer.h" +#include "llagentui.h" #include "llavatarnamecache.h" #include "llnotificationsutil.h" #include "lluictrlfactory.h" #include "sgversion.h" #include "llviewermenu.h" #include "llviewerparcelmgr.h" +#include "llviewermenu.h" #include "llviewerregion.h" #include "llviewerstats.h" #include "llvoavatar.h" #include "llworld.h" #include "rlvcommon.h" +#include "rlvhelper.h" #include "rlvhandler.h" +#include "rlvlocks.h" + +#include using namespace LLOldEvents; @@ -39,7 +44,7 @@ using namespace LLOldEvents; #ifdef RLV_EXTENSION_NOTIFY_BEHAVIOUR // Checked: 2009-12-05 (RLVa-1.1.0h) | Added: RLVa-1.1.0h -void RlvNotifications::notifyBehaviour(ERlvBehaviour eBhvr, ERlvParamType eType) +/*void RlvNotifications::notifyBehaviour(ERlvBehaviour eBhvr, ERlvParamType eType) { const std::string& strMsg = RlvStrings::getBehaviourNotificationString(eBhvr, eType); if (!strMsg.empty()) @@ -48,19 +53,11 @@ void RlvNotifications::notifyBehaviour(ERlvBehaviour eBhvr, ERlvParamType eType) argsNotify["MESSAGE"] = strMsg; LLNotificationsUtil::add("SystemMessageTip", argsNotify); } -} +}*/ #endif // RLV_EXTENSION_NOTIFY_BEHAVIOUR -// Checked: 2010-10-11 (RLVa-1.1.3c) | Added: RLVa-1.1.3c -void RlvNotifications::notifyBlocked(const std::string& strRlvString) -{ - LLSD argsNotify; - argsNotify["MESSAGE"] = RlvStrings::getString(strRlvString); - LLNotificationsUtil::add("SystemMessageTip", argsNotify); -} - -// Checked: 2009-11-11 (RLVa-1.1.0a) | Added: RLVa-1.1.0a -void RlvNotifications::notifyBlockedViewXXX(const char* pstrAssetType) +// Checked: 2009-11-11 (RLVa-1.1.0a) | Added: RLVa-1.1.0a/ +/*void RlvNotifications::notifyBlockedViewXXX(const char* pstrAssetType) { LLStringUtil::format_map_t argsMsg; std::string strMsg = RlvStrings::getString(RLV_STRING_BLOCKED_VIEWXXX); argsMsg["[TYPE]"] = pstrAssetType; @@ -70,16 +67,16 @@ void RlvNotifications::notifyBlockedViewXXX(const char* pstrAssetType) argsNotify["MESSAGE"] = strMsg; LLNotificationsUtil::add("SystemMessageTip", argsNotify); } - +*/ // Checked: 2009-11-13 (RLVa-1.1.0b) | Modified: RLVa-1.1.0b -void RlvNotifications::warnGiveToRLV() +void RlvUtil::warnGiveToRLV() { if ( (gSavedSettings.getWarning(RLV_SETTING_FIRSTUSE_GIVETORLV)) && (RlvSettings::getForbidGiveToRLV()) ) - LLNotifications::instance().add(RLV_SETTING_FIRSTUSE_GIVETORLV, LLSD(), LLSD(), &RlvNotifications::onGiveToRLVConfirmation); + LLNotifications::instance().add(RLV_SETTING_FIRSTUSE_GIVETORLV, LLSD(), LLSD(), &RlvUtil::onGiveToRLVConfirmation); } // Checked: 2009-11-13 (RLVa-1.1.0b) | Modified: RLVa-1.1.0b -void RlvNotifications::onGiveToRLVConfirmation(const LLSD& notification, const LLSD& response) +void RlvUtil::onGiveToRLVConfirmation(const LLSD& notification, const LLSD& response) { gSavedSettings.setWarning(RLV_SETTING_FIRSTUSE_GIVETORLV, FALSE); @@ -93,11 +90,12 @@ void RlvNotifications::onGiveToRLVConfirmation(const LLSD& notification, const L // #ifdef RLV_EXPERIMENTAL_COMPOSITEFOLDERS -BOOL RlvSettings::fCompositeFolders = FALSE; +bool RlvSettings::fCompositeFolders = false; #endif // RLV_EXPERIMENTAL_COMPOSITEFOLDERS -BOOL RlvSettings::fLegacyNaming = TRUE; -BOOL RlvSettings::fNoSetEnv = FALSE; -BOOL RlvSettings::fShowNameTags = FALSE; +bool RlvSettings::fCanOOC = true; +bool RlvSettings::fLegacyNaming = true; +bool RlvSettings::fNoSetEnv = false; +bool RlvSettings::fShowNameTags = false; // Checked: 2009-12-18 (RLVa-1.1.0k) | Modified: RLVa-1.1.0i void RlvSettings::initClass() @@ -106,21 +104,31 @@ void RlvSettings::initClass() if (!fInitialized) { #ifdef RLV_EXPERIMENTAL_COMPOSITEFOLDERS - fCompositeFolders = rlvGetSettingBOOL(RLV_SETTING_ENABLECOMPOSITES, FALSE); + fCompositeFolders = rlvGetSetting(RLV_SETTING_ENABLECOMPOSITES, false); if (gSavedSettings.controlExists(RLV_SETTING_ENABLECOMPOSITES)) gSavedSettings.getControl(RLV_SETTING_ENABLECOMPOSITES)->getSignal()->connect(boost::bind(&onChangedSettingBOOL, _2, &fCompositeFolders)); #endif // RLV_EXPERIMENTAL_COMPOSITEFOLDERS - fLegacyNaming = rlvGetSettingBOOL(RLV_SETTING_ENABLELEGACYNAMING, TRUE); + fLegacyNaming = rlvGetSetting(RLV_SETTING_ENABLELEGACYNAMING, true); if (gSavedSettings.controlExists(RLV_SETTING_ENABLELEGACYNAMING)) gSavedSettings.getControl(RLV_SETTING_ENABLELEGACYNAMING)->getSignal()->connect(boost::bind(&onChangedSettingBOOL, _2, &fLegacyNaming)); - fNoSetEnv = rlvGetSettingBOOL(RLV_SETTING_NOSETENV, FALSE); + fCanOOC = rlvGetSetting(RLV_SETTING_CANOOC, true); + fNoSetEnv = rlvGetSetting(RLV_SETTING_NOSETENV, false); - fShowNameTags = rlvGetSettingBOOL(RLV_SETTING_SHOWNAMETAGS, 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)); +#ifdef RLV_EXTENSION_STARTLOCATION + // Don't allow toggling RLVaLoginLastLocation from the debug settings floater + if (gSavedPerAccountSettings.controlExists(RLV_SETTING_LOGINLASTLOCATION)) + gSavedPerAccountSettings.getControl(RLV_SETTING_LOGINLASTLOCATION)->setHiddenFromSettingsEditor(true); +#endif // RLV_EXTENSION_STARTLOCATION + + if (gSavedSettings.controlExists(RLV_SETTING_AVATAROFFSET_Z)) + gSavedSettings.getControl(RLV_SETTING_AVATAROFFSET_Z)->getSignal()->connect(boost::bind(&onChangedAvatarOffset, _2)); + fInitialized = true; } } @@ -129,7 +137,7 @@ void RlvSettings::initClass() // Checked: 2010-04-01 (RLVa-1.2.0c) | Modified: RLVa-0.2.1d void RlvSettings::updateLoginLastLocation() { - if (gSavedPerAccountSettings.controlExists(RLV_SETTING_LOGINLASTLOCATION)) + if ( (!LLApp::isQuitting()) && (gSavedPerAccountSettings.controlExists(RLV_SETTING_LOGINLASTLOCATION)) ) { BOOL fValue = (gRlvHandler.hasBehaviour(RLV_BHVR_TPLOC)) || (!gRlvHandler.canStand()); if (gSavedPerAccountSettings.getBOOL(RLV_SETTING_LOGINLASTLOCATION) != fValue) @@ -141,11 +149,16 @@ void RlvSettings::initClass() } #endif // RLV_EXTENSION_STARTLOCATION -// Checked: 2009-12-18 (RLVa-1.1.0k) | Added: RLVa-1.1.0i -bool RlvSettings::onChangedSettingBOOL(const LLSD& newvalue, BOOL* pfSetting) +// Checked: 2010-10-11 (RLVa-1.2.0e) | Added: RLVa-1.2.0e +bool RlvSettings::onChangedAvatarOffset(const LLSD& sdValue) +{ + gAgent.sendAgentSetAppearance(); + return true; +} +bool RlvSettings::onChangedSettingBOOL(const LLSD& sdValue, bool* pfSetting) { if (pfSetting) - *pfSetting = newvalue.asBoolean(); + *pfSetting = sdValue.asBoolean(); return true; } @@ -156,8 +169,8 @@ bool RlvSettings::onChangedSettingBOOL(const LLSD& newvalue, BOOL* pfSetting) std::vector RlvStrings::m_Anonyms; std::map RlvStrings::m_StringMap; #ifdef RLV_EXTENSION_NOTIFY_BEHAVIOUR -std::map RlvStrings::m_BhvrAddMap; -std::map RlvStrings::m_BhvrRemMap; +/*std::map RlvStrings::m_BhvrAddMap; +std::map RlvStrings::m_BhvrRemMap;*/ #endif // RLV_EXTENSION_NOTIFY_BEHAVIOUR // Checked: 2010-03-09 (RLVa-1.2.0a) | Added: RLVa-1.1.0h @@ -195,7 +208,7 @@ void RlvStrings::initClass() } } #ifdef RLV_EXTENSION_NOTIFY_BEHAVIOUR - else if (pNode->hasName("behaviour-notifications")) + /*else if (pNode->hasName("behaviour-notifications")) { std::string strBhvr, strType; ERlvBehaviour eBhvr; for (LLXMLNode* pNotifyNode = pNode->getFirstChild(); pNotifyNode != NULL; pNotifyNode = pNotifyNode->getNextSibling()) @@ -211,7 +224,7 @@ void RlvStrings::initClass() else if ("rem" == strType) m_BhvrRemMap.insert(std::pair(eBhvr, pNotifyNode->getTextContents())); } - } + }*/ #endif // RLV_EXTENSION_NOTIFY_BEHAVIOUR } @@ -239,7 +252,7 @@ const std::string& RlvStrings::getAnonym(const std::string& strName) #ifdef RLV_EXTENSION_NOTIFY_BEHAVIOUR // Checked: 2009-12-05 (RLVa-1.1.0h) | Added: RLVa-1.1.0h -const std::string& RlvStrings::getBehaviourNotificationString(ERlvBehaviour eBhvr, ERlvParamType eType) +/*const std::string& RlvStrings::getBehaviourNotificationString(ERlvBehaviour eBhvr, ERlvParamType eType) { if (RLV_TYPE_ADD == eType) { @@ -252,7 +265,7 @@ const std::string& RlvStrings::getBehaviourNotificationString(ERlvBehaviour eBhv return (itString != m_BhvrRemMap.end()) ? itString->second : LLStringUtil::null; } return LLStringUtil::null; -} +}*/ #endif // RLV_EXTENSION_NOTIFY_BEHAVIOUR // Checked: 2009-11-11 (RLVa-1.1.0a) | Added: RLVa-1.1.0a @@ -346,20 +359,19 @@ void RlvUtil::filterLocation(std::string& strUTF8Text) LLWorld::region_list_t regions = LLWorld::getInstance()->getRegionList(); const std::string& strHiddenRegion = RlvStrings::getString(RLV_STRING_HIDDEN_REGION); for (LLWorld::region_list_t::const_iterator itRegion = regions.begin(); itRegion != regions.end(); ++itRegion) - rlvStringReplace(strUTF8Text, (*itRegion)->getName(), strHiddenRegion); + boost::ireplace_all(strUTF8Text, (*itRegion)->getName(), strHiddenRegion); // Filter any mention of the parcel name LLViewerParcelMgr* pParcelMgr = LLViewerParcelMgr::getInstance(); if (pParcelMgr) - rlvStringReplace(strUTF8Text, pParcelMgr->getAgentParcelName(), RlvStrings::getString(RLV_STRING_HIDDEN_PARCEL)); + boost::ireplace_all(strUTF8Text, pParcelMgr->getAgentParcelName(), RlvStrings::getString(RLV_STRING_HIDDEN_PARCEL)); } // Checked: 2010-12-08 (RLVa-1.2.2c) | Modified: RLVa-1.2.2c void RlvUtil::filterNames(std::string& strUTF8Text, bool fFilterLegacy) { - std::vector idAgents; + uuid_vec_t idAgents; LLWorld::getInstance()->getAvatars(&idAgents, NULL); - for (int idxAgent = 0, cntAgent = idAgents.size(); idxAgent < cntAgent; idxAgent++) { LLAvatarName avName; @@ -369,21 +381,24 @@ void RlvUtil::filterNames(std::string& strUTF8Text, bool fFilterLegacy) // NOTE: if the legacy first and last name are empty we get a legacy name of " " which would replace all spaces in the string std::string strLegacyName; - if ( (fFilterLegacy) && (!avName.mIsDisplayNameDefault) && (!avName.mLegacyFirstName.empty()) ) + if ( (fFilterLegacy) && (!avName.mLegacyFirstName.empty()) && + ((!avName.mIsDisplayNameDefault) || (LLCacheName::getDefaultLastName() == avName.mLegacyLastName)) ) + { strLegacyName = avName.getLegacyName(); + } // If the display name is a subset of the legacy name we need to filter that first, otherwise it's the other way around - if (std::string::npos != strLegacyName.find(avName.mDisplayName)) + if (boost::icontains(strLegacyName, avName.mDisplayName)) { if (!strLegacyName.empty()) - rlvStringReplace(strUTF8Text, strLegacyName, strAnonym); - rlvStringReplace(strUTF8Text, avName.mDisplayName, strAnonym); + boost::ireplace_all(strUTF8Text, strLegacyName, strAnonym); + boost::ireplace_all(strUTF8Text, avName.mDisplayName, strAnonym); } else { - rlvStringReplace(strUTF8Text, avName.mDisplayName, strAnonym); + boost::ireplace_all(strUTF8Text, avName.mDisplayName, strAnonym); if (!strLegacyName.empty()) - rlvStringReplace(strUTF8Text, strLegacyName, strAnonym); + boost::ireplace_all(strUTF8Text, strLegacyName, strAnonym); } } } @@ -424,15 +439,28 @@ bool RlvUtil::isNearbyRegion(const std::string& strRegion) return false; } +// Checked: 2011-04-11 (RLVa-1.3.0h) | Modified: RLVa-1.3.0h +void RlvUtil::notifyBlocked(const std::string& strNotifcation, const LLSD& sdArgs) +{ + std::string strMsg = RlvStrings::getString(strNotifcation); + LLStringUtil::format(strMsg, sdArgs); + + LLSD sdNotify; + sdNotify["MESSAGE"] = strMsg; + LLNotificationsUtil::add("SystemMessageTip", sdNotify); +} + // Checked: 2010-11-11 (RLVa-1.2.1g) | Added: RLVa-1.2.1g void RlvUtil::notifyFailedAssertion(const std::string& strAssert, const std::string& strFile, int nLine) { + // Don't show the same assertion over and over, or if the user opted out static std::string strAssertPrev, strFilePrev; static int nLinePrev; - if ( (strAssertPrev == strAssert) && (strFile == strFilePrev) && (nLine == nLinePrev) ) + if ( ((strAssertPrev == strAssert) && (strFile == strFilePrev) && (nLine == nLinePrev)) || + (!rlvGetSetting(RLV_SETTING_SHOWASSERTIONFAIL, true)) ) { - // Don't show the same assertion over and over return; } + strAssertPrev = strAssert; strFilePrev = strFile; nLinePrev = nLine; @@ -447,7 +475,7 @@ void RlvUtil::sendBusyMessage(const LLUUID& idTo, const std::string& strMsg, con { // [See process_improved_im()] std::string strFullName; - gAgent.buildFullname(strFullName); + LLAgentUI::buildFullname(strFullName); pack_instant_message(gMessageSystem, gAgent.getID(), FALSE, gAgent.getSessionID(), idTo, strFullName, strMsg, IM_ONLINE, IM_BUSY_AUTO_RESPONSE, idSession); @@ -479,6 +507,25 @@ bool RlvUtil::sendChatReply(S32 nChannel, const std::string& strUTF8Text) // Generic menu enablers // +// Checked: 2010-04-23 (RLVa-1.2.0g) | Modified: RLVa-1.2.0g +BOOL rlvMenuCheckEnabled(void*) +{ + return rlv_handler_t::isEnabled(); +} + +// Checked: 2010-04-23 (RLVa-1.2.0g) | Modified: RLVa-1.2.0g +void rlvMenuToggleEnabled(void*) +{ + gSavedSettings.setBOOL(RLV_SETTING_MAIN, !rlv_handler_t::isEnabled()); + + LLSD args; + args["MESSAGE"] = + llformat("RestrainedLove Support will be %s after you restart", (rlv_handler_t::isEnabled()) ? "disabled" : "enabled" ); + LLNotificationsUtil::add("GenericAlert", args); + + return; +} + bool RlvEnableIfNot::handleEvent(LLPointer, const LLSD& userdata) { bool fEnable = true; @@ -495,6 +542,21 @@ bool RlvEnableIfNot::handleEvent(LLPointer, const LLSD& userdata) // Selection functors // +// Checked: 2010-04-11 (RLVa-1.2.0b) | Modified: RLVa-0.2.0g +bool rlvCanDeleteOrReturn() +{ + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) || (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) ) + { + struct RlvCanDeleteOrReturn : public LLSelectedObjectFunctor + { + /*virtual*/ bool apply(LLViewerObject* pObj) { return pObj->isReturnable(); } + } f; + LLObjectSelectionHandle hSel = LLSelectMgr::getInstance()->getSelection(); + return (hSel.notNull()) && (0 != hSel->getRootObjectCount()) && (hSel->applyToRootObjects(&f, false)); + } + return true; +} + // Checked: 2010-04-20 (RLVa-1.2.0f) | Modified: RLVa-0.2.0f bool RlvSelectHasLockedAttach::apply(LLSelectNode* pNode) { @@ -508,16 +570,10 @@ bool RlvSelectIsEditable::apply(LLSelectNode* pNode) return (pObj) && (!gRlvHandler.canEdit(pObj)); } -// Checked: 2009-07-05 (RLVa-1.0.0b) | Modified: RLVa-0.2.0f -bool RlvSelectIsOwnedByOrGroupOwned::apply(LLSelectNode* pNode) -{ - return (pNode->mPermissions->isGroupOwned()) || (pNode->mPermissions->getOwner() == m_idAgent); -} - -// Checked: 2010-04-01 (RLVa-1.2.0c) | Modified: RLVa-0.2.0f +// Checked: 2011-05-28 (RLVa-1.4.0a) | Modified: RLVa-1.4.0a bool RlvSelectIsSittingOn::apply(LLSelectNode* pNode) { - return (pNode->getObject()) && (pNode->getObject()->getRootEdit() == m_pObject); + return (pNode->getObject()) && (pNode->getObject()->getRootEdit()->isChild(m_pAvatar)); } // ============================================================================ @@ -582,19 +638,36 @@ bool rlvPredCanNotRemoveItem(const LLViewerInventoryItem* pItem) return !rlvPredCanRemoveItem(pItem); } +// Checked: 2010-04-24 (RLVa-1.2.0f) | Added: RLVa-1.2.0f +RlvPredIsEqualOrLinkedItem::RlvPredIsEqualOrLinkedItem(const LLUUID& idItem) +{ + m_pItem = gInventory.getItem(idItem); +} + +// Checked: 2010-04-24 (RLVa-1.2.0f) | Added: RLVa-1.2.0f +bool RlvPredIsEqualOrLinkedItem::operator()(const LLViewerInventoryItem* pItem) const +{ + return (m_pItem) && (pItem) && (m_pItem->getLinkedUUID() == pItem->getLinkedUUID()); +} + // ============================================================================ // Various public helper functions // -// Checked: 2010-09-28 (RLVa-1.1.3b) | Modified: RLVa-1.1.3b -BOOL rlvAttachToEnabler(void* pParam) +// Checked: 2009-11-15 (RLVa-1.1.0c) | Added: RLVa-1.1.0c +/* +BOOL rlvEnableSharedWearEnabler(void* pParam) { - // Visually disable an option on the "Attach to (HUD)" submenu if: - // - the attachment point is locked non-detachable with an object attached - // - the attachment point is locked non-attachable - return (pParam != NULL) && - (!gRlvAttachmentLocks.hasLockedAttachment((LLViewerJointAttachment*)pParam)) && - (!gRlvAttachmentLocks.isLockedAttachmentPoint((LLViewerJointAttachment*)pParam, RLV_LOCK_ADD)); + return false; + // Visually disable the "Enable Shared Wear" option when at least one attachment is non-detachable + return (!gRlvHandler.hasLockedAttachment(RLV_LOCK_REMOVE)); +} +*/ + +// Checked: 2010-11-01 (RLVa-1.2.2a) | Added: RLVa-1.2.2a +const std::string& rlvGetAnonym(const LLAvatarName& avName) +{ + return RlvStrings::getAnonym(avName); } // ============================================================================ diff --git a/indra/newview/rlvcommon.h b/indra/newview/rlvcommon.h index ac097ab5d..e44c06f57 100644 --- a/indra/newview/rlvcommon.h +++ b/indra/newview/rlvcommon.h @@ -17,99 +17,107 @@ #ifndef RLV_COMMON_H #define RLV_COMMON_H -#include "llmemberlistener.h" -#include "llinventorymodel.h" +#include "llavatarname.h" #include "llselectmgr.h" -#include "llview.h" #include "llviewercontrol.h" -#include "llviewerinventory.h" +#include "llmemberlistener.h" + #include "rlvdefines.h" -#include "rlvviewer2.h" + +#ifdef LL_WINDOWS + #pragma warning (push) + #pragma warning (disable : 4702) // warning C4702: unreachable code +#endif +#include +#ifdef LL_WINDOWS + #pragma warning (pop) +#endif + +using namespace LLOldEvents; // ============================================================================ // Forward declarations // -class RlvCommand; - -typedef std::vector c_llvo_vec_t; - -// ============================================================================ -// RlvNotifications // +// General viewer source +// +class LLInventoryItem; +class LLViewerInventoryCategory; +class LLViewerInventoryItem; +class LLViewerJointAttachment; +class LLWearable; -class RlvNotifications -{ -public: - static void notifyBehaviour(ERlvBehaviour eBhvr, ERlvParamType eType); - static void notifyBlockedTeleport() { notifyBlocked("blocked_teleport"); } - static void notifyBlockedViewNote() { notifyBlockedViewXXX(LLAssetType::lookup(LLAssetType::AT_NOTECARD)); } - static void notifyBlockedViewScript() { notifyBlockedViewXXX(LLAssetType::lookup(LLAssetType::AT_SCRIPT)); } - static void notifyBlockedViewTexture() { notifyBlockedViewXXX(LLAssetType::lookup(LLAssetType::AT_TEXTURE)); } +// +// RLVa-specific +// +class RlvCommand; +typedef std::list rlv_command_list_t; +class RlvObject; - static void warnGiveToRLV(); -protected: - static void notifyBlocked(const std::string& strRlvString); - static void notifyBlockedViewXXX(const char* pstrAssetType); +struct RlvException; +typedef boost::variant RlvExceptionOption; - static void onGiveToRLVConfirmation(const LLSD& notification, const LLSD& response); -}; +class RlvGCTimer; // ============================================================================ // RlvSettings // -inline BOOL rlvGetSettingBOOL(const std::string& strSetting, BOOL fDefault) +template inline T rlvGetSetting(const std::string& strSetting, const T& defaultValue) { - return (gSavedSettings.controlExists(strSetting)) ? gSavedSettings.getBOOL(strSetting) : fDefault; + RLV_ASSERT_DBG(gSavedSettings.controlExists(strSetting)); + return (gSavedSettings.controlExists(strSetting)) ? gSavedSettings.get(strSetting) : defaultValue; } -inline BOOL rlvGetPerUserSettingsBOOL(const std::string& strSetting, BOOL fDefault) + +template inline T rlvGetPerUserSetting(const std::string& strSetting, const T& defaultValue) { - return (gSavedPerAccountSettings.controlExists(strSetting)) ? gSavedPerAccountSettings.getBOOL(strSetting) : fDefault; -} -inline std::string rlvGetSettingString(const std::string& strSetting, const std::string& strDefault) -{ - return (gSavedSettings.controlExists(strSetting)) ? gSavedSettings.getString(strSetting) : strDefault; + RLV_ASSERT_DBG(gSavedPerAccountSettings.controlExists(strSetting)); + return (gSavedPerAccountSettings.controlExists(strSetting)) ? gSavedPerAccountSettings.get(strSetting) : defaultValue; } class RlvSettings { public: - static BOOL getDebug() { return rlvGetSettingBOOL(RLV_SETTING_DEBUG, FALSE); } - static BOOL getForbidGiveToRLV() { return rlvGetSettingBOOL(RLV_SETTING_FORBIDGIVETORLV, TRUE); } - static BOOL getNoSetEnv() { return fNoSetEnv; } + static F32 getAvatarOffsetZ() { return rlvGetSetting(RLV_SETTING_AVATAROFFSET_Z, 0.0); } + static bool getDebug() { return rlvGetSetting(RLV_SETTING_DEBUG, false); } + static bool getCanOOC() { return fCanOOC; } + static bool getForbidGiveToRLV() { return rlvGetSetting(RLV_SETTING_FORBIDGIVETORLV, true); } + static bool getNoSetEnv() { return fNoSetEnv; } - static std::string getWearAddPrefix() { return rlvGetSettingString(RLV_SETTING_WEARADDPREFIX, LLStringUtil::null); } - static std::string getWearReplacePrefix() { return rlvGetSettingString(RLV_SETTING_WEARREPLACEPREFIX, LLStringUtil::null); } + static std::string getWearAddPrefix() { return rlvGetSetting(RLV_SETTING_WEARADDPREFIX, LLStringUtil::null); } + static std::string getWearReplacePrefix() { return rlvGetSetting(RLV_SETTING_WEARREPLACEPREFIX, LLStringUtil::null); } - static bool getDebugHideUnsetDup() { return rlvGetSettingBOOL(RLV_SETTING_DEBUGHIDEUNSETDUP, FALSE); } + static bool getDebugHideUnsetDup() { return rlvGetSetting(RLV_SETTING_DEBUGHIDEUNSETDUP, false); } #ifdef RLV_EXPERIMENTAL_COMPOSITEFOLDERS static BOOL getEnableComposites() { return fCompositeFolders; } #endif // RLV_EXPERIMENTAL_COMPOSITEFOLDERS - static BOOL getEnableLegacyNaming() { return fLegacyNaming; } - static BOOL getEnableWear() { return TRUE; } - static BOOL getEnableSharedWear() { return rlvGetSettingBOOL(RLV_SETTING_ENABLESHAREDWEAR, FALSE); } - static BOOL getHideLockedLayers() { return rlvGetSettingBOOL(RLV_SETTING_HIDELOCKEDLAYER, FALSE); } - static BOOL getHideLockedAttach() { return rlvGetSettingBOOL(RLV_SETTING_HIDELOCKEDATTACH, FALSE); } - static BOOL getHideLockedInventory() { return rlvGetSettingBOOL(RLV_SETTING_HIDELOCKEDINVENTORY, FALSE); } - static BOOL getSharedInvAutoRename() { return rlvGetSettingBOOL(RLV_SETTING_SHAREDINVAUTORENAME, TRUE); } - static BOOL getShowNameTags() { return fShowNameTags; } + static bool getEnableLegacyNaming() { return fLegacyNaming; } + static bool getEnableSharedWear() { return rlvGetSetting(RLV_SETTING_ENABLESHAREDWEAR, false); } + static bool getHideLockedLayers() { return rlvGetSetting(RLV_SETTING_HIDELOCKEDLAYER, false); } + 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; } #ifdef RLV_EXTENSION_STARTLOCATION - static BOOL getLoginLastLocation() { return rlvGetPerUserSettingsBOOL(RLV_SETTING_LOGINLASTLOCATION, TRUE); } + static bool getLoginLastLocation() { return rlvGetPerUserSetting(RLV_SETTING_LOGINLASTLOCATION, true); } static void updateLoginLastLocation(); #endif // RLV_EXTENSION_STARTLOCATION static void initClass(); protected: - static bool onChangedSettingBOOL(const LLSD& newvalue, BOOL* pfSetting); + static bool onChangedAvatarOffset(const LLSD& sdValue); + static bool onChangedMenuLevel(); + static bool onChangedSettingBOOL(const LLSD& sdValue, bool* pfSetting); #ifdef RLV_EXPERIMENTAL_COMPOSITEFOLDERS static BOOL fCompositeFolders; #endif // RLV_EXPERIMENTAL_COMPOSITEFOLDERS - static BOOL fLegacyNaming; - static BOOL fNoSetEnv; - static BOOL fShowNameTags; + static bool fCanOOC; + static bool fLegacyNaming; + static bool fNoSetEnv; + static bool fShowNameTags; }; // ============================================================================ @@ -121,6 +129,7 @@ class RlvStrings public: static void initClass(); + static const std::string& getAnonym(const LLAvatarName& avName); // @shownames static const std::string& getAnonym(const std::string& strName); // @shownames static const std::string& getBehaviourNotificationString(ERlvBehaviour eBhvr, ERlvParamType eType); static const std::string& getString(const std::string& strStringName); @@ -133,10 +142,6 @@ public: protected: static std::vector m_Anonyms; static std::map m_StringMap; - #ifdef RLV_EXTENSION_NOTIFY_BEHAVIOUR - static std::map m_BhvrAddMap; - static std::map m_BhvrRemMap; - #endif // RLV_EXTENSION_NOTIFY_BEHAVIOUR }; // ============================================================================ @@ -156,6 +161,9 @@ public: static bool isForceTp() { return m_fForceTp; } static void forceTp(const LLVector3d& posDest); // Ignores restrictions that might otherwise prevent tp'ing + static void notifyBlocked(const std::string& strNotifcation, const LLSD& sdArgs = LLSD()); + static void notifyBlockedGeneric() { notifyBlocked(RLV_STRING_BLOCKED_GENERIC); } + static void notifyBlockedViewXXX(LLAssetType::EType assetType) { notifyBlocked(RLV_STRING_BLOCKED_VIEWXXX, LLSD().with("[TYPE]", LLAssetType::lookup(assetType))); } static void notifyFailedAssertion(const std::string& strAssert, const std::string& strFile, int nLine); static void sendBusyMessage(const LLUUID& idTo, const std::string& strMsg, const LLUUID& idSession = LLUUID::null); @@ -163,6 +171,8 @@ public: static bool sendChatReply(S32 nChannel, const std::string& strUTF8Text); static bool sendChatReply(const std::string& strChannel, const std::string& strUTF8Text); + static void warnGiveToRLV(); + static void onGiveToRLVConfirmation(const LLSD& notification, const LLSD& response); protected: static bool m_fForceTp; // @standtp }; @@ -171,13 +181,6 @@ protected: // Extensibility classes // -class RlvBehaviourObserver -{ -public: - virtual ~RlvBehaviourObserver() {} - virtual void changed(const RlvCommand& rlvCmd, bool fInternal) = 0; -}; - class RlvCommandHandler { public: @@ -193,15 +196,21 @@ typedef bool (RlvCommandHandler::*rlvCommandHandler)(const RlvCommand& rlvCmd, E // Generic menu enablers // +BOOL rlvMenuCheckEnabled(void*); +void rlvMenuToggleEnabled(void*); +//void rlvMenuToggleVisible(void*); +//bool rlvMenuEnableIfNot(const LLSD& sdParam); class RlvEnableIfNot : public LLMemberListener { - bool handleEvent(LLPointer, const LLSD&); + bool handleEvent(LLPointer, const LLSD&); }; // ============================================================================ // Selection functors // +bool rlvCanDeleteOrReturn(); + struct RlvSelectHasLockedAttach : public LLSelectedNodeFunctor { RlvSelectHasLockedAttach() {} @@ -215,28 +224,14 @@ struct RlvSelectIsEditable : public LLSelectedNodeFunctor /*virtual*/ bool apply(LLSelectNode* pNode); }; -struct RlvSelectIsOwnedByOrGroupOwned : public LLSelectedNodeFunctor -{ - RlvSelectIsOwnedByOrGroupOwned(const LLUUID& uuid) : m_idAgent(uuid) {} - virtual bool apply(LLSelectNode* pNode); -protected: - LLUUID m_idAgent; -}; - struct RlvSelectIsSittingOn : public LLSelectedNodeFunctor { - RlvSelectIsSittingOn(LLXform* pObject) : m_pObject(pObject) {} - virtual bool apply(LLSelectNode* pNode); + RlvSelectIsSittingOn(const LLVOAvatar* pAvatar) : m_pAvatar(pAvatar) {} + /*virtual*/ bool apply(LLSelectNode* pNode); protected: - LLXform* m_pObject; + const LLVOAvatar* m_pAvatar; }; -// ============================================================================ -// Various public helper functions -// - -BOOL rlvAttachToEnabler(void* pParam); - // ============================================================================ // Predicates // @@ -265,12 +260,8 @@ protected: struct RlvPredIsEqualOrLinkedItem { RlvPredIsEqualOrLinkedItem(const LLViewerInventoryItem* pItem) : m_pItem(pItem) {} - RlvPredIsEqualOrLinkedItem(const LLUUID& idItem) { m_pItem = gInventory.getItem(idItem); } - - bool operator()(const LLViewerInventoryItem* pItem) const - { - return (m_pItem) && (pItem) && (m_pItem->getLinkedUUID() == pItem->getLinkedUUID()); - } + RlvPredIsEqualOrLinkedItem(const LLUUID& idItem); + bool operator()(const LLViewerInventoryItem* pItem) const; protected: const LLViewerInventoryItem* m_pItem; }; @@ -285,6 +276,12 @@ template struct RlvPredValuesEqual // Inlined class member functions // +// Checked: 2010-10-31 (RLVa-1.2.2a) | Added: RLVa-1.2.2a +inline const std::string& RlvStrings::getAnonym(const LLAvatarName& avName) +{ + return getAnonym(avName.mDisplayName); +} + // Checked: 2010-03-26 (RLVa-1.2.0b) | Modified: RLVa-1.0.2a inline bool RlvUtil::isEmote(const std::string& strUTF8Text) { diff --git a/indra/newview/rlvdefines.h b/indra/newview/rlvdefines.h index 74b28359e..17118d4fa 100644 --- a/indra/newview/rlvdefines.h +++ b/indra/newview/rlvdefines.h @@ -58,7 +58,7 @@ #ifdef RLV_EXPERIMENTAL_CMDS #define RLV_EXTENSION_CMD_ALLOWIDLE // Forces "Away" status when idle (effect is the same as setting AllowIdleAFK to TRUE) #define RLV_EXTENSION_CMD_GETCOMMAND // @getcommand: