summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandreykproductengine <akleshchev@productengine.com>2015-05-14 19:11:53 +0300
committerandreykproductengine <akleshchev@productengine.com>2015-05-14 19:11:53 +0300
commit9e2eca1a8c64bcc90f71870b034bccdd1fdd57ab (patch)
tree08f17907cb5263587170a938b45c42a568ea1112
parent4f236dd7e8d28a6a473344b1aa527ba4e37c8881 (diff)
MAINT-5216 FIXED Error appears when trying to upload the model "instance test.dae"
-rw-r--r--indra/llprimitive/lldaeloader.cpp30
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++;