From 0f64c31fcd7396eb06e0fbea1fed11eaa32310ab Mon Sep 17 00:00:00 2001 From: Beq Date: Sun, 5 Feb 2023 01:24:27 +0000 Subject: [PATCH] [FIRE-32599] Local Mesh - Add Support for broken collada (autodesk) reuses the same LLDAELoader function. --- indra/llprimitive/lldaeloader.h | 4 ++-- indra/newview/vjlocalmeshimportdae.cpp | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) 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.");