SH-4300 WIP - removed outfit autopopulate
parent
4c75140008
commit
8090388a27
|
|
@ -1861,24 +1861,6 @@ void LLAgentWearables::updateServer()
|
|||
gAgent.sendAgentSetAppearance();
|
||||
}
|
||||
|
||||
void LLAgentWearables::populateMyOutfitsFolder(void)
|
||||
{
|
||||
llinfos << "starting outfit population" << llendl;
|
||||
|
||||
const LLUUID& my_outfits_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
|
||||
LLLibraryOutfitsFetch* outfits = new LLLibraryOutfitsFetch(my_outfits_id);
|
||||
outfits->mMyOutfitsID = my_outfits_id;
|
||||
|
||||
// Get the complete information on the items in the inventory and
|
||||
// setup an observer that will wait for that to happen.
|
||||
gInventory.addObserver(outfits);
|
||||
outfits->startFetch();
|
||||
if (outfits->isFinished())
|
||||
{
|
||||
outfits->done();
|
||||
}
|
||||
}
|
||||
|
||||
boost::signals2::connection LLAgentWearables::addLoadingStartedCallback(loading_started_callback_t cb)
|
||||
{
|
||||
return mLoadingStartedSignal.connect(cb);
|
||||
|
|
|
|||
|
|
@ -171,12 +171,6 @@ protected:
|
|||
//--------------------------------------------------------------------
|
||||
// Outfits
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
|
||||
// Should only be called if we *know* we've never done so before, since users may
|
||||
// not want the Library outfits to stay in their quick outfit selector and can delete them.
|
||||
void populateMyOutfitsFolder();
|
||||
|
||||
private:
|
||||
void makeNewOutfitDone(S32 type, U32 index);
|
||||
|
||||
|
|
|
|||
|
|
@ -35,46 +35,6 @@
|
|||
#include "llvoavatarself.h"
|
||||
|
||||
|
||||
void order_my_outfits_cb()
|
||||
{
|
||||
if (!LLApp::isRunning())
|
||||
{
|
||||
llwarns << "called during shutdown, skipping" << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
const LLUUID& my_outfits_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
|
||||
if (my_outfits_id.isNull()) return;
|
||||
|
||||
LLInventoryModel::cat_array_t* cats;
|
||||
LLInventoryModel::item_array_t* items;
|
||||
gInventory.getDirectDescendentsOf(my_outfits_id, cats, items);
|
||||
if (!cats) return;
|
||||
|
||||
//My Outfits should at least contain saved initial outfit and one another outfit
|
||||
if (cats->size() < 2)
|
||||
{
|
||||
llwarning("My Outfits category was not populated properly", 0);
|
||||
return;
|
||||
}
|
||||
|
||||
llinfos << "Starting updating My Outfits with wearables ordering information" << llendl;
|
||||
|
||||
for (LLInventoryModel::cat_array_t::iterator outfit_iter = cats->begin();
|
||||
outfit_iter != cats->end(); ++outfit_iter)
|
||||
{
|
||||
const LLUUID& cat_id = (*outfit_iter)->getUUID();
|
||||
if (cat_id.isNull()) continue;
|
||||
|
||||
// saved initial outfit already contains wearables ordering information
|
||||
if (cat_id == LLAppearanceMgr::getInstance()->getBaseOutfitUUID()) continue;
|
||||
|
||||
LLAppearanceMgr::getInstance()->updateClothingOrderingInfo(cat_id);
|
||||
}
|
||||
|
||||
llinfos << "Finished updating My Outfits with wearables ordering information" << llendl;
|
||||
}
|
||||
|
||||
LLInitialWearablesFetch::LLInitialWearablesFetch(const LLUUID& cof_id) :
|
||||
LLInventoryFetchDescendentsObserver(cof_id)
|
||||
{
|
||||
|
|
@ -244,357 +204,3 @@ void LLInitialWearablesFetch::processWearablesMessage()
|
|||
}
|
||||
}
|
||||
|
||||
LLLibraryOutfitsFetch::LLLibraryOutfitsFetch(const LLUUID& my_outfits_id) :
|
||||
LLInventoryFetchDescendentsObserver(my_outfits_id),
|
||||
mCurrFetchStep(LOFS_FOLDER),
|
||||
mOutfitsPopulated(false)
|
||||
{
|
||||
llinfos << "created" << llendl;
|
||||
|
||||
mMyOutfitsID = LLUUID::null;
|
||||
mClothingID = LLUUID::null;
|
||||
mLibraryClothingID = LLUUID::null;
|
||||
mImportedClothingID = LLUUID::null;
|
||||
mImportedClothingName = "Imported Library Clothing";
|
||||
}
|
||||
|
||||
LLLibraryOutfitsFetch::~LLLibraryOutfitsFetch()
|
||||
{
|
||||
llinfos << "destroyed" << llendl;
|
||||
}
|
||||
|
||||
void LLLibraryOutfitsFetch::done()
|
||||
{
|
||||
llinfos << "start" << llendl;
|
||||
|
||||
// Delay this until idle() routine, since it's a heavy operation and
|
||||
// we also can't have it run within notifyObservers.
|
||||
doOnIdleOneTime(boost::bind(&LLLibraryOutfitsFetch::doneIdle,this));
|
||||
gInventory.removeObserver(this); // Prevent doOnIdleOneTime from being added twice.
|
||||
}
|
||||
|
||||
void LLLibraryOutfitsFetch::doneIdle()
|
||||
{
|
||||
llinfos << "start" << llendl;
|
||||
|
||||
gInventory.addObserver(this); // Add this back in since it was taken out during ::done()
|
||||
|
||||
switch (mCurrFetchStep)
|
||||
{
|
||||
case LOFS_FOLDER:
|
||||
folderDone();
|
||||
mCurrFetchStep = LOFS_OUTFITS;
|
||||
break;
|
||||
case LOFS_OUTFITS:
|
||||
outfitsDone();
|
||||
mCurrFetchStep = LOFS_LIBRARY;
|
||||
break;
|
||||
case LOFS_LIBRARY:
|
||||
libraryDone();
|
||||
mCurrFetchStep = LOFS_IMPORTED;
|
||||
break;
|
||||
case LOFS_IMPORTED:
|
||||
importedFolderDone();
|
||||
mCurrFetchStep = LOFS_CONTENTS;
|
||||
break;
|
||||
case LOFS_CONTENTS:
|
||||
contentsDone();
|
||||
break;
|
||||
default:
|
||||
llwarns << "Got invalid state for outfit fetch: " << mCurrFetchStep << llendl;
|
||||
mOutfitsPopulated = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
// We're completely done. Cleanup.
|
||||
if (mOutfitsPopulated)
|
||||
{
|
||||
gInventory.removeObserver(this);
|
||||
delete this;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void LLLibraryOutfitsFetch::folderDone()
|
||||
{
|
||||
llinfos << "start" << llendl;
|
||||
|
||||
LLInventoryModel::cat_array_t cat_array;
|
||||
LLInventoryModel::item_array_t wearable_array;
|
||||
gInventory.collectDescendents(mMyOutfitsID, cat_array, wearable_array,
|
||||
LLInventoryModel::EXCLUDE_TRASH);
|
||||
|
||||
// Early out if we already have items in My Outfits
|
||||
// except the case when My Outfits contains just initial outfit
|
||||
if (cat_array.count() > 1)
|
||||
{
|
||||
mOutfitsPopulated = true;
|
||||
return;
|
||||
}
|
||||
|
||||
mClothingID = gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING);
|
||||
mLibraryClothingID = gInventory.findLibraryCategoryUUIDForType(LLFolderType::FT_CLOTHING, false);
|
||||
|
||||
// If Library->Clothing->Initial Outfits exists, use that.
|
||||
LLNameCategoryCollector matchFolderFunctor("Initial Outfits");
|
||||
cat_array.clear();
|
||||
gInventory.collectDescendentsIf(mLibraryClothingID,
|
||||
cat_array, wearable_array,
|
||||
LLInventoryModel::EXCLUDE_TRASH,
|
||||
matchFolderFunctor);
|
||||
if (cat_array.count() > 0)
|
||||
{
|
||||
const LLViewerInventoryCategory *cat = cat_array.get(0);
|
||||
mLibraryClothingID = cat->getUUID();
|
||||
}
|
||||
|
||||
mComplete.clear();
|
||||
|
||||
// Get the complete information on the items in the inventory.
|
||||
uuid_vec_t folders;
|
||||
folders.push_back(mClothingID);
|
||||
folders.push_back(mLibraryClothingID);
|
||||
setFetchIDs(folders);
|
||||
startFetch();
|
||||
if (isFinished())
|
||||
{
|
||||
done();
|
||||
}
|
||||
}
|
||||
|
||||
void LLLibraryOutfitsFetch::outfitsDone()
|
||||
{
|
||||
llinfos << "start" << llendl;
|
||||
|
||||
LLInventoryModel::cat_array_t cat_array;
|
||||
LLInventoryModel::item_array_t wearable_array;
|
||||
uuid_vec_t folders;
|
||||
|
||||
// Collect the contents of the Library's Clothing folder
|
||||
gInventory.collectDescendents(mLibraryClothingID, cat_array, wearable_array,
|
||||
LLInventoryModel::EXCLUDE_TRASH);
|
||||
|
||||
llassert(cat_array.count() > 0);
|
||||
for (LLInventoryModel::cat_array_t::const_iterator iter = cat_array.begin();
|
||||
iter != cat_array.end();
|
||||
++iter)
|
||||
{
|
||||
const LLViewerInventoryCategory *cat = iter->get();
|
||||
|
||||
// Get the names and id's of every outfit in the library, skip "Ruth"
|
||||
// because it's a low quality legacy outfit
|
||||
if (cat->getName() != "Ruth")
|
||||
{
|
||||
// Get the name of every outfit in the library
|
||||
folders.push_back(cat->getUUID());
|
||||
mLibraryClothingFolders.push_back(cat->getUUID());
|
||||
}
|
||||
}
|
||||
cat_array.clear();
|
||||
wearable_array.clear();
|
||||
|
||||
// Check if you already have an "Imported Library Clothing" folder
|
||||
LLNameCategoryCollector matchFolderFunctor(mImportedClothingName);
|
||||
gInventory.collectDescendentsIf(mClothingID,
|
||||
cat_array, wearable_array,
|
||||
LLInventoryModel::EXCLUDE_TRASH,
|
||||
matchFolderFunctor);
|
||||
if (cat_array.size() > 0)
|
||||
{
|
||||
const LLViewerInventoryCategory *cat = cat_array.get(0);
|
||||
mImportedClothingID = cat->getUUID();
|
||||
}
|
||||
|
||||
mComplete.clear();
|
||||
setFetchIDs(folders);
|
||||
startFetch();
|
||||
if (isFinished())
|
||||
{
|
||||
done();
|
||||
}
|
||||
}
|
||||
|
||||
class LLLibraryOutfitsCopyDone: public LLInventoryCallback
|
||||
{
|
||||
public:
|
||||
LLLibraryOutfitsCopyDone(LLLibraryOutfitsFetch * fetcher):
|
||||
mFireCount(0), mLibraryOutfitsFetcher(fetcher)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~LLLibraryOutfitsCopyDone()
|
||||
{
|
||||
if (!LLApp::isExiting() && mLibraryOutfitsFetcher)
|
||||
{
|
||||
gInventory.addObserver(mLibraryOutfitsFetcher);
|
||||
mLibraryOutfitsFetcher->done();
|
||||
}
|
||||
}
|
||||
|
||||
/* virtual */ void fire(const LLUUID& inv_item)
|
||||
{
|
||||
mFireCount++;
|
||||
}
|
||||
private:
|
||||
U32 mFireCount;
|
||||
LLLibraryOutfitsFetch * mLibraryOutfitsFetcher;
|
||||
};
|
||||
|
||||
// Copy the clothing folders from the library into the imported clothing folder
|
||||
void LLLibraryOutfitsFetch::libraryDone()
|
||||
{
|
||||
llinfos << "start" << llendl;
|
||||
|
||||
if (mImportedClothingID != LLUUID::null)
|
||||
{
|
||||
// Skip straight to fetching the contents of the imported folder
|
||||
importedFolderFetch();
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove observer; next autopopulation step will be triggered externally by LLLibraryOutfitsCopyDone.
|
||||
gInventory.removeObserver(this);
|
||||
|
||||
LLPointer<LLInventoryCallback> copy_waiter = new LLLibraryOutfitsCopyDone(this);
|
||||
mImportedClothingID = gInventory.createNewCategory(mClothingID,
|
||||
LLFolderType::FT_NONE,
|
||||
mImportedClothingName);
|
||||
// Copy each folder from library into clothing unless it already exists.
|
||||
for (uuid_vec_t::const_iterator iter = mLibraryClothingFolders.begin();
|
||||
iter != mLibraryClothingFolders.end();
|
||||
++iter)
|
||||
{
|
||||
const LLUUID& src_folder_id = (*iter); // Library clothing folder ID
|
||||
const LLViewerInventoryCategory *cat = gInventory.getCategory(src_folder_id);
|
||||
if (!cat)
|
||||
{
|
||||
llwarns << "Library folder import for uuid:" << src_folder_id << " failed to find folder." << llendl;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!LLAppearanceMgr::getInstance()->getCanMakeFolderIntoOutfit(src_folder_id))
|
||||
{
|
||||
llinfos << "Skipping non-outfit folder name:" << cat->getName() << llendl;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Don't copy the category if it already exists.
|
||||
LLNameCategoryCollector matchFolderFunctor(cat->getName());
|
||||
LLInventoryModel::cat_array_t cat_array;
|
||||
LLInventoryModel::item_array_t wearable_array;
|
||||
gInventory.collectDescendentsIf(mImportedClothingID,
|
||||
cat_array, wearable_array,
|
||||
LLInventoryModel::EXCLUDE_TRASH,
|
||||
matchFolderFunctor);
|
||||
if (cat_array.size() > 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
LLUUID dst_folder_id = gInventory.createNewCategory(mImportedClothingID,
|
||||
LLFolderType::FT_NONE,
|
||||
cat->getName());
|
||||
LLAppearanceMgr::getInstance()->shallowCopyCategoryContents(src_folder_id, dst_folder_id, copy_waiter);
|
||||
}
|
||||
}
|
||||
|
||||
void LLLibraryOutfitsFetch::importedFolderFetch()
|
||||
{
|
||||
llinfos << "start" << llendl;
|
||||
|
||||
// Fetch the contents of the Imported Clothing Folder
|
||||
uuid_vec_t folders;
|
||||
folders.push_back(mImportedClothingID);
|
||||
|
||||
mComplete.clear();
|
||||
setFetchIDs(folders);
|
||||
startFetch();
|
||||
if (isFinished())
|
||||
{
|
||||
done();
|
||||
}
|
||||
}
|
||||
|
||||
void LLLibraryOutfitsFetch::importedFolderDone()
|
||||
{
|
||||
llinfos << "start" << llendl;
|
||||
|
||||
LLInventoryModel::cat_array_t cat_array;
|
||||
LLInventoryModel::item_array_t wearable_array;
|
||||
uuid_vec_t folders;
|
||||
|
||||
// Collect the contents of the Imported Clothing folder
|
||||
gInventory.collectDescendents(mImportedClothingID, cat_array, wearable_array,
|
||||
LLInventoryModel::EXCLUDE_TRASH);
|
||||
|
||||
for (LLInventoryModel::cat_array_t::const_iterator iter = cat_array.begin();
|
||||
iter != cat_array.end();
|
||||
++iter)
|
||||
{
|
||||
const LLViewerInventoryCategory *cat = iter->get();
|
||||
|
||||
// Get the name of every imported outfit
|
||||
folders.push_back(cat->getUUID());
|
||||
mImportedClothingFolders.push_back(cat->getUUID());
|
||||
}
|
||||
|
||||
mComplete.clear();
|
||||
setFetchIDs(folders);
|
||||
startFetch();
|
||||
if (isFinished())
|
||||
{
|
||||
done();
|
||||
}
|
||||
}
|
||||
|
||||
void LLLibraryOutfitsFetch::contentsDone()
|
||||
{
|
||||
llinfos << "start" << llendl;
|
||||
|
||||
LLInventoryModel::cat_array_t cat_array;
|
||||
LLInventoryModel::item_array_t wearable_array;
|
||||
|
||||
LLPointer<LLInventoryCallback> order_myoutfits_on_destroy = new LLBoostFuncInventoryCallback(no_op_inventory_func, order_my_outfits_cb);
|
||||
|
||||
for (uuid_vec_t::const_iterator folder_iter = mImportedClothingFolders.begin();
|
||||
folder_iter != mImportedClothingFolders.end();
|
||||
++folder_iter)
|
||||
{
|
||||
const LLUUID &folder_id = (*folder_iter);
|
||||
const LLViewerInventoryCategory *cat = gInventory.getCategory(folder_id);
|
||||
if (!cat)
|
||||
{
|
||||
llwarns << "Library folder import for uuid:" << folder_id << " failed to find folder." << llendl;
|
||||
continue;
|
||||
}
|
||||
|
||||
//initial outfit should be already in My Outfits
|
||||
if (cat->getName() == LLStartUp::getInitialOutfitName()) continue;
|
||||
|
||||
// First, make a folder in the My Outfits directory.
|
||||
LLUUID new_outfit_folder_id = gInventory.createNewCategory(mMyOutfitsID, LLFolderType::FT_OUTFIT, cat->getName());
|
||||
|
||||
cat_array.clear();
|
||||
wearable_array.clear();
|
||||
// Collect the contents of each imported clothing folder, so we can create new outfit links for it
|
||||
gInventory.collectDescendents(folder_id, cat_array, wearable_array,
|
||||
LLInventoryModel::EXCLUDE_TRASH);
|
||||
|
||||
for (LLInventoryModel::item_array_t::const_iterator wearable_iter = wearable_array.begin();
|
||||
wearable_iter != wearable_array.end();
|
||||
++wearable_iter)
|
||||
{
|
||||
const LLViewerInventoryItem *item = wearable_iter->get();
|
||||
link_inventory_item(gAgent.getID(),
|
||||
item->getLinkedUUID(),
|
||||
new_outfit_folder_id,
|
||||
item->getName(),
|
||||
item->getDescription(),
|
||||
LLAssetType::AT_LINK,
|
||||
order_myoutfits_on_destroy);
|
||||
}
|
||||
}
|
||||
|
||||
mOutfitsPopulated = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,45 +70,4 @@ private:
|
|||
initial_wearable_data_vec_t mAgentInitialWearables; // Wearables from the old agent wearables msg
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// InitialWearablesFetch
|
||||
//
|
||||
// This grabs outfits from the Library and copies those over to the user's
|
||||
// outfits folder, typically during first-ever login.
|
||||
//--------------------------------------------------------------------
|
||||
class LLLibraryOutfitsFetch : public LLInventoryFetchDescendentsObserver
|
||||
{
|
||||
public:
|
||||
enum ELibraryOutfitFetchStep
|
||||
{
|
||||
LOFS_FOLDER = 0,
|
||||
LOFS_OUTFITS,
|
||||
LOFS_LIBRARY,
|
||||
LOFS_IMPORTED,
|
||||
LOFS_CONTENTS
|
||||
};
|
||||
|
||||
LLLibraryOutfitsFetch(const LLUUID& my_outfits_id);
|
||||
~LLLibraryOutfitsFetch();
|
||||
|
||||
virtual void done();
|
||||
void doneIdle();
|
||||
LLUUID mMyOutfitsID;
|
||||
void importedFolderFetch();
|
||||
protected:
|
||||
void folderDone();
|
||||
void outfitsDone();
|
||||
void libraryDone();
|
||||
void importedFolderDone();
|
||||
void contentsDone();
|
||||
enum ELibraryOutfitFetchStep mCurrFetchStep;
|
||||
uuid_vec_t mLibraryClothingFolders;
|
||||
uuid_vec_t mImportedClothingFolders;
|
||||
bool mOutfitsPopulated;
|
||||
LLUUID mClothingID;
|
||||
LLUUID mLibraryClothingID;
|
||||
LLUUID mImportedClothingID;
|
||||
std::string mImportedClothingName;
|
||||
};
|
||||
|
||||
#endif // LL_AGENTWEARABLESINITIALFETCH_H
|
||||
|
|
|
|||
|
|
@ -2815,23 +2815,6 @@ void LLAppearanceMgr::copyLibraryGestures()
|
|||
}
|
||||
}
|
||||
|
||||
void LLAppearanceMgr::autopopulateOutfits()
|
||||
{
|
||||
// If this is the very first time the user has logged into viewer2+ (from a legacy viewer, or new account)
|
||||
// then auto-populate outfits from the library into the My Outfits folder.
|
||||
|
||||
LL_INFOS("Avatar") << self_av_string() << "avatar fully visible" << LL_ENDL;
|
||||
|
||||
static bool check_populate_my_outfits = true;
|
||||
if (check_populate_my_outfits &&
|
||||
(LLInventoryModel::getIsFirstTimeInViewer2()
|
||||
|| gSavedSettings.getBOOL("MyOutfitsAutofill")))
|
||||
{
|
||||
gAgentWearables.populateMyOutfitsFolder();
|
||||
}
|
||||
check_populate_my_outfits = false;
|
||||
}
|
||||
|
||||
// Handler for anything that's deferred until avatar de-clouds.
|
||||
void LLAppearanceMgr::onFirstFullyVisible()
|
||||
{
|
||||
|
|
@ -2839,10 +2822,6 @@ void LLAppearanceMgr::onFirstFullyVisible()
|
|||
gAgentAvatarp->reportAvatarRezTime();
|
||||
gAgentAvatarp->debugAvatarVisible();
|
||||
|
||||
// The auto-populate is failing at the point of generating outfits
|
||||
// folders, so don't do the library copy until that is resolved.
|
||||
// autopopulateOutfits();
|
||||
|
||||
// If this is the first time we've ever logged in,
|
||||
// then copy default gestures from the library.
|
||||
if (gAgent.isFirstLogin()) {
|
||||
|
|
|
|||
|
|
@ -173,9 +173,6 @@ public:
|
|||
// Called when self avatar is first fully visible.
|
||||
void onFirstFullyVisible();
|
||||
|
||||
// Create initial outfits from library.
|
||||
void autopopulateOutfits();
|
||||
|
||||
// Copy initial gestures from library.
|
||||
void copyLibraryGestures();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue