diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-11-22 00:10:37 +0200 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2024-11-22 15:38:53 +0200 |
commit | 7ff7de0f067d4d579143180ae21063d041f5d74a (patch) | |
tree | 8e2aca3ebc5399bf2b7beb0bb42aee71f510d514 /indra/newview | |
parent | 3db8ce984690486cf12343745a6330750b27ae0d (diff) |
viewer#3125 Crash at LLMaterialEditor::loadMaterial
Looks like floater expired while waiting for response
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llmaterialeditor.cpp | 22 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_material_editor.xml | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/strings.xml | 3 |
3 files changed, 16 insertions, 12 deletions
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index dde238eddb..1e3a328464 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -1976,21 +1976,21 @@ void LLMaterialEditor::loadMaterialFromFile(const std::string& filename, S32 ind return; } - LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor"); - if (index >= 0) { // Prespecified material + LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor"); me->loadMaterial(model_in, filename, index); } else if (model_in.materials.size() == 1) { - // Only one, just load it + // Only one material, just load it + LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor"); me->loadMaterial(model_in, filename, 0); } else { - // Promt user to select material + // Multiple materials, Promt user to select material std::list<std::string> material_list; std::vector<tinygltf::Material>::const_iterator mat_iter = model_in.materials.begin(); std::vector<tinygltf::Material>::const_iterator mat_end = model_in.materials.end(); @@ -2008,15 +2008,19 @@ void LLMaterialEditor::loadMaterialFromFile(const std::string& filename, S32 ind } } - material_list.push_back(me->getString("material_batch_import_text")); + material_list.push_back(LLTrans::getString("material_batch_import_text")); LLFloaterComboOptions::showUI( - [me, model_in, filename](const std::string& option, S32 index) + [model_in, filename](const std::string& option, S32 index) { - me->loadMaterial(model_in, filename, index); + if (index >= 0) // -1 on cancel + { + LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor"); + me->loadMaterial(model_in, filename, index); + } }, - me->getString("material_selection_title"), - me->getString("material_selection_text"), + LLTrans::getString("material_selection_title"), + LLTrans::getString("material_selection_text"), material_list ); } diff --git a/indra/newview/skins/default/xui/en/floater_material_editor.xml b/indra/newview/skins/default/xui/en/floater_material_editor.xml index a6a401f43e..21ceeafeea 100644 --- a/indra/newview/skins/default/xui/en/floater_material_editor.xml +++ b/indra/newview/skins/default/xui/en/floater_material_editor.xml @@ -13,9 +13,6 @@ title="[MATERIAL_NAME]"> <string name="no_upload_fee_string">no upload fee</string> <string name="upload_fee_string">L$[FEE] upload fee</string> - <string name="material_selection_title">Material selection</string> - <string name="material_selection_text">Select material:</string> - <string name="material_batch_import_text">--- Bulk Upload All ---</string> <string name="material_override_title">Editing Material</string> <scroll_container diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 2d04b3e0fe..f0a26f9c56 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -4312,6 +4312,9 @@ name="Command_360_Capture_Tooltip">Capture a 360 equirectangular image</string> <!-- PBR Materials --> <string name="Material Texture Name Header">Textures present this material: </string> + <string name="material_selection_title">Material selection</string> + <string name="material_selection_text">Select material:</string> + <string name="material_batch_import_text">--- Bulk Upload All ---</string> <!-- Conversation log messages --> <string name="logging_calls_disabled_log_empty"> |