diff options
-rw-r--r-- | indra/newview/llpanelface.cpp | 16 | ||||
-rw-r--r-- | indra/newview/llselectmgr.cpp | 20 | ||||
-rw-r--r-- | indra/newview/llviewerobject.cpp | 31 |
3 files changed, 53 insertions, 14 deletions
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 06f69e6fb5..ab6d4dc1d6 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -4374,10 +4374,26 @@ void LLPanelFace::onPasteTexture(LLViewerObject* objectp, S32 te) if (te_data["te"].has("pbr")) { objectp->setRenderMaterialID(te, te_data["te"]["pbr"].asUUID(), false); + + // todo: provide copied overrides here + LLCoros::instance().launch("modifyMaterialCoro", + std::bind(&LLGLTFMaterialList::modifyMaterialCoro, + gAgent.getRegionCapability("ModifyMaterialParams"), + llsd::map( + "object_id", objectp->getID(), + "side", te), nullptr)); } else { objectp->setRenderMaterialID(te, LLUUID::null, false); + + // blank out any override data on the server + LLCoros::instance().launch("modifyMaterialCoro", + std::bind(&LLGLTFMaterialList::modifyMaterialCoro, + gAgent.getRegionCapability("ModifyMaterialParams"), + llsd::map( + "object_id", objectp->getID(), + "side", te), nullptr)); } // Texture map diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index e4a67d7982..52b35d5158 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -1812,6 +1812,14 @@ void LLObjectSelection::applyNoCopyPbrMaterialToTEs(LLViewerInventoryItem* item) // apply texture for the selected faces //add(LLStatViewer::EDIT_TEXTURE, 1); object->setRenderMaterialID(te, asset_id, false /*will be sent later*/); + + // blank out any override data on the server + LLCoros::instance().launch("modifyMaterialCoro", + std::bind(&LLGLTFMaterialList::modifyMaterialCoro, + gAgent.getRegionCapability("ModifyMaterialParams"), + llsd::map( + "object_id", object->getID(), + "side", te), nullptr)); } } } @@ -1948,7 +1956,15 @@ void LLSelectMgr::selectionSetGLTFMaterial(const LLUUID& mat_id) objectp->setParameterEntryInUse(LLNetworkData::PARAMS_RENDER_MATERIAL, TRUE, false /*prevent an update*/); } - objectp->setRenderMaterialID(te, asset_id); + objectp->setRenderMaterialID(te, asset_id, false /*prevent an update to prevent a race condition*/); + + // blank out any override data on the server + LLCoros::instance().launch("modifyMaterialCoro", + std::bind(&LLGLTFMaterialList::modifyMaterialCoro, + gAgent.getRegionCapability("ModifyMaterialParams"), + llsd::map( + "object_id", objectp->getID(), + "side", te), nullptr)); return true; } @@ -1978,6 +1994,8 @@ void LLSelectMgr::selectionSetGLTFMaterial(const LLUUID& mat_id) LLRenderMaterialParams* param_block = (LLRenderMaterialParams*)object->getParameterEntry(LLNetworkData::PARAMS_RENDER_MATERIAL); if (param_block) { + // To not cause multiple competing request that modify + // same param field send update only once per object if (param_block->isEmpty()) { object->setHasRenderMaterialParams(false); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index a649387795..1efc4ea3d5 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -7215,25 +7215,30 @@ void LLViewerObject::setRenderMaterialID(S32 te_in, const LLUUID& id, bool updat "object_id", getID(), "side", te), nullptr)); } + } - // update and send LLRenderMaterialParams - LLRenderMaterialParams* param_block = (LLRenderMaterialParams*)getParameterEntry(LLNetworkData::PARAMS_RENDER_MATERIAL); - if (!param_block && id.notNull()) - { // block doesn't exist, but it will need to - param_block = (LLRenderMaterialParams*) createNewParameterEntry(LLNetworkData::PARAMS_RENDER_MATERIAL)->data; - } + // update and send LLRenderMaterialParams + LLRenderMaterialParams* param_block = (LLRenderMaterialParams*)getParameterEntry(LLNetworkData::PARAMS_RENDER_MATERIAL); + if (!param_block && id.notNull()) + { // block doesn't exist, but it will need to + param_block = (LLRenderMaterialParams*)createNewParameterEntry(LLNetworkData::PARAMS_RENDER_MATERIAL)->data; + } - if (param_block) - { // update existing parameter block - for (S32 te = start_idx; te < end_idx; ++te) - { - param_block->setMaterial(te, id); - } + if (param_block) + { // update existing parameter block + for (S32 te = start_idx; te < end_idx; ++te) + { + param_block->setMaterial(te, id); + } + if (update_server) + { + // If 'in use' changes, it will send an update itself. bool in_use_changed = setParameterEntryInUse(LLNetworkData::PARAMS_RENDER_MATERIAL, !param_block->isEmpty(), true); if (!in_use_changed) - { // in use didn't change, but the parameter did + { + // In use didn't change, but the parameter did, send an update parameterChanged(LLNetworkData::PARAMS_RENDER_MATERIAL, param_block, !param_block->isEmpty(), true); } } |