diff options
-rw-r--r-- | indra/llprimitive/lldaeloader.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index 6c040470b7..1cb80a5769 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -1931,17 +1931,35 @@ void LLDAELoader::processElement( daeElement* element, bool& badElement, DAE* da badElement = true; } - std::string label = getLodlessLabel(instance_geo); + std::string label; + + if (model->mLabel.empty()) + { + label = getLodlessLabel(instance_geo); - llassert(!label.empty()); + llassert(!label.empty()); - if (model->mSubmodelID) + if (model->mSubmodelID) + { + label += (char)((int)'a' + model->mSubmodelID); + } + + model->mLabel = label + lod_suffix[mLod]; + } + else { - label +=(char)((int)'a' + model->mSubmodelID); + // Don't change model's name if possible, it will play havoc with scenes that already use said model. + size_t ext_pos = getSuffixPosition(model->mLabel); + if (ext_pos != -1) + { + label = model->mLabel.substr(0, ext_pos); + } + else + { + label = model->mLabel; + } } - model->mLabel = label + lod_suffix[mLod]; - mScene[transformation].push_back(LLModelInstance(model, label, transformation, materials)); stretch_extents(model, transformation, mExtents[0], mExtents[1], mFirstTransform); i++; |