From 8ba0baa63109d5e45c1f3cfd75c7d230ff99031f Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 22 Dec 2010 10:55:48 -0700 Subject: fix for SH-648: Crash on exit in LLViewerFetchedTexture (ref count error) --- indra/newview/llfloatermodelpreview.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 85d0ae02cf..cc4359a1bf 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -475,10 +475,10 @@ void LLFloaterModelPreview::onPreviewLODCommit(LLUICtrl* ctrl, void* userdata) S32 which_mode = 0; - LLComboBox* combo = (LLComboBox*) ctrl; - - which_mode = (NUM_LOD-1)-combo->getFirstSelectedIndex(); // 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); } -- cgit v1.2.3 From 07d3480ec35a9a5bade25acb99fc39935bad38a2 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 22 Dec 2010 15:18:55 -0600 Subject: SH-658 Preserve LOD mode when switching between preview LoDs. --- indra/newview/llfloatermodelpreview.cpp | 143 ++++++++++++++++++-------------- 1 file changed, 80 insertions(+), 63 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 1050e86060..39af84cfa0 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -89,6 +89,7 @@ #include "llstring.h" #include "llbutton.h" #include "llcheckboxctrl.h" +#include "llradiogroup.h" #include "llsliderctrl.h" #include "llspinctrl.h" #include "lltoggleablemenu.h" @@ -257,6 +258,12 @@ LLFloater(key) mLastMouseY = 0; mGLName = 0; mStatusLock = new LLMutex(NULL); + + mLODMode[LLModel::LOD_HIGH] = 0; + for (U32 i = 0; i < LLModel::LOD_HIGH; i++) + { + mLODMode[i] = 1; + } } //----------------------------------------------------------------------------- @@ -3309,84 +3316,87 @@ void LLModelPreview::updateStatusMessages() }; const U32 num_file_controls = sizeof(file_controls)/sizeof(char*); - //enable/disable controls based on radio groups - if (mFMP->childGetValue("lod_from_file").asBoolean()) - { - for (U32 i = 0; i < num_file_controls; ++i) - { - mFMP->childEnable(file_controls[i]); - } - - for (U32 i = 0; i < num_lod_controls; ++i) - { - mFMP->childDisable(lod_controls[i]); - } - - - } - else if (mFMP->childGetValue("lod_none").asBoolean()) + if (fmp) { - for (U32 i = 0; i < num_file_controls; ++i) - { - mFMP->childDisable(file_controls[i]); - } + //enable/disable controls based on radio groups + if (mFMP->childGetValue("lod_from_file").asBoolean()) + { + fmp->mLODMode[mPreviewLOD] = 0; + for (U32 i = 0; i < num_file_controls; ++i) + { + mFMP->childEnable(file_controls[i]); + } - for (U32 i = 0; i < num_lod_controls; ++i) - { - mFMP->childDisable(lod_controls[i]); + for (U32 i = 0; i < num_lod_controls; ++i) + { + mFMP->childDisable(lod_controls[i]); + } } - - if (!mModel[mPreviewLOD].empty()) + else if (mFMP->childGetValue("lod_none").asBoolean()) { - mModel[mPreviewLOD].clear(); - mScene[mPreviewLOD].clear(); - mVertexBuffer[mPreviewLOD].clear(); + fmp->mLODMode[mPreviewLOD] = 2; + for (U32 i = 0; i < num_file_controls; ++i) + { + mFMP->childDisable(file_controls[i]); + } - //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->childDisable(lod_controls[i]); + } - for (U32 i = 0; i < num_lod_controls; ++i) - { - mFMP->childEnable(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 + fmp->mLODMode[mPreviewLOD] = 1; - //if (threshold) - { - U32 lod_mode = 0; - LLCtrlSelectionInterface* iface = mFMP->childGetSelectionInterface("lod_mode"); - if (iface) + for (U32 i = 0; i < num_file_controls; ++i) { - lod_mode = iface->getFirstSelectedIndex(); + mFMP->childDisable(file_controls[i]); } - LLSpinCtrl* threshold = mFMP->getChild("lod_error_threshold"); - LLSpinCtrl* limit = mFMP->getChild("lod_triangle_limit"); + for (U32 i = 0; i < num_lod_controls; ++i) + { + mFMP->childEnable(lod_controls[i]); + } - limit->setMaxValue(mMaxTriangleLimit); - limit->setValue(total_tris[mPreviewLOD]); + //if (threshold) + { + U32 lod_mode = 0; + LLCtrlSelectionInterface* iface = mFMP->childGetSelectionInterface("lod_mode"); + if (iface) + { + lod_mode = iface->getFirstSelectedIndex(); + } - if (lod_mode == 0) - { - limit->setVisible(true); - threshold->setVisible(false); + LLSpinCtrl* threshold = mFMP->getChild("lod_error_threshold"); + LLSpinCtrl* limit = mFMP->getChild("lod_triangle_limit"); limit->setMaxValue(mMaxTriangleLimit); - } - else - { - limit->setVisible(false); - threshold->setVisible(true); + limit->setValue(total_tris[mPreviewLOD]); + + if (lod_mode == 0) + { + limit->setVisible(true); + threshold->setVisible(false); + + limit->setMaxValue(mMaxTriangleLimit); + } + else + { + limit->setVisible(false); + threshold->setVisible(true); + } } } } @@ -4092,6 +4102,13 @@ void LLModelPreview::setPreviewLOD(S32 lod) mFMP->childSetColor(lod_triangles_name[i], color); mFMP->childSetColor(lod_vertices_name[i], color); } + + LLFloaterModelPreview* fmp = LLFloaterModelPreview::sInstance; + if (fmp) + { + LLRadioGroup* radio = fmp->getChild("lod_file_or_limit"); + radio->selectNthItem(fmp->mLODMode[mPreviewLOD]); + } } refresh(); updateStatusMessages(); -- cgit v1.2.3