diff options
author | andreykproductengine <akleshchev@productengine.com> | 2015-03-27 21:22:18 +0200 |
---|---|---|
committer | andreykproductengine <akleshchev@productengine.com> | 2015-03-27 21:22:18 +0200 |
commit | e712a5230e4f6da7dd750aee2ca8aeb2e4371f72 (patch) | |
tree | 6caea21b7604e8755bf26b0a6fe6fbe2b7ce1776 /indra/llprimitive | |
parent | 0818a0189c4ebadce44686a43d1bda176626d7c2 (diff) |
MAINT-4982 Naming rules unification
Diffstat (limited to 'indra/llprimitive')
-rw-r--r-- | indra/llprimitive/lldaeloader.cpp | 65 | ||||
-rw-r--r-- | indra/llprimitive/lldaeloader.h | 1 |
2 files changed, 31 insertions, 35 deletions
diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index 272ebb7552..ed38c97b06 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -1911,31 +1911,24 @@ void LLDAELoader::processElement( daeElement* element, bool& badElement, DAE* da llassert(!label.empty()); if (model->mSubmodelID) - { - // CHECK FOR _LODX and _PHYS here to ensure we bolt the submodel 'salt' at the right loc - // - if ((label.find("_LOD") != -1) || (label.find("_PHYS") != -1)) - { - std::string labelStart; - std::string markup; - size_t underscore_offset = label.rfind('_'); - if (underscore_offset != -1) - { - markup = label.substr(underscore_offset + 1, 4); - label.erase(label.begin() + underscore_offset, label.end()); - label +=(char)((int)'a' + model->mSubmodelID); - label += "_"; - label += markup; - } - else - { - label +=(char)((int)'a' + model->mSubmodelID); - } - } - else - { - label += (char)((int)'a' + model->mSubmodelID); - } + { + // CHECK FOR _LODX and _PHYS here to ensure we bolt the submodel 'salt' at the right loc + // + std::string labelStart; + std::string markup; + size_t label_offset = getSuffixPosition(label); + if (label_offset != -1) + { + markup = label.substr(label_offset + 1, 4); + label.erase(label.begin() + label_offset, label.end()); + label +=(char)((int)'a' + model->mSubmodelID); + label += "_"; + label += markup; + } + else + { + label +=(char)((int)'a' + model->mSubmodelID); + } } model->mLabel = label; @@ -2166,11 +2159,7 @@ std::string LLDAELoader::getElementLabel(daeElement *element) if (name.length()) { // make sure that index won't mix up with pre-named lod extensions - size_t ext_pos = name.find("_LOD"); - if (ext_pos == -1) - { - ext_pos = name.find("_PHYS"); - } + size_t ext_pos = getSuffixPosition(name); if (ext_pos == -1) { @@ -2194,6 +2183,16 @@ std::string LLDAELoader::getElementLabel(daeElement *element) return std::string("object") + index_string; } +// static +size_t LLDAELoader::getSuffixPosition(std::string label) +{ + if ((label.find("_LOD") != -1) || (label.find("_PHYS") != -1)) + { + return label.rfind('_'); + } + return -1; +} + LLColor4 LLDAELoader::getDaeColor(daeElement* element) { LLColor4 value; @@ -2290,11 +2289,7 @@ bool LLDAELoader::loadModelsFromDomMesh(domMesh* mesh, std::vector<LLModel*>& mo // extract actual name and suffix for future use in submodels std::string name_base, name_suffix; - size_t ext_pos = model_name.find("_LOD"); - if (ext_pos == -1) - { - ext_pos = model_name.find("_PHYS"); - } + size_t ext_pos = getSuffixPosition(model_name); if (ext_pos == -1) { diff --git a/indra/llprimitive/lldaeloader.h b/indra/llprimitive/lldaeloader.h index cd07ade282..e31b023d22 100644 --- a/indra/llprimitive/lldaeloader.h +++ b/indra/llprimitive/lldaeloader.h @@ -97,6 +97,7 @@ protected: bool loadModelsFromDomMesh(domMesh* mesh, std::vector<LLModel*>& models_out, U32 submodel_limit); static std::string getElementLabel(daeElement *element); + static size_t getSuffixPosition(std::string label); private: U32 mGeneratedModelLimit; // Attempt to limit amount of generated submodels |