From 1a42b98a8f55662aed448e9bcd5035082140bbcf Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 17 Jun 2013 16:56:59 -0400 Subject: SH-4237 WIP - logging cleanup in onAIS handling --- indra/newview/llaisapi.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp index 21f6482a06..e57bbbb0be 100755 --- a/indra/newview/llaisapi.cpp +++ b/indra/newview/llaisapi.cpp @@ -315,7 +315,7 @@ void AISUpdate::parseUpdate(const LLSD& update) } else { - llwarns << "unrecognized embedded field " << field << llendl; + //LL_DEBUGS("Inventory") << "unhandled embedded field " << field << llendl; } } @@ -439,8 +439,9 @@ void AISUpdate::doUpdate() LLViewerInventoryCategory *cat = gInventory.getCategory(id); if (cat->getVersion() != version) { - llwarns << "Possible version mismatch, viewer " << cat->getVersion() - << " server " << version << llendl; + llwarns << "Possible version mismatch for category " << cat->getName() + << ", viewer version " << cat->getVersion() + << " server version " << version << llendl; } } -- cgit v1.2.3 From 3e0e236f33a866a3962295a99495fd1159532ba8 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 24 Jun 2013 15:42:27 -0400 Subject: SH-4243 WIP - cleaned up callback structure for createNewCategory, modified makeNewOutfitLinks() to wait for category creation before populating. --- indra/newview/llappearancemgr.cpp | 49 ++++++++++++++------- indra/newview/llappearancemgr.h | 4 +- indra/newview/llfloateropenobject.cpp | 21 +++------ indra/newview/llfloateropenobject.h | 11 +---- indra/newview/llinventorymodel.cpp | 72 ++++++++++++++----------------- indra/newview/llinventorymodel.h | 9 +--- indra/newview/llpaneloutfitsinventory.cpp | 2 +- indra/newview/llstartup.cpp | 4 +- indra/newview/llviewerinventory.cpp | 3 +- indra/newview/llviewerinventory.h | 6 ++- 10 files changed, 89 insertions(+), 92 deletions(-) diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index cb32bf9c40..93b0e6f4e7 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1466,6 +1466,7 @@ void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LL { case LLAssetType::AT_LINK: { + LL_DEBUGS("Avatar") << "linking inventory item " << item->getName() << llendl; //getActualDescription() is used for a new description //to propagate ordering information saved in descriptions of links link_inventory_item(gAgent.getID(), @@ -1482,6 +1483,7 @@ void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LL // Skip copying outfit links. if (catp && catp->getPreferredType() != LLFolderType::FT_OUTFIT) { + LL_DEBUGS("Avatar") << "linking inventory folder " << item->getName() << llendl; link_inventory_item(gAgent.getID(), item->getLinkedUUID(), dst_id, @@ -1496,7 +1498,7 @@ void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LL case LLAssetType::AT_BODYPART: case LLAssetType::AT_GESTURE: { - llinfos << "copying inventory item " << item->getName() << llendl; + LL_DEBUGS("Avatar") << "copying inventory item " << item->getName() << llendl; copy_inventory_item(gAgent.getID(), item->getPermissions().getOwner(), item->getUUID(), @@ -2815,11 +2817,14 @@ bool LLAppearanceMgr::updateBaseOutfit() llassert(!isOutfitLocked()); return false; } + + setOutfitLocked(true); gAgentWearables.notifyLoadingStarted(); const LLUUID base_outfit_id = getBaseOutfitUUID(); + LL_DEBUGS("Avatar") << "updating base outfit to " << base_outfit_id << llendl; if (base_outfit_id.isNull()) return false; updateClothingOrderingInfo(); @@ -3334,12 +3339,14 @@ void show_created_outfit(LLUUID& folder_id, bool show_panel = true) return; } + LL_DEBUGS("Avatar") << "called" << llendl; LLSD key; //EXT-7727. For new accounts inventory callback is created during login process // and may be processed after login process is finished if (show_panel) { + LL_DEBUGS("Avatar") << "showing panel" << llendl; LLFloaterSidePanelContainer::showPanel("appearance", "panel_outfits_inventory", key); } @@ -3358,32 +3365,44 @@ void show_created_outfit(LLUUID& folder_id, bool show_panel = true) // link, since, the COF version has changed. There is a race // condition in initial outfit setup which can lead to rez // failures - SH-3860. + LL_DEBUGS("Avatar") << "requesting appearance update after createBaseOutfitLink" << llendl; LLPointer cb = new LLUpdateAppearanceOnDestroy; LLAppearanceMgr::getInstance()->createBaseOutfitLink(folder_id, cb); } -LLUUID LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, bool show_panel) +void LLAppearanceMgr::onOutfitFolderCreated(const LLSD& result, bool show_panel) { - 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( - parent_id, - LLFolderType::FT_OUTFIT, - new_folder_name); + LL_DEBUGS("Avatar") << ll_pretty_print_sd(result) << llendl; - updateClothingOrderingInfo(); + LLPointer cb = new LLBoostFuncInventoryCallback(no_op_inventory_func, + boost::bind(&LLAppearanceMgr::onOutfitFolderCreatedAndClothingOrdered,this,result,show_panel)); + updateClothingOrderingInfo(LLUUID::null, false, cb); +} +void LLAppearanceMgr::onOutfitFolderCreatedAndClothingOrdered(const LLSD& result, bool show_panel) +{ + LLUUID folder_id = result["folder_id"].asUUID(); LLPointer cb = new LLBoostFuncInventoryCallback(no_op_inventory_func, boost::bind(show_created_outfit,folder_id,show_panel)); shallowCopyCategoryContents(getCOF(),folder_id, cb); +} + +void LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, bool show_panel) +{ + if (!isAgentAvatarValid()) return; - dumpCat(folder_id,"COF, new outfit"); + LL_DEBUGS("Avatar") << "creating new outfit" << llendl; - return folder_id; + gAgentWearables.notifyLoadingStarted(); + + // First, make a folder in the My Outfits directory. + const LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); + llsd_func_type func = boost::bind(&LLAppearanceMgr::onOutfitFolderCreated,this,_1,show_panel); + gInventory.createNewCategory( + parent_id, + LLFolderType::FT_OUTFIT, + new_folder_name, + func); } void LLAppearanceMgr::wearBaseOutfit() diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index a257f30ea5..d4993780aa 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -186,7 +186,9 @@ public: void removeItemFromAvatar(const LLUUID& item_id); - LLUUID makeNewOutfitLinks(const std::string& new_folder_name,bool show_panel = true); + void onOutfitFolderCreated(const LLSD& result, bool show_panel); + void onOutfitFolderCreatedAndClothingOrdered(const LLSD& result, bool show_panel); + void makeNewOutfitLinks(const std::string& new_folder_name, bool show_panel = true); bool moveWearable(LLViewerInventoryItem* item, bool closer_to_body); diff --git a/indra/newview/llfloateropenobject.cpp b/indra/newview/llfloateropenobject.cpp index 4bfef8b45f..1c086976ba 100755 --- a/indra/newview/llfloateropenobject.cpp +++ b/indra/newview/llfloateropenobject.cpp @@ -162,21 +162,17 @@ void LLFloaterOpenObject::moveToInventory(bool wear) { parent_category_id = gInventory.getRootFolderID(); } - - LLCategoryCreate* cat_data = new LLCategoryCreate(object_id, wear); - + + llsd_func_type func = boost::bind(LLFloaterOpenObject::callbackCreateInventoryCategory,_1,object_id,wear); LLUUID category_id = gInventory.createNewCategory(parent_category_id, LLFolderType::FT_NONE, name, - callbackCreateInventoryCategory, - (void*)cat_data); + func); //If we get a null category ID, we are using a capability in createNewCategory and we will //handle the following in the callbackCreateInventoryCategory routine. if ( category_id.notNull() ) { - delete cat_data; - LLCatAndWear* data = new LLCatAndWear; data->mCatID = category_id; data->mWear = wear; @@ -198,20 +194,18 @@ void LLFloaterOpenObject::moveToInventory(bool wear) } // static -void LLFloaterOpenObject::callbackCreateInventoryCategory(const LLSD& result, void* data) +void LLFloaterOpenObject::callbackCreateInventoryCategory(const LLSD& result, LLUUID object_id, bool wear) { - LLCategoryCreate* cat_data = (LLCategoryCreate*)data; - - LLUUID category_id = result["folder_id"].asUUID(); LLCatAndWear* wear_data = new LLCatAndWear; + LLUUID category_id = result["folder_id"].asUUID(); wear_data->mCatID = category_id; - wear_data->mWear = cat_data->mWear; + wear_data->mWear = wear; wear_data->mFolderResponded = true; // Copy and/or move the items into the newly created folder. // Ignore any "you're going to break this item" messages. - BOOL success = move_inv_category_world_to_agent(cat_data->mObjectID, category_id, TRUE, + BOOL success = move_inv_category_world_to_agent(object_id, category_id, TRUE, callbackMoveInventory, (void*)wear_data); if (!success) @@ -221,7 +215,6 @@ void LLFloaterOpenObject::callbackCreateInventoryCategory(const LLSD& result, vo LLNotificationsUtil::add("OpenObjectCannotCopy"); } - delete cat_data; } // static diff --git a/indra/newview/llfloateropenobject.h b/indra/newview/llfloateropenobject.h index bf7fe69c65..1d7eecd107 100755 --- a/indra/newview/llfloateropenobject.h +++ b/indra/newview/llfloateropenobject.h @@ -45,15 +45,6 @@ public: void dirty(); - class LLCategoryCreate - { - public: - LLCategoryCreate(LLUUID object_id, bool wear) : mObjectID(object_id), mWear(wear) {} - public: - LLUUID mObjectID; - bool mWear; - }; - struct LLCatAndWear { LLUUID mCatID; @@ -72,7 +63,7 @@ protected: void onClickMoveToInventory(); void onClickMoveAndWear(); - static void callbackCreateInventoryCategory(const LLSD& result, void* data); + static void callbackCreateInventoryCategory(const LLSD& result, LLUUID object_id, bool wear); static void callbackMoveInventory(S32 result, void* data); private: diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index aadf87ab35..82d58523ce 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -472,11 +472,9 @@ class LLCreateInventoryCategoryResponder : public LLHTTPClient::Responder LOG_CLASS(LLCreateInventoryCategoryResponder); public: LLCreateInventoryCategoryResponder(LLInventoryModel* model, - void (*callback)(const LLSD&, void*), - void* user_data) : - mModel(model), - mCallback(callback), - mData(user_data) + boost::optional callback): + mModel(model), + mCallback(callback) { } @@ -497,7 +495,7 @@ protected: } LLUUID category_id = content["folder_id"].asUUID(); - + LL_DEBUGS("Avatar") << ll_pretty_print_sd(content) << llendl; // Add the category to the internal representation LLPointer cat = new LLViewerInventoryCategory( category_id, @@ -510,17 +508,15 @@ protected: LLInventoryModel::LLCategoryUpdate update(cat->getParentUUID(), 1); mModel->accountForUpdate(update); mModel->updateCategory(cat); - - if (mCallback && mData) + + if (mCallback) { - mCallback(content, mData); + mCallback.get()(content); } - } private: - void (*mCallback)(const LLSD&, void*); - void* mData; + boost::optional mCallback; LLInventoryModel* mModel; }; @@ -531,8 +527,7 @@ private: LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, LLFolderType::EType preferred_type, const std::string& pname, - void (*callback)(const LLSD&, void*), //Default to NULL - void* user_data) //Default to NULL + boost::optional callback) { LLUUID id; @@ -559,33 +554,32 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, name.assign(LLViewerFolderType::lookupNewCategoryName(preferred_type)); } - if ( callback && user_data ) //callback required for acked message. + LLViewerRegion* viewer_region = gAgent.getRegion(); + std::string url; + if ( viewer_region ) + url = viewer_region->getCapability("CreateInventoryCategory"); + + if (!url.empty() && callback.get_ptr()) { - LLViewerRegion* viewer_region = gAgent.getRegion(); - std::string url; - if ( viewer_region ) - url = viewer_region->getCapability("CreateInventoryCategory"); + //Let's use the new capability. - if (!url.empty()) - { - //Let's use the new capability. - - LLSD request, body; - body["folder_id"] = id; - body["parent_id"] = parent_id; - body["type"] = (LLSD::Integer) preferred_type; - body["name"] = name; - - request["message"] = "CreateInventoryCategory"; - request["payload"] = body; - - // viewer_region->getCapAPI().post(request); - LLHTTPClient::post( - url, - body, - new LLCreateInventoryCategoryResponder(this, callback, user_data) ); - return LLUUID::null; - } + LLSD request, body; + body["folder_id"] = id; + body["parent_id"] = parent_id; + body["type"] = (LLSD::Integer) preferred_type; + body["name"] = name; + + request["message"] = "CreateInventoryCategory"; + request["payload"] = body; + + LL_DEBUGS("Avatar") << "create category request: " << ll_pretty_print_sd(request) << llendl; + // viewer_region->getCapAPI().post(request); + LLHTTPClient::post( + url, + body, + new LLCreateInventoryCategoryResponder(this, callback) ); + + return LLUUID::null; } // Add the category to the internal representation diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index 5de951ed05..f28211cfa1 100755 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -34,6 +34,7 @@ #include "llhttpclient.h" #include "lluuid.h" #include "llpermissionsflags.h" +#include "llviewerinventory.h" #include "llstring.h" #include "llmd5.h" #include @@ -45,14 +46,9 @@ class LLInventoryObserver; class LLInventoryObject; class LLInventoryItem; class LLInventoryCategory; -class LLViewerInventoryItem; -class LLViewerInventoryCategory; -class LLViewerInventoryItem; -class LLViewerInventoryCategory; class LLMessageSystem; class LLInventoryCollectFunctor; - //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // LLInventoryModel // @@ -394,8 +390,7 @@ public: LLUUID createNewCategory(const LLUUID& parent_id, LLFolderType::EType preferred_type, const std::string& name, - void (*callback)(const LLSD&, void*) = NULL, - void* user_data = NULL ); + boost::optional callback = boost::optional()); protected: // Internal methods that add inventory and make sure that all of // the internal data structures are consistent. These methods diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index d6c927ab58..21b77ef471 100755 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -184,7 +184,7 @@ bool LLPanelOutfitsInventory::onSaveCommit(const LLSD& notification, const LLSD& LLStringUtil::trim(outfit_name); if( !outfit_name.empty() ) { - LLUUID outfit_folder = LLAppearanceMgr::getInstance()->makeNewOutfitLinks(outfit_name); + LLAppearanceMgr::getInstance()->makeNewOutfitLinks(outfit_name); LLSidepanelAppearance* panel_appearance = getAppearanceSP(); if (panel_appearance) diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 8890df199b..84d42c6345 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2613,10 +2613,10 @@ void LLStartUp::saveInitialOutfit() if (sWearablesLoadedCon.connected()) { - lldebugs << "sWearablesLoadedCon is connected, disconnecting" << llendl; + LL_DEBUGS("Avatar") << "sWearablesLoadedCon is connected, disconnecting" << llendl; sWearablesLoadedCon.disconnect(); } - lldebugs << "calling makeNewOutfitLinks( \"" << sInitialOutfit << "\" )" << llendl; + LL_DEBUGS("Avatar") << "calling makeNewOutfitLinks( \"" << sInitialOutfit << "\" )" << llendl; LLAppearanceMgr::getInstance()->makeNewOutfitLinks(sInitialOutfit,false); } diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 26aecd39d1..9725ea6456 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -69,8 +69,9 @@ #include "llclipboard.h" #include "llhttpretrypolicy.h" -// Two do-nothing ops for use in callbacks. +// do-nothing ops for use in callbacks. void no_op_inventory_func(const LLUUID&) {} +void no_op_llsd_func(const LLSD&) {} void no_op() {} ///---------------------------------------------------------------------------- diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 032efd9542..de1f3daa1e 100755 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -263,9 +263,11 @@ private: }; typedef boost::function inventory_func_type; -void no_op_inventory_func(const LLUUID&); // A do-nothing inventory_func - +typedef boost::function llsd_func_type; typedef boost::function nullary_func_type; + +void no_op_inventory_func(const LLUUID&); // A do-nothing inventory_func +void no_op_llsd_func(const LLSD&); // likewise for LLSD void no_op(); // A do-nothing nullary func. // Shim between inventory callback and boost function/callable -- cgit v1.2.3 From bbdd2a34d01d938226c7935a3d52ec0a7c483e90 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 25 Jun 2013 10:00:46 -0400 Subject: SH-4243 FIX - removed wait for category creation, since callback-based cap only works correctly if a recent fix is deployed server-side. May revisit at some point. --- indra/newview/llappearancemgr.cpp | 25 ++++++++++++------------- indra/newview/llappearancemgr.h | 4 ++-- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 93b0e6f4e7..c068a6358f 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3370,20 +3370,19 @@ void show_created_outfit(LLUUID& folder_id, bool show_panel = true) LLAppearanceMgr::getInstance()->createBaseOutfitLink(folder_id, cb); } -void LLAppearanceMgr::onOutfitFolderCreated(const LLSD& result, bool show_panel) +void LLAppearanceMgr::onOutfitFolderCreated(const LLUUID& folder_id, bool show_panel) { - LL_DEBUGS("Avatar") << ll_pretty_print_sd(result) << llendl; - - LLPointer cb = new LLBoostFuncInventoryCallback(no_op_inventory_func, - boost::bind(&LLAppearanceMgr::onOutfitFolderCreatedAndClothingOrdered,this,result,show_panel)); + LLPointer cb = + new LLBoostFuncInventoryCallback(no_op_inventory_func, + boost::bind(&LLAppearanceMgr::onOutfitFolderCreatedAndClothingOrdered,this,folder_id,show_panel)); updateClothingOrderingInfo(LLUUID::null, false, cb); } -void LLAppearanceMgr::onOutfitFolderCreatedAndClothingOrdered(const LLSD& result, bool show_panel) +void LLAppearanceMgr::onOutfitFolderCreatedAndClothingOrdered(const LLUUID& folder_id, bool show_panel) { - LLUUID folder_id = result["folder_id"].asUUID(); - LLPointer cb = new LLBoostFuncInventoryCallback(no_op_inventory_func, - boost::bind(show_created_outfit,folder_id,show_panel)); + LLPointer cb = + new LLBoostFuncInventoryCallback(no_op_inventory_func, + boost::bind(show_created_outfit,folder_id,show_panel)); shallowCopyCategoryContents(getCOF(),folder_id, cb); } @@ -3397,12 +3396,12 @@ void LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, boo // First, make a folder in the My Outfits directory. const LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); - llsd_func_type func = boost::bind(&LLAppearanceMgr::onOutfitFolderCreated,this,_1,show_panel); - gInventory.createNewCategory( + //llsd_func_type func = boost::bind(&LLAppearanceMgr::onOutfitFolderCreated,this,_1,show_panel); + LLUUID folder_id = gInventory.createNewCategory( parent_id, LLFolderType::FT_OUTFIT, - new_folder_name, - func); + new_folder_name); + onOutfitFolderCreated(folder_id, show_panel); } void LLAppearanceMgr::wearBaseOutfit() diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index d4993780aa..beed6e824a 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -186,8 +186,8 @@ public: void removeItemFromAvatar(const LLUUID& item_id); - void onOutfitFolderCreated(const LLSD& result, bool show_panel); - void onOutfitFolderCreatedAndClothingOrdered(const LLSD& result, bool show_panel); + void onOutfitFolderCreated(const LLUUID& folder_id, bool show_panel); + void onOutfitFolderCreatedAndClothingOrdered(const LLUUID& folder_id, bool show_panel); void makeNewOutfitLinks(const std::string& new_folder_name, bool show_panel = true); bool moveWearable(LLViewerInventoryItem* item, bool closer_to_body); -- cgit v1.2.3 From ffd7b0d7e7ef13510d7299e601a71c7fedb0a4d1 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 25 Jun 2013 17:52:02 -0400 Subject: SH-4305 WIP --- indra/newview/llappearancemgr.cpp | 78 +++++++++++++++++++++++++++++++---- indra/newview/llappearancemgr.h | 4 ++ indra/newview/llfloateropenobject.cpp | 5 +-- indra/newview/llfloateropenobject.h | 2 +- indra/newview/llinventorymodel.cpp | 8 ++-- indra/newview/llinventorymodel.h | 2 +- 6 files changed, 83 insertions(+), 16 deletions(-) diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index c068a6358f..f19500c98d 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -53,6 +53,7 @@ #include "llsdutil.h" #include "llsdserialize.h" #include "llhttpretrypolicy.h" +#include "llaisapi.h" #if LL_MSVC // disable boost::lexical_cast warning @@ -1449,6 +1450,53 @@ void LLAppearanceMgr::shallowCopyCategory(const LLUUID& src_id, const LLUUID& ds gInventory.notifyObservers(); } +void LLAppearanceMgr::copyCategoryLinks(const LLUUID& src_id, const LLUUID& dst_id, + bool include_folder_links, LLPointer cb) +{ + LLInventoryModel::cat_array_t* cats; + LLInventoryModel::item_array_t* items; + LLSD contents = LLSD::emptyArray(); + gInventory.getDirectDescendentsOf(src_id, cats, items); + llinfos << "copying " << items->count() << " items" << llendl; + for (LLInventoryModel::item_array_t::const_iterator iter = items->begin(); + iter != items->end(); + ++iter) + { + const LLViewerInventoryItem* item = (*iter); + switch (item->getActualType()) + { + case LLAssetType::AT_LINK: + { + LL_DEBUGS("Avatar") << "linking inventory item " << item->getName() << llendl; + //getActualDescription() is used for a new description + //to propagate ordering information saved in descriptions of links + LLSD item_contents; + 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); + break; + } + case LLAssetType::AT_LINK_FOLDER: + { + LLViewerInventoryCategory *catp = item->getLinkedCategory(); + if (catp && include_folder_links) + { + LL_DEBUGS("Avatar") << "linking inventory folder " << item->getName() << llendl; + LLSD base_contents; + base_contents["name"] = catp->getName(); + base_contents["desc"] = ""; // categories don't have descriptions. + base_contents["linked_id"] = catp->getLinkedUUID(); + base_contents["type"] = LLAssetType::AT_LINK_FOLDER; + contents.append(base_contents); + } + break; + } + } + } + slam_inventory_folder(dst_id, contents, cb); +} // Copy contents of src_id to dst_id. void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LLUUID& dst_id, LLPointer cb) @@ -3383,7 +3431,8 @@ void LLAppearanceMgr::onOutfitFolderCreatedAndClothingOrdered(const LLUUID& fold LLPointer cb = new LLBoostFuncInventoryCallback(no_op_inventory_func, boost::bind(show_created_outfit,folder_id,show_panel)); - shallowCopyCategoryContents(getCOF(),folder_id, cb); + bool copy_folder_links = false; + copyCategoryLinks(getCOF(), folder_id, copy_folder_links, cb); } void LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, bool show_panel) @@ -3396,12 +3445,27 @@ void LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, boo // First, make a folder in the My Outfits directory. const LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); - //llsd_func_type func = boost::bind(&LLAppearanceMgr::onOutfitFolderCreated,this,_1,show_panel); - LLUUID folder_id = gInventory.createNewCategory( - parent_id, - LLFolderType::FT_OUTFIT, - new_folder_name); - onOutfitFolderCreated(folder_id, show_panel); + std::string cap; + if (AISCommand::getCap(cap)) + { + // cap-based category creation was buggy until recently. use + // existence of AIS as an indicator the fix is present. Does + // not actually use AIS to create the category. + inventory_func_type func = boost::bind(&LLAppearanceMgr::onOutfitFolderCreated,this,_1,show_panel); + LLUUID folder_id = gInventory.createNewCategory( + parent_id, + LLFolderType::FT_OUTFIT, + new_folder_name, + func); + } + else + { + LLUUID folder_id = gInventory.createNewCategory( + parent_id, + LLFolderType::FT_OUTFIT, + new_folder_name); + onOutfitFolderCreated(folder_id, show_panel); + } } void LLAppearanceMgr::wearBaseOutfit() diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index beed6e824a..4d7c536b3d 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -73,6 +73,10 @@ public: void enforceCOFItemRestrictions(LLPointer cb); S32 getActiveCopyOperations() const; + + // Copy all links via the slam command (single inventory operation where supported) + void copyCategoryLinks(const LLUUID& src_id, const LLUUID& dst_id, + bool include_folder_links, LLPointer cb); // Copy all items and the src category itself. void shallowCopyCategory(const LLUUID& src_id, const LLUUID& dst_id, diff --git a/indra/newview/llfloateropenobject.cpp b/indra/newview/llfloateropenobject.cpp index 1c086976ba..9986bdbd7f 100755 --- a/indra/newview/llfloateropenobject.cpp +++ b/indra/newview/llfloateropenobject.cpp @@ -163,7 +163,7 @@ void LLFloaterOpenObject::moveToInventory(bool wear) parent_category_id = gInventory.getRootFolderID(); } - llsd_func_type func = boost::bind(LLFloaterOpenObject::callbackCreateInventoryCategory,_1,object_id,wear); + inventory_func_type func = boost::bind(LLFloaterOpenObject::callbackCreateInventoryCategory,_1,object_id,wear); LLUUID category_id = gInventory.createNewCategory(parent_category_id, LLFolderType::FT_NONE, name, @@ -194,10 +194,9 @@ void LLFloaterOpenObject::moveToInventory(bool wear) } // static -void LLFloaterOpenObject::callbackCreateInventoryCategory(const LLSD& result, LLUUID object_id, bool wear) +void LLFloaterOpenObject::callbackCreateInventoryCategory(const LLUUID& category_id, LLUUID object_id, bool wear) { LLCatAndWear* wear_data = new LLCatAndWear; - LLUUID category_id = result["folder_id"].asUUID(); wear_data->mCatID = category_id; wear_data->mWear = wear; diff --git a/indra/newview/llfloateropenobject.h b/indra/newview/llfloateropenobject.h index 1d7eecd107..8e472804a4 100755 --- a/indra/newview/llfloateropenobject.h +++ b/indra/newview/llfloateropenobject.h @@ -63,7 +63,7 @@ protected: void onClickMoveToInventory(); void onClickMoveAndWear(); - static void callbackCreateInventoryCategory(const LLSD& result, LLUUID object_id, bool wear); + static void callbackCreateInventoryCategory(const LLUUID& category_id, LLUUID object_id, bool wear); static void callbackMoveInventory(S32 result, void* data); private: diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 82d58523ce..e1fd2e02fa 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -472,7 +472,7 @@ class LLCreateInventoryCategoryResponder : public LLHTTPClient::Responder LOG_CLASS(LLCreateInventoryCategoryResponder); public: LLCreateInventoryCategoryResponder(LLInventoryModel* model, - boost::optional callback): + boost::optional callback): mModel(model), mCallback(callback) { @@ -511,12 +511,12 @@ protected: if (mCallback) { - mCallback.get()(content); + mCallback.get()(category_id); } } private: - boost::optional mCallback; + boost::optional mCallback; LLInventoryModel* mModel; }; @@ -527,7 +527,7 @@ private: LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, LLFolderType::EType preferred_type, const std::string& pname, - boost::optional callback) + boost::optional callback) { LLUUID id; diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index f28211cfa1..ee0d4e1994 100755 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -390,7 +390,7 @@ public: LLUUID createNewCategory(const LLUUID& parent_id, LLFolderType::EType preferred_type, const std::string& name, - boost::optional callback = boost::optional()); + boost::optional callback = boost::optional()); protected: // Internal methods that add inventory and make sure that all of // the internal data structures are consistent. These methods -- cgit v1.2.3 From e2e198d9b36f4ef90ef7ca088e643b1fc399c53e Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 26 Jun 2013 10:50:07 -0400 Subject: SH-4305 WIP - fix for compiler grumbling on linux build. --- indra/newview/llappearancemgr.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index f19500c98d..8a0814734c 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1493,6 +1493,11 @@ void LLAppearanceMgr::copyCategoryLinks(const LLUUID& src_id, const LLUUID& dst_ } break; } + default: + { + // Linux refuses to compile unless all possible enums are handled. Really, Linux? + break; + } } } slam_inventory_folder(dst_id, contents, cb); -- cgit v1.2.3