summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosmic Linden <cosmic@lindenlab.com>2024-01-24 13:57:46 -0800
committerCosmic Linden <cosmic@lindenlab.com>2024-01-25 10:32:38 -0800
commit1691a25ce801bfd22cfc89958a07c4f53d3af772 (patch)
treeb5d3de1a681ddf45bfc3da50461dda9993d9af0e
parent97764080b0eaf7b359b7e2332e6c1257ba86a71a (diff)
Fix material preview sometimes not updating when transitioning from blank material to non-blank material
-rw-r--r--indra/newview/llfetchedgltfmaterial.h2
-rw-r--r--indra/newview/llgltfmaterialpreviewmgr.cpp2
-rw-r--r--indra/newview/lltexturectrl.cpp4
3 files changed, 6 insertions, 2 deletions
diff --git a/indra/newview/llfetchedgltfmaterial.h b/indra/newview/llfetchedgltfmaterial.h
index 3fa4619d8c..42c835a416 100644
--- a/indra/newview/llfetchedgltfmaterial.h
+++ b/indra/newview/llfetchedgltfmaterial.h
@@ -40,6 +40,8 @@ public:
virtual ~LLFetchedGLTFMaterial();
LLFetchedGLTFMaterial& operator=(const LLFetchedGLTFMaterial& rhs);
+ // LLGLTFMaterial::operator== is defined, but LLFetchedGLTFMaterial::operator== is not.
+ bool operator==(const LLGLTFMaterial& rhs) const = delete;
// If this material is loaded, fire the given function
void onMaterialComplete(std::function<void()> material_complete);
diff --git a/indra/newview/llgltfmaterialpreviewmgr.cpp b/indra/newview/llgltfmaterialpreviewmgr.cpp
index 1dba3f082f..394f600a92 100644
--- a/indra/newview/llgltfmaterialpreviewmgr.cpp
+++ b/indra/newview/llgltfmaterialpreviewmgr.cpp
@@ -130,6 +130,8 @@ namespace
LLGLTFPreviewTexture::MaterialLoadLevels get_material_load_levels(LLFetchedGLTFMaterial& material)
{
+ llassert(!material.isFetching());
+
using MaterialTextures = LLPointer<LLViewerFetchedTexture>*[LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT];
MaterialTextures textures;
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index 916c0194c2..febda177e2 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -666,7 +666,7 @@ void LLFloaterTexturePicker::draw()
{
mGLTFMaterial = (LLFetchedGLTFMaterial*) gGLTFMaterialList.getMaterial(mImageAssetID);
llassert(mGLTFMaterial == nullptr || dynamic_cast<LLFetchedGLTFMaterial*>(gGLTFMaterialList.getMaterial(mImageAssetID)) != nullptr);
- if (mGLTFPreview.isNull() || mGLTFMaterial.isNull() || (old_material.notNull() && (*old_material.get() != *mGLTFMaterial.get())))
+ if (mGLTFPreview.isNull() || mGLTFMaterial.isNull() || (old_material.notNull() && (old_material.get() != mGLTFMaterial.get())))
{
// Only update the preview if needed, since gGLTFMaterialPreviewMgr does not cache the preview.
if (mGLTFMaterial.isNull())
@@ -2206,7 +2206,7 @@ void LLTextureCtrl::draw()
if (mInventoryPickType == PICK_MATERIAL)
{
mGLTFMaterial = gGLTFMaterialList.getMaterial(mImageAssetID);
- if (mGLTFPreview.isNull() || mGLTFMaterial.isNull() || (old_material.notNull() && (*old_material.get() != *mGLTFMaterial.get())))
+ if (mGLTFPreview.isNull() || mGLTFMaterial.isNull() || (old_material.notNull() && (old_material.get() != mGLTFMaterial.get())))
{
// Only update the preview if needed, since gGLTFMaterialPreviewMgr does not cache the preview.
if (mGLTFMaterial.isNull())