diff options
author | andreykproductengine <akleshchev@productengine.com> | 2015-02-03 15:50:08 +0200 |
---|---|---|
committer | andreykproductengine <akleshchev@productengine.com> | 2015-02-03 15:50:08 +0200 |
commit | 0939bf4063ffe494e0a5f108636b9469d387dfb4 (patch) | |
tree | 2843f8e39582fd6ed81097a2e13744c1faa5e8d0 | |
parent | 6262768772d6123e3262ad3e672940e623371f00 (diff) |
MAINT-4806 naming fix
-rw-r--r-- | indra/llprimitive/lldaeloader.cpp | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index 80c6ff4a96..72de651eea 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -2135,21 +2135,35 @@ std::string LLDAELoader::getElementLabel(daeElement *element) std::string index_string; if (parent) { + // retrieve index to distinguish items inside same parent size_t ind = 0; parent->getChildren().find(element, ind); index_string = "_" + boost::lexical_cast<std::string>(ind); - // if parent has a name, use it + // if parent has a name or ID, use it std::string name = parent->getAttribute("name"); - if (name.length()) + if (!name.length()) { - return name + index_string; + name = std::string(parent->getID()); } - // if parent has an ID, use it - if (parent->getID()) + if (name.length()) { - return std::string(parent->getID()) + index_string; + // 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"); + } + + if (ext_pos == -1) + { + return name + index_string; + } + else + { + return name.insert(ext_pos, index_string); + } } } |