summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2013-06-03 17:09:25 -0400
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2013-06-03 17:09:25 -0400
commit63940048eff9c9a1929574ba7581f4c835af35d3 (patch)
treea41d25501f0c2d77a8b406308771200371e92e7d /indra
parent02d2808a419ce37df877756883b96147d06aa4d8 (diff)
SH-4166 WIP - COF-slammer infrastructure working for non-AIS case.
Diffstat (limited to 'indra')
-rwxr-xr-xindra/newview/llappearancemgr.cpp56
-rwxr-xr-xindra/newview/llappearancemgr.h2
-rwxr-xr-xindra/newview/llviewerinventory.cpp50
-rwxr-xr-xindra/newview/llviewerinventory.h7
4 files changed, 92 insertions, 23 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 2288f633f4..0c09689a70 100755
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -1622,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(
@@ -1704,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();
@@ -1769,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.
@@ -1785,7 +1772,34 @@ 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);
+ }
+ llinfos << "slamming to: " << ll_pretty_print_sd(contents) << llendl;
+ slam_inventory_folder(getCOF(), contents, link_waiter);
+#endif
LL_DEBUGS("Avatar") << self_av_string() << "waiting for LLUpdateAppearanceOnDestroy" << LL_ENDL;
}
@@ -2776,7 +2790,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);
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index 4679ceaf57..97f3283818 100755
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -235,8 +235,6 @@ private:
LLInventoryModel::item_array_t& obj_items,
LLInventoryModel::item_array_t& gest_items);
- void removeCategoryContents(const LLUUID& category, bool keep_outfit_links,
- LLPointer<LLInventoryCallback> cb);
static void onOutfitRename(const LLSD& notification, const LLSD& response);
void setOutfitLocked(bool locked);
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index 465a49d004..db8671d51b 100755
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -1828,6 +1828,54 @@ void create_new_item(const std::string& name,
}
+void slam_inventory_folder(const LLUUID& folder_id,
+ const LLSD& contents,
+ LLPointer<LLInventoryCallback> cb)
+{
+ std::string cap;
+ if (AISCommand::getCap(cap))
+ {
+ //LLPointer<AISCommand> cmd_ptr = new SlamFolderCommand(folder_id, contents, cb);
+ //cmd_ptr->run_command();
+ }
+ else // no cap
+ {
+ for (LLSD::array_const_iterator it = contents.beginArray();
+ it != contents.endArray();
+ ++it)
+ {
+ const LLSD& item_contents = *it;
+ link_inventory_item(gAgent.getID(),
+ item_contents["linked_id"].asUUID(),
+ folder_id,
+ item_contents["name"].asString(),
+ item_contents["desc"].asString(),
+ LLAssetType::EType(item_contents["type"].asInteger()),
+ cb);
+ }
+ remove_folder_contents(folder_id,false,cb);
+ }
+}
+
+void remove_folder_contents(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);
+ }
+ }
+}
+
const std::string NEW_LSL_NAME = "New Script"; // *TODO:Translate? (probably not)
const std::string NEW_NOTECARD_NAME = "New Note"; // *TODO:Translate? (probably not)
const std::string NEW_GESTURE_NAME = "New Gesture"; // *TODO:Translate? (probably not)
@@ -2263,3 +2311,5 @@ BOOL LLViewerInventoryItem::regenerateLink()
gInventory.notifyObservers();
return TRUE;
}
+
+
diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h
index c52b0c2d9d..9af71dfc9c 100755
--- a/indra/newview/llviewerinventory.h
+++ b/indra/newview/llviewerinventory.h
@@ -407,4 +407,11 @@ void menu_create_inventory_item(LLInventoryPanel* root,
const LLSD& userdata,
const LLUUID& default_parent_uuid = LLUUID::null);
+void slam_inventory_folder(const LLUUID& folder_id,
+ const LLSD& contents,
+ LLPointer<LLInventoryCallback> cb);
+
+void remove_folder_contents(const LLUUID& folder_id, bool keep_outfit_links,
+ LLPointer<LLInventoryCallback> cb);
+
#endif // LL_LLVIEWERINVENTORY_H