summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2012-10-12 17:25:17 -0500
committerDave Parks <davep@lindenlab.com>2012-10-12 17:25:17 -0500
commit9b7bfcf594a8388eae087886c53ead164251c62e (patch)
tree78475b190f8258d7ff79b695557c12286a117ae8
parentb8f88a535c1441bd76482e5c42d99adcb5371ca6 (diff)
MAINT-1568 Fix for inconsistent triangle counts when changing LoD sources in model importer
-rwxr-xr-xindra/newview/llfloatermodelpreview.cpp24
-rw-r--r--indra/newview/llfloatermodelpreview.h9
2 files changed, 31 insertions, 2 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index a071f338ba..449173f9b4 100755
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -737,6 +737,20 @@ void LLFloaterModelPreview::onAutoFillCommit(LLUICtrl* ctrl, void* userdata)
void LLFloaterModelPreview::onLODParamCommit(S32 lod, bool enforce_tri_limit)
{
mModelPreview->onLODParamCommit(lod, enforce_tri_limit);
+
+ //refresh LoDs that reference this one
+ for (S32 i = lod - 1; i >= 0; --i)
+ {
+ LLComboBox* lod_source_combo = getChild<LLComboBox>("lod_source_" + lod_name[i]);
+ if (lod_source_combo->getCurrentIndex() == LLModelPreview::USE_LOD_ABOVE)
+ {
+ onLoDSourceCommit(i);
+ }
+ else
+ {
+ break;
+ }
+ }
}
@@ -4588,7 +4602,7 @@ void LLModelPreview::updateLodControls(S32 lod)
if (!lod_combo) return;
S32 lod_mode = lod_combo->getCurrentIndex();
- if (lod_mode == 0) // LoD from file
+ if (lod_mode == LOD_FROM_FILE) // LoD from file
{
fmp->mLODMode[lod] = 0;
for (U32 i = 0; i < num_file_controls; ++i)
@@ -4601,7 +4615,7 @@ void LLModelPreview::updateLodControls(S32 lod)
mFMP->childHide(lod_controls[i] + lod_name[lod]);
}
}
- else if (lod_mode == 2) // use LoD above
+ else if (lod_mode == USE_LOD_ABOVE) // use LoD above
{
fmp->mLODMode[lod] = 2;
for (U32 i = 0; i < num_file_controls; ++i)
@@ -5762,6 +5776,12 @@ 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::GENERATE)
+ { //rebuild LoD to update triangle counts
+ onLODParamCommit(lod, true);
+ }
}
void LLFloaterModelPreview::resetDisplayOptions()
diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h
index ab319c30d5..e588418f7b 100644
--- a/indra/newview/llfloatermodelpreview.h
+++ b/indra/newview/llfloatermodelpreview.h
@@ -311,6 +311,15 @@ class LLModelPreview : public LLViewerDynamicTexture, public LLMutex
typedef boost::signals2::signal<void (bool)> model_updated_signal_t;
public:
+
+ typedef enum
+ {
+ LOD_FROM_FILE = 0,
+ GENERATE,
+ USE_LOD_ABOVE,
+ } eLoDMode;
+
+public:
LLModelPreview(S32 width, S32 height, LLFloater* fmp);
virtual ~LLModelPreview();