summaryrefslogtreecommitdiff
path: root/indra/newview/llappearancemgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llappearancemgr.cpp')
-rwxr-xr-xindra/newview/llappearancemgr.cpp90
1 files changed, 58 insertions, 32 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index d817f10aee..722587ec0e 100755
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -397,6 +397,12 @@ public:
LLCallAfterInventoryBatchMgr(dst_cat_id, phase_name, on_completion_func, on_failure_func, retry_after, max_retries)
{
addItems(src_items);
+ sInstanceCount++;
+ }
+
+ ~LLCallAfterInventoryCopyMgr()
+ {
+ sInstanceCount--;
}
virtual bool requestOperation(const LLUUID& item_id)
@@ -419,8 +425,15 @@ public:
);
return true;
}
+
+ static S32 getInstanceCount() { return sInstanceCount; }
+
+private:
+ static S32 sInstanceCount;
};
+S32 LLCallAfterInventoryCopyMgr::sInstanceCount = 0;
+
LLUpdateAppearanceOnDestroy::LLUpdateAppearanceOnDestroy(bool update_base_outfit_ordering,
bool enforce_item_restrictions,
bool enforce_ordering):
@@ -1609,25 +1622,6 @@ void LLAppearanceMgr::purgeBaseOutfitLink(const LLUUID& category, LLPointer<LLIn
}
}
-void LLAppearanceMgr::removeCategoryContents(const LLUUID& category, bool keep_outfit_links,
- LLPointer<LLInventoryCallback> cb)
-{
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- gInventory.collectDescendents(category, cats, items,
- LLInventoryModel::EXCLUDE_TRASH);
- for (S32 i = 0; i < items.count(); ++i)
- {
- LLViewerInventoryItem *item = items.get(i);
- if (keep_outfit_links && (item->getActualType() == LLAssetType::AT_LINK_FOLDER))
- continue;
- if (item->getIsLinkType())
- {
- remove_inventory_item(item->getUUID(), cb);
- }
- }
-}
-
// Keep the last N wearables of each type. For viewer 2.0, N is 1 for
// both body parts and clothing items.
void LLAppearanceMgr::filterWearableItems(
@@ -1691,6 +1685,11 @@ void LLAppearanceMgr::removeAll(LLInventoryModel::item_array_t& items_to_kill,
void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append)
{
LLViewerInventoryCategory *pcat = gInventory.getCategory(category);
+ if (!pcat)
+ {
+ llwarns << "no category found for id " << category << llendl;
+ return;
+ }
LL_INFOS("Avatar") << self_av_string() << "starting, cat '" << (pcat ? pcat->getName() : "[UNKNOWN]") << "'" << LL_ENDL;
const LLUUID cof = getCOF();
@@ -1756,6 +1755,7 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append)
// Will link all the above items.
LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy;
+#if 0
linkAll(cof,all_items,link_waiter);
// Add link to outfit if category is an outfit.
@@ -1772,7 +1772,37 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append)
// even in the non-append case, createBaseOutfitLink() already
// deletes the existing link, don't need to do it again here.
bool keep_outfit_links = true;
- removeCategoryContents(cof, keep_outfit_links, link_waiter);
+ remove_folder_contents(cof, keep_outfit_links, link_waiter);
+#else
+ LLSD contents = LLSD::emptyArray();
+ for (LLInventoryModel::item_array_t::const_iterator it = all_items.begin();
+ it != all_items.end(); ++it)
+ {
+ LLSD item_contents;
+ LLInventoryItem *item = *it;
+ item_contents["name"] = item->getName();
+ item_contents["desc"] = item->getActualDescription();
+ item_contents["linked_id"] = item->getLinkedUUID();
+ item_contents["type"] = LLAssetType::AT_LINK;
+ contents.append(item_contents);
+ }
+ const LLUUID& base_id = append ? getBaseOutfitUUID() : category;
+ LLViewerInventoryCategory *base_cat = gInventory.getCategory(base_id);
+ if (base_cat)
+ {
+ LLSD base_contents;
+ base_contents["name"] = base_cat->getName();
+ base_contents["desc"] = "";
+ base_contents["linked_id"] = base_cat->getLinkedUUID();
+ base_contents["type"] = LLAssetType::AT_LINK_FOLDER;
+ contents.append(base_contents);
+ }
+ if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"))
+ {
+ dump_sequential_xml(gAgentAvatarp->getFullname() + "_slam_request", contents);
+ }
+ slam_inventory_folder(getCOF(), contents, link_waiter);
+#endif
LL_DEBUGS("Avatar") << self_av_string() << "waiting for LLUpdateAppearanceOnDestroy" << LL_ENDL;
}
@@ -2154,6 +2184,11 @@ void LLAppearanceMgr::wearInventoryCategory(LLInventoryCategory* category, bool
category->getUUID(), copy, append));
}
+S32 LLAppearanceMgr::getActiveCopyOperations() const
+{
+ return LLCallAfterInventoryCopyMgr::getInstanceCount();
+}
+
void LLAppearanceMgr::wearCategoryFinal(LLUUID& cat_id, bool copy_items, bool append)
{
LL_INFOS("Avatar") << self_av_string() << "starting" << LL_ENDL;
@@ -2758,7 +2793,7 @@ bool LLAppearanceMgr::updateBaseOutfit()
updateClothingOrderingInfo();
// in a Base Outfit we do not remove items, only links
- removeCategoryContents(base_outfit_id, false, NULL);
+ remove_folder_contents(base_outfit_id, false, NULL);
LLPointer<LLInventoryCallback> dirty_state_updater =
new LLBoostFuncInventoryCallback(no_op_inventory_func, appearance_mgr_update_dirty_state);
@@ -2918,7 +2953,7 @@ protected:
//LL_DEBUGS("Avatar") << dumpResponse() << LL_ENDL;
if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"))
{
- dumpContents(gAgentAvatarp->getFullname() + "_appearance_request_ok", content);
+ dump_sequential_xml(gAgentAvatarp->getFullname() + "_appearance_request_ok", content);
}
}
else
@@ -2936,7 +2971,7 @@ protected:
if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"))
{
const LLSD& content = getContent();
- dumpContents(gAgentAvatarp->getFullname() + "_appearance_request_error", content);
+ dump_sequential_xml(gAgentAvatarp->getFullname() + "_appearance_request_error", content);
debugCOF(content);
}
onFailure();
@@ -2960,15 +2995,6 @@ protected:
}
}
- void dumpContents(const std::string outprefix, const LLSD& content)
- {
- std::string outfilename = get_sequential_numbered_file_name(outprefix,".xml");
- std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename);
- std::ofstream ofs(fullpath.c_str(), std::ios_base::out);
- ofs << LLSDOStreamer<LLSDXMLFormatter>(content, LLSDFormatter::OPTIONS_PRETTY);
- LL_DEBUGS("Avatar") << "results saved to: " << fullpath << LL_ENDL;
- }
-
void debugCOF(const LLSD& content)
{
LL_INFOS("Avatar") << "AIS COF, version received: " << content["expected"].asInteger()