Browse Source

MaterialXLoader: Respect handlers attached to manager when loading textures (#27432)

Matches how GLTFloader does this
hybridherbst 1 year ago
parent
commit
8ca5469c99
1 changed files with 11 additions and 1 deletions
  1. 11 1
      examples/jsm/loaders/MaterialXLoader.js

+ 11 - 1
examples/jsm/loaders/MaterialXLoader.js

@@ -326,7 +326,17 @@ class MaterialXNode {
 
 		const filePrefix = this.getRecursiveAttribute( 'fileprefix' ) || '';
 
-		const texture = this.materialX.textureLoader.load( filePrefix + this.value );
+		let loader = this.materialX.textureLoader;
+		const uri = filePrefix + this.value;
+
+		if ( uri ) {
+
+			const handler = this.materialX.manager.getHandler( uri );
+			if ( handler !== null ) loader = handler;
+
+		}
+
+		const texture = loader.load( uri );
 		texture.wrapS = texture.wrapT = RepeatWrapping;
 		texture.flipY = false;