From f2b026138d5abe5464de6db349b3431c262de53a Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Tue, 5 Feb 2013 03:30:56 -0600 Subject: Don't send a materials update to the sim until the previous one has been acknowledged. --- indra/newview/llpanelface.cpp | 93 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 85 insertions(+), 8 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index e0f9ec9b99..7b3bbf8b3b 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -257,7 +257,9 @@ LLPanelFace::LLPanelFace() : LLPanel(), mMaterialID(LLMaterialID::null), mMaterial(LLMaterialPtr()), - mIsAlpha(FALSE) + mIsAlpha(false), + mUpdateInFlight(false), + mUpdatePending(false) { } @@ -1140,6 +1142,13 @@ void LLPanelFace::getState() llinfos << "Requesting material ID " << mMaterialID.asString() << llendl; LLMaterialMgr::getInstance()->get(objectp->getRegion()->getRegionID(),mMaterialID,boost::bind(&LLPanelFace::onMaterialLoaded, this, _1, _2)); } + if (mUpdatePending && !mUpdateInFlight) + { + // One or more updates are pending, and the + // previous one has been acknowledged. Send + // the pending updates. + updateMaterial(); + } } // Set variable values for numeric expressions @@ -1206,6 +1215,9 @@ void LLPanelFace::refresh() void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMaterialPtr material) { mMaterial = material; + // We've gotten a materials update, so the sim's ready for another. + mUpdateInFlight = false; + // Alpha LLCtrlSelectionInterface* combobox_alphamode = childGetSelectionInterface("combobox alphamode"); @@ -1278,6 +1290,11 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate void LLPanelFace::updateMaterial() { + if (mUpdateInFlight) + { + LL_WARNS("Materials") << "Attempt to update material while a previous update is pending ignored." << LL_ENDL; + return; + } LLComboBox* comboAlphaMode = getChild("combobox alphamode"); LLComboBox* comboBumpiness = getChild("combobox bumpiness"); LLComboBox* comboShininess = getChild("combobox shininess"); @@ -1336,6 +1353,10 @@ void LLPanelFace::updateMaterial() mMaterial->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); llinfos << "Updating material: " << mMaterial->asLLSD() << llendl; LLSelectMgr::getInstance()->selectionSetMaterial( *mMaterial ); + + // We've sent an update. Need to hold off on any more until + // the sim acknowledges this one. + mUpdateInFlight = true; } else { @@ -1346,8 +1367,15 @@ void LLPanelFace::updateMaterial() mMaterial.reset(); mMaterialID = LLMaterialID::null; // Delete existing material entry... + + // Hold off any further updates till this one's + // acknowledged. + //mUpdateInFlight = true; } } + + // We've taken care of the update, so clear the update pending flag. + mUpdatePending = false; } // @@ -1368,7 +1396,14 @@ void LLPanelFace::onCommitColor(const LLSD& data) void LLPanelFace::onCommitShinyColor(const LLSD& data) { - updateMaterial(); + if (!mUpdateInFlight) + { + updateMaterial(); + } + else + { + mUpdatePending = true; + } } void LLPanelFace::onCommitAlpha(const LLSD& data) @@ -1531,7 +1566,14 @@ void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; self->sendShiny(); - self->updateMaterial(); + if (!self->mUpdateInFlight) + { + self->updateMaterial(); + } + else + { + self->mUpdatePending = true; + } } // static @@ -1554,7 +1596,14 @@ void LLPanelFace::onCommitAlphaMode(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; updateAlphaControls(ctrl,userdata); - self->updateMaterial(); + if (!self->mUpdateInFlight) + { + self->updateMaterial(); + } + else + { + self->mUpdatePending = true; + } } // static @@ -1608,25 +1657,53 @@ void LLPanelFace::onSelectTexture(const LLSD& data) void LLPanelFace::onCommitMaterialTexture( const LLSD& data ) { - updateMaterial(); + if (!mUpdateInFlight) + { + updateMaterial(); + } + else + { + mUpdatePending = true; + } } void LLPanelFace::onCancelMaterialTexture(const LLSD& data) { // not sure what to do here other than - updateMaterial(); + if (!mUpdateInFlight) + { + updateMaterial(); + } + else + { + mUpdatePending = true; + } } void LLPanelFace::onSelectMaterialTexture(const LLSD& data) { - updateMaterial(); + if (!mUpdateInFlight) + { + updateMaterial(); + } + else + { + mUpdatePending = true; + } } //static void LLPanelFace::onCommitMaterial(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; - self->updateMaterial(); + if (!self->mUpdateInFlight) + { + self->updateMaterial(); + } + else + { + self->mUpdatePending = true; + } } // static -- cgit v1.3 From 3422f75cf749df10c7bb7711b9a7fa870655818f Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Wed, 6 Feb 2013 21:38:05 -0600 Subject: Tell the renderer to use the updated material immediately on editing it. --- indra/newview/llpanelface.cpp | 2 +- indra/newview/llselectmgr.cpp | 11 ++++++----- indra/newview/llselectmgr.h | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 7b3bbf8b3b..7e9fe212dd 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1352,7 +1352,7 @@ void LLPanelFace::updateMaterial() mMaterial->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); mMaterial->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); llinfos << "Updating material: " << mMaterial->asLLSD() << llendl; - LLSelectMgr::getInstance()->selectionSetMaterial( *mMaterial ); + LLSelectMgr::getInstance()->selectionSetMaterial( mMaterial ); // We've sent an update. Need to hold off on any more until // the sim acknowledges this one. diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index c93cecdd5d..9f343f465c 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -2010,18 +2010,19 @@ void LLSelectMgr::selectionSetGlow(F32 glow) mSelectedObjects->applyToObjects( &func2 ); } -void LLSelectMgr::selectionSetMaterial(LLMaterial& material) +void LLSelectMgr::selectionSetMaterial(LLMaterialPtr material) { struct f1 : public LLSelectedTEFunctor { - LLMaterial mMaterial; - f1(LLMaterial material) : mMaterial(material) {}; + LLMaterialPtr mMaterial; + f1(LLMaterialPtr material) : mMaterial(material) {}; bool apply(LLViewerObject* object, S32 face) { if (object->permModify()) { - llinfos << "Putting material on object " << object->getID() << " face " << face << ", material: " << mMaterial.asLLSD() << llendl; - LLMaterialMgr::getInstance()->put(object->getID(),face,mMaterial); + llinfos << "Putting material on object " << object->getID() << " face " << face << ", material: " << mMaterial->asLLSD() << llendl; + LLMaterialMgr::getInstance()->put(object->getID(),face,*mMaterial); + object->setTEMaterialParams(face,mMaterial); } return true; } diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index f1da18dcc3..2eae5b94c9 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -48,6 +48,7 @@ #include #include #include +#include // boost::make_shared class LLMessageSystem; class LLViewerTexture; @@ -538,7 +539,7 @@ public: void selectionSetClickAction(U8 action); void selectionSetIncludeInSearch(bool include_in_search); void selectionSetGlow(const F32 glow); - void selectionSetMaterial(LLMaterial& material); + void selectionSetMaterial(LLMaterialPtr material); void selectionSetObjectPermissions(U8 perm_field, BOOL set, U32 perm_mask, BOOL override = FALSE); void selectionSetObjectName(const std::string& name); -- cgit v1.3