if( json.materials ){
for( const nextMaterial of json.materials ){
if( nextMaterial.extensions ){
for( const nextExtensionKey in nextMaterial.extensions ){
if( json.extensionsUsed.indexOf( nextExtensionKey ) === -1 ){
json.extensionsUsed.push( nextExtensionKey );
}
}
}
}
}
In my case, additional parsing of materials helped to avoid errors in case they have extensions that are not considered in the general list.
@tnormandao if an extension is used in a material but not included in json.extensionsUsed, then it's an invalid glTF file and we cannot support it here. See glTF Spec → Specifying Extensions:
All extensions used in a glTF asset must be listed in the top-level extensionsUsed array...
You can also check your models using the glTF validator.
Most helpful comment
@tnormandao if an extension is used in a material but not included in
json.extensionsUsed, then it's an invalid glTF file and we cannot support it here. See glTF Spec → Specifying Extensions:You can also check your models using the glTF validator.