summaryrefslogtreecommitdiff
path: root/indra/newview/llappearancemgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llappearancemgr.cpp')
-rw-r--r--indra/newview/llappearancemgr.cpp60
1 files changed, 56 insertions, 4 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 7deaaf1593..3947be49bb 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -177,7 +177,13 @@ class LLUpdateDirtyState: public LLInventoryCallback
{
public:
LLUpdateDirtyState() {}
- virtual ~LLUpdateDirtyState(){ LLAppearanceMgr::getInstance()->updateIsDirty(); }
+ virtual ~LLUpdateDirtyState()
+ {
+ if (LLAppearanceMgr::instanceExists())
+ {
+ LLAppearanceMgr::getInstance()->updateIsDirty();
+ }
+ }
virtual void fire(const LLUUID&) {}
};
@@ -923,6 +929,14 @@ bool LLAppearanceMgr::wearItemOnAvatar(const LLUUID& item_id_to_wear, bool do_up
{
if (item_id_to_wear.isNull()) return false;
+ // *TODO: issue with multi-wearable should be fixed:
+ // in this case this method will be called N times - loading started for each item
+ // and than N times will be called - loading completed for each item.
+ // That means subscribers will be notified that loading is done after first item in a batch is worn.
+ // (loading indicator disappears for example before all selected items are worn)
+ // Have not fix this issue for 2.1 because of stability reason. EXT-7777.
+ gAgentWearables.notifyLoadingStarted();
+
LLViewerInventoryItem* item_to_wear = gInventory.getItem(item_id_to_wear);
if (!item_to_wear) return false;
@@ -1060,7 +1074,7 @@ void LLAppearanceMgr::takeOffOutfit(const LLUUID& cat_id)
{
LLInventoryModel::cat_array_t cats;
LLInventoryModel::item_array_t items;
- LLFindWorn collector;
+ LLFindWearablesEx collector(/*is_worn=*/ true, /*include_body_parts=*/ false);
gInventory.collectDescendentsIf(cat_id, cats, items, FALSE, collector);
@@ -1219,6 +1233,34 @@ bool LLAppearanceMgr::getCanRemoveOutfit(const LLUUID& outfit_cat_id)
return true;
}
+// static
+bool LLAppearanceMgr::getCanRemoveFromCOF(const LLUUID& outfit_cat_id)
+{
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ LLFindWearablesEx is_worn(/*is_worn=*/ true, /*include_body_parts=*/ false);
+ gInventory.collectDescendentsIf(outfit_cat_id,
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_worn);
+ return items.size() > 0;
+}
+
+// static
+bool LLAppearanceMgr::getCanAddToCOF(const LLUUID& outfit_cat_id)
+{
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ LLFindWearablesEx not_worn(/*is_worn=*/ false, /*include_body_parts=*/ false);
+ gInventory.collectDescendentsIf(outfit_cat_id,
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ not_worn);
+ return items.size() > 0;
+}
+
void LLAppearanceMgr::purgeBaseOutfitLink(const LLUUID& category)
{
LLInventoryModel::cat_array_t cats;
@@ -1333,9 +1375,12 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append)
// - Body parts: always include COF contents as a fallback in case any
// required parts are missing.
+ // Preserve body parts from COF if appending.
LLInventoryModel::item_array_t body_items;
getDescendentsOfAssetType(cof, body_items, LLAssetType::AT_BODYPART, false);
getDescendentsOfAssetType(category, body_items, LLAssetType::AT_BODYPART, false);
+ if (append)
+ reverse(body_items.begin(), body_items.end());
// Reduce body items to max of one per type.
removeDuplicateItems(body_items);
filterWearableItems(body_items, 1);
@@ -2114,6 +2159,8 @@ bool LLAppearanceMgr::updateBaseOutfit()
}
setOutfitLocked(true);
+ gAgentWearables.notifyLoadingStarted();
+
const LLUUID base_outfit_id = getBaseOutfitUUID();
if (base_outfit_id.isNull()) return false;
@@ -2273,6 +2320,7 @@ public:
}
LLAppearanceMgr::getInstance()->updateIsDirty();
+ gAgentWearables.notifyLoadingFinished(); // New outfit is saved.
LLAppearanceMgr::getInstance()->updatePanelOutfitName("");
}
@@ -2288,6 +2336,8 @@ LLUUID LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, b
{
if (!isAgentAvatarValid()) return LLUUID::null;
+ gAgentWearables.notifyLoadingStarted();
+
// First, make a folder in the My Outfits directory.
const LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
LLUUID folder_id = gInventory.createNewCategory(
@@ -2494,7 +2544,9 @@ void LLAppearanceMgr::registerAttachment(const LLUUID& item_id)
if (mAttachmentInvLinkEnabled)
{
- LLAppearanceMgr::addCOFItemLink(item_id, false); // Add COF link for item.
+ // we have to pass do_update = true to call LLAppearanceMgr::updateAppearanceFromCOF.
+ // it will trigger gAgentWariables.notifyLoadingFinished()
+ LLAppearanceMgr::addCOFItemLink(item_id, true); // Add COF link for item.
}
else
{
@@ -2524,7 +2576,7 @@ void LLAppearanceMgr::linkRegisteredAttachments()
++it)
{
LLUUID item_id = *it;
- addCOFItemLink(item_id, false);
+ addCOFItemLink(item_id, true);
}
mRegisteredAttachments.clear();
}