diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 2288f633f41398ee7d7378d7c3666af47edd6a5d..0c09689a702083a68a5caf0921c24c7b9f12f4ae 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 4679ceaf57d1413fb1a9cc353eb8ff8c4678fa8f..97f328381877c861c3f226ce31f007e473bb98de 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -235,8 +235,6 @@ class LLAppearanceMgr: public LLSingleton<LLAppearanceMgr> 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 465a49d0048c0cbe1ec796ea9d6d485a0033d9c3..db8671d51b51ee411b243d39765dc2284128f393 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 c52b0c2d9d00a655d74e4db6e501457e0416f109..9af71dfc9c98f22d6e175f8ae47b54119de96b33 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