diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index ba04991a02f590b4932fe73c33aa3803c487511f..3cee7826fd2f38a4322a7e7e3a463d84e553465f 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -1124,14 +1124,19 @@ void LLAgentWearables::addWearableToAgentInventory(LLPointer<LLInventoryCallback cb); } -void LLAgentWearables::removeWearable(const LLWearableType::EType type, bool do_remove_all, U32 index) +void LLAgentWearables::removeWearable(const LLWearableType::EType type, bool do_remove_all, U32 index, BOOL will_replace) { - if (gAgent.isTeen() && + if (gAgent.isTeen() && (type == LLWearableType::WT_UNDERSHIRT || type == LLWearableType::WT_UNDERPANTS)) { // Can't take off underclothing in simple UI mode or on PG accounts - // TODO: enable the removing of a single undershirt/underpants if multiple are worn. - Nyx - return; + + if (getWearableCount(type) < 2 && !will_replace) + { + // if there is 0 or 1 undergarment worn, and we're not going to be immediately adding another, + // we cannot allow the removal for teen accounts + return; + } } if (getWearableCount(type) == 0) { @@ -1239,6 +1244,31 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it { llinfos << "setWearableOutfit() start" << llendl; + S32 count = wearables.count(); + llassert(items.count() == count); + S32 i; + + bool has_undershirt = false; + bool has_underpants = false; + + for (i = 0; i < count; i++) + { + LLViewerWearable* new_wearable = wearables[i]; + if (new_wearable) + { + const LLWearableType::EType type = new_wearable->getType(); + if (type == LLWearableType::WT_UNDERSHIRT) + { + has_undershirt = true; + } + if (type == LLWearableType::WT_UNDERPANTS) + { + has_underpants = true; + } + } + } + + // TODO: Removed check for ensuring that teens don't remove undershirt and underwear. Handle later if (remove) { @@ -1248,15 +1278,17 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it { if (LLWearableType::getAssetType((LLWearableType::EType)type) == LLAssetType::AT_CLOTHING) { - removeWearable((LLWearableType::EType)type, true, 0); + bool will_replace = false; + if ((type == LLWearableType::WT_UNDERSHIRT && has_undershirt) || + (type == LLWearableType::WT_UNDERPANTS && has_underpants)) + { + will_replace = true; + } + removeWearable((LLWearableType::EType)type, true, 0, will_replace); } } } - S32 count = wearables.count(); - llassert(items.count() == count); - - S32 i; for (i = 0; i < count; i++) { LLViewerWearable* new_wearable = wearables[i]; diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h index 5be4648636792a5c883750c57b635b1ea5abb46a..f2f224a5736d2481cb3bec85c8b9bca3d923a06e 100644 --- a/indra/newview/llagentwearables.h +++ b/indra/newview/llagentwearables.h @@ -146,7 +146,7 @@ class LLAgentWearables : public LLInitClass<LLAgentWearables>, public LLWearable // Removing wearables //-------------------------------------------------------------------- public: - void removeWearable(const LLWearableType::EType type, bool do_remove_all /*= false*/, U32 index /*= 0*/); + void removeWearable(const LLWearableType::EType type, bool do_remove_all /*= false*/, U32 index /*= 0*/, BOOL will_replace = false); private: void removeWearableFinal(const LLWearableType::EType type, bool do_remove_all /*= false*/, U32 index /*= 0*/); protected: diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 0ec6ef3d1464ed98f94fd4a8e9e3553c66460a5e..725939dd3eedddef8d6582ab3a743e195ba955b3 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2144,7 +2144,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled) { LLVector3 tagPos = mRoot->getWorldPosition(); tagPos[VZ] -= mPelvisToFoot; - tagPos[VZ] += ( mBodySize[VZ] + mAvatarOffset[VZ] + 0.125f ); + tagPos[VZ] += ( mBodySize[VZ] + 0.125f ); mVoiceVisualizer->setVoiceSourceWorldPosition( tagPos ); } }//if ( voiceEnabled )