summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llmaterialeditor.cpp74
-rw-r--r--indra/newview/llpanelface.cpp7
-rw-r--r--indra/newview/llselectmgr.cpp14
3 files changed, 45 insertions, 50 deletions
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp
index 17da7e8853..cd3f122101 100644
--- a/indra/newview/llmaterialeditor.cpp
+++ b/indra/newview/llmaterialeditor.cpp
@@ -921,22 +921,22 @@ void LLMaterialEditor::onSelectCtrl(LLUICtrl* ctrl, const LLSD& data, S32 dirty_
//Textures
case MATERIAL_BASE_COLOR_TEX_DIRTY:
{
- nodep->mSavedGLTFOverrideMaterials[te]->mBaseColorId = mCtrl->getValue().asUUID();
+ nodep->mSavedGLTFOverrideMaterials[te]->setBaseColorId(mCtrl->getValue().asUUID(), true);
break;
}
case MATERIAL_METALLIC_ROUGHTNESS_TEX_DIRTY:
{
- nodep->mSavedGLTFOverrideMaterials[te]->mMetallicRoughnessId = mCtrl->getValue().asUUID();
+ nodep->mSavedGLTFOverrideMaterials[te]->setMetallicRoughnessId(mCtrl->getValue().asUUID(), true);
break;
}
case MATERIAL_EMISIVE_TEX_DIRTY:
{
- nodep->mSavedGLTFOverrideMaterials[te]->mEmissiveId = mCtrl->getValue().asUUID();
+ nodep->mSavedGLTFOverrideMaterials[te]->setEmissiveId(mCtrl->getValue().asUUID(), true);
break;
}
case MATERIAL_NORMAL_TEX_DIRTY:
{
- nodep->mSavedGLTFOverrideMaterials[te]->mNormalId = mCtrl->getValue().asUUID();
+ nodep->mSavedGLTFOverrideMaterials[te]->setNormalId(mCtrl->getValue().asUUID(), true);
break;
}
// Colors
@@ -945,12 +945,12 @@ void LLMaterialEditor::onSelectCtrl(LLUICtrl* ctrl, const LLSD& data, S32 dirty_
LLColor4 ret = linearColor4(LLColor4(mCtrl->getValue()));
// except transparency
ret.mV[3] = nodep->mSavedGLTFOverrideMaterials[te]->mBaseColor.mV[3];
- nodep->mSavedGLTFOverrideMaterials[te]->mBaseColor = ret;
+ nodep->mSavedGLTFOverrideMaterials[te]->setBaseColorFactor(ret, true);
break;
}
case MATERIAL_EMISIVE_COLOR_DIRTY:
{
- nodep->mSavedGLTFOverrideMaterials[te]->mEmissiveColor = LLColor4(mCtrl->getValue());
+ nodep->mSavedGLTFOverrideMaterials[te]->setEmissiveColorFactor(LLColor3(mCtrl->getValue()), true);
break;
}
default:
@@ -2415,109 +2415,119 @@ public:
U32 reverted_flags = mEditor->getRevertedChangesFlags();
LLPointer<LLGLTFMaterial> revert_mat;
- // mSavedGLTFOverrideMaterials[te] being null
- // means we need to use a default value
- bool can_revert = (nodep->mSavedGLTFOverrideMaterials.size() > te)
- && nodep->mSavedGLTFOverrideMaterials[te].notNull();
+ if (nodep->mSavedGLTFOverrideMaterials.size() > te)
+ {
+ if (nodep->mSavedGLTFOverrideMaterials[te].notNull())
+ {
+ revert_mat = nodep->mSavedGLTFOverrideMaterials[te];
+ }
+ else
+ {
+ // mSavedGLTFOverrideMaterials[te] being present but null
+ // means we need to use a default value
+ revert_mat = new LLGLTFMaterial();
+ }
+ }
+ // else can not revert at all
// Override object's values with values from editor where appropriate
if (changed_flags & MATERIAL_BASE_COLOR_DIRTY)
{
material->setBaseColorFactor(mEditor->getBaseColor(), true);
}
- else if ((reverted_flags & MATERIAL_BASE_COLOR_DIRTY) && can_revert)
+ else if ((reverted_flags & MATERIAL_BASE_COLOR_DIRTY) && revert_mat.notNull())
{
- material->setBaseColorFactor(nodep->mSavedGLTFOverrideMaterials[te]->mBaseColor, true);
+ material->setBaseColorFactor(revert_mat->mBaseColor, false);
}
if (changed_flags & MATERIAL_BASE_COLOR_TEX_DIRTY)
{
material->setBaseColorId(mEditor->getBaseColorId(), true);
}
- else if ((reverted_flags & MATERIAL_BASE_COLOR_TEX_DIRTY) && can_revert)
+ else if ((reverted_flags & MATERIAL_BASE_COLOR_TEX_DIRTY) && revert_mat.notNull())
{
- material->setBaseColorId(nodep->mSavedGLTFOverrideMaterials[te]->mBaseColorId, true);
+ material->setBaseColorId(revert_mat->mBaseColorId, false);
}
if (changed_flags & MATERIAL_NORMAL_TEX_DIRTY)
{
material->setNormalId(mEditor->getNormalId(), true);
}
- else if ((reverted_flags & MATERIAL_NORMAL_TEX_DIRTY) && can_revert)
+ else if ((reverted_flags & MATERIAL_NORMAL_TEX_DIRTY) && revert_mat.notNull())
{
- material->setNormalId(nodep->mSavedGLTFOverrideMaterials[te]->mNormalId, true);
+ material->setNormalId(revert_mat->mNormalId, false);
}
if (changed_flags & MATERIAL_METALLIC_ROUGHTNESS_TEX_DIRTY)
{
material->setMetallicRoughnessId(mEditor->getMetallicRoughnessId(), true);
}
- else if ((reverted_flags & MATERIAL_METALLIC_ROUGHTNESS_TEX_DIRTY) && can_revert)
+ else if ((reverted_flags & MATERIAL_METALLIC_ROUGHTNESS_TEX_DIRTY) && revert_mat.notNull())
{
- material->setMetallicRoughnessId(nodep->mSavedGLTFOverrideMaterials[te]->mMetallicRoughnessId, true);
+ material->setMetallicRoughnessId(revert_mat->mMetallicRoughnessId, false);
}
if (changed_flags & MATERIAL_METALLIC_ROUGHTNESS_METALNESS_DIRTY)
{
material->setMetallicFactor(mEditor->getMetalnessFactor(), true);
}
- else if ((reverted_flags & MATERIAL_METALLIC_ROUGHTNESS_METALNESS_DIRTY) && can_revert)
+ else if ((reverted_flags & MATERIAL_METALLIC_ROUGHTNESS_METALNESS_DIRTY) && revert_mat.notNull())
{
- material->setMetallicFactor(nodep->mSavedGLTFOverrideMaterials[te]->mMetallicFactor, true);
+ material->setMetallicFactor(revert_mat->mMetallicFactor, false);
}
if (changed_flags & MATERIAL_METALLIC_ROUGHTNESS_ROUGHNESS_DIRTY)
{
material->setRoughnessFactor(mEditor->getRoughnessFactor(), true);
}
- else if ((reverted_flags & MATERIAL_METALLIC_ROUGHTNESS_ROUGHNESS_DIRTY) && can_revert)
+ else if ((reverted_flags & MATERIAL_METALLIC_ROUGHTNESS_ROUGHNESS_DIRTY) && revert_mat.notNull())
{
- material->setRoughnessFactor(nodep->mSavedGLTFOverrideMaterials[te]->mRoughnessFactor, true);
+ material->setRoughnessFactor(revert_mat->mRoughnessFactor, false);
}
if (changed_flags & MATERIAL_EMISIVE_COLOR_DIRTY)
{
material->setEmissiveColorFactor(LLColor3(mEditor->getEmissiveColor()), true);
}
- else if ((reverted_flags & MATERIAL_EMISIVE_COLOR_DIRTY) && can_revert)
+ else if ((reverted_flags & MATERIAL_EMISIVE_COLOR_DIRTY) && revert_mat.notNull())
{
- material->setEmissiveColorFactor(nodep->mSavedGLTFOverrideMaterials[te]->mEmissiveColor, true);
+ material->setEmissiveColorFactor(revert_mat->mEmissiveColor, false);
}
if (changed_flags & MATERIAL_EMISIVE_TEX_DIRTY)
{
material->setEmissiveId(mEditor->getEmissiveId(), true);
}
- else if ((reverted_flags & MATERIAL_EMISIVE_TEX_DIRTY) && can_revert)
+ else if ((reverted_flags & MATERIAL_EMISIVE_TEX_DIRTY) && revert_mat.notNull())
{
- material->setEmissiveId(nodep->mSavedGLTFOverrideMaterials[te]->mEmissiveId, true);
+ material->setEmissiveId(revert_mat->mEmissiveId, false);
}
if (changed_flags & MATERIAL_DOUBLE_SIDED_DIRTY)
{
material->setDoubleSided(mEditor->getDoubleSided(), true);
}
- else if ((reverted_flags & MATERIAL_DOUBLE_SIDED_DIRTY) && can_revert)
+ else if ((reverted_flags & MATERIAL_DOUBLE_SIDED_DIRTY) && revert_mat.notNull())
{
- material->setDoubleSided(nodep->mSavedGLTFOverrideMaterials[te]->mDoubleSided, true);
+ material->setDoubleSided(revert_mat->mDoubleSided, false);
}
if (changed_flags & MATERIAL_ALPHA_MODE_DIRTY)
{
material->setAlphaMode(mEditor->getAlphaMode(), true);
}
- else if ((reverted_flags & MATERIAL_ALPHA_MODE_DIRTY) && can_revert)
+ else if ((reverted_flags & MATERIAL_ALPHA_MODE_DIRTY) && revert_mat.notNull())
{
- material->setAlphaMode(nodep->mSavedGLTFOverrideMaterials[te]->mAlphaMode, true);
+ material->setAlphaMode(revert_mat->mAlphaMode, false);
}
if (changed_flags & MATERIAL_ALPHA_CUTOFF_DIRTY)
{
material->setAlphaCutoff(mEditor->getAlphaCutoff(), true);
}
- else if ((reverted_flags & MATERIAL_ALPHA_CUTOFF_DIRTY) && can_revert)
+ else if ((reverted_flags & MATERIAL_ALPHA_CUTOFF_DIRTY) && revert_mat.notNull())
{
- material->setAlphaCutoff(nodep->mSavedGLTFOverrideMaterials[te]->mAlphaCutoff, true);
+ material->setAlphaCutoff(revert_mat->mAlphaCutoff, false);
}
#if 1
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index 37ecf72b1b..f88735e275 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -4408,12 +4408,7 @@ void LLPanelFace::onPasteTexture(LLViewerObject* objectp, S32 te)
tep->setGLTFMaterialOverride(nullptr);
// 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));
+ LLGLTFMaterialList::queueApplyMaterialAsset(objectp->getID(), te, LLUUID::null);
}
// Texture map
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 6dbdc380dc..22dae36255 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -1814,12 +1814,7 @@ void LLObjectSelection::applyNoCopyPbrMaterialToTEs(LLViewerInventoryItem* item)
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));
+ LLGLTFMaterialList::queueApplyMaterialAsset(object->getID(), te, asset_id);
}
}
}
@@ -1959,12 +1954,7 @@ void LLSelectMgr::selectionSetGLTFMaterial(const LLUUID& mat_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));
+ LLGLTFMaterialList::queueApplyMaterialAsset(objectp->getID(), te, asset_id);
return true;
}