summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Nikolenko <maximnproductengine@lindenlab.com>2025-05-30 03:06:33 +0300
committerGitHub <noreply@github.com>2025-05-30 03:06:33 +0300
commit136149d1a196d2c0c15b9977937e64ccd26c1a49 (patch)
treec531107fe278c9293a6f60a61a3ae91a5297c150
parentbe40d20bca15b97ccba557dc530fe55a92456ebf (diff)
#4191 skip loading model compressed with Draco
-rw-r--r--indra/newview/gltf/asset.cpp19
-rw-r--r--indra/newview/gltf/asset.h1
-rw-r--r--indra/newview/gltf/llgltfloader.cpp43
-rw-r--r--indra/newview/gltf/llgltfloader.h2
-rw-r--r--indra/newview/skins/default/xui/en/floater_model_preview.xml3
5 files changed, 44 insertions, 24 deletions
diff --git a/indra/newview/gltf/asset.cpp b/indra/newview/gltf/asset.cpp
index 3859bdc103..8c9f77686a 100644
--- a/indra/newview/gltf/asset.cpp
+++ b/indra/newview/gltf/asset.cpp
@@ -50,6 +50,10 @@ namespace LL
"KHR_texture_transform"
};
+ static std::unordered_set<std::string> ExtensionsIgnored = {
+ "KHR_materials_pbrSpecularGlossiness"
+ };
+
Material::AlphaMode gltf_alpha_mode_to_enum(const std::string& alpha_mode)
{
if (alpha_mode == "OPAQUE")
@@ -494,10 +498,21 @@ bool Asset::prep()
{
if (ExtensionsSupported.find(extension) == ExtensionsSupported.end())
{
- LL_WARNS() << "Unsupported extension: " << extension << LL_ENDL;
- mUnsupportedExtensions.push_back(extension);
+ if (ExtensionsIgnored.find(extension) == ExtensionsIgnored.end())
+ {
+ LL_WARNS() << "Unsupported extension: " << extension << LL_ENDL;
+ mUnsupportedExtensions.push_back(extension);
+ }
+ else
+ {
+ mIgnoredExtensions.push_back(extension);
+ }
}
}
+ if (mUnsupportedExtensions.size() > 0)
+ {
+ return false;
+ }
// do buffers first as other resources depend on them
for (auto& buffer : mBuffers)
diff --git a/indra/newview/gltf/asset.h b/indra/newview/gltf/asset.h
index a22de4d59d..b9554d753c 100644
--- a/indra/newview/gltf/asset.h
+++ b/indra/newview/gltf/asset.h
@@ -397,6 +397,7 @@ namespace LL
bool mLoadIntoVRAM = false;
std::vector<std::string> mUnsupportedExtensions;
+ std::vector<std::string> mIgnoredExtensions;
// prepare for first time use
bool prep();
diff --git a/indra/newview/gltf/llgltfloader.cpp b/indra/newview/gltf/llgltfloader.cpp
index 2461a878fb..5cdd7f09e0 100644
--- a/indra/newview/gltf/llgltfloader.cpp
+++ b/indra/newview/gltf/llgltfloader.cpp
@@ -111,8 +111,6 @@ LLGLTFLoader::~LLGLTFLoader() {}
bool LLGLTFLoader::OpenFile(const std::string &filename)
{
tinygltf::TinyGLTF loader;
- std::string error_msg;
- std::string warn_msg;
std::string filename_lc(filename);
LLStringUtil::toLower(filename_lc);
@@ -120,28 +118,11 @@ bool LLGLTFLoader::OpenFile(const std::string &filename)
if (!mGltfLoaded)
{
- if (!warn_msg.empty())
- LL_WARNS("GLTF_IMPORT") << "gltf load warning: " << warn_msg.c_str() << LL_ENDL;
- if (!error_msg.empty())
- LL_WARNS("GLTF_IMPORT") << "gltf load error: " << error_msg.c_str() << LL_ENDL;
+ notifyUnsupportedExtension(true);
return false;
}
- if (mGLTFAsset.mUnsupportedExtensions.size() > 0)
- {
- LLSD args;
- args["Message"] = "UnsupportedExtension";
- std::string del;
- std::string ext;
- for (auto& extension : mGLTFAsset.mUnsupportedExtensions)
- {
- ext += del;
- ext += extension;
- del = ",";
- }
- args["EXT"] = ext;
- mWarningsArray.append(args);
- }
+ notifyUnsupportedExtension(false);
mMeshesLoaded = parseMeshes();
if (mMeshesLoaded) uploadMeshes();
@@ -1347,3 +1328,23 @@ LLUUID LLGLTFLoader::imageBufferToTextureUUID(const gltf_texture& tex)
return LLUUID::null;
}
+void LLGLTFLoader::notifyUnsupportedExtension(bool unsupported)
+{
+ std::vector<std::string> extensions = unsupported ? mGLTFAsset.mUnsupportedExtensions : mGLTFAsset.mIgnoredExtensions;
+ if (extensions.size() > 0)
+ {
+ LLSD args;
+ args["Message"] = unsupported ? "UnsupportedExtension" : "IgnoredExtension";
+ std::string del;
+ std::string ext;
+ for (auto& extension : extensions)
+ {
+ ext += del;
+ ext += extension;
+ del = ",";
+ }
+ args["EXT"] = ext;
+ mWarningsArray.append(args);
+ }
+}
+
diff --git a/indra/newview/gltf/llgltfloader.h b/indra/newview/gltf/llgltfloader.h
index d0f761df2c..6e0fe2b32c 100644
--- a/indra/newview/gltf/llgltfloader.h
+++ b/indra/newview/gltf/llgltfloader.h
@@ -174,6 +174,8 @@ private:
S32 findGLTFRootJoint(const LL::GLTF::Skin& gltf_skin) const; // if there are multiple roots, gltf stores them under one commor joint
LLUUID imageBufferToTextureUUID(const gltf_texture& tex);
+ void notifyUnsupportedExtension(bool unsupported);
+
// bool mPreprocessGLTF;
/* Below inherited from dae loader - unknown if/how useful here
diff --git a/indra/newview/skins/default/xui/en/floater_model_preview.xml b/indra/newview/skins/default/xui/en/floater_model_preview.xml
index c0cddf0984..6231abf9a5 100644
--- a/indra/newview/skins/default/xui/en/floater_model_preview.xml
+++ b/indra/newview/skins/default/xui/en/floater_model_preview.xml
@@ -62,7 +62,8 @@
<string name="ParsingErrorNoScene">Document has no visual_scene</string>
<string name="ParsingErrorPositionInvalidModel">Unable to process mesh without position data. Invalid model.</string>
<string name="InvalidGeometryNonTriangulated">Invalid geometry: GLTF files must contain triangulated meshes only.</string>
- <string name="UnsupportedExtension">Model uses unsupported extension, related material properties are ignored: [EXT]</string>
+ <string name="IgnoredExtension">Model uses unsupported extension: [EXT], related material properties are ignored.</string>
+ <string name="UnsupportedExtension">Unable to load a model, unsupported extension: [EXT]</string>
<panel
follows="top|left"