summaryrefslogtreecommitdiff
path: root/indra/llprimitive
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-11-02 00:33:39 +0200
committerakleshchev <117672381+akleshchev@users.noreply.github.com>2023-11-06 18:29:42 +0200
commit52c60ab3fdb8617471eccd9df52cc126e0243e76 (patch)
tree7496136c8551ef61fd306f119c7cc6a77ca16a47 /indra/llprimitive
parent3a5b678eba5d86acccb1a1f233f862d292258fac (diff)
SL-20523 Local textures not updating on PBR Materials #4
Diffstat (limited to 'indra/llprimitive')
-rw-r--r--indra/llprimitive/llgltfmaterial.cpp27
-rw-r--r--indra/llprimitive/llgltfmaterial.h12
2 files changed, 19 insertions, 20 deletions
diff --git a/indra/llprimitive/llgltfmaterial.cpp b/indra/llprimitive/llgltfmaterial.cpp
index e590b14656..3945be3254 100644
--- a/indra/llprimitive/llgltfmaterial.cpp
+++ b/indra/llprimitive/llgltfmaterial.cpp
@@ -89,8 +89,7 @@ LLGLTFMaterial& LLGLTFMaterial::operator=(const LLGLTFMaterial& rhs)
mOverrideDoubleSided = rhs.mOverrideDoubleSided;
mOverrideAlphaMode = rhs.mOverrideAlphaMode;
- mLocalTextureIds = rhs.mLocalTextureIds;
- mLocalTextureTrackingIds = rhs.mLocalTextureTrackingIds;
+ mTrackingIdToLocalTexture = rhs.mTrackingIdToLocalTexture;
updateTextureTracking();
@@ -606,6 +605,8 @@ void LLGLTFMaterial::applyOverride(const LLGLTFMaterial& override_mat)
mTextureTransform[i].mRotation = override_mat.mTextureTransform[i].mRotation;
}
}
+
+ mTrackingIdToLocalTexture.insert(override_mat.mTrackingIdToLocalTexture.begin(), override_mat.mTrackingIdToLocalTexture.begin());
}
void LLGLTFMaterial::getOverrideLLSD(const LLGLTFMaterial& override_mat, LLSD& data)
@@ -781,17 +782,15 @@ void LLGLTFMaterial::removeTextureEntry(LLTextureEntry* te)
void LLGLTFMaterial::addLocalTextureTracking(const LLUUID& tracking_id, const LLUUID& tex_id)
{
- mLocalTextureTrackingIds.insert(tracking_id);
- mLocalTextureIds.insert(tex_id);
+ mTrackingIdToLocalTexture[tracking_id] = tex_id;
}
-void LLGLTFMaterial::removeLocalTextureTracking(const LLUUID& tracking_id, const LLUUID& tex_id)
+void LLGLTFMaterial::removeLocalTextureTracking(const LLUUID& tracking_id)
{
- mLocalTextureTrackingIds.erase(tracking_id);
- mLocalTextureIds.erase(tex_id);
+ mTrackingIdToLocalTexture.erase(tracking_id);
}
-bool LLGLTFMaterial::replaceLocalTexture(const LLUUID& old_id, const LLUUID& new_id)
+bool LLGLTFMaterial::replaceLocalTexture(const LLUUID& tracking_id, const LLUUID& old_id, const LLUUID& new_id)
{
bool res = false;
@@ -804,10 +803,13 @@ bool LLGLTFMaterial::replaceLocalTexture(const LLUUID& old_id, const LLUUID& new
}
}
- mLocalTextureIds.erase(old_id);
if (res)
{
- mLocalTextureIds.insert(new_id);
+ mTrackingIdToLocalTexture[tracking_id] = new_id;
+ }
+ else
+ {
+ mTrackingIdToLocalTexture.erase(tracking_id);
}
return res;
@@ -815,8 +817,5 @@ bool LLGLTFMaterial::replaceLocalTexture(const LLUUID& old_id, const LLUUID& new
void LLGLTFMaterial::updateTextureTracking()
{
- if (mLocalTextureTrackingIds.size() > 0)
- {
- LL_WARNS() << "copied a material with local textures, but tracking not implemented" << LL_ENDL;
- }
+ // setTEGLTFMaterialOverride is responsible for tracking
}
diff --git a/indra/llprimitive/llgltfmaterial.h b/indra/llprimitive/llgltfmaterial.h
index 2a9ef3ffe0..7b38663307 100644
--- a/indra/llprimitive/llgltfmaterial.h
+++ b/indra/llprimitive/llgltfmaterial.h
@@ -196,7 +196,7 @@ public:
// write to given tinygltf::Model
void writeToModel(tinygltf::Model& model, S32 mat_index) const;
- void applyOverride(const LLGLTFMaterial& override_mat);
+ virtual void applyOverride(const LLGLTFMaterial& override_mat);
// apply the given LLSD override data
void applyOverrideLLSD(const LLSD& data);
@@ -224,13 +224,13 @@ public:
// For local textures so that editor will know to track changes
void addLocalTextureTracking(const LLUUID& tracking_id, const LLUUID &tex_id);
- void removeLocalTextureTracking(const LLUUID& tracking_id, const LLUUID& tex_id);
- bool hasLocalTextures() { return !mLocalTextureIds.empty(); }
- virtual bool replaceLocalTexture(const LLUUID &old_id, const LLUUID& new_id);
+ void removeLocalTextureTracking(const LLUUID& tracking_id);
+ bool hasLocalTextures() { return !mTrackingIdToLocalTexture.empty(); }
+ virtual bool replaceLocalTexture(const LLUUID& tracking_id, const LLUUID &old_id, const LLUUID& new_id);
virtual void updateTextureTracking();
- uuid_set_t mLocalTextureIds;
- uuid_set_t mLocalTextureTrackingIds;
+ typedef std::map<LLUUID, LLUUID> local_tex_map_t;
+ local_tex_map_t mTrackingIdToLocalTexture;
std::set<LLTextureEntry*> mTextureEntires;
protected: