Skip to content

FBXLoader: Use getHandler() for custom texture loaders. #31032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 5, 2025
15 changes: 2 additions & 13 deletions examples/jsm/loaders/FBXLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,21 +437,10 @@ class FBXTreeParser {
// load a texture specified as a blob or data URI, or via an external URL using TextureLoader
loadTexture( textureNode, images ) {

const nonNativeExtensions = new Set( [ 'tga', 'tif', 'tiff', 'exr', 'dds', 'hdr', 'ktx2' ] );

const extension = textureNode.FileName.split( '.' ).pop().toLowerCase();

const loader = nonNativeExtensions.has( extension ) ? this.manager.getHandler( `.${extension}` ) : this.textureLoader;

if ( ! loader ) {

console.warn(
`FBXLoader: ${extension.toUpperCase()} loader not found, creating placeholder texture for`,
textureNode.RelativeFilename
);
return new Texture();

}
let loader = this.manager.getHandler( `.${extension}` );
if ( loader === null) loader = this.textureLoader;

const loaderPath = loader.path;

Expand Down