summaryrefslogtreecommitdiff
path: root/indra/newview/llmaterialeditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llmaterialeditor.cpp')
-rw-r--r--indra/newview/llmaterialeditor.cpp37
1 files changed, 8 insertions, 29 deletions
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp
index a6d2729dfa..7cd9b9198f 100644
--- a/indra/newview/llmaterialeditor.cpp
+++ b/indra/newview/llmaterialeditor.cpp
@@ -2039,11 +2039,16 @@ public:
// Selection can cover multiple objects, and live editor is
// supposed to overwrite changed values only
LLTextureEntry* tep = objectp->getTE(te);
- LLPointer<LLGLTFMaterial> material = tep->getGLTFMaterial();
+ LLPointer<LLGLTFMaterial> material = tep->getGLTFRenderMaterial();
+
if (material.isNull())
{
material = new LLGLTFMaterial();
}
+ else
+ {
+ material = new LLGLTFMaterial(*material);
+ }
// Override object's values with values from editor where appropriate
if (mEditor->getUnsavedChangesFlags() & MATERIAL_BASE_COLOR_DIRTY)
@@ -2101,12 +2106,13 @@ public:
std::string overrides_json = material->asJSON();
+
LLSD overrides = llsd::map(
"object_id", objectp->getID(),
"side", te,
"gltf_json", overrides_json
);
- LLCoros::instance().launch("modifyMaterialCoro", std::bind(&LLMaterialEditor::modifyMaterialCoro, mEditor, mCapUrl, overrides));
+ LLCoros::instance().launch("modifyMaterialCoro", std::bind(&LLGLTFMaterialList::modifyMaterialCoro, mCapUrl, overrides));
}
return true;
}
@@ -2587,30 +2593,3 @@ void LLMaterialEditor::loadDefaults()
setFromGltfModel(model_in, 0, true);
}
-void LLMaterialEditor::modifyMaterialCoro(std::string cap_url, LLSD overrides)
-{
- LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
- LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
- httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("modifyMaterialCoro", httpPolicy));
- LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
- LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions);
- LLCore::HttpHeaders::ptr_t httpHeaders;
-
- httpOpts->setFollowRedirects(true);
-
- LL_DEBUGS() << "Applying override via ModifyMaterialParams cap: " << overrides << LL_ENDL;
-
- LLSD result = httpAdapter->postAndSuspend(httpRequest, cap_url, overrides, httpOpts, httpHeaders);
-
- LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
- LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
-
- if (!status)
- {
- LL_WARNS() << "Failed to modify material." << LL_ENDL;
- }
- else if (!result["success"].asBoolean())
- {
- LL_WARNS() << "Failed to modify material: " << result["message"] << LL_ENDL;
- }
-}