diff --git a/indra/llprimitive/lldaeloader.h b/indra/llprimitive/lldaeloader.h
index 7ed1ea787a..f013162804 100644
--- a/indra/llprimitive/lldaeloader.h
+++ b/indra/llprimitive/lldaeloader.h
@@ -107,9 +107,9 @@ protected:
static std::string getElementLabel(daeElement *element);
static size_t getSuffixPosition(std::string label);
static std::string getLodlessLabel(daeElement *element);
-
- static std::string preprocessDAE(std::string filename);
static LODSuffixArray sLODSuffix; // mesh loader suffix configuration
+public: // open up for local mesh to use
+ static std::string preprocessDAE(std::string filename);
private:
U32 mGeneratedModelLimit; // Attempt to limit amount of generated submodels
diff --git a/indra/newview/vjlocalmeshimportdae.cpp b/indra/newview/vjlocalmeshimportdae.cpp
index bbd97a2b8c..fc0f63034e 100644
--- a/indra/newview/vjlocalmeshimportdae.cpp
+++ b/indra/newview/vjlocalmeshimportdae.cpp
@@ -32,8 +32,10 @@
#include "vjlocalmeshimportdae.h"
/* linden headers */
+#include "llviewercontrol.h" // for gSavedSettings
#include "llmodelloader.h"
#include "llvoavatarself.h"
+#include "lldaeloader.h" // for preProcessDAE
/* dae headers*/
#if LL_MSVC
@@ -54,7 +56,6 @@
#pragma warning (default : 4264)
#endif
-
LLLocalMeshImportDAE::loadFile_return LLLocalMeshImportDAE::loadFile(LLLocalMeshFile* data, LLLocalMeshFileLOD lod)
{
pushLog("DAE Importer", "Starting");
@@ -70,7 +71,16 @@ LLLocalMeshImportDAE::loadFile_return LLLocalMeshImportDAE::loadFile(LLLocalMesh
mLoadingLog.clear();
// open file and check if opened
- collada_dom = collada_core.open(filename);
+ if (gSavedSettings.getBOOL("ImporterPreprocessDAE"))
+ {
+ collada_dom = collada_core.openFromMemory(filename, LLDAELoader::preprocessDAE(filename).c_str());
+ }
+ else
+ {
+ LL_INFOS() << "Skipping dae preprocessing" << LL_ENDL;
+ collada_dom = collada_core.open(filename);
+ }
+
if (!collada_dom)
{
pushLog("DAE Importer", "Collada DOM instance could not initialize.");