diff options
-rwxr-xr-x | indra/newview/llappearancemgr.cpp | 57 | ||||
-rwxr-xr-x | indra/newview/llappearancemgr.h | 7 |
2 files changed, 40 insertions, 24 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 16552f0082..cb32bf9c40 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -436,11 +436,14 @@ S32 LLCallAfterInventoryCopyMgr::sInstanceCount = 0; LLUpdateAppearanceOnDestroy::LLUpdateAppearanceOnDestroy(bool update_base_outfit_ordering, bool enforce_item_restrictions, - bool enforce_ordering): + bool enforce_ordering, + nullary_func_t post_update_func + ): mFireCount(0), mUpdateBaseOrder(update_base_outfit_ordering), mEnforceItemRestrictions(enforce_item_restrictions), - mEnforceOrdering(enforce_ordering) + mEnforceOrdering(enforce_ordering), + mPostUpdateFunc(post_update_func) { selfStartPhase("update_appearance_on_destroy"); } @@ -464,7 +467,10 @@ LLUpdateAppearanceOnDestroy::~LLUpdateAppearanceOnDestroy() selfStopPhase("update_appearance_on_destroy"); - LLAppearanceMgr::instance().updateAppearanceFromCOF(mUpdateBaseOrder, mEnforceItemRestrictions, mEnforceOrdering); + LLAppearanceMgr::instance().updateAppearanceFromCOF(mUpdateBaseOrder, + mEnforceItemRestrictions, + mEnforceOrdering, + mPostUpdateFunc); } } @@ -473,29 +479,34 @@ LLUpdateAppearanceAndEditWearableOnDestroy::LLUpdateAppearanceAndEditWearableOnD { } -LLUpdateAppearanceAndEditWearableOnDestroy::~LLUpdateAppearanceAndEditWearableOnDestroy() +void edit_wearable_and_customize_avatar(LLUUID item_id) { - if (!LLApp::isExiting()) + // Start editing the item if previously requested. + gAgentWearables.editWearableIfRequested(item_id); + + // TODO: camera mode may not be changed if a debug setting is tweaked + if( gAgentCamera.cameraCustomizeAvatar() ) { - LLAppearanceMgr::instance().updateAppearanceFromCOF(); - - // Start editing the item if previously requested. - gAgentWearables.editWearableIfRequested(mItemID); - - // TODO: camera mode may not be changed if a debug setting is tweaked - if( gAgentCamera.cameraCustomizeAvatar() ) + // If we're in appearance editing mode, the current tab may need to be refreshed + LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>( + LLFloaterSidePanelContainer::getPanel("appearance")); + if (panel) { - // If we're in appearance editing mode, the current tab may need to be refreshed - LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>( - LLFloaterSidePanelContainer::getPanel("appearance")); - if (panel) - { - panel->showDefaultSubpart(); - } + panel->showDefaultSubpart(); } } } +LLUpdateAppearanceAndEditWearableOnDestroy::~LLUpdateAppearanceAndEditWearableOnDestroy() +{ + if (!LLApp::isExiting()) + { + LLAppearanceMgr::instance().updateAppearanceFromCOF( + false,true,true, + boost::bind(edit_wearable_and_customize_avatar, mItemID)); + } +} + struct LLFoundData { @@ -1971,7 +1982,8 @@ void LLAppearanceMgr::enforceCOFItemRestrictions(LLPointer<LLInventoryCallback> void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering, bool enforce_item_restrictions, - bool enforce_ordering) + bool enforce_ordering, + nullary_func_t post_update_func) { if (mIsInUpdateAppearanceFromCOF) { @@ -1989,7 +2001,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering, // enforce_item_restrictions to false so we don't get // caught in a perpetual loop. LLPointer<LLInventoryCallback> cb( - new LLUpdateAppearanceOnDestroy(update_base_outfit_ordering, false, enforce_ordering)); + new LLUpdateAppearanceOnDestroy(update_base_outfit_ordering, false, enforce_ordering, post_update_func)); enforceCOFItemRestrictions(cb); return; } @@ -2003,7 +2015,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering, // to wait for the update callbacks, then (finally!) call // updateAppearanceFromCOF() with no additional COF munging needed. LLPointer<LLInventoryCallback> cb( - new LLUpdateAppearanceOnDestroy(false, false, false)); + new LLUpdateAppearanceOnDestroy(false, false, false, post_update_func)); updateClothingOrderingInfo(LLUUID::null, update_base_outfit_ordering, cb); return; } @@ -2120,6 +2132,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering, { doOnIdleRepeating(boost::bind(&LLWearableHoldingPattern::pollFetchCompletion,holder)); } + post_update_func(); } void LLAppearanceMgr::getDescendentsOfAssetType(const LLUUID& category, diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 9eb26767c4..a257f30ea5 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -51,7 +51,8 @@ public: void updateAppearanceFromCOF(bool update_base_outfit_ordering = false, bool enforce_item_restrictions = true, - bool enforce_ordering = true); + bool enforce_ordering = true, + nullary_func_t post_update_func = no_op); bool needToSaveCOF(); void updateCOF(const LLUUID& category, bool append = false); void wearInventoryCategory(LLInventoryCategory* category, bool copy, bool append); @@ -272,7 +273,8 @@ class LLUpdateAppearanceOnDestroy: public LLInventoryCallback public: LLUpdateAppearanceOnDestroy(bool update_base_outfit_ordering = false, bool enforce_item_restrictions = true, - bool enforce_ordering = true); + bool enforce_ordering = true, + nullary_func_t post_update_func = no_op); virtual ~LLUpdateAppearanceOnDestroy(); /* virtual */ void fire(const LLUUID& inv_item); @@ -281,6 +283,7 @@ private: bool mUpdateBaseOrder; bool mEnforceItemRestrictions; bool mEnforceOrdering; + nullary_func_t mPostUpdateFunc; }; class LLUpdateAppearanceAndEditWearableOnDestroy: public LLInventoryCallback |