summaryrefslogtreecommitdiff
path: root/indra/llprimitive
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2016-09-02 14:34:06 -0400
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2016-09-02 14:34:06 -0400
commita2875ba53ec02235a0db5734264108c0f0898269 (patch)
treef9dc66183550cda2c3478f72fa7018094da3cd19 /indra/llprimitive
parent227eb6c4a49724fe513f5d67af68d355d173f951 (diff)
parentd07a8b9965b54fca34b239a51af46b996a58d553 (diff)
merge
Diffstat (limited to 'indra/llprimitive')
-rw-r--r--indra/llprimitive/lldaeloader.cpp9
-rw-r--r--indra/llprimitive/llmodelloader.cpp30
-rw-r--r--indra/llprimitive/llmodelloader.h4
3 files changed, 32 insertions, 11 deletions
diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp
index 38b061dd79..37ebdf2cec 100644
--- a/indra/llprimitive/lldaeloader.cpp
+++ b/indra/llprimitive/lldaeloader.cpp
@@ -1404,7 +1404,8 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
// incorrect.
LLUUID fake_mesh_id;
fake_mesh_id.generate();
- pJoint->addAttachmentPosOverride( jointTransform.getTranslation(), fake_mesh_id, "");
+ bool dummy; // not used
+ pJoint->addAttachmentPosOverride( jointTransform.getTranslation(), fake_mesh_id, "", dummy);
}
else
{
@@ -2248,7 +2249,11 @@ std::string LLDAELoader::getElementLabel(daeElement *element)
// 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 (ind > 0)
+ {
+ index_string = "_" + boost::lexical_cast<std::string>(ind);
+ }
// if parent has a name or ID, use it
std::string name = parent->getAttribute("name");
diff --git a/indra/llprimitive/llmodelloader.cpp b/indra/llprimitive/llmodelloader.cpp
index 816ebc558a..4e468ff45f 100644
--- a/indra/llprimitive/llmodelloader.cpp
+++ b/indra/llprimitive/llmodelloader.cpp
@@ -150,6 +150,23 @@ void LLModelLoader::run()
doOnIdleOneTime(boost::bind(&LLModelLoader::loadModelCallback,this));
}
+// static
+bool LLModelLoader::getSLMFilename(const std::string& model_filename, std::string& slm_filename)
+{
+ slm_filename = model_filename;
+
+ std::string::size_type i = model_filename.rfind(".");
+ if (i != std::string::npos)
+ {
+ slm_filename.replace(i, model_filename.size()-1, ".slm");
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
bool LLModelLoader::doLoadModel()
{
//first, look for a .slm file of the same name that was modified later
@@ -157,20 +174,17 @@ bool LLModelLoader::doLoadModel()
if (mTrySLM)
{
- std::string filename = mFilename;
-
- std::string::size_type i = filename.rfind(".");
- if (i != std::string::npos)
- {
- filename.replace(i, filename.size()-1, ".slm");
+ std::string slm_filename;
+ if (getSLMFilename(mFilename, slm_filename))
+ {
llstat slm_status;
- if (LLFile::stat(filename, &slm_status) == 0)
+ if (LLFile::stat(slm_filename, &slm_status) == 0)
{ //slm file exists
llstat dae_status;
if (LLFile::stat(mFilename, &dae_status) != 0 ||
dae_status.st_mtime < slm_status.st_mtime)
{
- if (loadFromSLM(filename))
+ if (loadFromSLM(slm_filename))
{ //slm successfully loaded, if this fails, fall through and
//try loading from dae
diff --git a/indra/llprimitive/llmodelloader.h b/indra/llprimitive/llmodelloader.h
index a902ca3404..d64e0a0773 100644
--- a/indra/llprimitive/llmodelloader.h
+++ b/indra/llprimitive/llmodelloader.h
@@ -137,7 +137,9 @@ public:
virtual void setNoOptimize() { mNoOptimize = true; }
virtual void run();
-
+
+ static bool getSLMFilename(const std::string& model_filename, std::string& slm_filename);
+
// Will try SLM or derived class OpenFile as appropriate
//
virtual bool doLoadModel();