@babylonjs/loaders 7.19.1 → 7.20.0
Sign up to get free protection for your applications and to get access to all the features.
- package/OBJ/objFileLoader.d.ts +12 -2
- package/OBJ/objFileLoader.js +5 -1
- package/OBJ/objFileLoader.js.map +1 -1
- package/SPLAT/splatFileLoader.d.ts +20 -3
- package/SPLAT/splatFileLoader.js +3 -1
- package/SPLAT/splatFileLoader.js.map +1 -1
- package/STL/stlFileLoader.d.ts +17 -3
- package/STL/stlFileLoader.js +2 -1
- package/STL/stlFileLoader.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_lod.d.ts +15 -0
- package/glTF/2.0/Extensions/MSFT_lod.js +3 -0
- package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -1
- package/glTF/2.0/glTFLoader.js +17 -5
- package/glTF/2.0/glTFLoader.js.map +1 -1
- package/glTF/glTFFileLoader.d.ts +74 -31
- package/glTF/glTFFileLoader.js +32 -15
- package/glTF/glTFFileLoader.js.map +1 -1
- package/package.json +3 -3
package/glTF/2.0/glTFLoader.js
CHANGED
@@ -387,12 +387,21 @@ export class GLTFLoader {
|
|
387
387
|
}
|
388
388
|
_loadExtensions() {
|
389
389
|
for (const name in GLTFLoader._RegisteredExtensions) {
|
390
|
-
|
391
|
-
if (
|
392
|
-
|
390
|
+
// Don't load explicitly disabled extensions.
|
391
|
+
if (this.parent.extensionOptions[name]?.enabled === false) {
|
392
|
+
// But warn if the disabled extension is used by the model.
|
393
|
+
if (this.isExtensionUsed(name)) {
|
394
|
+
Logger.Warn(`Extension ${name} is used but has been explicitly disabled.`);
|
395
|
+
}
|
396
|
+
}
|
397
|
+
else {
|
398
|
+
const extension = GLTFLoader._RegisteredExtensions[name].factory(this);
|
399
|
+
if (extension.name !== name) {
|
400
|
+
Logger.Warn(`The name of the glTF loader extension instance does not match the registered name: ${extension.name} !== ${name}`);
|
401
|
+
}
|
402
|
+
this._extensions.push(extension);
|
403
|
+
this._parent.onExtensionLoadedObservable.notifyObservers(extension);
|
393
404
|
}
|
394
|
-
this._extensions.push(extension);
|
395
|
-
this._parent.onExtensionLoadedObservable.notifyObservers(extension);
|
396
405
|
}
|
397
406
|
this._extensions.sort((a, b) => (a.order || Number.MAX_VALUE) - (b.order || Number.MAX_VALUE));
|
398
407
|
this._parent.onExtensionLoadedObservable.clear();
|
@@ -402,6 +411,9 @@ export class GLTFLoader {
|
|
402
411
|
for (const name of this._gltf.extensionsRequired) {
|
403
412
|
const available = this._extensions.some((extension) => extension.name === name && extension.enabled);
|
404
413
|
if (!available) {
|
414
|
+
if (this.parent.extensionOptions[name]?.enabled === false) {
|
415
|
+
throw new Error(`Required extension ${name} is disabled`);
|
416
|
+
}
|
405
417
|
throw new Error(`Required extension ${name} is not available`);
|
406
418
|
}
|
407
419
|
}
|