diff options
Diffstat (limited to 'indra/newview/llfloatermodelpreview.cpp')
-rwxr-xr-x | indra/newview/llfloatermodelpreview.cpp | 94 |
1 files changed, 56 insertions, 38 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 87ada50e9a..1050e86060 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -94,8 +94,7 @@ #include "lltoggleablemenu.h" #include "llvfile.h" #include "llvfs.h" - - +#include "llcallbacklist.h" #include "glod/glod.h" @@ -108,7 +107,6 @@ const S32 PREVIEW_RESIZE_HANDLE_SIZE = S32(RESIZE_HANDLE_WIDTH * OO_SQRT2) + PRE const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE; const S32 PREF_BUTTON_HEIGHT = 16 + 7 + 16; const S32 PREVIEW_TEXTURE_HEIGHT = 300; -const S32 NUM_LOD = 4; void drawBoxOutline(const LLVector3& pos, const LLVector3& size); @@ -483,12 +481,10 @@ void LLFloaterModelPreview::onPreviewLODCommit(LLUICtrl* ctrl, void* userdata) S32 which_mode = 0; - LLCtrlSelectionInterface* iface = fp->childGetSelectionInterface("preview_lod_combo"); - if (iface) - { - which_mode = iface->getFirstSelectedIndex(); - } - which_mode = (NUM_LOD-1)-which_mode; // combo box list of lods is in reverse order + LLComboBox* combo = (LLComboBox*) ctrl;
+
+ which_mode = (NUM_LOD-1)-combo->getFirstSelectedIndex(); // combo box list of lods is in reverse order
+
fp->mModelPreview->setPreviewLOD(which_mode); } @@ -1581,8 +1577,8 @@ void LLModelLoader::run() } processElement(scene); - - mPreview->loadModelCallback(mLod); + + doOnIdleOneTime(boost::bind(&LLModelPreview::loadModelCallback,mPreview,mLod)); } } @@ -2034,6 +2030,8 @@ LLModelPreview::~LLModelPreview() U32 LLModelPreview::calcResourceCost() { + assert_main_thread(); + rebuildUploadData(); if ( mModelLoader->getLoadState() != LLModelLoader::ERROR_PARSING ) @@ -2115,6 +2113,8 @@ U32 LLModelPreview::calcResourceCost() void LLModelPreview::rebuildUploadData() { + assert_main_thread(); + mUploadData.clear(); mTextureSet.clear(); @@ -2223,6 +2223,8 @@ void LLModelPreview::clearModel(S32 lod) void LLModelPreview::loadModel(std::string filename, S32 lod) { + assert_main_thread(); + LLMutexLock lock(this); if (mModelLoader) @@ -2278,6 +2280,8 @@ void LLModelPreview::loadModel(std::string filename, S32 lod) void LLModelPreview::setPhysicsFromLOD(S32 lod) { + assert_main_thread(); + if (lod >= 0 && lod <= 3) { mModel[LLModel::LOD_PHYSICS] = mModel[lod]; @@ -2333,7 +2337,9 @@ void LLModelPreview::clearGLODGroup() } void LLModelPreview::loadModelCallback(S32 lod) -{ //NOT the main thread +{ + assert_main_thread(); + LLMutexLock lock(this); if (!mModelLoader) { @@ -2388,6 +2394,8 @@ void LLModelPreview::resetPreviewTarget() void LLModelPreview::generateNormals() { + assert_main_thread(); + S32 which_lod = mPreviewLOD; @@ -2655,7 +2663,7 @@ bool LLModelPreview::containsRiggedAsset( void ) } return false; } -void LLModelPreview::genLODs(S32 which_lod) +void LLModelPreview::genLODs(S32 which_lod, U32 decimation) { if (mBaseModel.empty()) { @@ -2872,7 +2880,7 @@ void LLModelPreview::genLODs(S32 which_lod) { if (lod < start) { - triangle_count /= 3; + triangle_count /= decimation; } } else @@ -3030,6 +3038,8 @@ void LLModelPreview::genLODs(S32 which_lod) void LLModelPreview::updateStatusMessages() { + assert_main_thread(); + //triangle/vertex/submesh count for each mesh asset for each lod std::vector<S32> tris[LLModel::NUM_LODS]; std::vector<S32> verts[LLModel::NUM_LODS]; @@ -3314,7 +3324,7 @@ void LLModelPreview::updateStatusMessages() } - else if (mFMP->childGetValue("lod_auto_generate").asBoolean()) + else if (mFMP->childGetValue("lod_none").asBoolean()) { for (U32 i = 0; i < num_file_controls; ++i) { @@ -3323,6 +3333,31 @@ void LLModelPreview::updateStatusMessages() for (U32 i = 0; i < num_lod_controls; ++i) { + mFMP->childDisable(lod_controls[i]); + } + + if (!mModel[mPreviewLOD].empty()) + { + mModel[mPreviewLOD].clear(); + mScene[mPreviewLOD].clear(); + mVertexBuffer[mPreviewLOD].clear(); + + //this can cause phasing issues with the UI, so reenter this function and return + updateStatusMessages(); + return; + } + + + } + else + { // auto generate, also the default case for wizard which has no radio selection + for (U32 i = 0; i < num_file_controls; ++i) + { + mFMP->childDisable(file_controls[i]); + } + + for (U32 i = 0; i < num_lod_controls; ++i) + { mFMP->childEnable(lod_controls[i]); } @@ -3355,29 +3390,6 @@ void LLModelPreview::updateStatusMessages() } } } - else - { // "None" is chosen - for (U32 i = 0; i < num_file_controls; ++i) - { - mFMP->childDisable(file_controls[i]); - } - - for (U32 i = 0; i < num_lod_controls; ++i) - { - mFMP->childDisable(lod_controls[i]); - } - - if (!mModel[mPreviewLOD].empty()) - { - mModel[mPreviewLOD].clear(); - mScene[mPreviewLOD].clear(); - mVertexBuffer[mPreviewLOD].clear(); - - //this can cause phasing issues with the UI, so reenter this function and return - updateStatusMessages(); - return; - } - } if (mFMP->childGetValue("physics_load_from_file").asBoolean()) { @@ -3561,6 +3573,8 @@ void LLModelPreview::update() //----------------------------------------------------------------------------- BOOL LLModelPreview::render() { + assert_main_thread(); + LLMutexLock lock(this); mNeedsUpdate = FALSE; @@ -4086,6 +4100,8 @@ void LLModelPreview::setPreviewLOD(S32 lod) //static void LLFloaterModelPreview::onBrowseLOD(void* data) { + assert_main_thread(); + LLFloaterModelPreview* mp = (LLFloaterModelPreview*) data; mp->loadModel(mp->mModelPreview->mPreviewLOD); } @@ -4093,6 +4109,8 @@ void LLFloaterModelPreview::onBrowseLOD(void* data) //static void LLFloaterModelPreview::onUpload(void* user_data) { + assert_main_thread(); + LLFloaterModelPreview* mp = (LLFloaterModelPreview*) user_data; mp->mModelPreview->rebuildUploadData(); |