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.h73
1 files changed, 47 insertions, 26 deletions
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index 9d6cd34ad7..7e35919892 100644
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -43,9 +43,9 @@ 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:
void updateAppearanceFromCOF();
@@ -53,6 +53,7 @@ public:
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);
@@ -74,6 +75,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);
+
// Update the displayed outfit name in UI.
void updatePanelOutfitName(const std::string& name);
@@ -118,10 +125,22 @@ 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);
+
protected:
- LLAppearanceManager();
- ~LLAppearanceManager();
+ LLAppearanceMgr();
+ ~LLAppearanceMgr();
private:
@@ -173,17 +192,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 +215,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 +232,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 +259,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 +274,7 @@ public:
virtual void done()
{
gInventory.removeObserver(this);
- doOnIdle(mCallable);
+ doOnIdleOneTime(mCallable);
delete this;
}
protected:
@@ -263,7 +285,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 +300,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 +315,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 +324,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 +346,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();
}