summaryrefslogtreecommitdiff
path: root/indra/newview/llgltfmateriallist.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-10-31 20:12:53 +0200
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-10-31 20:12:53 +0200
commit094a8876d6e030b5dc618ea28250e15022030c78 (patch)
treedef08dcfc7baa41eb445d2f9a8ed54f5daed6d14 /indra/newview/llgltfmateriallist.cpp
parent35d4124b5eb3d412643124993b4fa8c09f3f747c (diff)
SL-18446 Material override arrival filtering
Diffstat (limited to 'indra/newview/llgltfmateriallist.cpp')
-rw-r--r--indra/newview/llgltfmateriallist.cpp49
1 files changed, 29 insertions, 20 deletions
diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp
index 80f198fc6c..d91a448bc8 100644
--- a/indra/newview/llgltfmateriallist.cpp
+++ b/indra/newview/llgltfmateriallist.cpp
@@ -117,6 +117,12 @@ namespace
if (!success)
{
LL_WARNS() << "failed to parse GLTF override data. errors: " << error_msg << " | warnings: " << warn_msg << LL_ENDL;
+
+ // unblock material editor
+ if (obj && obj->isAnySelected())
+ {
+ LLMaterialEditor::updateLive(object_id, sides[i].asInteger());
+ }
}
else
{
@@ -131,28 +137,25 @@ namespace
}
else if (obj && obj->isAnySelected())
{
- // Might want to cause a full selection
- // update here instead of just an editor
- LLMaterialEditor::updateLive();
+ LLMaterialEditor::updateLive(object_id, side);
}
}
}
if (obj && side_set.size() != obj->getNumTEs())
{ // object exists and at least one texture entry needs to have its override data nulled out
+ bool object_has_selection = obj->isAnySelected();
for (int i = 0; i < obj->getNumTEs(); ++i)
{
if (side_set.find(i) == side_set.end())
{
obj->setTEGLTFMaterialOverride(i, nullptr);
+ if (object_has_selection)
+ {
+ LLMaterialEditor::updateLive(object_id, i);
+ }
}
}
- if (obj->isAnySelected())
- {
- // Might want to cause a full selection
- // update here instead of just an editor
- LLMaterialEditor::updateLive();
- }
}
}
else
@@ -163,15 +166,14 @@ namespace
if (clear_all && obj)
{ // override list was empty or an error occurred, null out all overrides for this object
+ bool object_has_selection = obj->isAnySelected();
for (int i = 0; i < obj->getNumTEs(); ++i)
{
obj->setTEGLTFMaterialOverride(i, nullptr);
- }
- if (obj->isAnySelected())
- {
- // Might want to cause a full selection
- // update here instead of just an editor
- LLMaterialEditor::updateLive();
+ if (object_has_selection)
+ {
+ LLMaterialEditor::updateLive(obj->getID(), i);
+ }
}
}
return true;
@@ -199,6 +201,7 @@ void LLGLTFMaterialList::applyQueuedOverrides(LLViewerObject* obj)
if (iter != mQueuedOverrides.end())
{
+ bool object_has_selection = obj->isAnySelected();
override_list_t& overrides = iter->second;
for (int i = 0; i < overrides.size(); ++i)
{
@@ -209,11 +212,9 @@ void LLGLTFMaterialList::applyQueuedOverrides(LLViewerObject* obj)
return;
}
obj->setTEGLTFMaterialOverride(i, overrides[i]);
- if (obj->isAnySelected())
+ if (object_has_selection)
{
- // Might want to cause a full selection
- // update here instead of just an editor
- LLMaterialEditor::updateLive();
+ LLMaterialEditor::updateLive(id, i);
}
}
}
@@ -380,7 +381,7 @@ void LLGLTFMaterialList::registerCallbacks()
}
// static
-void LLGLTFMaterialList::modifyMaterialCoro(std::string cap_url, LLSD overrides)
+void LLGLTFMaterialList::modifyMaterialCoro(std::string cap_url, LLSD overrides, void(*done_callback)(bool) )
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
@@ -398,12 +399,20 @@ void LLGLTFMaterialList::modifyMaterialCoro(std::string cap_url, LLSD overrides)
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
+ bool success = true;
if (!status)
{
LL_WARNS() << "Failed to modify material." << LL_ENDL;
+ success = false;
}
else if (!result["success"].asBoolean())
{
LL_WARNS() << "Failed to modify material: " << result["message"] << LL_ENDL;
+ success = false;
+ }
+
+ if (done_callback)
+ {
+ done_callback(success);
}
}