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.h41
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