From f3806a4a05238230c5bf7ffe408d63bd662cb73c Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Fri, 30 Apr 2021 19:35:03 +0300
Subject: [PATCH] SL-15159 Switching uploader to 'load from file' causes a
 small freeze even if empty

---
 indra/newview/llfloatermodelpreview.cpp | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index 999e4a9582f..6f5b95b602b 100644
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -1718,9 +1718,20 @@ void LLFloaterModelPreview::toggleCalculateButton(bool visible)
 void LLFloaterModelPreview::onLoDSourceCommit(S32 lod)
 {
 	mModelPreview->updateLodControls(lod);
-	refresh();
 
 	LLComboBox* lod_source_combo = getChild<LLComboBox>("lod_source_" + lod_name[lod]);
+
+    if (lod_source_combo->getCurrentIndex() == LLModelPreview::LOD_FROM_FILE
+        && mModelPreview->mLODFile[lod].empty())
+    {
+        // File wasn't selected, so nothing to do yet, refreshing
+        // hovewer will cause a small freeze with large meshes
+        // Might be good idea to open filepicker here
+        return;
+    }
+
+	refresh();
+
 	if (lod_source_combo->getCurrentIndex() == LLModelPreview::GENERATE)
 	{ //rebuild LoD to update triangle counts
 		onLODParamCommit(lod, true);
-- 
GitLab