diff options
Diffstat (limited to 'indra/newview/llmodelpreview.cpp')
-rw-r--r-- | indra/newview/llmodelpreview.cpp | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 64ea1710f5..c73282dad3 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -132,20 +132,21 @@ std::string getLodSuffix(S32 lod) return suffix; } -void FindModel(LLModelLoader::scene& scene, const std::string& name_to_match, LLModel*& baseModelOut, LLMatrix4& matOut) +static bool FindModel(const LLModelLoader::scene& scene, const std::string& name_to_match, LLModel*& baseModelOut, LLMatrix4& matOut) { - for (auto scene_iter = scene.begin(); scene_iter != scene.end(); scene_iter++) + for (const auto& scene_pair : scene) { - for (auto model_iter = scene_iter->second.begin(); model_iter != scene_iter->second.end(); model_iter++) + for (const auto& model_iter : scene_pair.second) { - if (model_iter->mModel && (model_iter->mModel->mLabel == name_to_match)) + if (model_iter.mModel && (model_iter.mModel->mLabel == name_to_match)) { - baseModelOut = model_iter->mModel; - matOut = scene_iter->first; - return; + baseModelOut = model_iter.mModel; + matOut = scene_pair.first; + return true; } } } + return false; } //----------------------------------------------------------------------------- @@ -319,10 +320,8 @@ void LLModelPreview::rebuildUploadData() mat *= scale_mat; - for (auto model_iter = iter->second.begin(); model_iter != iter->second.end(); ++model_iter) - { // for each instance with said transform applied - LLModelInstance instance = *model_iter; - + for (LLModelInstance& instance : iter->second) + { //for each instance with said transform applied LLModel* base_model = instance.mModel; if (base_model && !requested_name.empty()) @@ -354,7 +353,7 @@ void LLModelPreview::rebuildUploadData() } else { - //Physics can be inherited from other LODs or loaded, so we need to adjust what extension we are searching for + // Physics can be inherited from other LODs or loaded, so we need to adjust what extension we are searching for extensionLOD = mPhysicsSearchLOD; } @@ -365,9 +364,9 @@ void LLModelPreview::rebuildUploadData() name_to_match += toAdd; } - FindModel(mScene[i], name_to_match, lod_model, transform); + bool found = FindModel(mScene[i], name_to_match, lod_model, transform); - if (!lod_model && i != LLModel::LOD_PHYSICS) + if (!found && i != LLModel::LOD_PHYSICS) { if (mImporterDebug) { @@ -380,7 +379,7 @@ void LLModelPreview::rebuildUploadData() } int searchLOD = (i > LLModel::LOD_HIGH) ? LLModel::LOD_HIGH : i; - while ((searchLOD <= LLModel::LOD_HIGH) && !lod_model) + for (; searchLOD <= LLModel::LOD_HIGH; ++searchLOD) { std::string name_to_match = instance.mLabel; llassert(!name_to_match.empty()); @@ -394,8 +393,8 @@ void LLModelPreview::rebuildUploadData() // See if we can find an appropriately named model in LOD 'searchLOD' // - FindModel(mScene[searchLOD], name_to_match, lod_model, transform); - searchLOD++; + if (FindModel(mScene[searchLOD], name_to_match, lod_model, transform)) + break; } } } @@ -1174,8 +1173,7 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod) LLModel* found_model = NULL; LLMatrix4 transform; - FindModel(mBaseScene, loaded_name, found_model, transform); - if (found_model) + if (FindModel(mBaseScene, loaded_name, found_model, transform)) { // don't rename correctly named models (even if they are placed in a wrong order) name_based = true; } @@ -2500,6 +2498,8 @@ void LLModelPreview::updateStatusMessages() S32 phys_tris = 0; S32 phys_hulls = 0; S32 phys_points = 0; + S32 which_mode = 0; + S32 file_mode = 1; //get the triangle count for the whole scene for (LLModelLoader::scene::iterator iter = mScene[LLModel::LOD_PHYSICS].begin(), endIter = mScene[LLModel::LOD_PHYSICS].end(); iter != endIter; ++iter) @@ -2621,18 +2621,16 @@ void LLModelPreview::updateStatusMessages() fmp->childEnable("simplify_cancel"); fmp->childEnable("decompose_cancel"); } - } - - LLCtrlSelectionInterface* iface = fmp->childGetSelectionInterface("physics_lod_combo"); - S32 which_mode = 0; - S32 file_mode = 1; - if (iface) - { - which_mode = iface->getFirstSelectedIndex(); - file_mode = iface->getItemCount() - 1; + LLCtrlSelectionInterface* iface = fmp->childGetSelectionInterface("physics_lod_combo"); + if (iface) + { + which_mode = iface->getFirstSelectedIndex(); + file_mode = iface->getItemCount() - 1; + } } + if (which_mode == file_mode) { mFMP->childEnable("physics_file"); |