diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp
index 820924be33..47c5fb7924 100644
--- a/indra/llprimitive/lldaeloader.cpp
+++ b/indra/llprimitive/lldaeloader.cpp
@@ -116,14 +116,17 @@ std::string colladaVersion[VERSIONTYPE_COUNT+1] =
"Unsupported"
};
-static const std::string lod_suffix[LLModel::NUM_LODS] =
-{
- "_LOD0",
- "_LOD1",
- "_LOD2",
- "",
- "_PHYS",
-};
+// moved to allow configuration
+// static const std::string lod_suffix[LLModel::NUM_LODS] =
+// {
+// "_LOD0",
+// "_LOD1",
+// "_LOD2",
+// "",
+// "_PHYS",
+// };
+//
+
const U32 LIMIT_MATERIALS_OUTPUT = 12;
@@ -931,7 +934,11 @@ LLDAELoader::LLDAELoader(
std::map& jointAliasMap,
U32 maxJointsPerMesh,
U32 modelLimit,
- bool preprocess)
+ // mesh loader suffix configuration
+ // bool preprocess)
+ bool preprocess,
+ const LODSuffixArray& lod_suffix)
+ //
: LLModelLoader(
filename,
lod,
@@ -947,12 +954,21 @@ LLDAELoader::LLDAELoader(
mGeneratedModelLimit(modelLimit),
mPreprocessDAE(preprocess)
{
+ // mesh loader suffix configuration
+ for(int i=0;i
}
LLDAELoader::~LLDAELoader()
{
}
+//static
+LODSuffixArray LLDAELoader::sLODSuffix{};// configurable lod suffixes
+
struct ModelSort
{
bool operator()(const LLPointer< LLModel >& lhs, const LLPointer< LLModel >& rhs)
@@ -2208,8 +2224,17 @@ void LLDAELoader::processElement( daeElement* element, bool& badElement, DAE* da
{
label += (char)((int)'a' + model->mSubmodelID);
}
-
- model->mLabel = label + lod_suffix[mLod];
+ // Support altenate LOD naming conventions
+ // model->mLabel = label + sLODSuffix[mLod];
+ if ( sLODSuffix[mLod].size() > 0 )
+ {
+ model->mLabel = label + '_' + sLODSuffix[mLod];
+ }
+ else
+ {
+ model->mLabel = label;
+ }
+ //
}
else
{
@@ -2485,13 +2510,19 @@ std::string LLDAELoader::getElementLabel(daeElement *element)
// static
size_t LLDAELoader::getSuffixPosition(std::string label)
{
- // Bug fixes in mesh importer by Drake Arconis
+ // Selectable suffixes
//if ((label.find("_LOD") != -1) || (label.find("_PHYS") != -1))
- if ((label.find("_LOD") != std::string::npos) || (label.find("_PHYS") != std::string::npos))
- //
+ //{
+ // return label.rfind('_');
+ //}
+ for(int i=0; i < LLModel::NUM_LODS; i++)
{
- return label.rfind('_');
+ if (sLODSuffix[i].size() && label.find(sLODSuffix[i]) != std::string::npos)
+ {
+ return label.rfind('_');
+ }
}
+ //
return -1;
}
@@ -2636,8 +2667,17 @@ bool LLDAELoader::loadModelsFromDomMesh(domMesh* mesh, std::vector& mo
LLModel* ret = new LLModel(volume_params, 0.f);
std::string model_name = getLodlessLabel(mesh);
- ret->mLabel = model_name + lod_suffix[mLod];
-
+ // Support altenate LOD naming conventions
+ // ret->mLabel = model_name + sLODSuffix[mLod];
+ if ( sLODSuffix[mLod].size() > 0 )
+ {
+ ret->mLabel = model_name + '_' + sLODSuffix[mLod];
+ }
+ else
+ {
+ ret->mLabel = model_name;
+ }
+ //
llassert(!ret->mLabel.empty());
// Like a monkey, ready to be shot into space
@@ -2695,7 +2735,10 @@ bool LLDAELoader::loadModelsFromDomMesh(domMesh* mesh, std::vector& mo
{
LLModel* next = new LLModel(volume_params, 0.f);
next->mSubmodelID = ++submodelID;
- next->mLabel = model_name + (char)((int)'a' + next->mSubmodelID) + lod_suffix[mLod];
+ // configurable lod suffixes
+ // next->mLabel = model_name + (char)((int)'a' + next->mSubmodelID) + lod_suffix[mLod];
+ next->mLabel = model_name + (char)((int)'a' + next->mSubmodelID) + sLODSuffix[mLod];
+ //
next->getVolumeFaces() = remainder;
next->mNormalizedScale = ret->mNormalizedScale;
next->mNormalizedTranslation = ret->mNormalizedTranslation;
diff --git a/indra/llprimitive/lldaeloader.h b/indra/llprimitive/lldaeloader.h
index 5d34cb8091..7ed1ea787a 100644
--- a/indra/llprimitive/lldaeloader.h
+++ b/indra/llprimitive/lldaeloader.h
@@ -39,6 +39,7 @@ class domController;
class domSkin;
class domMesh;
+using LODSuffixArray = std::array; // configurable lod suffixes
class LLDAELoader : public LLModelLoader
{
public:
@@ -59,7 +60,11 @@ public:
std::map& jointAliasMap,
U32 maxJointsPerMesh,
U32 modelLimit,
- bool preprocess);
+ // configrable lod suffix support
+ // bool preprocess);
+ bool preprocess,
+ const LODSuffixArray& lod_suffix);
+ //
virtual ~LLDAELoader() ;
virtual bool OpenFile(const std::string& filename);
@@ -104,6 +109,7 @@ protected:
static std::string getLodlessLabel(daeElement *element);
static std::string preprocessDAE(std::string filename);
+ static LODSuffixArray sLODSuffix; // mesh loader suffix configuration
private:
U32 mGeneratedModelLimit; // Attempt to limit amount of generated submodels
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index b40de81563..c3f6ee0642 100644
--- a/indra/llprimitive/llmodel.cpp
+++ b/indra/llprimitive/llmodel.cpp
@@ -634,10 +634,13 @@ void LLModel::generateNormals(F32 angle_cutoff)
}
}
-
+extern std::string stripSuffix(std::string); // mesh loader suffix configuration
std::string LLModel::getName() const
{
- return mRequestedLabel.empty() ? mLabel : mRequestedLabel;
+ // remove the LOD suffix when used as the model name.
+ // return mRequestedLabel.empty() ? mLabel : mRequestedLabel;
+ return mRequestedLabel.empty() ? stripSuffix(mLabel) : mRequestedLabel;
+ //
}
//static
diff --git a/indra/llprimitive/llmodelloader.cpp b/indra/llprimitive/llmodelloader.cpp
index 33671b9bd2..3bacbfc522 100644
--- a/indra/llprimitive/llmodelloader.cpp
+++ b/indra/llprimitive/llmodelloader.cpp
@@ -218,7 +218,7 @@ void LLModelLoader::setLoadState(U32 state)
{
mStateCallback(state, mOpaqueData);
}
-
+extern std::string stripSuffix(std::string); // mesh loader suffix configuration
bool LLModelLoader::loadFromSLM(const std::string& filename)
{
//only need to populate mScene with data from slm
@@ -320,7 +320,10 @@ bool LLModelLoader::loadFromSLM(const std::string& filename)
&& !instance_label.empty())
{
// restore model names
- std::string name = instance_label;
+ // This is going to get confusing here. We are juggling internal LOD names, with potentially overridden user ones.
+ // std::string name = instance_label;
+ std::string name = stripSuffix(instance_label);
+ //
switch (lod)
{
case LLModel::LOD_IMPOSTOR: name += "_LOD0"; break;
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 618df007bf..8c9eda5847 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -9239,6 +9239,62 @@
Backup
0
+ FSMeshLowestLodSuffix
+
+ FSMeshLowLodSuffix
+
+ FSMeshMediumLodSuffix
+
+ FSMeshHighLodSuffix
+
+ FSMeshPhysicsSuffix
+
+
FSMeshUploadAutoEnableWeights