summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-10-29 03:16:16 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-10-29 03:16:16 +0300
commit35d4124b5eb3d412643124993b4fa8c09f3f747c (patch)
treee8e35b52d51e4baef9c39cda52174d965a7ff1bb /indra
parentb6a35e36d71b421e8f74e5b5e3f0909c8fcda930 (diff)
SL-18446 Material override arrival for selected objects should update material editor
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llgltfmateriallist.cpp25
-rw-r--r--indra/newview/llmaterialeditor.cpp21
-rw-r--r--indra/newview/llmaterialeditor.h4
3 files changed, 48 insertions, 2 deletions
diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp
index ab7a6495c4..80f198fc6c 100644
--- a/indra/newview/llgltfmateriallist.cpp
+++ b/indra/newview/llgltfmateriallist.cpp
@@ -31,6 +31,7 @@
#include "lldispatcher.h"
#include "llfetchedgltfmaterial.h"
#include "llfilesystem.h"
+#include "llmaterialeditor.h"
#include "llsdserialize.h"
#include "lltinygltfhelper.h"
#include "llviewercontrol.h"
@@ -128,6 +129,12 @@ namespace
// object not ready to receive override data, queue for later
gGLTFMaterialList.queueOverrideUpdate(object_id, side, override_data);
}
+ else if (obj && obj->isAnySelected())
+ {
+ // Might want to cause a full selection
+ // update here instead of just an editor
+ LLMaterialEditor::updateLive();
+ }
}
}
@@ -140,6 +147,12 @@ namespace
obj->setTEGLTFMaterialOverride(i, nullptr);
}
}
+ if (obj->isAnySelected())
+ {
+ // Might want to cause a full selection
+ // update here instead of just an editor
+ LLMaterialEditor::updateLive();
+ }
}
}
else
@@ -154,6 +167,12 @@ namespace
{
obj->setTEGLTFMaterialOverride(i, nullptr);
}
+ if (obj->isAnySelected())
+ {
+ // Might want to cause a full selection
+ // update here instead of just an editor
+ LLMaterialEditor::updateLive();
+ }
}
return true;
}
@@ -190,6 +209,12 @@ void LLGLTFMaterialList::applyQueuedOverrides(LLViewerObject* obj)
return;
}
obj->setTEGLTFMaterialOverride(i, overrides[i]);
+ if (obj->isAnySelected())
+ {
+ // Might want to cause a full selection
+ // update here instead of just an editor
+ LLMaterialEditor::updateLive();
+ }
}
}
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp
index 533f882d39..c10625a45a 100644
--- a/indra/newview/llmaterialeditor.cpp
+++ b/indra/newview/llmaterialeditor.cpp
@@ -1513,13 +1513,14 @@ void LLMaterialEditor::loadMaterialFromFile(const std::string& filename, S32 ind
);
}
}
+
void LLMaterialEditor::onSelectionChanged()
{
// This won't get deletion or deselectAll()
// Might need to handle that separately
- mUnsavedChanges = 0;
clearTextures();
setFromSelection();
+ // At the moment all cahges are 'live' so don't reset dirty flags
// saveLiveValues(); todo
}
@@ -1554,6 +1555,21 @@ void LLMaterialEditor::saveLiveValues()
LLSelectMgr::getInstance()->getSelection()->applyToObjects(&savefunc);
}
+void LLMaterialEditor::updateLive()
+{
+ const LLSD floater_key(LIVE_MATERIAL_EDITOR_KEY);
+ LLFloater* instance = LLFloaterReg::findInstance("material_editor", floater_key);
+ if (instance && LLFloater::isVisible(instance))
+ {
+ LLMaterialEditor* me = (LLMaterialEditor*)instance;
+ if (me)
+ {
+ me->clearTextures();
+ me->setFromSelection();
+ }
+ }
+}
+
void LLMaterialEditor::loadLive()
{
// Allow only one 'live' instance
@@ -2164,6 +2180,9 @@ void LLMaterialEditor::applyToSelection()
// TODO figure out how to get the right asset id in cases where we don't have a good one
LLRenderMaterialOverrideFunctor override_func(this, url);
selected_objects->applyToTEs(&override_func);
+
+ // we posted all changes
+ mUnsavedChanges = 0;
}
else
{
diff --git a/indra/newview/llmaterialeditor.h b/indra/newview/llmaterialeditor.h
index 091f51234f..87c94041d3 100644
--- a/indra/newview/llmaterialeditor.h
+++ b/indra/newview/llmaterialeditor.h
@@ -103,8 +103,10 @@ public:
// will promt to select specific one
static void loadMaterialFromFile(const std::string& filename, S32 index = -1);
- void onSelectionChanged(); // // live overrides selection changes
+ void onSelectionChanged(); // live overrides selection changes
void saveLiveValues(); // for restoration on cancel
+
+ static void updateLive();
static void loadLive();
static void loadObjectSave();