diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-07-04 20:19:50 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-07-04 21:40:31 +0300 |
commit | 429274c4681da05d2e1ea7eb37b5d031fb4b1347 (patch) | |
tree | 79e466fa4712e9c3b711435dd6399160166f74c2 /indra/newview/llmodelpreview.cpp | |
parent | ed9dbabb5e6e5f48492dc650ec2fd82317008b6f (diff) |
SL-17545 Recalculate lods when replacing high lod with something incompatible
Diffstat (limited to 'indra/newview/llmodelpreview.cpp')
-rw-r--r-- | indra/newview/llmodelpreview.cpp | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 4ec2d82350..d8131171bd 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -816,8 +816,10 @@ void LLModelPreview::clearIncompatible(S32 lod) // at this point we don't care about sub-models, // different amount of sub-models means face count mismatch, not incompatibility U32 lod_size = countRootModels(mModel[lod]); + bool replaced_base_model = (lod == LLModel::LOD_HIGH); for (U32 i = 0; i <= LLModel::LOD_HIGH; i++) - { //clear out any entries that aren't compatible with this model + { + // Clear out any entries that aren't compatible with this model if (i != lod) { if (countRootModels(mModel[i]) != lod_size) @@ -831,10 +833,45 @@ void LLModelPreview::clearIncompatible(S32 lod) mBaseModel = mModel[lod]; mBaseScene = mScene[lod]; mVertexBuffer[5].clear(); + replaced_base_model = true; } } } } + + if (replaced_base_model) + { + // In case base was replaced, we might need to restart generation + bool subscribe_for_generation = mLodsQuery.empty(); + if (lod == LLModel::LOD_HIGH) + { + mLodsQuery.clear(); + } + + LLFloaterModelPreview* fmp = LLFloaterModelPreview::sInstance; + if (!fmp) return; + + for (S32 i = LLModel::LOD_HIGH; i >= 0; --i) + { + if (mModel[i].empty()) + { + // Base model was replaced, regenerate this lod if applicable + LLComboBox* lod_combo = mFMP->findChild<LLComboBox>("lod_source_" + lod_name[i]); + if (!lod_combo) return; + + S32 lod_mode = lod_combo->getCurrentIndex(); + if (lod_mode != LOD_FROM_FILE) + { + mLodsQuery.push_back(i); + } + } + } + + if (!mLodsQuery.empty() && subscribe_for_generation) + { + doOnIdleRepeating(lodQueryCallback); + } + } } void LLModelPreview::loadModelCallback(S32 loaded_lod) |