SH-4305 WIP
parent
bbdd2a34d0
commit
ffd7b0d7e7
|
|
@ -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<LLInventoryCallback> 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<LLInventoryCallback> cb)
|
||||
|
|
@ -3383,7 +3431,8 @@ void LLAppearanceMgr::onOutfitFolderCreatedAndClothingOrdered(const LLUUID& fold
|
|||
LLPointer<LLInventoryCallback> 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()
|
||||
|
|
|
|||
|
|
@ -73,6 +73,10 @@ public:
|
|||
void enforceCOFItemRestrictions(LLPointer<LLInventoryCallback> 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<LLInventoryCallback> cb);
|
||||
|
||||
// Copy all items and the src category itself.
|
||||
void shallowCopyCategory(const LLUUID& src_id, const LLUUID& dst_id,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -472,7 +472,7 @@ class LLCreateInventoryCategoryResponder : public LLHTTPClient::Responder
|
|||
LOG_CLASS(LLCreateInventoryCategoryResponder);
|
||||
public:
|
||||
LLCreateInventoryCategoryResponder(LLInventoryModel* model,
|
||||
boost::optional<llsd_func_type> callback):
|
||||
boost::optional<inventory_func_type> callback):
|
||||
mModel(model),
|
||||
mCallback(callback)
|
||||
{
|
||||
|
|
@ -511,12 +511,12 @@ protected:
|
|||
|
||||
if (mCallback)
|
||||
{
|
||||
mCallback.get()(content);
|
||||
mCallback.get()(category_id);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
boost::optional<llsd_func_type> mCallback;
|
||||
boost::optional<inventory_func_type> 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<llsd_func_type> callback)
|
||||
boost::optional<inventory_func_type> callback)
|
||||
{
|
||||
|
||||
LLUUID id;
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ public:
|
|||
LLUUID createNewCategory(const LLUUID& parent_id,
|
||||
LLFolderType::EType preferred_type,
|
||||
const std::string& name,
|
||||
boost::optional<llsd_func_type> callback = boost::optional<llsd_func_type>());
|
||||
boost::optional<inventory_func_type> callback = boost::optional<inventory_func_type>());
|
||||
protected:
|
||||
// Internal methods that add inventory and make sure that all of
|
||||
// the internal data structures are consistent. These methods
|
||||
|
|
|
|||
Loading…
Reference in New Issue