ソースを参照

Loaders: Added missing .setPath() in remaining core loaders.

Mugen87 6 年 前
コミット
492bcfe2ff

+ 8 - 0
docs/api/en/loaders/AnimationLoader.html

@@ -81,6 +81,14 @@
 		be parsed with [page:AnimationClip.parse].
 		be parsed with [page:AnimationClip.parse].
 		</p>
 		</p>
 
 
+		<h3>[method:AnimationLoader setPath]( [param:String path] )</h3>
+		<p>
+			[page:String path] — Base path of the file to load.<br /><br />
+
+			Sets the base path or URL from which to load files. This can be useful if
+			you are loading many animations from the same directory.
+		</p>
+
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 8 - 0
docs/api/en/loaders/AudioLoader.html

@@ -92,6 +92,14 @@
 		Begin loading from url and pass the loaded [page:String AudioBuffer] to onLoad.
 		Begin loading from url and pass the loaded [page:String AudioBuffer] to onLoad.
 		</p>
 		</p>
 
 
+		<h3>[method:AudioLoader setPath]( [param:String path] )</h3>
+		<p>
+			[page:String path] — Base path of the file to load.<br /><br />
+			
+			Sets the base path or URL from which to load files. This can be useful if
+			you are loading many audios from the same directory.
+		</p>
+
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 8 - 0
docs/api/en/loaders/BufferGeometryLoader.html

@@ -85,6 +85,14 @@
 		Parse a <em>JSON</em> structure and return a [page:BufferGeometry].
 		Parse a <em>JSON</em> structure and return a [page:BufferGeometry].
 		</p>
 		</p>
 
 
+		<h3>[method:BufferGeometryLoader setPath]( [param:String path] )</h3>
+		<p>
+			[page:String path] — Base path of the file to load.<br /><br />
+
+			Sets the base path or URL from which to load files. This can be useful if
+			you are loading many geometries from the same directory.
+		</p>
+
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 8 - 0
docs/api/en/loaders/DataTextureLoader.html

@@ -56,6 +56,14 @@
 		Begin loading from url and pass the loaded texture to onLoad.
 		Begin loading from url and pass the loaded texture to onLoad.
 		</p>
 		</p>
 
 
+		<h3>[method:DataTextureLoader setPath]( [param:String path] )</h3>
+		<p>
+			[page:String path] — Base path of the file to load.<br /><br />
+
+			Sets the base path or URL from which to load files. This can be useful if
+			you are loading many data textures from the same directory.
+		</p>
+
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 9 - 3
docs/api/en/loaders/MaterialLoader.html

@@ -84,12 +84,18 @@
 		Parse a <em>JSON</em> structure and create a new [page:Material] of the type [page:String json.type] with parameters defined in the json object.
 		Parse a <em>JSON</em> structure and create a new [page:Material] of the type [page:String json.type] with parameters defined in the json object.
 		</p>
 		</p>
 
 
-		<h3>[method:null setTextures]( [param:Object textures] )</h3>
+		<h3>[method:MaterialLoader setPath]( [param:String path] )</h3>
 		<p>
 		<p>
-		[page:Object textures] — object containing any textures used by the material.
-		</p>
+			[page:String path] — Base path of the file to load.<br /><br />
 
 
+			Sets the base path or URL from which to load files. This can be useful if
+			you are loading many materials from the same directory.
+		</p>
 
 
+		<h3>[method:MaterialLoader setTextures]( [param:Object textures] )</h3>
+		<p>
+		[page:Object textures] — object containing any textures used by the material.
+		</p>
 
 
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 

+ 8 - 0
src/loaders/AnimationLoader.js

