Skip to content

Commit 7ff7de0

Browse files
committed
viewer#3125 Crash at LLMaterialEditor::loadMaterial
Looks like floater expired while waiting for response
1 parent 3db8ce9 commit 7ff7de0

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

indra/newview/llmaterialeditor.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1976,21 +1976,21 @@ void LLMaterialEditor::loadMaterialFromFile(const std::string& filename, S32 ind
19761976
return;
19771977
}
19781978

1979-
LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor");
1980-
19811979
if (index >= 0)
19821980
{
19831981
// Prespecified material
1982+
LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor");
19841983
me->loadMaterial(model_in, filename, index);
19851984
}
19861985
else if (model_in.materials.size() == 1)
19871986
{
1988-
// Only one, just load it
1987+
// Only one material, just load it
1988+
LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor");
19891989
me->loadMaterial(model_in, filename, 0);
19901990
}
19911991
else
19921992
{
1993-
// Promt user to select material
1993+
// Multiple materials, Promt user to select material
19941994
std::list<std::string> material_list;
19951995
std::vector<tinygltf::Material>::const_iterator mat_iter = model_in.materials.begin();
19961996
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
20082008
}
20092009
}
20102010

2011-
material_list.push_back(me->getString("material_batch_import_text"));
2011+
material_list.push_back(LLTrans::getString("material_batch_import_text"));
20122012

20132013
LLFloaterComboOptions::showUI(
2014-
[me, model_in, filename](const std::string& option, S32 index)
2014+
[model_in, filename](const std::string& option, S32 index)
20152015
{
2016-
me->loadMaterial(model_in, filename, index);
2016+
if (index >= 0) // -1 on cancel
2017+
{
2018+
LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor");
2019+
me->loadMaterial(model_in, filename, index);
2020+
}
20172021
},
2018-
me->getString("material_selection_title"),
2019-
me->getString("material_selection_text"),
2022+
LLTrans::getString("material_selection_title"),
2023+
LLTrans::getString("material_selection_text"),
20202024
material_list
20212025
);
20222026
}

indra/newview/skins/default/xui/en/floater_material_editor.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
title="[MATERIAL_NAME]">
1414
<string name="no_upload_fee_string">no upload fee</string>
1515
<string name="upload_fee_string">L$[FEE] upload fee</string>
16-
<string name="material_selection_title">Material selection</string>
17-
<string name="material_selection_text">Select material:</string>
18-
<string name="material_batch_import_text">--- Bulk Upload All ---</string>
1916
<string name="material_override_title">Editing Material</string>
2017

2118
<scroll_container

indra/newview/skins/default/xui/en/strings.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4312,6 +4312,9 @@ name="Command_360_Capture_Tooltip">Capture a 360 equirectangular image</string>
43124312

43134313
<!-- PBR Materials -->
43144314
<string name="Material Texture Name Header">Textures present this material: </string>
4315+
<string name="material_selection_title">Material selection</string>
4316+
<string name="material_selection_text">Select material:</string>
4317+
<string name="material_batch_import_text">--- Bulk Upload All ---</string>
43154318

43164319
<!-- Conversation log messages -->
43174320
<string name="logging_calls_disabled_log_empty">

0 commit comments

Comments
 (0)