From 88292104d9a2332e6169f2add8f0b590bb22dbff Mon Sep 17 00:00:00 2001
From: David Parks <davep@lindenlab.com>
Date: Wed, 4 Nov 2009 14:19:05 +0000
Subject: [PATCH] Fix for crash when loading some meshes. Added button to
 auto-fill LODs.

---
 indra/llmath/llvolume.cpp  | 4 +++-
 indra/newview/pipeline.cpp | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index afa82ed399..ddd1b4b3db 100644
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -1690,9 +1690,11 @@ LLVolume::LLVolume(const LLVolumeParams &params, const F32 detail, const BOOL ge
 
 	mGenerateSingleFace = generate_single_face;
 
-	generate();
+	mLODScaleBias.setVec(1,1,1);
+
 	if (mParams.getSculptID().isNull() && params.getSculptType() == LL_SCULPT_TYPE_NONE)
 	{
+		generate();
 		createVolumeFaces();
 	}
 }
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 7cf5cf75ad..4fc94c08bc 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -8988,6 +8988,7 @@ void LLPipeline::LLMeshThread::run()
 		{
 			LLVolumeParams volume_params;
 			volume_params.setType(LL_PCODE_PROFILE_SQUARE, LL_PCODE_PATH_LINE);
+			volume_params.setSculptID(mMeshID, LL_SCULPT_TYPE_MESH);
 			mVolume = new LLVolume(volume_params, mDetail);
 			mVolume->createVolumeFacesFromStream(buffer_stream);
 		}
-- 
GitLab