From 6aa63dce3367a60a5f8ae58d0651844ec7a0a79e Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 5 Mar 2015 16:17:45 -0500 Subject: SL-103 WIP - viewer enforces wearable limits based on total articles of clothing rather than per-type limit. Limit is artificially low for testing, will bump before release. --- indra/llappearance/llwearabledata.cpp | 59 ++++++++++++++++++++++++++--------- indra/llappearance/llwearabledata.h | 14 +++++---- indra/llappearance/llwearabletype.cpp | 2 +- 3 files changed, 53 insertions(+), 22 deletions(-) mode change 100644 => 100755 indra/llappearance/llwearabledata.h mode change 100644 => 100755 indra/llappearance/llwearabletype.cpp (limited to 'indra/llappearance') diff --git a/indra/llappearance/llwearabledata.cpp b/indra/llappearance/llwearabledata.cpp index cf1ee435a8..39d4179a80 100755 --- a/indra/llappearance/llwearabledata.cpp +++ b/indra/llappearance/llwearabledata.cpp @@ -92,7 +92,7 @@ void LLWearableData::setWearable(const LLWearableType::EType type, U32 index, LL } } -U32 LLWearableData::pushWearable(const LLWearableType::EType type, +void LLWearableData::pushWearable(const LLWearableType::EType type, LLWearable *wearable, bool trigger_updated /* = true */) { @@ -100,9 +100,8 @@ U32 LLWearableData::pushWearable(const LLWearableType::EType type, { // no null wearables please! LL_WARNS() << "Null wearable sent for type " << type << LL_ENDL; - return MAX_CLOTHING_PER_TYPE; } - if (type < LLWearableType::WT_COUNT || mWearableDatas[type].size() < MAX_CLOTHING_PER_TYPE) + if (canAddWearable(type)) { mWearableDatas[type].push_back(wearable); if (trigger_updated) @@ -110,9 +109,7 @@ U32 LLWearableData::pushWearable(const LLWearableType::EType type, const BOOL removed = FALSE; wearableUpdated(wearable, removed); } - return mWearableDatas[type].size()-1; } - return MAX_CLOTHING_PER_TYPE; } // virtual @@ -125,7 +122,7 @@ void LLWearableData::wearableUpdated(LLWearable *wearable, BOOL removed) } } -void LLWearableData::popWearable(LLWearable *wearable) +void LLWearableData::eraseWearable(LLWearable *wearable) { if (wearable == NULL) { @@ -133,16 +130,16 @@ void LLWearableData::popWearable(LLWearable *wearable) return; } - U32 index = getWearableIndex(wearable); const LLWearableType::EType type = wearable->getType(); - if (index < MAX_CLOTHING_PER_TYPE && index < getWearableCount(type)) + U32 index; + if (getWearableIndex(wearable,index)) { - popWearable(type, index); + eraseWearable(type, index); } } -void LLWearableData::popWearable(const LLWearableType::EType type, U32 index) +void LLWearableData::eraseWearable(const LLWearableType::EType type, U32 index) { LLWearable *wearable = getWearable(type, index); if (wearable) @@ -203,11 +200,11 @@ void LLWearableData::pullCrossWearableValues(const LLWearableType::EType type) } -U32 LLWearableData::getWearableIndex(const LLWearable *wearable) const +BOOL LLWearableData::getWearableIndex(const LLWearable *wearable, U32& index_found) const { if (wearable == NULL) { - return MAX_CLOTHING_PER_TYPE; + return FALSE; } const LLWearableType::EType type = wearable->getType(); @@ -215,18 +212,50 @@ U32 LLWearableData::getWearableIndex(const LLWearable *wearable) const if (wearable_iter == mWearableDatas.end()) { LL_WARNS() << "tried to get wearable index with an invalid type!" << LL_ENDL; - return MAX_CLOTHING_PER_TYPE; + return FALSE; } const wearableentry_vec_t& wearable_vec = wearable_iter->second; for(U32 index = 0; index < wearable_vec.size(); index++) { if (wearable_vec[index] == wearable) { - return index; + index_found = index; + return TRUE; } } - return MAX_CLOTHING_PER_TYPE; + return FALSE; +} + +U32 LLWearableData::getClothingLayerCount() const +{ + U32 count = 0; + for (S32 i = 0; i < LLWearableType::WT_COUNT; i++) + { + LLWearableType::EType type = (LLWearableType::EType)i; + if (LLWearableType::getAssetType(type)==LLAssetType::AT_CLOTHING) + { + count += getWearableCount(type); + } + } + return count; +} + +BOOL LLWearableData::canAddWearable(const LLWearableType::EType type) const +{ + LLAssetType::EType a_type = LLWearableType::getAssetType(type); + if (a_type==LLAssetType::AT_CLOTHING) + { + return (getClothingLayerCount() < MAX_CLOTHING_LAYERS); + } + else if (a_type==LLAssetType::AT_BODYPART) + { + return (getWearableCount(type) < 1); + } + else + { + return FALSE; + } } BOOL LLWearableData::isOnTop(LLWearable* wearable) const diff --git a/indra/llappearance/llwearabledata.h b/indra/llappearance/llwearabledata.h old mode 100644 new mode 100755 index 03bd179f25..cb6cb954f0 --- a/indra/llappearance/llwearabledata.h +++ b/indra/llappearance/llwearabledata.h @@ -60,11 +60,13 @@ public: const LLWearable* getBottomWearable(const LLWearableType::EType type) const; U32 getWearableCount(const LLWearableType::EType type) const; U32 getWearableCount(const U32 tex_index) const; - U32 getWearableIndex(const LLWearable *wearable) const; + BOOL getWearableIndex(const LLWearable *wearable, U32& index) const; + U32 getClothingLayerCount() const; + BOOL canAddWearable(const LLWearableType::EType type) const; BOOL isOnTop(LLWearable* wearable) const; - - static const U32 MAX_CLOTHING_PER_TYPE = 5; + + static const U32 MAX_CLOTHING_LAYERS = 10; //-------------------------------------------------------------------- // Setters @@ -72,11 +74,11 @@ public: protected: // Low-level data structure setter - public access is via setWearableItem, etc. void setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable); - U32 pushWearable(const LLWearableType::EType type, LLWearable *wearable, + void pushWearable(const LLWearableType::EType type, LLWearable *wearable, bool trigger_updated = true); virtual void wearableUpdated(LLWearable *wearable, BOOL removed); - void popWearable(LLWearable *wearable); - void popWearable(const LLWearableType::EType type, U32 index); + void eraseWearable(LLWearable *wearable); + void eraseWearable(const LLWearableType::EType type, U32 index); void clearWearableType(const LLWearableType::EType type); bool swapWearables(const LLWearableType::EType type, U32 index_a, U32 index_b); diff --git a/indra/llappearance/llwearabletype.cpp b/indra/llappearance/llwearabletype.cpp old mode 100644 new mode 100755 index 618e2a1941..58c446e586 --- a/indra/llappearance/llwearabletype.cpp +++ b/indra/llappearance/llwearabletype.cpp @@ -160,7 +160,7 @@ BOOL LLWearableType::getDisableCameraSwitch(LLWearableType::EType type) return entry->mDisableCameraSwitch; } -// static +// static BOOL LLWearableType::getAllowMultiwear(LLWearableType::EType type) { const LLWearableDictionary *dict = LLWearableDictionary::getInstance(); -- cgit v1.2.3 From d2b3d187d96cc85dee1709a121d4570f6488debb Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 9 Mar 2015 15:53:07 -0400 Subject: SL-103 WIP - bumped MAX_CLOTHING_LAYERS to target value of 60 --- indra/llappearance/llwearabledata.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llappearance') diff --git a/indra/llappearance/llwearabledata.h b/indra/llappearance/llwearabledata.h index cb6cb954f0..a0c446ea9e 100755 --- a/indra/llappearance/llwearabledata.h +++ b/indra/llappearance/llwearabledata.h @@ -66,7 +66,7 @@ public: BOOL isOnTop(LLWearable* wearable) const; - static const U32 MAX_CLOTHING_LAYERS = 10; + static const U32 MAX_CLOTHING_LAYERS = 60; //-------------------------------------------------------------------- // Setters -- cgit v1.2.3 From 738195a98d3009becd5dbeaae7f77e70fff7de3e Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 9 Mar 2015 18:52:59 -0400 Subject: SL-103 WIP - fix for some inventory items not enabling add --- indra/llappearance/llwearabletype.cpp | 7 +++++++ indra/llappearance/llwearabletype.h | 1 + 2 files changed, 8 insertions(+) mode change 100644 => 100755 indra/llappearance/llwearabletype.h (limited to 'indra/llappearance') diff --git a/indra/llappearance/llwearabletype.cpp b/indra/llappearance/llwearabletype.cpp index 58c446e586..87109a5906 100755 --- a/indra/llappearance/llwearabletype.cpp +++ b/indra/llappearance/llwearabletype.cpp @@ -27,6 +27,7 @@ #include "linden_common.h" #include "llwearabletype.h" #include "llinventorytype.h" +#include "llinventorydefines.h" static LLTranslationBridge* sTrans = NULL; @@ -169,3 +170,9 @@ BOOL LLWearableType::getAllowMultiwear(LLWearableType::EType type) return entry->mAllowMultiwear; } +// static +LLWearableType::EType LLWearableType::inventoryFlagsToWearableType(U32 flags) +{ + return (LLWearableType::EType)(flags & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK); +} + diff --git a/indra/llappearance/llwearabletype.h b/indra/llappearance/llwearabletype.h old mode 100644 new mode 100755 index e51e6731d3..6fa87ec30e --- a/indra/llappearance/llwearabletype.h +++ b/indra/llappearance/llwearabletype.h @@ -77,6 +77,7 @@ public: static LLInventoryType::EIconName getIconName(EType type); static BOOL getDisableCameraSwitch(EType type); static BOOL getAllowMultiwear(EType type); + static EType inventoryFlagsToWearableType(U32 flags); protected: LLWearableType() {} -- cgit v1.2.3 From 1a54bc44bb06dfdadc31c4d3bb5527ca8e0817a5 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 7 Apr 2015 13:03:12 -0400 Subject: appearance utility source updated --- indra/llappearance/llwearabledata.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llappearance') diff --git a/indra/llappearance/llwearabledata.h b/indra/llappearance/llwearabledata.h index a0c446ea9e..996c4c18b4 100755 --- a/indra/llappearance/llwearabledata.h +++ b/indra/llappearance/llwearabledata.h @@ -66,7 +66,8 @@ public: BOOL isOnTop(LLWearable* wearable) const; - static const U32 MAX_CLOTHING_LAYERS = 60; + // DO NOT COMMIT, TESTING ONLY! + static const U32 MAX_CLOTHING_LAYERS = 999; //-------------------------------------------------------------------- // Setters -- cgit v1.2.3 From cddfcda1677c4a5d25d2adc54eb4c3aef0953ee1 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 7 Apr 2015 13:04:03 -0400 Subject: appearance utility source updated --- indra/llappearance/llwearabledata.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra/llappearance') diff --git a/indra/llappearance/llwearabledata.h b/indra/llappearance/llwearabledata.h index 996c4c18b4..a0c446ea9e 100755 --- a/indra/llappearance/llwearabledata.h +++ b/indra/llappearance/llwearabledata.h @@ -66,8 +66,7 @@ public: BOOL isOnTop(LLWearable* wearable) const; - // DO NOT COMMIT, TESTING ONLY! - static const U32 MAX_CLOTHING_LAYERS = 999; + static const U32 MAX_CLOTHING_LAYERS = 60; //-------------------------------------------------------------------- // Setters -- cgit v1.2.3