Skip to content

Commit b76dd1d

Browse files
authored
Merge pull request #14943 from Mugen87/dev9
Examples: More usage of setPath() and setResourcePath() in loaders.
2 parents 8788865 + e12b7a2 commit b76dd1d

27 files changed

+271
-48
lines changed

docs/examples/loaders/BabylonLoader.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ <h3>[method:Object3D parse]( [param:Object json] )</h3>
8484
Lights are parsed accordingly.
8585
</p>
8686

87+
<h3>[method:BabylonLoader setPath]( [param:String path] )</h3>
88+
<p>
89+
[page:String path] — Base path.
90+
</p>
91+
<p>
92+
Set the base path for the file.
93+
</p>
94+
8795
<h2>Source</h2>
8896

8997
[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/BabylonLoader.js examples/js/loaders/BabylonLoader.js]

docs/examples/loaders/PCDLoader.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,14 @@ <h3>[method:Object3D parse]( [param:Arraybuffer data],[param:String url] )</h3>
9393
The object is converted to [page:Points] with a [page:BufferGeometry] and a [page:PointsMaterial].
9494
</p>
9595

96+
<h3>[method:PCDLoader setPath]( [param:String path] )</h3>
97+
<p>
98+
[page:String path] — Base path.
99+
</p>
100+
<p>
101+
Set the base path for the file.
102+
</p>
103+
96104
<h2>Source</h2>
97105

98106
[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/PCDLoader.js examples/js/loaders/PCDLoader.js]

docs/examples/loaders/PDBLoader.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,14 @@ <h3>[method:Object parse]( [param:String text] )</h3>
8787
Parse a <em>pdb</em> text and return a <em>JSON</em> structure.<br />
8888
</p>
8989

90+
<h3>[method:PDBLoader setPath]( [param:String path] )</h3>
91+
<p>
92+
[page:String path] — Base path.
93+
</p>
94+
<p>
95+
Set the base path for the file.
96+
</p>
97+
9098
<h2>Source</h2>
9199

92100
[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/PDBLoader.js examples/js/loaders/PDBLoader.js]

docs/examples/loaders/PRWMLoader.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ <h3>PRWMLoader.isBigEndianPlatform( )</h3>
9494
Return true if the endianness of the platform is Big Endian, false otherwise.
9595
</p>
9696

97+
<h3>[method:PRWMLoader setPath]( [param:String path] )</h3>
98+
<p>
99+
[page:String path] — Base path.
100+
</p>
101+
<p>
102+
Set the base path for the file.
103+
</p>
104+
97105
<h2>Source</h2>
98106

99107
[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/PRWMLoader.js examples/js/loaders/PRWMLoader.js]

docs/examples/loaders/SVGLoader.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ <h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Func
9999
Begin loading from url and call onLoad with the response content.
100100
</p>
101101

102+
<h3>[method:SVGLoader setPath]( [param:String path] )</h3>
103+
<p>
104+
[page:String path] — Base path.
105+
</p>
106+
<p>
107+
Set the base path for the file.
108+
</p>
102109

103110
<h2>Source</h2>
104111

docs/examples/loaders/TGALoader.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ <h3>[method:DataTexture load]( [param:String url], [param:Function onLoad], [par
7676
Begin loading from url and pass the loaded [page:DataTexture texture] to onLoad. The [page:DataTexture texture] is also directly returned for immediate use (but may not be fully loaded).
7777
</p>
7878

79+
<h3>[method:TGALoader setPath]( [param:String path] )</h3>
80+
<p>
81+
[page:String path] — Base path.
82+
</p>
83+
<p>
84+
Set the base path for the file.
85+
</p>
86+
7987
<h2>Source</h2>
8088

8189
[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/TGALoader.js examples/js/loaders/TGALoader.js]

examples/js/loaders/3MFLoader.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ THREE.ThreeMFLoader.prototype = {
1717

1818
var scope = this;
1919
var loader = new THREE.FileLoader( scope.manager );
20+
loader.setPath( scope.path );
2021
loader.setResponseType( 'arraybuffer' );
2122
loader.load( url, function ( buffer ) {
2223

@@ -26,6 +27,13 @@ THREE.ThreeMFLoader.prototype = {
2627

2728
},
2829

30+
setPath: function ( value ) {
31+
32+
this.path = value;
33+
return this;
34+
35+
},
36+
2937
parse: function ( data ) {
3038

3139
var scope = this;

examples/js/loaders/AMFLoader.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ THREE.AMFLoader.prototype = {
3333
var scope = this;
3434

3535
var loader = new THREE.FileLoader( scope.manager );
36+
loader.setPath( scope.path );
3637
loader.setResponseType( 'arraybuffer' );
3738
loader.load( url, function ( text ) {
3839

@@ -42,6 +43,13 @@ THREE.AMFLoader.prototype = {
4243

4344
},
4445

46+
setPath: function ( value ) {
47+
48+
this.path = value;
49+
return this;
50+
51+
},
52+
4553
parse: function ( data ) {
4654

4755
function loadDocument( data ) {

examples/js/loaders/AWDLoader.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
this._baseDir = url.substr( 0, url.lastIndexOf( '/' ) + 1 );
117117

118118
var loader = new THREE.FileLoader( this.manager );
119+
loader.setPath( this.path );
119120
loader.setResponseType( 'arraybuffer' );
120121
loader.load( url, function ( text ) {
121122

@@ -125,6 +126,13 @@
125126

126127
},
127128

129+
setPath: function ( value ) {
130+
131+
this.path = value;
132+
return this;
133+
134+
},
135+
128136
parse: function ( data ) {
129137

130138
var blen = data.byteLength;

examples/js/loaders/BVHLoader.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ THREE.BVHLoader.prototype = {
2626
var scope = this;
2727

2828
var loader = new THREE.FileLoader( scope.manager );
29+
loader.setPath( scope.path );
2930
loader.load( url, function ( text ) {
3031

3132
onLoad( scope.parse( text ) );
@@ -34,6 +35,13 @@ THREE.BVHLoader.prototype = {
3435

3536
},
3637

38+
setPath: function ( value ) {
39+
40+
this.path = value;
41+
return this;
42+
43+
},
44+
3745
parse: function ( text ) {
3846

3947
/*

0 commit comments

Comments
 (0)