From c3973a4895a5827a5a95dd15e99813bc32e11993 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 21 Jul 2010 15:28:28 -0400 Subject: EXT-8135 FIX - use LLUpdateAppearanceOnDestroy callback to postpone appearance update until all links are created --- indra/newview/llappearancemgr.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llappearancemgr.h') diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 84c911c038..a6cd129306 100644 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -418,4 +418,6 @@ void callAfterCategoryFetch(const LLUUID& cat_id, T callable) } } +void wear_multiple(const uuid_vec_t& ids, bool replace); + #endif -- cgit v1.2.3 From ee40479c3d55aa9a4dd82b3c96df8936f5ef8550 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 23 Jul 2010 16:22:20 -0400 Subject: Removed a bunch of templates and inlining through the miracle of boost::function --- indra/newview/llappearancemgr.h | 181 ++-------------------------------------- 1 file changed, 9 insertions(+), 172 deletions(-) (limited to 'indra/newview/llappearancemgr.h') diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index a6cd129306..ca57d62446 100644 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -242,182 +242,19 @@ private: LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id,const std::string& name); -// Shim class and template function to allow arbitrary boost::bind -// expressions to be run as one-time idle callbacks. -template -class OnIdleCallbackOneTime -{ -public: - OnIdleCallbackOneTime(T callable): - mCallable(callable) - { - } - static void onIdle(void *data) - { - gIdleCallbacks.deleteFunction(onIdle, data); - OnIdleCallbackOneTime* self = reinterpret_cast*>(data); - self->call(); - delete self; - } - void call() - { - mCallable(); - } -private: - T mCallable; -}; +typedef boost::function nullary_func_t; +typedef boost::function bool_func_t; -template -void doOnIdleOneTime(T callable) -{ - OnIdleCallbackOneTime* cb_functor = new OnIdleCallbackOneTime(callable); - gIdleCallbacks.addFunction(&OnIdleCallbackOneTime::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 -class OnIdleCallbackRepeating -{ -public: - OnIdleCallbackRepeating(T callable): - mCallable(callable) - { - } - // Will keep getting called until the callable returns true. - static void onIdle(void *data) - { - OnIdleCallbackRepeating* self = reinterpret_cast*>(data); - bool done = self->call(); - if (done) - { - gIdleCallbacks.deleteFunction(onIdle, data); - delete self; - } - } - bool call() - { - return mCallable(); - } -private: - T mCallable; -}; +// Call a given callable once in idle loop. +void doOnIdleOneTime(nullary_func_t callable); -template -void doOnIdleRepeating(T callable) -{ - OnIdleCallbackRepeating* cb_functor = new OnIdleCallbackRepeating(callable); - gIdleCallbacks.addFunction(&OnIdleCallbackRepeating::onIdle,cb_functor); -} +// Repeatedly call a callable in idle loop until it returns true. +void doOnIdleRepeating(bool_func_t callable); -template -class CallAfterCategoryFetchStage2: public LLInventoryFetchItemsObserver -{ -public: - CallAfterCategoryFetchStage2(const uuid_vec_t& ids, - T callable) : - LLInventoryFetchItemsObserver(ids), - mCallable(callable) - { - } - ~CallAfterCategoryFetchStage2() - { - } - virtual void done() - { - llinfos << this << " done with incomplete " << mIncomplete.size() - << " complete " << mComplete.size() << " calling callable" << llendl; - - gInventory.removeObserver(this); - doOnIdleOneTime(mCallable); - delete this; - } -protected: - T mCallable; -}; - -template -class CallAfterCategoryFetchStage1: public LLInventoryFetchDescendentsObserver -{ -public: - CallAfterCategoryFetchStage1(const LLUUID& cat_id, T callable) : - LLInventoryFetchDescendentsObserver(cat_id), - mCallable(callable) - { - } - ~CallAfterCategoryFetchStage1() - { - } - virtual void done() - { - // What we do here is get the complete information on the items in - // the library, and set up an observer that will wait for that to - // happen. - LLInventoryModel::cat_array_t cat_array; - LLInventoryModel::item_array_t item_array; - gInventory.collectDescendents(mComplete.front(), - cat_array, - item_array, - LLInventoryModel::EXCLUDE_TRASH); - S32 count = item_array.count(); - if(!count) - { - llwarns << "Nothing fetched in category " << mComplete.front() - << llendl; - //dec_busy_count(); - gInventory.removeObserver(this); - - // lets notify observers that loading is finished. - gAgentWearables.notifyLoadingFinished(); - delete this; - return; - } - - llinfos << "stage1 got " << item_array.count() << " items, passing to stage2 " << llendl; - uuid_vec_t ids; - for(S32 i = 0; i < count; ++i) - { - ids.push_back(item_array.get(i)->getUUID()); - } - - gInventory.removeObserver(this); - - // do the fetch - CallAfterCategoryFetchStage2 *stage2 = new CallAfterCategoryFetchStage2(ids, mCallable); - stage2->startFetch(); - if(stage2->isFinished()) - { - // everything is already here - call done. - stage2->done(); - } - else - { - // it's all on it's way - add an observer, and the inventory - // will call done for us when everything is here. - gInventory.addObserver(stage2); - } - delete this; - } -protected: - T mCallable; -}; - -template -void callAfterCategoryFetch(const LLUUID& cat_id, T callable) -{ - CallAfterCategoryFetchStage1 *stage1 = new CallAfterCategoryFetchStage1(cat_id, callable); - stage1->startFetch(); - if (stage1->isFinished()) - { - stage1->done(); - } - else - { - gInventory.addObserver(stage1); - } -} +// Invoke a given callable after category contents are fully fetched. +void callAfterCategoryFetch(const LLUUID& cat_id, nullary_func_t cb); +// Wear all items in a uuid vector. void wear_multiple(const uuid_vec_t& ids, bool replace); #endif -- cgit v1.2.3 From 2e9671a8a8ec0a8897945c96aa62c77ad245abac Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Mon, 26 Jul 2010 10:33:43 +0300 Subject: EXT-8329 FIXED Provided disabling 'Wear Item' button after item was worn. Details: 1 Updated condition is item can be worn considering situation when item is copied in COF but is not worn. 2 Avoided code duplication in method LLOutfitsList::canWearSelected() reviewed by Vadim Savchuk and Neal Orman at https://codereview.productengine.com/secondlife/r/785/ --HG-- branch : product-engine --- indra/newview/llappearancemgr.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llappearancemgr.h') diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index a6cd129306..e8df69b179 100644 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -223,6 +223,11 @@ public: BOOL getIsInCOF(const LLUUID& obj_id) const; // Is this in the COF and can the user delete it from the COF? BOOL getIsProtectedCOFItem(const LLUUID& obj_id) const; + + /** + * Checks if COF contains link to specified object. + */ + static bool isLinkInCOF(const LLUUID& obj_id); }; class LLUpdateAppearanceOnDestroy: public LLInventoryCallback -- cgit v1.2.3