From 0939bf4063ffe494e0a5f108636b9469d387dfb4 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 3 Feb 2015 15:50:08 +0200 Subject: MAINT-4806 naming fix --- indra/llprimitive/lldaeloader.cpp | 26 ++++++++++++++++++++------ 1 file 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(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); + } } } -- cgit v1.2.3