Browse Source

GLTFLoader: Use .path for resourcePath if .resourcePath is undefined

Takahiro 6 years ago
parent
commit
1f9e341896
1 changed files with 16 additions and 4 deletions
  1. 16 4
      examples/js/loaders/GLTFLoader.js

+ 16 - 4
examples/js/loaders/GLTFLoader.js

@@ -25,9 +25,21 @@ THREE.GLTFLoader = ( function () {
 
 			var scope = this;
 
-			var path = this.resourcePath !== undefined
-				? this.resourcePath
-				: THREE.LoaderUtils.extractUrlBase( url );
+			var resourcePath;
+
+			if ( this.resourcePath !== undefined ) {
+
+				resourcePath = this.resourcePath;
+
+			} else if ( this.path !== undefined ) {
+
+				resourcePath = this.path;
+
+			} else {
+
+				resourcePath = THREE.LoaderUtils.extractUrlBase( url );
+
+			}
 
 			var loader = new THREE.FileLoader( scope.manager );
 
@@ -38,7 +50,7 @@ THREE.GLTFLoader = ( function () {
 
 				try {
 
-					scope.parse( data, path, onLoad, onError );
+					scope.parse( data, resourcePath, onLoad, onError );
 
 				} catch ( e ) {