Browse Source

Merge pull request #14653 from looeee/fbxloader_improve_texture_checks

FBXLoader: improved texture checks
Mr.doob 7 years ago
parent
commit
005c45d26d
1 changed files with 15 additions and 2 deletions
  1. 15 2
      examples/js/loaders/FBXLoader.js

+ 15 - 2
examples/js/loaders/FBXLoader.js

@@ -389,9 +389,22 @@ THREE.FBXLoader = ( function () {
 
 			var texture;
 
-			if ( textureNode.FileName.slice( - 3 ).toLowerCase() === 'tga' ) {
+			var extension = textureNode.FileName.slice( - 3 ).toLowerCase();
 
-				texture = THREE.Loader.Handlers.get( '.tga' ).load( fileName );
+			if ( extension === 'tga' ) {
+
+				var loader = THREE.Loader.Handlers.get( '.tga' );
+				if ( loader === null ) {
+
+					console.warn( 'FBXLoader: TGALoader not found, creating empty placeholder texture for', fileName );
+					texture = new THREE.Texture();
+
+				} else texture = loader.load( fileName );
+
+			} else if ( extension === 'psd' ) {
+
+				console.warn( 'FBXLoader: PSD textures are not supported, creating empty placeholder texture for', fileName );
+				texture = new THREE.Texture();
 
 			} else {