diff options
author | Howard Stearns <howard.stearns@gmail.com> | 2022-03-03 18:56:52 -0800 |
---|---|---|
committer | Howard Stearns <howard.stearns@gmail.com> | 2022-03-03 18:56:52 -0800 |
commit | 340213b3023ec1dcc58587f35d270a3ad1a1e83d (patch) | |
tree | db39172caeda0071a03e973a6ae4d353e6866c58 /indra/newview | |
parent | 239a29ab5c67bef8ffc773b0f405d8cc4542cf34 (diff) |
SL-9748 - Only supply a default physics shape if it is named default_physics_shape
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/cube.dae | 2 | ||||
-rw-r--r-- | indra/newview/llfloatermodelpreview.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llmodelpreview.cpp | 32 | ||||
-rw-r--r-- | indra/newview/llmodelpreview.h | 4 |
4 files changed, 21 insertions, 19 deletions
diff --git a/indra/newview/cube.dae b/indra/newview/cube.dae index f9df955ff2..085b2c7309 100644 --- a/indra/newview/cube.dae +++ b/indra/newview/cube.dae @@ -51,7 +51,7 @@ <library_geometries> - <geometry id="F1" name="Unit Cube"> + <geometry id="F1" name="default_physics_shape"> <mesh> <source id="cube-vertex-positions"> diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 4a51533a57..d99d95934c 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -483,7 +483,7 @@ void LLFloaterModelPreview::prepareToLoadModel(S32 lod) { // loading physics from file mModelPreview->mPhysicsSearchLOD = lod; - mModelPreview->mLastSpecifiedPhysicsP = NULL; + mModelPreview->mWarnOfUnmatchedPhyicsMeshes = false; } } void LLFloaterModelPreview::loadModel(S32 lod) diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 4e3b4c5c41..7578d3b9bb 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -86,6 +86,7 @@ static const LLColor4 PREVIEW_DEG_FILL_COL(1.f, 0.f, 0.f, 0.5f); static const F32 PREVIEW_DEG_EDGE_WIDTH(3.f); static const F32 PREVIEW_DEG_POINT_SIZE(8.f); static const F32 PREVIEW_ZOOM_LIMIT(10.f); +static const std::string DEFAULT_PHYSICS_MESH_NAME = "default_physics_shape"; const F32 SKIN_WEIGHT_CAMERA_DISTANCE = 16.f; @@ -465,15 +466,19 @@ void LLModelPreview::rebuildUploadData() LLFloaterModelPreview::addStringToLog(out, false); } } - if (mLastSpecifiedPhysicsP && !lod_model && (i == LLModel::LOD_PHYSICS)) + if (mWarnOfUnmatchedPhyicsMeshes && !lod_model && (i == LLModel::LOD_PHYSICS)) { // Despite the various strategies above, if we don't now have a physics model, we're going to end up with decomposition. - // That's ok, but in the case where someone supplied a physics file, that's probably not what they wanted. + // That's ok, but might not what they wanted. Use default_physics_shape if found. std::ostringstream out; - out << "No physics model specified for " << instance.mLabel << ". Reusing physics model " << mLastSpecifiedPhysicsModelOriginalName << "."; + out << "No physics model specified for " << instance.mLabel; + if (mDefaultPhysicsShapeP) + { + out << " - using: " << DEFAULT_PHYSICS_MESH_NAME; + lod_model = mDefaultPhysicsShapeP; + } LL_WARNS() << out.str() << LL_ENDL; - LLFloaterModelPreview::addStringToLog(out, false); - lod_model = mLastSpecifiedPhysicsP; + LLFloaterModelPreview::addStringToLog(out, !mDefaultPhysicsShapeP); // Flash log tab if no default. } if (lod_model) @@ -1061,6 +1066,13 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod) } else { + if (loaded_lod == LLModel::LOD_PHYSICS) + { // Explicitly loading physics. See if there is a default mesh. + LLMatrix4 ignored_transform; // Each mesh that uses this will supply their own. + mDefaultPhysicsShapeP = nullptr; + FindModel(mScene[loaded_lod], DEFAULT_PHYSICS_MESH_NAME + getLodSuffix(loaded_lod), mDefaultPhysicsShapeP, ignored_transform); + mWarnOfUnmatchedPhyicsMeshes = true; + } BOOL legacyMatching = gSavedSettings.getBOOL("ImporterLegacyMatching"); if (!legacyMatching) { @@ -1131,20 +1143,10 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod) LL_WARNS() << out.str() << LL_ENDL; LLFloaterModelPreview::addStringToLog(out, false); } - if (loaded_lod == LLModel::LOD_PHYSICS) - { - mLastSpecifiedPhysicsModelOriginalName = loaded_name; - mLastSpecifiedPhysicsP = mModel[loaded_lod][idx]; - } mModel[loaded_lod][idx]->mLabel = name; } } } - else if ((loaded_lod == LLModel::LOD_PHYSICS) && !mLastSpecifiedPhysicsP) - { - mLastSpecifiedPhysicsModelOriginalName = stripSuffix(mModel[loaded_lod][0]->mLabel); - mLastSpecifiedPhysicsP = mModel[loaded_lod][0]; - } } } } diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h index 9105ad2716..c46f9197e7 100644 --- a/indra/newview/llmodelpreview.h +++ b/indra/newview/llmodelpreview.h @@ -217,8 +217,8 @@ private: LLVOAvatar* getPreviewAvatar(void) { return mPreviewAvatar; } // Count amount of original models, excluding sub-models static U32 countRootModels(LLModelLoader::model_list models); - LLModel* mLastSpecifiedPhysicsP{}; // As opposed to being found by name or LOD; - std::string mLastSpecifiedPhysicsModelOriginalName{""}; // Since the above will have it's label bashed. + LLModel* mDefaultPhysicsShapeP{}; // If supplied by name in physics file. + bool mWarnOfUnmatchedPhyicsMeshes{false}; protected: friend class LLModelLoader; |