@@ -19,6 +19,7 @@ Object.assign( AnimationLoader.prototype, {
 		var scope = this;
 		var scope = this;
 
 
 		var loader = new FileLoader( scope.manager );
 		var loader = new FileLoader( scope.manager );
+		loader.setPath( scope.path );
 		loader.load( url, function ( text ) {
 		loader.load( url, function ( text ) {
 
 
 			onLoad( scope.parse( JSON.parse( text ) ) );
 			onLoad( scope.parse( JSON.parse( text ) ) );
@@ -41,6 +42,13 @@ Object.assign( AnimationLoader.prototype, {
 
 
 		onLoad( animations );
 		onLoad( animations );
 
 
+	},
+
+	setPath: function ( value ) {
+
+		this.path = value;
+		return this;
+
 	}
 	}
 
 
 } );
 } );

+ 8 - 0
src/loaders/AudioLoader.js

@@ -18,6 +18,7 @@ Object.assign( AudioLoader.prototype, {
 
 
 		var loader = new FileLoader( this.manager );
 		var loader = new FileLoader( this.manager );
 		loader.setResponseType( 'arraybuffer' );
 		loader.setResponseType( 'arraybuffer' );
+		loader.setPath( this.path );
 		loader.load( url, function ( buffer ) {
 		loader.load( url, function ( buffer ) {
 
 
 			// Create a copy of the buffer. The `decodeAudioData` method
 			// Create a copy of the buffer. The `decodeAudioData` method
@@ -33,6 +34,13 @@ Object.assign( AudioLoader.prototype, {
 
 
 		}, onProgress, onError );
 		}, onProgress, onError );
 
 
+	},
+
+	setPath: function ( value ) {
+
+		this.path = value;
+		return this;
+
 	}
 	}
 
 
 } );
 } );

+ 8 - 0
src/loaders/BufferGeometryLoader.js

@@ -22,6 +22,7 @@ Object.assign( BufferGeometryLoader.prototype, {
 		var scope = this;
 		var scope = this;
 
 
 		var loader = new FileLoader( scope.manager );
 		var loader = new FileLoader( scope.manager );
+		loader.setPath( scope.path );
 		loader.load( url, function ( text ) {
 		loader.load( url, function ( text ) {
 
 
 			onLoad( scope.parse( JSON.parse( text ) ) );
 			onLoad( scope.parse( JSON.parse( text ) ) );
@@ -86,6 +87,13 @@ Object.assign( BufferGeometryLoader.prototype, {
 
 
 		return geometry;
 		return geometry;
 
 
+	},
+
+	setPath: function ( value ) {
+
+		this.path = value;
+		return this;
+
 	}
 	}
 
 
 } );
 } );

+ 8 - 1
src/loaders/DataTextureLoader.js

@@ -28,7 +28,7 @@ Object.assign( DataTextureLoader.prototype, {
 
 
 		var loader = new FileLoader( this.manager );
 		var loader = new FileLoader( this.manager );
 		loader.setResponseType( 'arraybuffer' );
 		loader.setResponseType( 'arraybuffer' );
-
+		loader.setPath( this.path );
 		loader.load( url, function ( buffer ) {
 		loader.load( url, function ( buffer ) {
 
 
 			var texData = scope._parser( buffer );
 			var texData = scope._parser( buffer );
@@ -87,6 +87,13 @@ Object.assign( DataTextureLoader.prototype, {
 
 
 		return texture;
 		return texture;
 
 
+	},
+
+	setPath: function ( value ) {
+
+		this.path = value;
+		return this;
+
 	}
 	}
 
 
 } );
 } );

+ 15 - 6
src/loaders/MaterialLoader.js

@@ -25,6 +25,7 @@ Object.assign( MaterialLoader.prototype, {
 		var scope = this;
 		var scope = this;
 
 
 		var loader = new FileLoader( scope.manager );
 		var loader = new FileLoader( scope.manager );
+		loader.setPath( scope.path );
 		loader.load( url, function ( text ) {
 		loader.load( url, function ( text ) {
 
 
 			onLoad( scope.parse( JSON.parse( text ) ) );
 			onLoad( scope.parse( JSON.parse( text ) ) );
@@ -33,12 +34,6 @@ Object.assign( MaterialLoader.prototype, {
 
 
 	},
 	},
 
 
-	setTextures: function ( value ) {
-
-		this.textures = value;
-
-	},
-
 	parse: function ( json ) {
 	parse: function ( json ) {
 
 
 		var textures = this.textures;
 		var textures = this.textures;
@@ -219,6 +214,20 @@ Object.assign( MaterialLoader.prototype, {
 
 
 		return material;
 		return material;
 
 
+	},
+
+	setPath: function ( value ) {
+
+		this.path = value;
+		return this;
+
+	},
+
+	setTextures: function ( value ) {
+
+		this.textures = value;
+		return this;
+
 	}
 	}
 
 
 } );
 } );