summaryrefslogtreecommitdiff
path: root/indra/newview/llmaterialeditor.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-10-30 23:56:33 +0200
committerakleshchev <117672381+akleshchev@users.noreply.github.com>2023-11-06 18:29:42 +0200
commit3a5b678eba5d86acccb1a1f233f862d292258fac (patch)
tree16c71f0ed33daa46c9c10281255ec0a37dca7749 /indra/newview/llmaterialeditor.cpp
parent596a63051ebabfec51e48be02bbec33ab962d915 (diff)
SL-20523 Local textures not updating on PBR Materials #3
Diffstat (limited to 'indra/newview/llmaterialeditor.cpp')
-rw-r--r--indra/newview/llmaterialeditor.cpp58
1 files changed, 31 insertions, 27 deletions
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp
index b8e34b7409..836ea5c869 100644
--- a/indra/newview/llmaterialeditor.cpp
+++ b/indra/newview/llmaterialeditor.cpp
@@ -365,11 +365,6 @@ LLMaterialEditor::LLMaterialEditor(const LLSD& key)
LLMaterialEditor::~LLMaterialEditor()
{
- for (mat_connection_map_t::value_type cn : mTextureChangesUpdates)
- {
- cn.second.mConnection.disconnect();
- }
- mTextureChangesUpdates.clear();
}
void LLMaterialEditor::setObjectID(const LLUUID& object_id)
@@ -540,6 +535,11 @@ void LLMaterialEditor::onClose(bool app_quitting)
{
mSelectionUpdateSlot.disconnect();
}
+ for (mat_connection_map_t::value_type cn : mTextureChangesUpdates)
+ {
+ cn.second.mConnection.disconnect();
+ }
+ mTextureChangesUpdates.clear();
LLPreview::onClose(app_quitting);
}
@@ -872,22 +872,24 @@ void LLMaterialEditor::setEnableEditing(bool can_modify)
void LLMaterialEditor::subscribeToLocalTexture(S32 dirty_flag, const LLUUID& tracking_id)
{
- LocalTextureConnection info;
- info.mTrackingId = tracking_id;
- info.mConnection = LLLocalBitmapMgr::getInstance()->setOnChangedCallback(tracking_id,
- [this, dirty_flag](const LLUUID& tracking_id, const LLUUID& old_id, const LLUUID& new_id)
- {
- if (new_id.isNull())
- {
- mTextureChangesUpdates[dirty_flag].mConnection.disconnect();
- mTextureChangesUpdates.erase(dirty_flag);
- }
- else
- {
- replaceLocalTexture(old_id, new_id);
- }
- });
- mTextureChangesUpdates[dirty_flag] = info;
+ if (mTextureChangesUpdates[dirty_flag].mTrackingId != tracking_id)
+ {
+ mTextureChangesUpdates[dirty_flag].mConnection.disconnect();
+ mTextureChangesUpdates[dirty_flag].mTrackingId = tracking_id;
+ mTextureChangesUpdates[dirty_flag].mConnection = LLLocalBitmapMgr::getInstance()->setOnChangedCallback(tracking_id,
+ [this, dirty_flag](const LLUUID& tracking_id, const LLUUID& old_id, const LLUUID& new_id)
+ {
+ if (new_id.isNull())
+ {
+ mTextureChangesUpdates[dirty_flag].mConnection.disconnect();
+ //mTextureChangesUpdates.erase(dirty_flag);
+ }
+ else
+ {
+ replaceLocalTexture(old_id, new_id);
+ }
+ });
+ }
}
void LLMaterialEditor::replaceLocalTexture(const LLUUID& old_id, const LLUUID& new_id)
@@ -981,19 +983,21 @@ void LLMaterialEditor::onCommitTexture(LLUICtrl* ctrl, const LLSD& data, S32 dir
// the texture that is not in use
childSetValue(upload_fee_ctrl_name, getString("no_upload_fee_string"));
}
+ }
+ LLTextureCtrl* tex_ctrl = (LLTextureCtrl*)ctrl;
+ if (tex_ctrl->isImageLocal())
+ {
+ subscribeToLocalTexture(dirty_flag, tex_ctrl->getLocalTrackingID());
+ }
+ else
+ {
// unsubcribe potential old callabck
mat_connection_map_t::iterator found = mTextureChangesUpdates.find(dirty_flag);
if (found != mTextureChangesUpdates.end())
{
found->second.mConnection.disconnect();
}
-
- LLTextureCtrl* tex_ctrl = (LLTextureCtrl*)ctrl;
- if (tex_ctrl->isImageLocal())
- {
- subscribeToLocalTexture(dirty_flag, tex_ctrl->getLocalTrackingID());
- }
}
markChangesUnsaved(dirty_flag);