summaryrefslogtreecommitdiff
path: root/indra/newview/llagentwearables.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llagentwearables.cpp')
-rw-r--r--indra/newview/llagentwearables.cpp253
1 files changed, 132 insertions, 121 deletions
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index b5fde0baca..3e73bbef15 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -100,13 +100,13 @@ void checkWearableAgainstInventory(LLWearable *wearable)
void LLAgentWearables::dump()
{
llinfos << "LLAgentWearablesDump" << llendl;
- for (S32 i = 0; i < WT_COUNT; i++)
+ for (S32 i = 0; i < LLWearableType::WT_COUNT; i++)
{
- U32 count = getWearableCount((EWearableType)i);
+ U32 count = getWearableCount((LLWearableType::EType)i);
llinfos << "Type: " << i << " count " << count << llendl;
for (U32 j=0; j<count; j++)
{
- LLWearable* wearable = getWearable((EWearableType)i,j);
+ LLWearable* wearable = getWearable((LLWearableType::EType)i,j);
if (wearable == NULL)
{
llinfos << " " << j << " NULL wearable" << llendl;
@@ -250,7 +250,7 @@ void LLAgentWearables::addWearabletoAgentInventoryDone(const S32 type,
if (item_id.isNull())
return;
- LLUUID old_item_id = getWearableItemID((EWearableType)type,index);
+ LLUUID old_item_id = getWearableItemID((LLWearableType::EType)type,index);
if (wearable)
{
@@ -259,11 +259,11 @@ void LLAgentWearables::addWearabletoAgentInventoryDone(const S32 type,
if (old_item_id.notNull())
{
gInventory.addChangedMask(LLInventoryObserver::LABEL, old_item_id);
- setWearable((EWearableType)type,index,wearable);
+ setWearable((LLWearableType::EType)type,index,wearable);
}
else
{
- pushWearable((EWearableType)type,wearable);
+ pushWearable((LLWearableType::EType)type,wearable);
}
}
@@ -287,11 +287,11 @@ void LLAgentWearables::sendAgentWearablesUpdate()
{
// MULTI-WEARABLE: call i "type" or something.
// First make sure that we have inventory items for each wearable
- for (S32 type=0; type < WT_COUNT; ++type)
+ for (S32 type=0; type < LLWearableType::WT_COUNT; ++type)
{
- for (U32 j=0; j < getWearableCount((EWearableType)type); ++j)
+ for (U32 j=0; j < getWearableCount((LLWearableType::EType)type); ++j)
{
- LLWearable* wearable = getWearable((EWearableType)type,j);
+ LLWearable* wearable = getWearable((LLWearableType::EType)type,j);
if (wearable)
{
if (wearable->getItemID().isNull())
@@ -326,7 +326,7 @@ void LLAgentWearables::sendAgentWearablesUpdate()
lldebugs << "sendAgentWearablesUpdate()" << llendl;
// MULTI-WEARABLE: update for multi-wearables after server-side support is in.
- for (S32 type=0; type < WT_COUNT; ++type)
+ for (S32 type=0; type < LLWearableType::WT_COUNT; ++type)
{
gMessageSystem->nextBlockFast(_PREHASH_WearableData);
@@ -334,7 +334,7 @@ void LLAgentWearables::sendAgentWearablesUpdate()
gMessageSystem->addU8Fast(_PREHASH_WearableType, type_u8);
// MULTI-WEARABLE: TODO: hacked index to 0, needs to loop over all once messages support this.
- LLWearable* wearable = getWearable((EWearableType)type, 0);
+ LLWearable* wearable = getWearable((LLWearableType::EType)type, 0);
if (wearable)
{
//llinfos << "Sending wearable " << wearable->getName() << llendl;
@@ -350,16 +350,16 @@ void LLAgentWearables::sendAgentWearablesUpdate()
}
else
{
- //llinfos << "Not wearing wearable type " << LLWearableDictionary::getInstance()->getWearable((EWearableType)i) << llendl;
+ //llinfos << "Not wearing wearable type " << LLWearableType::getTypeName((LLWearableType::EType)i) << llendl;
gMessageSystem->addUUIDFast(_PREHASH_ItemID, LLUUID::null);
}
- lldebugs << " " << LLWearableDictionary::getTypeLabel((EWearableType)type) << ": " << (wearable ? wearable->getAssetID() : LLUUID::null) << llendl;
+ lldebugs << " " << LLWearableType::getTypeLabel((LLWearableType::EType)type) << ": " << (wearable ? wearable->getAssetID() : LLUUID::null) << llendl;
}
gAgent.sendReliableMessage();
}
-void LLAgentWearables::saveWearable(const EWearableType type, const U32 index, BOOL send_update)
+void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32 index, BOOL send_update)
{
LLWearable* old_wearable = getWearable(type, index);
if (old_wearable && (old_wearable->isDirty() || old_wearable->isOldVersion()))
@@ -422,7 +422,7 @@ void LLAgentWearables::saveWearable(const EWearableType type, const U32 index, B
}
}
-void LLAgentWearables::saveWearableAs(const EWearableType type,
+void LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
const U32 index,
const std::string& new_name,
BOOL save_in_lost_and_found)
@@ -483,7 +483,7 @@ void LLAgentWearables::saveWearableAs(const EWearableType type,
old_wearable->revertValues();
}
-void LLAgentWearables::revertWearable(const EWearableType type, const U32 index)
+void LLAgentWearables::revertWearable(const LLWearableType::EType type, const U32 index)
{
LLWearable* wearable = getWearable(type, index);
wearable->revertValues();
@@ -498,10 +498,10 @@ void LLAgentWearables::saveAllWearables()
// return;
//}
- for (S32 i=0; i < WT_COUNT; i++)
+ for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
{
- for (U32 j=0; j < getWearableCount((EWearableType)i); j++)
- saveWearable((EWearableType)i, j, FALSE);
+ for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
+ saveWearable((LLWearableType::EType)i, j, FALSE);
}
sendAgentWearablesUpdate();
}
@@ -509,14 +509,14 @@ void LLAgentWearables::saveAllWearables()
// Called when the user changes the name of a wearable inventory item that is currently being worn.
void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string& new_name)
{
- for (S32 i=0; i < WT_COUNT; i++)
+ for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
{
- for (U32 j=0; j < getWearableCount((EWearableType)i); j++)
+ for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
{
- LLUUID curr_item_id = getWearableItemID((EWearableType)i,j);
+ LLUUID curr_item_id = getWearableItemID((LLWearableType::EType)i,j);
if (curr_item_id == item_id)
{
- LLWearable* old_wearable = getWearable((EWearableType)i,j);
+ LLWearable* old_wearable = getWearable((LLWearableType::EType)i,j);
llassert(old_wearable);
std::string old_name = old_wearable->getName();
@@ -530,7 +530,7 @@ void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string&
}
old_wearable->setName(old_name);
- setWearable((EWearableType)i,j,new_wearable);
+ setWearable((LLWearableType::EType)i,j,new_wearable);
sendAgentWearablesUpdate();
break;
}
@@ -539,7 +539,7 @@ void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string&
}
-BOOL LLAgentWearables::isWearableModifiable(EWearableType type, U32 index) const
+BOOL LLAgentWearables::isWearableModifiable(LLWearableType::EType type, U32 index) const
{
LLUUID item_id = getWearableItemID(type, index);
if (!item_id.isNull())
@@ -554,7 +554,7 @@ BOOL LLAgentWearables::isWearableModifiable(EWearableType type, U32 index) const
return FALSE;
}
-BOOL LLAgentWearables::isWearableCopyable(EWearableType type, U32 index) const
+BOOL LLAgentWearables::isWearableCopyable(LLWearableType::EType type, U32 index) const
{
LLUUID item_id = getWearableItemID(type, index);
if (!item_id.isNull())
@@ -570,7 +570,7 @@ BOOL LLAgentWearables::isWearableCopyable(EWearableType type, U32 index) const
}
/*
- U32 LLAgentWearables::getWearablePermMask(EWearableType type)
+ U32 LLAgentWearables::getWearablePermMask(LLWearableType::EType type)
{
LLUUID item_id = getWearableItemID(type);
if (!item_id.isNull())
@@ -585,7 +585,7 @@ BOOL LLAgentWearables::isWearableCopyable(EWearableType type, U32 index) const
}
*/
-LLInventoryItem* LLAgentWearables::getWearableInventoryItem(EWearableType type, U32 index)
+LLInventoryItem* LLAgentWearables::getWearableInventoryItem(LLWearableType::EType type, U32 index)
{
LLUUID item_id = getWearableItemID(type,index);
LLInventoryItem* item = NULL;
@@ -598,11 +598,11 @@ LLInventoryItem* LLAgentWearables::getWearableInventoryItem(EWearableType type,
const LLWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id) const
{
- for (S32 i=0; i < WT_COUNT; i++)
+ for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
{
- for (U32 j=0; j < getWearableCount((EWearableType)i); j++)
+ for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
{
- const LLWearable * curr_wearable = getWearable((EWearableType)i, j);
+ const LLWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
if (curr_wearable && (curr_wearable->getItemID() == item_id))
{
return curr_wearable;
@@ -614,11 +614,11 @@ const LLWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id)
LLWearable* LLAgentWearables::getWearableFromAssetID(const LLUUID& asset_id)
{
- for (S32 i=0; i < WT_COUNT; i++)
+ for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
{
- for (U32 j=0; j < getWearableCount((EWearableType)i); j++)
+ for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
{
- LLWearable * curr_wearable = getWearable((EWearableType)i, j);
+ LLWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
if (curr_wearable && (curr_wearable->getAssetID() == asset_id))
{
return curr_wearable;
@@ -638,12 +638,12 @@ void LLAgentWearables::sendAgentWearablesRequest()
}
// static
-BOOL LLAgentWearables::selfHasWearable(EWearableType type)
+BOOL LLAgentWearables::selfHasWearable(LLWearableType::EType type)
{
return (gAgentWearables.getWearableCount(type) > 0);
}
-LLWearable* LLAgentWearables::getWearable(const EWearableType type, U32 index)
+LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 index)
{
wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
if (wearable_iter == mWearableDatas.end())
@@ -661,7 +661,7 @@ LLWearable* LLAgentWearables::getWearable(const EWearableType type, U32 index)
}
}
-void LLAgentWearables::setWearable(const EWearableType type, U32 index, LLWearable *wearable)
+void LLAgentWearables::setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable)
{
LLWearable *old_wearable = getWearable(type,index);
@@ -691,7 +691,7 @@ void LLAgentWearables::setWearable(const EWearableType type, U32 index, LLWearab
}
}
-U32 LLAgentWearables::pushWearable(const EWearableType type, LLWearable *wearable)
+U32 LLAgentWearables::pushWearable(const LLWearableType::EType type, LLWearable *wearable)
{
if (wearable == NULL)
{
@@ -699,7 +699,7 @@ U32 LLAgentWearables::pushWearable(const EWearableType type, LLWearable *wearabl
llwarns << "Null wearable sent for type " << type << llendl;
return MAX_WEARABLES_PER_TYPE;
}
- if (type < WT_COUNT || mWearableDatas[type].size() < MAX_WEARABLES_PER_TYPE)
+ if (type < LLWearableType::WT_COUNT || mWearableDatas[type].size() < MAX_WEARABLES_PER_TYPE)
{
mWearableDatas[type].push_back(wearable);
wearableUpdated(wearable);
@@ -741,7 +741,7 @@ void LLAgentWearables::popWearable(LLWearable *wearable)
}
U32 index = getWearableIndex(wearable);
- EWearableType type = wearable->getType();
+ LLWearableType::EType type = wearable->getType();
if (index < MAX_WEARABLES_PER_TYPE && index < getWearableCount(type))
{
@@ -749,7 +749,7 @@ void LLAgentWearables::popWearable(LLWearable *wearable)
}
}
-void LLAgentWearables::popWearable(const EWearableType type, U32 index)
+void LLAgentWearables::popWearable(const LLWearableType::EType type, U32 index)
{
LLWearable *wearable = getWearable(type, index);
if (wearable)
@@ -767,7 +767,7 @@ U32 LLAgentWearables::getWearableIndex(LLWearable *wearable)
return MAX_WEARABLES_PER_TYPE;
}
- const EWearableType type = wearable->getType();
+ const LLWearableType::EType type = wearable->getType();
wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
if (wearable_iter == mWearableDatas.end())
{
@@ -786,7 +786,7 @@ U32 LLAgentWearables::getWearableIndex(LLWearable *wearable)
return MAX_WEARABLES_PER_TYPE;
}
-const LLWearable* LLAgentWearables::getWearable(const EWearableType type, U32 index) const
+const LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 index) const
{
wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
if (wearable_iter == mWearableDatas.end())
@@ -804,7 +804,7 @@ const LLWearable* LLAgentWearables::getWearable(const EWearableType type, U32 in
}
}
-LLWearable* LLAgentWearables::getTopWearable(const EWearableType type)
+LLWearable* LLAgentWearables::getTopWearable(const LLWearableType::EType type)
{
U32 count = getWearableCount(type);
if ( count == 0)
@@ -815,7 +815,7 @@ LLWearable* LLAgentWearables::getTopWearable(const EWearableType type)
return getWearable(type, count-1);
}
-U32 LLAgentWearables::getWearableCount(const EWearableType type) const
+U32 LLAgentWearables::getWearableCount(const LLWearableType::EType type) const
{
wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
if (wearable_iter == mWearableDatas.end())
@@ -828,7 +828,7 @@ U32 LLAgentWearables::getWearableCount(const EWearableType type) const
U32 LLAgentWearables::getWearableCount(const U32 tex_index) const
{
- const EWearableType wearable_type = LLVOAvatarDictionary::getTEWearableType((LLVOAvatarDefines::ETextureIndex)tex_index);
+ const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType((LLVOAvatarDefines::ETextureIndex)tex_index);
return getWearableCount(wearable_type);
}
@@ -843,7 +843,7 @@ U32 LLAgentWearables::itemUpdatePendingCount() const
return mItemsAwaitingWearableUpdate.size();
}
-const LLUUID LLAgentWearables::getWearableItemID(EWearableType type, U32 index) const
+const LLUUID LLAgentWearables::getWearableItemID(LLWearableType::EType type, U32 index) const
{
const LLWearable *wearable = getWearable(type,index);
if (wearable)
@@ -852,7 +852,7 @@ const LLUUID LLAgentWearables::getWearableItemID(EWearableType type, U32 index)
return LLUUID();
}
-const LLUUID LLAgentWearables::getWearableAssetID(EWearableType type, U32 index) const
+const LLUUID LLAgentWearables::getWearableAssetID(LLWearableType::EType type, U32 index) const
{
const LLWearable *wearable = getWearable(type,index);
if (wearable)
@@ -916,11 +916,11 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
// Parse initial wearables data from message system
U8 type_u8 = 0;
gMessageSystem->getU8Fast(_PREHASH_WearableData, _PREHASH_WearableType, type_u8, i);
- if (type_u8 >= WT_COUNT)
+ if (type_u8 >= LLWearableType::WT_COUNT)
{
continue;
}
- const EWearableType type = (EWearableType) type_u8;
+ const LLWearableType::EType type = (LLWearableType::EType) type_u8;
LLUUID item_id;
gMessageSystem->getUUIDFast(_PREHASH_WearableData, _PREHASH_ItemID, item_id, i);
@@ -933,7 +933,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
}
else
{
- LLAssetType::EType asset_type = LLWearableDictionary::getAssetType(type);
+ LLAssetType::EType asset_type = LLWearableType::getAssetType(type);
if (asset_type == LLAssetType::AT_NONE)
{
continue;
@@ -946,7 +946,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
outfit->add(wearable_data);
}
- lldebugs << " " << LLWearableDictionary::getTypeLabel(type) << llendl;
+ lldebugs << " " << LLWearableType::getTypeLabel(type) << llendl;
}
// Get the complete information on the items in the inventory and set up an observer
@@ -970,11 +970,11 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
// Normally, all wearables referred to "AgentWearablesUpdate" will correspond to actual assets in the
// database. If for some reason, we can't load one of those assets, we can try to reconstruct it so that
// the user isn't left without a shape, for example. (We can do that only after the inventory has loaded.)
-void LLAgentWearables::recoverMissingWearable(const EWearableType type, U32 index)
+void LLAgentWearables::recoverMissingWearable(const LLWearableType::EType type, U32 index)
{
// Try to recover by replacing missing wearable with a new one.
LLNotificationsUtil::add("ReplacedMissingWearable");
- lldebugs << "Wearable " << LLWearableDictionary::getTypeLabel(type) << " could not be downloaded. Replaced inventory item with default wearable." << llendl;
+ lldebugs << "Wearable " << LLWearableType::getTypeLabel(type) << " could not be downloaded. Replaced inventory item with default wearable." << llendl;
LLWearable* new_wearable = LLWearableList::instance().createNewWearable(type);
S32 type_s32 = (S32) type;
@@ -1011,9 +1011,9 @@ void LLAgentWearables::recoverMissingWearableDone()
}
}
-void LLAgentWearables::addLocalTextureObject(const EWearableType wearable_type, const LLVOAvatarDefines::ETextureIndex texture_type, U32 wearable_index)
+void LLAgentWearables::addLocalTextureObject(const LLWearableType::EType wearable_type, const LLVOAvatarDefines::ETextureIndex texture_type, U32 wearable_index)
{
- LLWearable* wearable = getWearable((EWearableType)wearable_type, wearable_index);
+ LLWearable* wearable = getWearable((LLWearableType::EType)wearable_type, wearable_index);
if (!wearable)
{
llerrs << "Tried to add local texture object to invalid wearable with type " << wearable_type << " and index " << wearable_index << llendl;
@@ -1027,7 +1027,7 @@ class OnWearableItemCreatedCB: public LLInventoryCallback
{
public:
OnWearableItemCreatedCB():
- mWearablesAwaitingItems(WT_COUNT,NULL)
+ mWearablesAwaitingItems(LLWearableType::WT_COUNT,NULL)
{
llinfos << "created callback" << llendl;
}
@@ -1053,8 +1053,8 @@ public:
llwarns << "no wearable" << llendl;
return;
}
- EWearableType type = wearable->getType();
- if (type<WT_COUNT)
+ LLWearableType::EType type = wearable->getType();
+ if (type<LLWearableType::WT_COUNT)
{
mWearablesAwaitingItems[type] = wearable;
}
@@ -1078,8 +1078,8 @@ public:
}
if (item && item->isWearableType())
{
- EWearableType type = item->getWearableType();
- if (type < WT_COUNT)
+ LLWearableType::EType type = item->getWearableType();
+ if (type < LLWearableType::WT_COUNT)
{
LLWearable *wearable = mWearablesAwaitingItems[type];
if (wearable)
@@ -1106,30 +1106,30 @@ void LLAgentWearables::createStandardWearables(BOOL female)
gAgentAvatarp->setSex(female ? SEX_FEMALE : SEX_MALE);
- const BOOL create[WT_COUNT] =
+ const BOOL create[LLWearableType::WT_COUNT] =
{
- TRUE, //WT_SHAPE
- TRUE, //WT_SKIN
- TRUE, //WT_HAIR
- TRUE, //WT_EYES
- TRUE, //WT_SHIRT
- TRUE, //WT_PANTS
- TRUE, //WT_SHOES
- TRUE, //WT_SOCKS
- FALSE, //WT_JACKET
- FALSE, //WT_GLOVES
- TRUE, //WT_UNDERSHIRT
- TRUE, //WT_UNDERPANTS
- FALSE //WT_SKIRT
+ TRUE, //LLWearableType::WT_SHAPE
+ TRUE, //LLWearableType::WT_SKIN
+ TRUE, //LLWearableType::WT_HAIR
+ TRUE, //LLWearableType::WT_EYES
+ TRUE, //LLWearableType::WT_SHIRT
+ TRUE, //LLWearableType::WT_PANTS
+ TRUE, //LLWearableType::WT_SHOES
+ TRUE, //LLWearableType::WT_SOCKS
+ FALSE, //LLWearableType::WT_JACKET
+ FALSE, //LLWearableType::WT_GLOVES
+ TRUE, //LLWearableType::WT_UNDERSHIRT
+ TRUE, //LLWearableType::WT_UNDERPANTS
+ FALSE //LLWearableType::WT_SKIRT
};
LLPointer<LLInventoryCallback> cb = new OnWearableItemCreatedCB;
- for (S32 i=0; i < WT_COUNT; i++)
+ for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
{
if (create[i])
{
- llassert(getWearableCount((EWearableType)i) == 0);
- LLWearable* wearable = LLWearableList::instance().createNewWearable((EWearableType)i);
+ llassert(getWearableCount((LLWearableType::EType)i) == 0);
+ LLWearable* wearable = LLWearableList::instance().createNewWearable((LLWearableType::EType)i);
((OnWearableItemCreatedCB*)(&(*cb)))->addPendingWearable(wearable);
// no need to update here...
LLUUID category_id = LLUUID::null;
@@ -1164,6 +1164,7 @@ void LLAgentWearables::createStandardWearablesAllDone()
mWearablesLoaded = TRUE;
checkWearablesLoaded();
+ mLoadedSignal();
updateServer();
@@ -1174,16 +1175,16 @@ void LLAgentWearables::createStandardWearablesAllDone()
// MULTI-WEARABLE: Properly handle multiwearables later.
void LLAgentWearables::getAllWearablesArray(LLDynamicArray<S32>& wearables)
{
- for( S32 i = 0; i < WT_COUNT; ++i )
+ for( S32 i = 0; i < LLWearableType::WT_COUNT; ++i )
{
- if (getWearableCount((EWearableType) i) != 0)
+ if (getWearableCount((LLWearableType::EType) i) != 0)
{
wearables.push_back(i);
}
}
}
-// Note: wearables_to_include should be a list of EWearableType types
+// Note: wearables_to_include should be a list of LLWearableType::EType types
// attachments_to_include should be a list of attachment points
void LLAgentWearables::makeNewOutfit(const std::string& new_folder_name,
const LLDynamicArray<S32>& wearables_to_include,
@@ -1213,9 +1214,9 @@ void LLAgentWearables::makeNewOutfit(const std::string& new_folder_name,
for (i = 0; i < count; ++i)
{
const S32 type = wearables_to_include[i];
- for (U32 j=0; j<getWearableCount((EWearableType)i); j++)
+ for (U32 j=0; j<getWearableCount((LLWearableType::EType)i); j++)
{
- LLWearable* old_wearable = getWearable((EWearableType)type, j);
+ LLWearable* old_wearable = getWearable((LLWearableType::EType)type, j);
if (old_wearable)
{
std::string new_name;
@@ -1230,7 +1231,7 @@ void LLAgentWearables::makeNewOutfit(const std::string& new_folder_name,
new_wearable->setName(new_name);
}
- LLViewerInventoryItem* item = gInventory.getItem(getWearableItemID((EWearableType)type,j));
+ LLViewerInventoryItem* item = gInventory.getItem(getWearableItemID((LLWearableType::EType)type,j));
S32 todo = addWearableToAgentInventoryCallback::CALL_NONE;
if (!found_first_item)
{
@@ -1250,7 +1251,7 @@ void LLAgentWearables::makeNewOutfit(const std::string& new_folder_name,
llassert(item);
if (item)
{
- if (isWearableCopyable((EWearableType)type, j))
+ if (isWearableCopyable((LLWearableType::EType)type, j))
{
copy_inventory_item(
gAgent.getID(),
@@ -1364,7 +1365,7 @@ private:
void LLAgentWearables::makeNewOutfitDone(S32 type, U32 index)
{
- LLUUID first_item_id = getWearableItemID((EWearableType)type, index);
+ LLUUID first_item_id = getWearableItemID((LLWearableType::EType)type, index);
// Open the inventory and select the first item we added.
if (first_item_id.notNull())
{
@@ -1395,10 +1396,10 @@ void LLAgentWearables::addWearableToAgentInventory(LLPointer<LLInventoryCallback
cb);
}
-void LLAgentWearables::removeWearable(const EWearableType type, bool do_remove_all, U32 index)
+void LLAgentWearables::removeWearable(const LLWearableType::EType type, bool do_remove_all, U32 index)
{
if (gAgent.isTeen() &&
- (type == WT_UNDERSHIRT || type == WT_UNDERPANTS))
+ (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
@@ -1442,7 +1443,7 @@ void LLAgentWearables::removeWearable(const EWearableType type, bool do_remove_a
bool LLAgentWearables::onRemoveWearableDialog(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- EWearableType type = (EWearableType)notification["payload"]["wearable_type"].asInteger();
+ LLWearableType::EType type = (LLWearableType::EType)notification["payload"]["wearable_type"].asInteger();
S32 index = (S32)notification["payload"]["wearable_index"].asInteger();
switch(option)
{
@@ -1466,7 +1467,7 @@ bool LLAgentWearables::onRemoveWearableDialog(const LLSD& notification, const LL
}
// Called by removeWearable() and onRemoveWearableDialog() to actually do the removal.
-void LLAgentWearables::removeWearableFinal(const EWearableType type, bool do_remove_all, U32 index)
+void LLAgentWearables::removeWearableFinal(const LLWearableType::EType type, bool do_remove_all, U32 index)
{
//LLAgentDumper dumper("removeWearable");
if (do_remove_all)
@@ -1515,11 +1516,11 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
{
// note: shirt is the first non-body part wearable item. Update if wearable order changes.
// This loop should remove all clothing, but not any body parts
- for (S32 type = 0; type < (S32)WT_COUNT; type++)
+ for (S32 type = 0; type < (S32)LLWearableType::WT_COUNT; type++)
{
- if (LLWearableDictionary::getAssetType((EWearableType)type) == LLAssetType::AT_CLOTHING)
+ if (LLWearableType::getAssetType((LLWearableType::EType)type) == LLAssetType::AT_CLOTHING)
{
- removeWearable((EWearableType)type, true, 0);
+ removeWearable((LLWearableType::EType)type, true, 0);
}
}
}
@@ -1536,12 +1537,12 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
llassert(new_wearable);
if (new_wearable)
{
- const EWearableType type = new_wearable->getType();
+ const LLWearableType::EType type = new_wearable->getType();
new_wearable->setName(new_item->getName());
new_wearable->setItemID(new_item->getUUID());
- if (LLWearableDictionary::getAssetType(type) == LLAssetType::AT_BODYPART)
+ if (LLWearableType::getAssetType(type) == LLAssetType::AT_BODYPART)
{
// exactly one wearable per body part
setWearable(type,0,new_wearable);
@@ -1567,6 +1568,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
// Start rendering & update the server
mWearablesLoaded = TRUE;
checkWearablesLoaded();
+ mLoadedSignal();
queryWearableCache();
updateServer();
@@ -1584,7 +1586,7 @@ void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLWearable* ne
return;
}
- const EWearableType type = new_wearable->getType();
+ const LLWearableType::EType type = new_wearable->getType();
if (!do_append)
{
@@ -1597,7 +1599,7 @@ void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLWearable* ne
if ((old_wearable->getAssetID() == new_wearable->getAssetID()) &&
(old_item_id == new_item->getUUID()))
{
- lldebugs << "No change to wearable asset and item: " << LLWearableDictionary::getInstance()->getWearableEntry(type) << llendl;
+ lldebugs << "No change to wearable asset and item: " << LLWearableType::getTypeName(type) << llendl;
return;
}
@@ -1654,7 +1656,7 @@ bool LLAgentWearables::onSetWearableDialog(const LLSD& notification, const LLSD&
// MULTI_WEARABLE: unify code after null objects are gone.
void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLWearable* new_wearable, bool do_append)
{
- const EWearableType type = new_wearable->getType();
+ const LLWearableType::EType type = new_wearable->getType();
if (do_append && getWearableItemID(type,0).notNull())
{
@@ -1724,7 +1726,7 @@ void LLAgentWearables::queryWearableCache()
bool hash_computed = false;
for (U8 i=0; i < baked_dict->mWearables.size(); i++)
{
- const EWearableType baked_type = baked_dict->mWearables[i];
+ const LLWearableType::EType baked_type = baked_dict->mWearables[i];
const U32 num_wearables = getWearableCount(baked_type);
for (U32 index = 0; index < num_wearables; ++index)
{
@@ -1763,20 +1765,20 @@ void LLAgentWearables::queryWearableCache()
// User has picked "remove from avatar" from a menu.
// static
-void LLAgentWearables::userRemoveWearable(const EWearableType &type, const U32 &index)
+void LLAgentWearables::userRemoveWearable(const LLWearableType::EType &type, const U32 &index)
{
- if (!(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES)) //&&
- //!((!gAgent.isTeen()) && (type==WT_UNDERPANTS || type==WT_UNDERSHIRT)))
+ 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 EWearableType &type)
+void LLAgentWearables::userRemoveWearablesOfType(const LLWearableType::EType &type)
{
- if (!(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES)) //&&
- //!((!gAgent.isTeen()) && (type==WT_UNDERPANTS || type==WT_UNDERSHIRT)))
+ 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);
}
@@ -1801,17 +1803,17 @@ void LLAgentWearables::userRemoveAllClothesStep2(BOOL proceed)
{
if (proceed)
{
- gAgentWearables.removeWearable(WT_SHIRT,true,0);
- gAgentWearables.removeWearable(WT_PANTS,true,0);
- gAgentWearables.removeWearable(WT_SHOES,true,0);
- gAgentWearables.removeWearable(WT_SOCKS,true,0);
- gAgentWearables.removeWearable(WT_JACKET,true,0);
- gAgentWearables.removeWearable(WT_GLOVES,true,0);
- gAgentWearables.removeWearable(WT_UNDERSHIRT,true,0);
- gAgentWearables.removeWearable(WT_UNDERPANTS,true,0);
- gAgentWearables.removeWearable(WT_SKIRT,true,0);
- gAgentWearables.removeWearable(WT_ALPHA,true,0);
- gAgentWearables.removeWearable(WT_TATTOO,true,0);
+ gAgentWearables.removeWearable(LLWearableType::WT_SHIRT,true,0);
+ gAgentWearables.removeWearable(LLWearableType::WT_PANTS,true,0);
+ gAgentWearables.removeWearable(LLWearableType::WT_SHOES,true,0);
+ gAgentWearables.removeWearable(LLWearableType::WT_SOCKS,true,0);
+ gAgentWearables.removeWearable(LLWearableType::WT_JACKET,true,0);
+ gAgentWearables.removeWearable(LLWearableType::WT_GLOVES,true,0);
+ gAgentWearables.removeWearable(LLWearableType::WT_UNDERSHIRT,true,0);
+ gAgentWearables.removeWearable(LLWearableType::WT_UNDERPANTS,true,0);
+ gAgentWearables.removeWearable(LLWearableType::WT_SKIRT,true,0);
+ gAgentWearables.removeWearable(LLWearableType::WT_ALPHA,true,0);
+ gAgentWearables.removeWearable(LLWearableType::WT_TATTOO,true,0);
}
}
@@ -2012,24 +2014,28 @@ BOOL LLAgentWearables::areWearablesLoaded() const
void LLAgentWearables::updateWearablesLoaded()
{
mWearablesLoaded = (itemUpdatePendingCount()==0);
+ if (mWearablesLoaded)
+ {
+ mLoadedSignal();
+ }
}
bool LLAgentWearables::canWearableBeRemoved(const LLWearable* wearable) const
{
if (!wearable) return false;
- EWearableType type = wearable->getType();
+ LLWearableType::EType type = wearable->getType();
// Make sure the user always has at least one shape, skin, eyes, and hair type currently worn.
- return !(((type == WT_SHAPE) || (type == WT_SKIN) || (type == WT_HAIR) || (type == WT_EYES))
+ return !(((type == LLWearableType::WT_SHAPE) || (type == LLWearableType::WT_SKIN) || (type == LLWearableType::WT_HAIR) || (type == LLWearableType::WT_EYES))
&& (getWearableCount(type) <= 1) );
}
void LLAgentWearables::animateAllWearableParams(F32 delta, BOOL upload_bake)
{
- for( S32 type = 0; type < WT_COUNT; ++type )
+ for( S32 type = 0; type < LLWearableType::WT_COUNT; ++type )
{
- for (S32 count = 0; count < (S32)getWearableCount((EWearableType)type); ++count)
+ for (S32 count = 0; count < (S32)getWearableCount((LLWearableType::EType)type); ++count)
{
- LLWearable *wearable = getWearable((EWearableType)type,count);
+ LLWearable *wearable = getWearable((LLWearableType::EType)type,count);
wearable->animateParams(delta, upload_bake);
}
}
@@ -2091,3 +2097,8 @@ void LLAgentWearables::populateMyOutfitsFolder(void)
outfits->done();
}
}
+
+boost::signals2::connection LLAgentWearables::addLoadedCallback(loaded_callback_t cb)
+{
+ return mLoadedSignal.connect(cb);
+}