diff options
author | Eric M. Tulla (BigPapi) <tulla@lindenlab.com> | 2009-11-17 19:08:13 -0500 |
---|---|---|
committer | Eric M. Tulla (BigPapi) <tulla@lindenlab.com> | 2009-11-17 19:08:13 -0500 |
commit | 521820ad8da5d269ad22fae0b6a24bb31f8d41cb (patch) | |
tree | 3d5494f0c07c1536aff1f685e1bd86baba9d427f /indra/newview/llappearancemgr.h | |
parent | 913eff0f675ba8938e298d24e8ef6d5c9c594acb (diff) | |
parent | e6caf96b0a60dbbc75958ea4a74529601c51541f (diff) |
Merge of avatar-pipeline branch into viewer2
Diffstat (limited to 'indra/newview/llappearancemgr.h')
-rw-r--r-- | indra/newview/llappearancemgr.h | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 88d3320d1f..12ffa336b4 100644 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -36,6 +36,7 @@ #include "llsingleton.h" #include "llinventorymodel.h" #include "llviewerinventory.h" +#include "llcallbacklist.h" class LLWearable; struct LLWearableHoldingPattern; @@ -81,6 +82,11 @@ public: void setAttachmentInvLinkEnable(bool val); void linkRegisteredAttachments(); + // utility function for bulk linking. + void linkAll(const LLUUID& category, + LLInventoryModel::item_array_t& items, + LLPointer<LLInventoryCallback> cb); + protected: LLAppearanceManager(); ~LLAppearanceManager(); @@ -88,9 +94,6 @@ protected: private: void filterWearableItems(LLInventoryModel::item_array_t& items, S32 max_per_type); - void linkAll(const LLUUID& category, - LLInventoryModel::item_array_t& items, - LLPointer<LLInventoryCallback> cb); void getDescendentsOfAssetType(const LLUUID& category, LLInventoryModel::item_array_t& items, @@ -111,4 +114,36 @@ private: #define SUPPORT_ENSEMBLES 0 +// Shim class and template function to allow arbitrary boost::bind +// expressions to be run as one-time idle callbacks. +template <typename T> +class OnIdleCallback +{ +public: + OnIdleCallback(T callable): + mCallable(callable) + { + } + static void onIdle(void *data) + { + gIdleCallbacks.deleteFunction(onIdle, data); + OnIdleCallback<T>* self = reinterpret_cast<OnIdleCallback<T>*>(data); + self->call(); + delete self; + } + void call() + { + mCallable(); + } +private: + T mCallable; +}; + +template <typename T> +void doOnIdle(T callable) +{ + OnIdleCallback<T>* cb_functor = new OnIdleCallback<T>(callable); + gIdleCallbacks.addFunction(&OnIdleCallback<T>::onIdle,cb_functor); +} + #endif |