From d492666ce298fd992e6e84ceae58bafb8d0720bf Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Fri, 31 Aug 2012 18:16:46 -0700 Subject: Adding ability to clear the materials from the selected object faces. --- indra/newview/llfloaterstinson.cpp | 48 ++++++++++++++-------- indra/newview/llfloaterstinson.h | 12 +++--- .../skins/default/xui/en/floater_stinson.xml | 13 +++++- 3 files changed, 50 insertions(+), 23 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterstinson.cpp b/indra/newview/llfloaterstinson.cpp index 707f5b468a..c0aa2a637e 100644 --- a/indra/newview/llfloaterstinson.cpp +++ b/indra/newview/llfloaterstinson.cpp @@ -105,9 +105,13 @@ BOOL LLFloaterStinson::postBuild() llassert(mGetScrollList != NULL); mGetScrollList->setCommitCallback(boost::bind(&LLFloaterStinson::onGetResultsSelectionChange, this)); - mPutButton = findChild("put_button"); - llassert(mPutButton != NULL); - mPutButton->setCommitCallback(boost::bind(&LLFloaterStinson::onPutClicked, this)); + mPutSetButton = findChild("put_set_button"); + llassert(mPutSetButton != NULL); + mPutSetButton->setCommitCallback(boost::bind(&LLFloaterStinson::onPutSetClicked, this)); + + mPutClearButton = findChild("put_clear_button"); + llassert(mPutClearButton != NULL); + mPutClearButton->setCommitCallback(boost::bind(&LLFloaterStinson::onPutClearClicked, this)); mPutScrollList = findChild("put_scroll_list"); llassert(mPutScrollList != NULL); @@ -187,7 +191,8 @@ LLFloaterStinson::LLFloaterStinson(const LLSD& pParams) mStatusText(NULL), mGetButton(NULL), mGetScrollList(NULL), - mPutButton(NULL), + mPutSetButton(NULL), + mPutClearButton(NULL), mPutScrollList(NULL), mGoodPostButton(NULL), mBadPostButton(NULL), @@ -210,9 +215,14 @@ void LLFloaterStinson::onGetClicked() requestGetMaterials(); } -void LLFloaterStinson::onPutClicked() +void LLFloaterStinson::onPutSetClicked() +{ + requestPutMaterials(true); +} + +void LLFloaterStinson::onPutClearClicked() { - requestPutMaterials(); + requestPutMaterials(false); } void LLFloaterStinson::onGoodPostClicked() @@ -253,9 +263,9 @@ void LLFloaterStinson::onDeferredRequestGetMaterials(LLUUID regionId) requestGetMaterials(regionId); } -void LLFloaterStinson::onDeferredRequestPutMaterials(LLUUID regionId) +void LLFloaterStinson::onDeferredRequestPutMaterials(LLUUID regionId, bool pIsDoSet) { - requestPutMaterials(regionId); + requestPutMaterials(regionId, pIsDoSet); } void LLFloaterStinson::onDeferredRequestPostMaterials(LLUUID regionId, bool pUseGoodData) @@ -388,7 +398,7 @@ void LLFloaterStinson::requestGetMaterials(const LLUUID& regionId) } } -void LLFloaterStinson::requestPutMaterials() +void LLFloaterStinson::requestPutMaterials(bool pIsDoSet) { LLViewerRegion *region = gAgent.getRegion(); @@ -400,7 +410,7 @@ void LLFloaterStinson::requestPutMaterials() else if (!region->capabilitiesReceived()) { setState(kCapabilitiesLoading); - region->setCapabilitiesReceivedCallback(boost::bind(&LLFloaterStinson::onDeferredRequestPutMaterials, this, region->getRegionID())); + region->setCapabilitiesReceivedCallback(boost::bind(&LLFloaterStinson::onDeferredRequestPutMaterials, this, region->getRegionID(), pIsDoSet)); } else { @@ -475,7 +485,10 @@ void LLFloaterStinson::requestPutMaterials() LLSD faceData = LLSD::emptyMap(); faceData[MATERIALS_CAP_FACE_FIELD] = static_cast(curFaceIndex); faceData[MATERIALS_CAP_OBJECT_ID_FIELD] = static_cast(viewerObject->getLocalID()); - faceData[MATERIALS_CAP_MATERIAL_FIELD] = materialData; + if (pIsDoSet) + { + faceData[MATERIALS_CAP_MATERIAL_FIELD] = materialData; + } facesData.append(faceData); } } @@ -492,13 +505,13 @@ void LLFloaterStinson::requestPutMaterials() } } -void LLFloaterStinson::requestPutMaterials(const LLUUID& regionId) +void LLFloaterStinson::requestPutMaterials(const LLUUID& regionId, bool pIsDoSet) { const LLViewerRegion *region = gAgent.getRegion(); if ((region != NULL) && (region->getRegionID() == regionId)) { - requestPutMaterials(); + requestPutMaterials(pIsDoSet); } } @@ -903,7 +916,8 @@ void LLFloaterStinson::updateControls() case kRequestStarted : case kNotEnabled : mGetButton->setEnabled(FALSE); - mPutButton->setEnabled(FALSE); + mPutSetButton->setEnabled(FALSE); + mPutClearButton->setEnabled(FALSE); mGoodPostButton->setEnabled(FALSE); mBadPostButton->setEnabled(FALSE); break; @@ -911,13 +925,15 @@ void LLFloaterStinson::updateControls() case kRequestCompleted : case kError : mGetButton->setEnabled(TRUE); - mPutButton->setEnabled(isPutEnabled); + mPutSetButton->setEnabled(isPutEnabled); + mPutClearButton->setEnabled(isPutEnabled); mGoodPostButton->setEnabled(isGoodPostEnabled); mBadPostButton->setEnabled(TRUE); break; default : mGetButton->setEnabled(TRUE); - mPutButton->setEnabled(isPutEnabled); + mPutSetButton->setEnabled(isPutEnabled); + mPutClearButton->setEnabled(isPutEnabled); mGoodPostButton->setEnabled(isGoodPostEnabled); mBadPostButton->setEnabled(TRUE); llassert(0); diff --git a/indra/newview/llfloaterstinson.h b/indra/newview/llfloaterstinson.h index 743705f46a..1d906394c1 100644 --- a/indra/newview/llfloaterstinson.h +++ b/indra/newview/llfloaterstinson.h @@ -67,7 +67,8 @@ private: virtual ~LLFloaterStinson(); void onGetClicked(); - void onPutClicked(); + void onPutSetClicked(); + void onPutClearClicked(); void onGoodPostClicked(); void onBadPostClicked(); void onRegionCross(); @@ -75,7 +76,7 @@ private: void onInWorldSelectionChange(); void onDeferredCheckRegionMaterialStatus(LLUUID regionId); void onDeferredRequestGetMaterials(LLUUID regionId); - void onDeferredRequestPutMaterials(LLUUID regionId); + void onDeferredRequestPutMaterials(LLUUID regionId, bool pIsDoSet); void onDeferredRequestPostMaterials(LLUUID regionId, bool pUseGoodData); void onGetResponse(bool pRequestStatus, const LLSD& pContent); void onPutResponse(bool pRequestStatus, const LLSD& pContent); @@ -87,8 +88,8 @@ private: void requestGetMaterials(); void requestGetMaterials(const LLUUID& regionId); - void requestPutMaterials(); - void requestPutMaterials(const LLUUID& regionId); + void requestPutMaterials(bool pIsDoSet); + void requestPutMaterials(const LLUUID& regionId, bool pIsDoSet); void requestPostMaterials(bool pUseGoodData); void requestPostMaterials(const LLUUID& regionId, bool pUseGoodData); @@ -112,7 +113,8 @@ private: LLTextBase* mStatusText; LLButton* mGetButton; LLScrollListCtrl* mGetScrollList; - LLButton* mPutButton; + LLButton* mPutSetButton; + LLButton* mPutClearButton; LLScrollListCtrl* mPutScrollList; LLButton* mGoodPostButton; LLButton* mBadPostButton; diff --git a/indra/newview/skins/default/xui/en/floater_stinson.xml b/indra/newview/skins/default/xui/en/floater_stinson.xml index 7e23b270be..ddfbcbd0c9 100644 --- a/indra/newview/skins/default/xui/en/floater_stinson.xml +++ b/indra/newview/skins/default/xui/en/floater_stinson.xml @@ -149,17 +149,26 @@