summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2022-11-03 13:18:14 +0200
committerMnikolenko Productengine <mnikolenko@productengine.com>2022-11-03 15:17:09 +0200
commita0c7a7ecdc7b9fb53fa1175babf0d8497a3e9112 (patch)
tree9fa9ca18f29c07f4c2f42c169840701735cd04f1
parent0f20cf17fd31abb051efd5bd14399ed6329112cf (diff)
SL-18548 fix for crash when trying to Save material without caps
-rw-r--r--indra/newview/llmaterialeditor.cpp19
-rw-r--r--indra/newview/llmaterialeditor.h2
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml8
3 files changed, 29 insertions, 0 deletions
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp
index 00105c1e8f..397a302069 100644
--- a/indra/newview/llmaterialeditor.cpp
+++ b/indra/newview/llmaterialeditor.cpp
@@ -883,6 +883,11 @@ static U32 write_texture(const LLUUID& id, tinygltf::Model& model)
void LLMaterialEditor::onClickSave()
{
+ if (!capabilitiesAvalaible())
+ {
+ LLNotificationsUtil::add("MissingMaterialCaps");
+ return;
+ }
if (!can_afford_transaction(mExpectedUploadCost))
{
LLSD args;
@@ -2809,3 +2814,17 @@ void LLMaterialEditor::loadDefaults()
setFromGltfModel(model_in, 0, true);
}
+bool LLMaterialEditor::capabilitiesAvalaible()
+{
+ const LLViewerRegion* region = gAgent.getRegion();
+ if (!region)
+ {
+ LL_WARNS("MaterialEditor") << "Not connected to a region, cannot save material." << LL_ENDL;
+ return false;
+ }
+ std::string agent_url = region->getCapability("UpdateMaterialAgentInventory");
+ std::string task_url = region->getCapability("UpdateMaterialTaskInventory");
+
+ return (!agent_url.empty() && !task_url.empty());
+}
+
diff --git a/indra/newview/llmaterialeditor.h b/indra/newview/llmaterialeditor.h
index 1fb10dbcf1..8f0c16881b 100644
--- a/indra/newview/llmaterialeditor.h
+++ b/indra/newview/llmaterialeditor.h
@@ -228,6 +228,8 @@ public:
U32 getUnsavedChangesFlags() { return mUnsavedChanges; }
+ bool capabilitiesAvalaible();
+
private:
static bool updateInventoryItem(const std::string &buffer, const LLUUID &item_id, const LLUUID &task_id);
static void createInventoryItem(const std::string &buffer, const std::string &name, const std::string &desc);
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 07ad2838b0..1dc979fda6 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -6858,6 +6858,14 @@ Please try again.
<notification
icon="notifytip.tga"
+ name="MissingMaterialCaps"
+ type="notifytip">
+ <tag>fail</tag>
+ Not connected to a materials capable region.
+ </notification>
+
+ <notification
+ icon="notifytip.tga"
name="ScriptMissing"
type="notifytip">
Script is missing from database.