summaryrefslogtreecommitdiff
path: root/indra/newview/llappearancemgr.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llappearancemgr.h')
-rw-r--r--indra/newview/llappearancemgr.h92
1 files changed, 66 insertions, 26 deletions
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index 9d6cd34ad7..96541beb7d 100644
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -43,18 +43,24 @@ class LLWearable;
class LLWearableHoldingPattern;
class LLInventoryCallback;
-class LLAppearanceManager: public LLSingleton<LLAppearanceManager>
+class LLAppearanceMgr: public LLSingleton<LLAppearanceMgr>
{
- friend class LLSingleton<LLAppearanceManager>;
+ friend class LLSingleton<LLAppearanceMgr>;
public:
+ typedef std::vector<LLInventoryModel::item_array_t> wearables_by_type_t;
+
void updateAppearanceFromCOF();
bool needToSaveCOF();
void updateCOF(const LLUUID& category, bool append = false);
void wearInventoryCategory(LLInventoryCategory* category, bool copy, bool append);
void wearInventoryCategoryOnAvatar(LLInventoryCategory* category, bool append);
+ void wearCategoryFinal(LLUUID& cat_id, bool copy_items, bool append);
void wearOutfitByName(const std::string& name);
void changeOutfit(bool proceed, const LLUUID& category, bool append);
+ void replaceCurrentOutfit(const LLUUID& new_outfit);
+ void takeOffOutfit(const LLUUID& cat_id);
+ void addCategoryToCurrentOutfit(const LLUUID& cat_id);
// Copy all items and the src category itself.
void shallowCopyCategory(const LLUUID& src_id, const LLUUID& dst_id,
@@ -74,6 +80,12 @@ public:
const LLViewerInventoryItem *getBaseOutfitLink();
bool getBaseOutfitName(std::string &name);
+ // find the UUID of the currently worn outfit (Base Outfit)
+ const LLUUID getBaseOutfitUUID();
+
+ // Wear/attach an item (from a user's inventory) on the agent
+ bool wearItemOnAvatar(const LLUUID& item_to_wear, bool do_update = true, bool replace = false);
+
// Update the displayed outfit name in UI.
void updatePanelOutfitName(const std::string& name);
@@ -102,6 +114,7 @@ public:
// Remove COF entries
void removeCOFItemLinks(const LLUUID& item_id, bool do_update = true);
+ void removeCOFLinksOfType(LLWearableType::EType type, bool do_update = true);
// Add COF link to ensemble folder.
void addEnsembleLink(LLInventoryCategory* item, bool do_update = true);
@@ -118,13 +131,38 @@ public:
// Called when self avatar is first fully visible.
void onFirstFullyVisible();
+
+ // Create initial outfits from library.
+ void autopopulateOutfits();
+ void wearBaseOutfit();
+
+ // Overrides the base outfit with the content from COF
+ // @return false if there is no base outfit
+ bool updateBaseOutfit();
+
+ //Remove clothing or detach an object from the agent (a bodypart cannot be removed)
+ void removeItemFromAvatar(const LLUUID& item_id);
+
+
+ LLUUID makeNewOutfitLinks(const std::string& new_folder_name);
+
+ bool moveWearable(LLViewerInventoryItem* item, bool closer_to_body);
+
+ static void sortItemsByActualDescription(LLInventoryModel::item_array_t& items);
+
+ //Divvy items into arrays by wearable type
+ static void divvyWearablesByType(const LLInventoryModel::item_array_t& items, wearables_by_type_t& items_by_type);
+
protected:
- LLAppearanceManager();
- ~LLAppearanceManager();
+ LLAppearanceMgr();
+ ~LLAppearanceMgr();
private:
+ //Check ordering information on wearables stored in links' descriptions and update if it is invalid
+ void updateClothingOrderingInfo();
+
void filterWearableItems(LLInventoryModel::item_array_t& items, S32 max_per_type);
void getDescendentsOfAssetType(const LLUUID& category,
@@ -173,17 +211,17 @@ LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id,const std::string&
// Shim class and template function to allow arbitrary boost::bind
// expressions to be run as one-time idle callbacks.
template <typename T>
-class OnIdleCallback
+class OnIdleCallbackOneTime
{
public:
- OnIdleCallback(T callable):
+ OnIdleCallbackOneTime(T callable):
mCallable(callable)
{
}
static void onIdle(void *data)
{
gIdleCallbacks.deleteFunction(onIdle, data);
- OnIdleCallback<T>* self = reinterpret_cast<OnIdleCallback<T>*>(data);
+ OnIdleCallbackOneTime<T>* self = reinterpret_cast<OnIdleCallbackOneTime<T>*>(data);
self->call();
delete self;
}
@@ -196,14 +234,15 @@ private:
};
template <typename T>
-void doOnIdle(T callable)
+void doOnIdleOneTime(T callable)
{
- OnIdleCallback<T>* cb_functor = new OnIdleCallback<T>(callable);
- gIdleCallbacks.addFunction(&OnIdleCallback<T>::onIdle,cb_functor);
+ OnIdleCallbackOneTime<T>* cb_functor = new OnIdleCallbackOneTime<T>(callable);
+ gIdleCallbacks.addFunction(&OnIdleCallbackOneTime<T>::onIdle,cb_functor);
}
// Shim class and template function to allow arbitrary boost::bind
// expressions to be run as recurring idle callbacks.
+// Callable should return true when done, false to continue getting called.
template <typename T>
class OnIdleCallbackRepeating
{
@@ -212,7 +251,7 @@ public:
mCallable(callable)
{
}
- // Will keep getting called until the callable returns false.
+ // Will keep getting called until the callable returns true.
static void onIdle(void *data)
{
OnIdleCallbackRepeating<T>* self = reinterpret_cast<OnIdleCallbackRepeating<T>*>(data);
@@ -239,10 +278,12 @@ void doOnIdleRepeating(T callable)
}
template <class T>
-class CallAfterCategoryFetchStage2: public LLInventoryFetchObserver
+class CallAfterCategoryFetchStage2: public LLInventoryFetchItemsObserver
{
public:
- CallAfterCategoryFetchStage2(T callable):
+ CallAfterCategoryFetchStage2(const uuid_vec_t& ids,
+ T callable) :
+ LLInventoryFetchItemsObserver(ids),
mCallable(callable)
{
}
@@ -252,7 +293,7 @@ public:
virtual void done()
{
gInventory.removeObserver(this);
- doOnIdle(mCallable);
+ doOnIdleOneTime(mCallable);
delete this;
}
protected:
@@ -263,7 +304,8 @@ template <class T>
class CallAfterCategoryFetchStage1: public LLInventoryFetchDescendentsObserver
{
public:
- CallAfterCategoryFetchStage1(T callable):
+ CallAfterCategoryFetchStage1(const LLUUID& cat_id, T callable) :
+ LLInventoryFetchDescendentsObserver(cat_id),
mCallable(callable)
{
}
@@ -277,14 +319,14 @@ public:
// happen.
LLInventoryModel::cat_array_t cat_array;
LLInventoryModel::item_array_t item_array;
- gInventory.collectDescendents(mCompleteFolders.front(),
+ gInventory.collectDescendents(mComplete.front(),
cat_array,
item_array,
LLInventoryModel::EXCLUDE_TRASH);
S32 count = item_array.count();
if(!count)
{
- llwarns << "Nothing fetched in category " << mCompleteFolders.front()
+ llwarns << "Nothing fetched in category " << mComplete.front()
<< llendl;
//dec_busy_count();
gInventory.removeObserver(this);
@@ -292,8 +334,7 @@ public:
return;
}
- CallAfterCategoryFetchStage2<T> *stage2 = new CallAfterCategoryFetchStage2<T>(mCallable);
- LLInventoryFetchObserver::item_ref_t ids;
+ uuid_vec_t ids;
for(S32 i = 0; i < count; ++i)
{
ids.push_back(item_array.get(i)->getUUID());
@@ -302,8 +343,9 @@ public:
gInventory.removeObserver(this);
// do the fetch
- stage2->fetchItems(ids);
- if(stage2->isEverythingComplete())
+ CallAfterCategoryFetchStage2<T> *stage2 = new CallAfterCategoryFetchStage2<T>(ids, mCallable);
+ stage2->startFetch();
+ if(stage2->isFinished())
{
// everything is already here - call done.
stage2->done();
@@ -323,11 +365,9 @@ protected:
template <class T>
void callAfterCategoryFetch(const LLUUID& cat_id, T callable)
{
- CallAfterCategoryFetchStage1<T> *stage1 = new CallAfterCategoryFetchStage1<T>(callable);
- LLInventoryFetchDescendentsObserver::folder_ref_t folders;
- folders.push_back(cat_id);
- stage1->fetchDescendents(folders);
- if (stage1->isEverythingComplete())
+ CallAfterCategoryFetchStage1<T> *stage1 = new CallAfterCategoryFetchStage1<T>(cat_id, callable);
+ stage1->startFetch();
+ if (stage1->isFinished())
{
stage1->done();
}