From 6098706ae532131a4df890988dc209961ff52a33 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Mon, 16 Nov 2009 17:24:05 -0500 Subject: EXT-2445 appearance editor doesn't show correct previews This system is in dire need of a rewrite, but the bug reported is fairly simple. The visual params in the avatar are no longer authoritative, the real values are stored in the wearable itself. The appearance editor was manipulating the values in the avatar object, resulting in no change. Updated the preview windows to use the parameter objects stored in the wearable. Code reviewed by Bigpapi --HG-- branch : avatar-pipeline --- indra/newview/llscrollingpanelparam.cpp | 4 ++-- indra/newview/lltoolmorph.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/llscrollingpanelparam.cpp b/indra/newview/llscrollingpanelparam.cpp index 1fbaeb94f5..b5e55df1f5 100644 --- a/indra/newview/llscrollingpanelparam.cpp +++ b/indra/newview/llscrollingpanelparam.cpp @@ -73,9 +73,9 @@ LLScrollingPanelParam::LLScrollingPanelParam( const LLPanel::Params& panel_param F32 min_weight = param->getMinWeight(); F32 max_weight = param->getMaxWeight(); - mHintMin = new LLVisualParamHint( pos_x, pos_y, PARAM_HINT_WIDTH, PARAM_HINT_HEIGHT, mesh, param, min_weight); + mHintMin = new LLVisualParamHint( pos_x, pos_y, PARAM_HINT_WIDTH, PARAM_HINT_HEIGHT, mesh, (LLViewerVisualParam*) wearable->getVisualParam(param->getID()), min_weight); pos_x += PARAM_HINT_WIDTH + 3 * BTN_BORDER; - mHintMax = new LLVisualParamHint( pos_x, pos_y, PARAM_HINT_WIDTH, PARAM_HINT_HEIGHT, mesh, param, max_weight ); + mHintMax = new LLVisualParamHint( pos_x, pos_y, PARAM_HINT_WIDTH, PARAM_HINT_HEIGHT, mesh, (LLViewerVisualParam*) wearable->getVisualParam(param->getID()), max_weight ); mHintMin->setAllowsUpdates( FALSE ); mHintMax->setAllowsUpdates( FALSE ); diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp index d7d7b5f44b..14524580bf 100644 --- a/indra/newview/lltoolmorph.cpp +++ b/indra/newview/lltoolmorph.cpp @@ -146,8 +146,8 @@ void LLVisualParamHint::preRender(BOOL clear_depth) { LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); - mLastParamWeight = avatarp->getVisualParamWeight(mVisualParam); - avatarp->setVisualParamWeight(mVisualParam, mVisualParamWeight); + mLastParamWeight = mVisualParam->getWeight(); + mVisualParam->setWeight(mVisualParamWeight, FALSE); avatarp->setVisualParamWeight("Blink_Left", 0.f); avatarp->setVisualParamWeight("Blink_Right", 0.f); avatarp->updateComposites(); @@ -242,7 +242,7 @@ BOOL LLVisualParamHint::render() gGL.setSceneBlendType(LLRender::BT_ALPHA); gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); } - avatarp->setVisualParamWeight(mVisualParam, mLastParamWeight); + mVisualParam->setWeight(mLastParamWeight, FALSE); gGL.color4f(1,1,1,1); mGLTexturep->setGLTextureCreated(true); return TRUE; -- cgit v1.2.3 From afe1ad54ee8a53525072a2c22782fa7135716d29 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Mon, 16 Nov 2009 18:19:35 -0500 Subject: EXT-1068 appearance editor previews do not update addendum: re-added changes to avatar-parameters as well as wearable parameters so that the system knows to re-update the local composite after rendering each preview. Code reviewed by Bigpapi --HG-- branch : avatar-pipeline --- indra/newview/lltoolmorph.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra') diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp index 14524580bf..4fb75f7a49 100644 --- a/indra/newview/lltoolmorph.cpp +++ b/indra/newview/lltoolmorph.cpp @@ -148,6 +148,7 @@ void LLVisualParamHint::preRender(BOOL clear_depth) mLastParamWeight = mVisualParam->getWeight(); mVisualParam->setWeight(mVisualParamWeight, FALSE); + avatarp->setVisualParamWeight(mVisualParam->getID(), mVisualParamWeight, FALSE); avatarp->setVisualParamWeight("Blink_Left", 0.f); avatarp->setVisualParamWeight("Blink_Right", 0.f); avatarp->updateComposites(); @@ -242,6 +243,7 @@ BOOL LLVisualParamHint::render() gGL.setSceneBlendType(LLRender::BT_ALPHA); gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); } + avatarp->setVisualParamWeight(mVisualParam->getID(), mLastParamWeight); mVisualParam->setWeight(mLastParamWeight, FALSE); gGL.color4f(1,1,1,1); mGLTexturep->setGLTextureCreated(true); -- cgit v1.2.3 From 9c823a1d40392dc00bdfb1f09220a5065d764f40 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 17 Nov 2009 10:33:47 -0500 Subject: Deferring work to idle time to avoid recursive notifyObservers calls - added wrapper class to defer an arbitrary boost::bind or other callable --HG-- branch : avatar-pipeline --- indra/newview/llagentwearables.cpp | 18 +++++++----------- indra/newview/llappearancemgr.cpp | 18 ++++++++++++++++-- indra/newview/llappearancemgr.h | 33 +++++++++++++++++++++++++++++++++ indra/newview/llinventorybridge.cpp | 12 ++++++++++++ 4 files changed, 68 insertions(+), 13 deletions(-) (limited to 'indra') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 17e7eea2f1..a171f75b17 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -62,7 +62,7 @@ class LLInitialWearablesFetch : public LLInventoryFetchDescendentsObserver { public: LLInitialWearablesFetch() {} - ~LLInitialWearablesFetch() {} + ~LLInitialWearablesFetch(); virtual void done(); struct InitialWearableData @@ -84,7 +84,6 @@ public: protected: void processWearablesMessage(); void processContents(); - static void onIdle(void *userdata); }; LLAgentWearables gAgentWearables; @@ -2013,6 +2012,11 @@ void LLAgentWearables::updateServer() // to avoid gInventory.notifyObservers recursion. //-------------------------------------------------------------------- +LLInitialWearablesFetch::~LLInitialWearablesFetch() +{ + llinfos << "~LLInitialWearablesFetch" << llendl; +} + // virtual void LLInitialWearablesFetch::done() { @@ -2020,15 +2024,7 @@ void LLInitialWearablesFetch::done() // gInventory.notifyObservers. The results will be handled in the next // idle tick instead. gInventory.removeObserver(this); - gIdleCallbacks.addFunction(onIdle, this); -} - -// static -void LLInitialWearablesFetch::onIdle(void *data) -{ - gIdleCallbacks.deleteFunction(onIdle, data); - LLInitialWearablesFetch *self = reinterpret_cast(data); - self->processContents(); + doOnIdle(boost::bind(&LLInitialWearablesFetch::processContents,this)); } void LLInitialWearablesFetch::processContents() diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 80ac9e4085..a23d21f84b 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -95,8 +95,9 @@ public: mCopyItems(copy_items), mAppend(append) {} - ~LLOutfitObserver() {} - virtual void done(); //public + ~LLOutfitObserver(); + virtual void done(); + void doWearCategory(); protected: LLUUID mCatID; @@ -104,7 +105,19 @@ protected: bool mAppend; }; +LLOutfitObserver::~LLOutfitObserver() +{ + llinfos << "~LLOutfitObserver" << llendl; +} + +// BAP is LLOutfitObserver getting deleted here? void LLOutfitObserver::done() +{ + gInventory.removeObserver(this); + doOnIdle(boost::bind(&LLOutfitObserver::doWearCategory,this)); +} + +void LLOutfitObserver::doWearCategory() { // We now have an outfit ready to be copied to agent inventory. Do // it, and wear that outfit normally. @@ -175,6 +188,7 @@ void LLOutfitObserver::done() // Wear the inventory category. LLAppearanceManager::instance().wearInventoryCategoryOnAvatar(gInventory.getCategory(mCatID), mAppend); } + delete this; } class LLOutfitFetch : public LLInventoryFetchDescendentsObserver diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 88d3320d1f..f39fbd7b1a 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; @@ -111,4 +112,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 +class OnIdleCallback +{ +public: + OnIdleCallback(T callable): + mCallable(callable) + { + } + static void onIdle(void *data) + { + gIdleCallbacks.deleteFunction(onIdle, data); + OnIdleCallback* self = reinterpret_cast*>(data); + self->call(); + delete self; + } + void call() + { + mCallable(); + } +private: + T mCallable; +}; + +template +void doOnIdle(T callable) +{ + OnIdleCallback* cb_functor = new OnIdleCallback(callable); + gIdleCallbacks.addFunction(&OnIdleCallback::onIdle,cb_functor); +} + #endif diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index d7be09efa9..f406547620 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1682,6 +1682,17 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, // if target is an outfit or current outfit folder we use link if (move_is_into_current_outfit || move_is_into_outfit) { + if (inv_cat->getPreferredType() == LLFolderType::FT_NONE) + { + if (move_is_into_current_outfit) + { + // traverse category and add all contents to currently worn. + BOOL append = true; + LLAppearanceManager::instance().wearInventoryCategory(inv_cat, false, append); + } + } + else + { #if SUPPORT_ENSEMBLES // BAP - should skip if dup. if (move_is_into_current_outfit) @@ -1700,6 +1711,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, cb); } #endif + } } else { -- cgit v1.2.3