diff options
| author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-01-23 19:17:46 +0200 | 
|---|---|---|
| committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-01-23 20:36:54 +0200 | 
| commit | a3f43b4b73cc8fbd48a0574ebd74bbe660f8af50 (patch) | |
| tree | cb37d733ecbe763895a5c81191befc2a85b240ba /indra/newview | |
| parent | 8bad6ccde406566cd6859db69c45c06eb6001386 (diff) | |
SL-19014 Sanitize the override data sent for faces without GLTF materials
Diffstat (limited to 'indra/newview')
| -rw-r--r-- | indra/newview/llgltfmateriallist.cpp | 25 | ||||
| -rw-r--r-- | indra/newview/llgltfmateriallist.h | 2 | ||||
| -rw-r--r-- | indra/newview/llmaterialeditor.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/llpanelface.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/llselectmgr.cpp | 2 | 
5 files changed, 21 insertions, 12 deletions
| diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index 9399342a61..4cf1562042 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -392,15 +392,18 @@ void LLGLTFMaterialList::applyQueuedOverrides(LLViewerObject* obj)      }  } -void LLGLTFMaterialList::queueModify(const LLUUID& id, S32 side, const LLGLTFMaterial* mat) +void LLGLTFMaterialList::queueModify(const LLViewerObject* obj, S32 side, const LLGLTFMaterial* mat)  { -    if (mat == nullptr) +    if (obj && obj->getRenderMaterialID(side).notNull())      { -        sModifyQueue.push_back({ id, side, LLGLTFMaterial(), false }); -    } -    else -    { -        sModifyQueue.push_back({ id, side, *mat, true}); +        if (mat == nullptr) +        { +            sModifyQueue.push_back({ obj->getID(), side, LLGLTFMaterial(), false }); +        } +        else +        { +            sModifyQueue.push_back({ obj->getID(), side, *mat, true }); +        }      }  } @@ -437,8 +440,14 @@ void LLGLTFMaterialList::flushUpdates(void(*done_callback)(bool))      S32 i = data.size(); -    for (auto& e : sModifyQueue) +    for (ModifyMaterialData& e : sModifyQueue)      { +#ifdef SHOW_ASSERT +        // validate object has a material id +        LLViewerObject* obj = gObjectList.findObject(e.object_id); +        llassert(obj && obj->getRenderMaterialID(e.side).notNull()); +#endif +          data[i]["object_id"] = e.object_id;          data[i]["side"] = e.side; diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index 70540e5e01..5ce0e324f5 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -60,7 +60,7 @@ public:      //  mat - material to apply as override, or nullptr to remove existing overrides and revert to asset      //      // NOTE: do not use to revert to asset when applying a new asset id, use queueApply below -    static void queueModify(const LLUUID& id, S32 side, const LLGLTFMaterial* mat); +    static void queueModify(const LLViewerObject* obj, S32 side, const LLGLTFMaterial* mat);      // Queue an application of a material asset we want to send to the simulator.  Call "flushUpdates" to flush pending updates.      //  object_id - ID of object to apply material asset to diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index dabc7d16ea..a36ddeb532 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -2674,7 +2674,7 @@ public:              {                  mSuccess = true;              } -            LLGLTFMaterialList::queueModify(objectp->getID(), te, material); +            LLGLTFMaterialList::queueModify(objectp, te, material);          }          return true;      } diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index cf02f3c4e4..cb09ec9fbf 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -152,7 +152,7 @@ void LLPanelFace::updateSelectedGLTFMaterials(std::function<void(LLGLTFMaterial*                  new_override = *tep->getGLTFMaterialOverride();              }              mFunc(&new_override); -            LLGLTFMaterialList::queueModify(object->getID(), face, &new_override); +            LLGLTFMaterialList::queueModify(object, face, &new_override);              return true;          } diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 2b6578c272..1f604f3cba 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -2219,7 +2219,7 @@ void LLSelectMgr::selectionRevertGLTFMaterials()                      && asset_id.notNull())                  {                      // Restore overrides -                    LLGLTFMaterialList::queueModify(objectp->getID(), te, nodep->mSavedGLTFOverrideMaterials[te]); +                    LLGLTFMaterialList::queueModify(objectp, te, nodep->mSavedGLTFOverrideMaterials[te]);                  }                   else                  { | 
