#4191 skip loading model compressed with Draco

master
Maxim Nikolenko 2025-05-30 03:06:33 +03:00 committed by GitHub
parent be40d20bca
commit 136149d1a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 44 additions and 24 deletions

View File

@ -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)

View File

@ -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();

View File

@ -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);
}
}

View File

@ -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

View File

@ -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"