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.cpp208
1 files changed, 51 insertions, 157 deletions
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 5eb943877a..1fb4cff31a 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -56,8 +56,6 @@
#include <boost/scoped_ptr.hpp>
-#define USE_CURRENT_OUTFIT_FOLDER
-
//--------------------------------------------------------------------
// Classes for fetching initial wearables data
//--------------------------------------------------------------------
@@ -120,9 +118,8 @@ protected:
void importedFolderDone(void);
void contentsDone(void);
enum ELibraryOutfitFetchStep mCurrFetchStep;
- typedef std::vector<LLUUID> clothing_folder_vec_t;
- clothing_folder_vec_t mLibraryClothingFolders;
- clothing_folder_vec_t mImportedClothingFolders;
+ uuid_vec_t mLibraryClothingFolders;
+ uuid_vec_t mImportedClothingFolders;
bool mOutfitsPopulated;
LLUUID mClothingID;
LLUUID mLibraryClothingID;
@@ -291,7 +288,7 @@ void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& i
}
if (mTodo & CALL_RECOVERDONE)
{
- LLAppearanceManager::instance().addCOFItemLink(inv_item,false);
+ LLAppearanceMgr::instance().addCOFItemLink(inv_item,false);
gAgentWearables.recoverMissingWearableDone();
}
/*
@@ -299,7 +296,7 @@ void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& i
*/
if (mTodo & CALL_CREATESTANDARDDONE)
{
- LLAppearanceManager::instance().addCOFItemLink(inv_item,false);
+ LLAppearanceMgr::instance().addCOFItemLink(inv_item,false);
gAgentWearables.createStandardWearablesDone(mType, mIndex);
}
if (mTodo & CALL_MAKENEWOUTFITDONE)
@@ -308,7 +305,7 @@ void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& i
}
if (mTodo & CALL_WEARITEM)
{
- LLAppearanceManager::instance().addCOFItemLink(inv_item, true);
+ LLAppearanceMgr::instance().addCOFItemLink(inv_item, true);
}
}
@@ -485,7 +482,7 @@ void LLAgentWearables::saveWearable(const EWearableType type, const U32 index, B
return;
}
- gAgent.getAvatarObject()->wearableUpdated( type, TRUE );
+ gAgentAvatarp->wearableUpdated( type, TRUE );
if (send_update)
{
@@ -783,8 +780,7 @@ U32 LLAgentWearables::pushWearable(const EWearableType type, LLWearable *wearabl
void LLAgentWearables::wearableUpdated(LLWearable *wearable)
{
- LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
- avatarp->wearableUpdated(wearable->getType(), TRUE);
+ gAgentAvatarp->wearableUpdated(wearable->getType(), TRUE);
wearable->refreshName();
wearable->setLabelUpdated();
@@ -825,11 +821,10 @@ void LLAgentWearables::popWearable(LLWearable *wearable)
void LLAgentWearables::popWearable(const EWearableType type, U32 index)
{
LLWearable *wearable = getWearable(type, index);
- LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
if (wearable)
{
mWearableDatas[type].erase(mWearableDatas[type].begin() + index);
- avatarp->wearableUpdated(wearable->getType(), TRUE);
+ gAgentAvatarp->wearableUpdated(wearable->getType(), TRUE);
wearable->setLabelUpdated();
}
}
@@ -961,8 +956,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
LLUUID agent_id;
gMessageSystem->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
- LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
- if (avatarp && (agent_id == avatarp->getID()))
+ if (isAgentAvatarValid() && (agent_id == gAgentAvatarp->getID()))
{
gMessageSystem->getU32Fast(_PREHASH_AgentData, _PREHASH_SerialNum, gAgentQueryManager.mUpdateSerialNum);
@@ -1028,7 +1022,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
// Get the complete information on the items in the inventory and set up an observer
// that will trigger when the complete information is fetched.
- LLInventoryFetchDescendentsObserver::folder_ref_t folders;
+ uuid_vec_t folders;
folders.push_back(current_outfit_id);
outfit->fetchDescendents(folders);
if(outfit->isEverythingComplete())
@@ -1046,64 +1040,6 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
}
}
-// A single wearable that the avatar was wearing on start-up has arrived from the database.
-// static
-void LLAgentWearables::onInitialWearableAssetArrived(LLWearable* wearable, void* userdata)
-{
- boost::scoped_ptr<LLInitialWearablesFetch::InitialWearableData> wear_data((LLInitialWearablesFetch::InitialWearableData*)userdata);
- const EWearableType type = wear_data->mType;
- U32 index = 0;
-
- LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
- if (!avatarp)
- {
- return;
- }
-
- if (wearable)
- {
- llassert(type == wearable->getType());
- wearable->setItemID(wear_data->mItemID);
- index = gAgentWearables.pushWearable(type, wearable);
- gAgentWearables.mItemsAwaitingWearableUpdate.erase(wear_data->mItemID);
-
- // disable composites if initial textures are baked
- avatarp->setupComposites();
-
- avatarp->setCompositeUpdatesEnabled(TRUE);
- gInventory.addChangedMask(LLInventoryObserver::LABEL, wearable->getItemID());
- }
- else
- {
- // Somehow the asset doesn't exist in the database.
- gAgentWearables.recoverMissingWearable(type,index);
- }
-
-
- gInventory.notifyObservers();
-
- // Have all the wearables that the avatar was wearing at log-in arrived?
- // MULTI-WEARABLE: update when multiple wearables can arrive per type.
-
- gAgentWearables.updateWearablesLoaded();
- if (gAgentWearables.areWearablesLoaded())
- {
-
- // Can't query cache until all wearables have arrived, so calling this earlier is a no-op.
- gAgentWearables.queryWearableCache();
-
- // Make sure that the server's idea of the avatar's wearables actually match the wearables.
- gAgent.sendAgentSetAppearance();
-
- // Check to see if there are any baked textures that we hadn't uploaded before we logged off last time.
- // If there are any, schedule them to be uploaded as soon as the layer textures they depend on arrive.
- if (gAgentCamera.cameraCustomizeAvatar())
- {
- avatarp->requestLayerSetUploads();
- }
- }
-}
-
// 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.)
@@ -1179,7 +1115,7 @@ public:
{
llinfos << "All items created" << llendl;
LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy;
- LLAppearanceManager::instance().linkAll(LLAppearanceManager::instance().getCOF(),
+ LLAppearanceMgr::instance().linkAll(LLAppearanceMgr::instance().getCOF(),
mItemsToLink,
link_waiter);
}
@@ -1239,13 +1175,9 @@ void LLAgentWearables::createStandardWearables(BOOL female)
llwarns << "Creating Standard " << (female ? "female" : "male")
<< " Wearables" << llendl;
- LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
- if (!avatarp)
- {
- return;
- }
+ if (!isAgentAvatarValid()) return;
- avatarp->setSex(female ? SEX_FEMALE : SEX_MALE);
+ gAgentAvatarp->setSex(female ? SEX_FEMALE : SEX_MALE);
const BOOL create[WT_COUNT] =
{
@@ -1293,11 +1225,8 @@ void LLAgentWearables::createStandardWearablesDone(S32 type, U32 index)
{
llinfos << "type " << type << " index " << index << llendl;
- LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
- if (avatarp)
- {
- avatarp->updateVisualParams();
- }
+ if (!isAgentAvatarValid()) return;
+ gAgentAvatarp->updateVisualParams();
}
void LLAgentWearables::createStandardWearablesAllDone()
@@ -1312,8 +1241,7 @@ void LLAgentWearables::createStandardWearablesAllDone()
updateServer();
// Treat this as the first texture entry message, if none received yet
- LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
- avatarp->onFirstTEMessageReceived();
+ gAgentAvatarp->onFirstTEMessageReceived();
}
// MULTI-WEARABLE: Properly handle multiwearables later.
@@ -1335,11 +1263,7 @@ void LLAgentWearables::makeNewOutfit(const std::string& new_folder_name,
const LLDynamicArray<S32>& attachments_to_include,
BOOL rename_clothing)
{
- LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
- if (!avatarp)
- {
- return;
- }
+ if (!isAgentAvatarValid()) return;
// First, make a folder in the Clothes directory.
LLUUID folder_id = gInventory.createNewCategory(
@@ -1437,7 +1361,7 @@ void LLAgentWearables::makeNewOutfit(const std::string& new_folder_name,
for (S32 i = 0; i < attachments_to_include.count(); i++)
{
S32 attachment_pt = attachments_to_include[i];
- LLViewerJointAttachment* attachment = get_if_there(avatarp->mAttachmentPoints, attachment_pt, (LLViewerJointAttachment*)NULL);
+ LLViewerJointAttachment* attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, attachment_pt, (LLViewerJointAttachment*)NULL);
if (!attachment) continue;
for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
attachment_iter != attachment->mAttachedObjects.end();
@@ -1498,8 +1422,8 @@ public:
tab_outfits->changeOpenClose(tab_outfits->getDisplayChildren());
}
- LLAppearanceManager::instance().updateIsDirty();
- LLAppearanceManager::instance().updatePanelOutfitName("");
+ LLAppearanceMgr::instance().updateIsDirty();
+ LLAppearanceMgr::instance().updatePanelOutfitName("");
}
virtual void fire(const LLUUID&)
@@ -1512,11 +1436,7 @@ private:
LLUUID LLAgentWearables::makeNewOutfitLinks(const std::string& new_folder_name)
{
- LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
- if (!avatarp)
- {
- return LLUUID::null;
- }
+ if (!isAgentAvatarValid()) return LLUUID::null;
// First, make a folder in the My Outfits directory.
const LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
@@ -1526,8 +1446,8 @@ LLUUID LLAgentWearables::makeNewOutfitLinks(const std::string& new_folder_name)
new_folder_name);
LLPointer<LLInventoryCallback> cb = new LLShowCreatedOutfit(folder_id);
- LLAppearanceManager::instance().shallowCopyCategoryContents(LLAppearanceManager::instance().getCOF(),folder_id, cb);
- LLAppearanceManager::instance().createBaseOutfitLink(folder_id, cb);
+ LLAppearanceMgr::instance().shallowCopyCategoryContents(LLAppearanceMgr::instance().getCOF(),folder_id, cb);
+ LLAppearanceMgr::instance().createBaseOutfitLink(folder_id, cb);
return folder_id;
}
@@ -1680,7 +1600,6 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
BOOL remove)
{
llinfos << "setWearableOutfit() start" << llendl;
- LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
BOOL wearables_to_remove[WT_COUNT];
wearables_to_remove[WT_SHAPE] = FALSE;
@@ -1784,11 +1703,11 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
}
}
- if (avatarp)
+ if (isAgentAvatarValid())
{
- avatarp->setCompositeUpdatesEnabled(TRUE);
- avatarp->updateVisualParams();
- avatarp->invalidateAll();
+ gAgentAvatarp->setCompositeUpdatesEnabled(TRUE);
+ gAgentAvatarp->updateVisualParams();
+ gAgentAvatarp->invalidateAll();
}
// Start rendering & update the server
@@ -2038,12 +1957,7 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj
// already wearing and in request set -> leave alone.
// not wearing and in request set -> put on.
- LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
- if (!avatarp)
- {
- llwarns << "No avatar found." << llendl;
- return;
- }
+ if (!isAgentAvatarValid()) return;
std::set<LLUUID> requested_item_ids;
std::set<LLUUID> current_item_ids;
@@ -2052,8 +1966,8 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj
// Build up list of objects to be removed and items currently attached.
llvo_vec_t objects_to_remove;
- 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;
@@ -2109,12 +2023,7 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj
void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remove)
{
- LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
- if (!avatarp)
- {
- llwarns << "No avatar found." << llendl;
- return;
- }
+ if (!isAgentAvatarValid()) return;
if (objects_to_remove.empty())
return;
@@ -2137,17 +2046,12 @@ void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remo
void LLAgentWearables::userRemoveAllAttachments()
{
- LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
- if (!avatarp)
- {
- llwarns << "No avatar found." << llendl;
- return;
- }
+ if (!isAgentAvatarValid()) return;
llvo_vec_t objects_to_remove;
- 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;
@@ -2274,7 +2178,7 @@ void LLAgentWearables::populateMyOutfitsFolder(void)
// Get the complete information on the items in the inventory and
// setup an observer that will wait for that to happen.
- LLInventoryFetchDescendentsObserver::folder_ref_t folders;
+ uuid_vec_t folders;
outfits->mMyOutfitsID = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
folders.push_back(outfits->mMyOutfitsID);
@@ -2365,7 +2269,7 @@ void LLLibraryOutfitsFetch::folderDone(void)
mCompleteFolders.clear();
// Get the complete information on the items in the inventory.
- LLInventoryFetchDescendentsObserver::folder_ref_t folders;
+ uuid_vec_t folders;
folders.push_back(mClothingID);
folders.push_back(mLibraryClothingID);
fetchDescendents(folders);
@@ -2379,7 +2283,7 @@ void LLLibraryOutfitsFetch::outfitsDone(void)
{
LLInventoryModel::cat_array_t cat_array;
LLInventoryModel::item_array_t wearable_array;
- LLInventoryFetchDescendentsObserver::folder_ref_t folders;
+ uuid_vec_t folders;
// Collect the contents of the Library's Clothing folder
gInventory.collectDescendents(mLibraryClothingID, cat_array, wearable_array,
@@ -2469,7 +2373,7 @@ void LLLibraryOutfitsFetch::libraryDone(void)
LLFolderType::FT_NONE,
mImportedClothingName);
// Copy each folder from library into clothing unless it already exists.
- for (clothing_folder_vec_t::const_iterator iter = mLibraryClothingFolders.begin();
+ for (uuid_vec_t::const_iterator iter = mLibraryClothingFolders.begin();
iter != mLibraryClothingFolders.end();
++iter)
{
@@ -2481,7 +2385,7 @@ void LLLibraryOutfitsFetch::libraryDone(void)
continue;
}
- if (!LLAppearanceManager::getInstance()->getCanMakeFolderIntoOutfit(src_folder_id))
+ if (!LLAppearanceMgr::getInstance()->getCanMakeFolderIntoOutfit(src_folder_id))
{
llinfos << "Skipping non-outfit folder name:" << cat->getName() << llendl;
continue;
@@ -2503,14 +2407,14 @@ void LLLibraryOutfitsFetch::libraryDone(void)
LLUUID dst_folder_id = gInventory.createNewCategory(mImportedClothingID,
LLFolderType::FT_NONE,
cat->getName());
- LLAppearanceManager::getInstance()->shallowCopyCategoryContents(src_folder_id, dst_folder_id, copy_waiter);
+ LLAppearanceMgr::getInstance()->shallowCopyCategoryContents(src_folder_id, dst_folder_id, copy_waiter);
}
}
void LLLibraryOutfitsFetch::importedFolderFetch(void)
{
// Fetch the contents of the Imported Clothing Folder
- LLInventoryFetchDescendentsObserver::folder_ref_t folders;
+ uuid_vec_t folders;
folders.push_back(mImportedClothingID);
mCompleteFolders.clear();
@@ -2526,7 +2430,7 @@ void LLLibraryOutfitsFetch::importedFolderDone(void)
{
LLInventoryModel::cat_array_t cat_array;
LLInventoryModel::item_array_t wearable_array;
- LLInventoryFetchDescendentsObserver::folder_ref_t folders;
+ uuid_vec_t folders;
// Collect the contents of the Imported Clothing folder
gInventory.collectDescendents(mImportedClothingID, cat_array, wearable_array,
@@ -2556,7 +2460,7 @@ void LLLibraryOutfitsFetch::contentsDone(void)
LLInventoryModel::cat_array_t cat_array;
LLInventoryModel::item_array_t wearable_array;
- for (clothing_folder_vec_t::const_iterator folder_iter = mImportedClothingFolders.begin();
+ for (uuid_vec_t::const_iterator folder_iter = mImportedClothingFolders.begin();
folder_iter != mImportedClothingFolders.end();
++folder_iter)
{
@@ -2625,15 +2529,15 @@ void LLInitialWearablesFetch::processContents()
gInventory.collectDescendentsIf(mCompleteFolders.front(), cat_array, wearable_array,
LLInventoryModel::EXCLUDE_TRASH, is_wearable);
- LLAppearanceManager::instance().setAttachmentInvLinkEnable(true);
+ LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true);
if (wearable_array.count() > 0)
{
- LLAppearanceManager::instance().updateAppearanceFromCOF();
+ LLAppearanceMgr::instance().updateAppearanceFromCOF();
}
else
{
// if we're constructing the COF from the wearables message, we don't have a proper outfit link
- LLAppearanceManager::instance().setOutfitDirty(true);
+ LLAppearanceMgr::instance().setOutfitDirty(true);
processWearablesMessage();
}
delete this;
@@ -2670,7 +2574,7 @@ public:
link_inventory_item(gAgent.getID(),
item->getLinkedUUID(),
- LLAppearanceManager::instance().getCOF(),
+ LLAppearanceMgr::instance().getCOF(),
item->getName(),
LLAssetType::AT_LINK,
link_waiter);
@@ -2684,7 +2588,7 @@ void LLInitialWearablesFetch::processWearablesMessage()
{
if (!mAgentInitialWearables.empty()) // We have an empty current outfit folder, use the message data instead.
{
- const LLUUID current_outfit_id = LLAppearanceManager::instance().getCOF();
+ const LLUUID current_outfit_id = LLAppearanceMgr::instance().getCOF();
LLInventoryFetchObserver::item_ref_t ids;
for (U8 i = 0; i < mAgentInitialWearables.size(); ++i)
{
@@ -2693,16 +2597,7 @@ void LLInitialWearablesFetch::processWearablesMessage()
if (wearable_data->mAssetID.notNull())
{
-#ifdef USE_CURRENT_OUTFIT_FOLDER
ids.push_back(wearable_data->mItemID);
-#endif
-#if 0
-// // Fetch the wearables
-// LLWearableList::instance().getAsset(wearable_data->mAssetID,
-// LLStringUtil::null,
-// LLWearableDictionary::getAssetType(wearable_data->mType),
-// LLAgentWearables::onInitialWearableAssetArrived, (void*)(wearable_data));
-#endif
}
else
{
@@ -2713,11 +2608,10 @@ void LLInitialWearablesFetch::processWearablesMessage()
}
// Add all current attachments to the requested items as well.
- LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
- if(avatarp)
+ if (isAgentAvatarValid())
{
- for (LLVOAvatar::attachment_map_t::const_iterator iter = avatarp->mAttachmentPoints.begin();
- iter != avatarp->mAttachmentPoints.end(); ++iter)
+ for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
+ iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter)
{
LLViewerJointAttachment* attachment = iter->second;
if (!attachment) continue;