diff options
| author | Alexander Gavriliuk <alexandrgproductengine@lindenlab.com> | 2024-04-17 16:58:48 +0200 | 
|---|---|---|
| committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2025-04-01 15:24:15 +0300 | 
| commit | c609a45c26dae083cedc8d06566564cb55d2e72e (patch) | |
| tree | 9008e276020ffb290bbc58c947c37643cd8c0432 /indra | |
| parent | 515c1f15d835f1e8c45828722d8ad91b0604408c (diff) | |
secondlife/viewer#912 BugSplat Crash 1412267 (missed refactoring for FindModel)
# Conflicts:
#	indra/newview/llmodelpreview.cpp
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/llmodelpreview.cpp | 26 | 
1 files changed, 12 insertions, 14 deletions
| diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 29ab4e38c0..4ac3abd747 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -132,7 +132,7 @@ 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(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++)      { @@ -142,10 +142,11 @@ void FindModel(LLModelLoader::scene& scene, const std::string& name_to_match, LL              {                  baseModelOut = model_iter->mModel;                  matOut = scene_iter->first; -                return; +                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;                          } | 
