summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-11-08 23:14:08 +0200
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-11-09 00:20:40 +0200
commitdafbed80b4cfdf906913a469503db320da49cabf (patch)
treeffad843bc655d1d978bee03651bdd29d321a9702 /indra
parentd72824c2b789b81b2bc0ae2c20012ca45d23a42d (diff)
SL-18583 Copy&Paste support for overrides
And a fix for SL-18583
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llpanelface.cpp34
-rw-r--r--indra/newview/llselectmgr.cpp12
2 files changed, 37 insertions, 9 deletions
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index ab6d4dc1d6..37ecf72b1b 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -3716,6 +3716,7 @@ struct LLPanelFaceUpdateFunctor : public LLSelectedObjectFunctor
{
if (mUpdatePbr)
{
+ // setRenderMaterialId is supposed to create it
LLRenderMaterialParams* param_block = (LLRenderMaterialParams*)object->getParameterEntry(LLNetworkData::PARAMS_RENDER_MATERIAL);
if (param_block)
{
@@ -3723,10 +3724,14 @@ struct LLPanelFaceUpdateFunctor : public LLSelectedObjectFunctor
{
object->setHasRenderMaterialParams(false);
}
- else
+ else if (object->hasRenderMaterialParams())
{
object->parameterChanged(LLNetworkData::PARAMS_RENDER_MATERIAL, true);
}
+ else
+ {
+ object->setHasRenderMaterialParams(true);
+ }
}
}
@@ -3984,6 +3989,10 @@ void LLPanelFace::onCopyTexture()
te_data["te"]["bumpshiny"] = tep->getBumpShiny();
te_data["te"]["bumpfullbright"] = tep->getBumpShinyFullbright();
te_data["te"]["pbr"] = objectp->getRenderMaterialID(te);
+ if (tep->getGLTFMaterialOverride() != nullptr)
+ {
+ te_data["te"]["pbr_override"] = tep->getGLTFMaterialOverride()->asJSON();
+ }
if (te_data["te"].has("imageid"))
{
@@ -4371,21 +4380,32 @@ void LLPanelFace::onPasteTexture(LLViewerObject* objectp, S32 te)
{
objectp->setTEBumpShinyFullbright(te, (U8)te_data["te"]["bumpfullbright"].asInteger());
}
+ // PBR/GLTF
if (te_data["te"].has("pbr"))
{
- objectp->setRenderMaterialID(te, te_data["te"]["pbr"].asUUID(), false);
+ objectp->setRenderMaterialID(te, te_data["te"]["pbr"].asUUID(), false /*send in bulk later*/);
+ tep->setGLTFRenderMaterial(nullptr);
+ tep->setGLTFMaterialOverride(nullptr);
+
+ LLSD override_data;
+ override_data["object_id"] = objectp->getID();
+ override_data["side"] = te;
+ if (te_data["te"].has("pbr_override"))
+ {
+ override_data["gltf_json"] = te_data["te"]["pbr_override"];
+ }
- // 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));
+ override_data,
+ nullptr));
}
else
{
- objectp->setRenderMaterialID(te, LLUUID::null, false);
+ objectp->setRenderMaterialID(te, LLUUID::null, false /*send in bulk later*/ );
+ tep->setGLTFRenderMaterial(nullptr);
+ tep->setGLTFMaterialOverride(nullptr);
// blank out any override data on the server
LLCoros::instance().launch("modifyMaterialCoro",
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index fa9604ef9d..ee10872a16 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -2000,10 +2000,14 @@ void LLSelectMgr::selectionSetGLTFMaterial(const LLUUID& mat_id)
{
object->setHasRenderMaterialParams(false);
}
- else
+ else if (object->hasRenderMaterialParams())
{
object->parameterChanged(LLNetworkData::PARAMS_RENDER_MATERIAL, true);
}
+ else
+ {
+ object->setHasRenderMaterialParams(true);
+ }
}
if (!mItem)
@@ -2262,10 +2266,14 @@ void LLSelectMgr::selectionRevertGLTFMaterials()
{
object->setHasRenderMaterialParams(false);
}
- else
+ else if (object->hasRenderMaterialParams())
{
object->parameterChanged(LLNetworkData::PARAMS_RENDER_MATERIAL, true);
}
+ else
+ {
+ object->setHasRenderMaterialParams(true);
+ }
}
object->sendTEUpdate();