Ver código fonte

Added noImplicitReturns as compiler option

David Catuhe 7 anos atrás
pai
commit
c77672bb66
67 arquivos alterados com 5970 adições e 5875 exclusões
  1. 4 2
      Tools/Gulp/gulpfile.js
  2. 1419 1419
      dist/preview release/babylon.d.ts
  3. 38 38
      dist/preview release/babylon.js
  4. 51 22
      dist/preview release/babylon.max.js
  5. 1419 1419
      dist/preview release/babylon.module.d.ts
  6. 44 44
      dist/preview release/babylon.worker.js
  7. 1152 1152
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts
  8. 47 47
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js
  9. 160 136
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js
  10. 1152 1152
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts
  11. 2 1
      dist/preview release/gui/babylon.gui.js
  12. 3 3
      dist/preview release/gui/babylon.gui.min.js
  13. 3 3
      dist/preview release/inspector/babylon.inspector.bundle.js
  14. 2 0
      dist/preview release/inspector/babylon.inspector.js
  15. 3 3
      dist/preview release/inspector/babylon.inspector.min.js
  16. 1 1
      dist/preview release/loaders/babylon.glTF1FileLoader.d.ts
  17. 8 18
      dist/preview release/loaders/babylon.glTF1FileLoader.js
  18. 2 2
      dist/preview release/loaders/babylon.glTF1FileLoader.min.js
  19. 1 6
      dist/preview release/loaders/babylon.glTF2FileLoader.d.ts
  20. 108 114
      dist/preview release/loaders/babylon.glTF2FileLoader.js
  21. 2 2
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  22. 1 6
      dist/preview release/loaders/babylon.glTFFileLoader.d.ts
  23. 109 114
      dist/preview release/loaders/babylon.glTFFileLoader.js
  24. 3 3
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  25. 111 115
      dist/preview release/loaders/babylonjs.loaders.js
  26. 3 3
      dist/preview release/loaders/babylonjs.loaders.min.js
  27. 1 6
      dist/preview release/loaders/babylonjs.loaders.module.d.ts
  28. 2 1
      dist/preview release/materialsLibrary/babylonjs.materials.js
  29. 2 2
      dist/preview release/materialsLibrary/babylonjs.materials.min.js
  30. 2 1
      dist/preview release/postProcessesLibrary/babylonjs.postProcess.js
  31. 1 1
      dist/preview release/postProcessesLibrary/babylonjs.postProcess.min.js
  32. 2 1
      dist/preview release/proceduralTexturesLibrary/babylonjs.proceduralTextures.js
  33. 1 1
      dist/preview release/proceduralTexturesLibrary/babylonjs.proceduralTextures.min.js
  34. 2 1
      dist/preview release/serializers/babylonjs.serializers.js
  35. 1 1
      dist/preview release/serializers/babylonjs.serializers.min.js
  36. 1 0
      dist/preview release/what's new.md
  37. 2 1
      gui/src/tsconfig.json
  38. 4 2
      inspector/src/tabs/PropertyTab.ts
  39. 2 0
      inspector/src/tabs/TabBar.ts
  40. 2 1
      inspector/src/tsconfig.json
  41. 3 1
      loaders/src/glTF/1.0/babylon.glTFLoader.ts
  42. 1 1
      loaders/src/glTF/2.0/babylon.glTFLoaderExtension.ts
  43. 2 1
      loaders/src/tsconfig.json
  44. 2 1
      materialsLibrary/src/tsconfig.json
  45. 2 1
      postProcessLibrary/src/tsconfig.json
  46. 2 1
      proceduralTexturesLibrary/src/tsconfig.json
  47. 2 1
      serializers/src/tsconfig.json
  48. 1 1
      src/Animations/babylon.animation.ts
  49. 22 0
      src/Cameras/babylon.arcRotateCamera.ts
  50. 10 0
      src/Cameras/babylon.freeCamera.ts
  51. 4 0
      src/Cameras/babylon.gamepadCamera.ts
  52. 4 0
      src/Cameras/babylon.touchCamera.ts
  53. 4 0
      src/Cameras/babylon.universalCamera.ts
  54. 2 0
      src/Lights/babylon.light.ts
  55. 4 0
      src/Loading/Plugins/babylon.babylonFileLoader.ts
  56. 1 1
      src/Materials/babylon.effect.ts
  57. 5 5
      src/Mesh/babylon.abstractMesh.ts
  58. 7 7
      src/Mesh/babylon.mesh.ts
  59. 2 2
      src/Mesh/babylon.subMesh.ts
  60. 1 1
      src/Particles/babylon.solidParticleSystem.ts
  61. 5 1
      src/Physics/babylon.physicsEngine.ts
  62. 1 1
      src/Physics/babylon.physicsImpostor.ts
  63. 2 0
      src/PostProcess/RenderPipeline/babylon.postProcessRenderEffect.ts
  64. 3 1
      src/Tools/babylon.tools.ts
  65. 2 2
      src/babylon.node.ts
  66. 1 1
      src/babylon.scene.ts
  67. 2 1
      src/tsconfig.json

+ 4 - 2
Tools/Gulp/gulpfile.js

@@ -46,7 +46,8 @@ var tsConfig = {
     typescript: require('typescript'),
     experimentalDecorators: true,
     isolatedModules: false,
-    noImplicitAny: true
+    noImplicitAny: true,
+    noImplicitReturns: true
 };
 var tsProject = typescript.createProject(tsConfig);
 
@@ -57,7 +58,8 @@ var externalTsConfig = {
     typescript: require('typescript'),
     experimentalDecorators: true,
     isolatedModules: false,
-    noImplicitAny: true
+    noImplicitAny: true,
+    noImplicitReturns: true
 };
 
 function processDependency(kind, dependency, filesToLoad) {

Diferenças do arquivo suprimidas por serem muito extensas
+ 1419 - 1419
dist/preview release/babylon.d.ts


Diferenças do arquivo suprimidas por serem muito extensas
+ 38 - 38
dist/preview release/babylon.js


+ 51 - 22
dist/preview release/babylon.max.js

@@ -6668,13 +6668,14 @@ var BABYLON;
             }
             return name;
         };
-        Tools.first = function (array, predicate) {
+        Tools.First = function (array, predicate) {
             for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {
                 var el = array_1[_i];
                 if (predicate(el)) {
                     return el;
                 }
             }
+            return null;
         };
         /**
          * This method will return the name of the full name of the class, including its owning module (if any).
@@ -11682,7 +11683,7 @@ var BABYLON;
         Node.prototype.addBehavior = function (behavior) {
             var index = this._behaviors.indexOf(behavior);
             if (index !== -1) {
-                return;
+                return this;
             }
             behavior.attach(this);
             this._behaviors.push(behavior);
@@ -11691,7 +11692,7 @@ var BABYLON;
         Node.prototype.removeBehavior = function (behavior) {
             var index = this._behaviors.indexOf(behavior);
             if (index === -1) {
-                return;
+                return this;
             }
             this._behaviors[index].detach();
             this._behaviors.splice(index, 1);
@@ -13268,14 +13269,14 @@ var BABYLON;
          */
         AbstractMesh.prototype.setAbsolutePosition = function (absolutePosition) {
             if (!absolutePosition) {
-                return;
+                return this;
             }
             var absolutePositionX;
             var absolutePositionY;
             var absolutePositionZ;
             if (absolutePosition.x === undefined) {
                 if (arguments.length < 3) {
-                    return;
+                    return this;
                 }
                 absolutePositionX = arguments[0];
                 absolutePositionY = arguments[1];
@@ -13473,7 +13474,7 @@ var BABYLON;
          */
         AbstractMesh.prototype._updateSubMeshesBoundingInfo = function (matrix) {
             if (!this.subMeshes) {
-                return;
+                return this;
             }
             for (var subIndex = 0; subIndex < this.subMeshes.length; subIndex++) {
                 var subMesh = this.subMeshes[subIndex];
@@ -13776,14 +13777,14 @@ var BABYLON;
         };
         AbstractMesh.prototype.applyImpulse = function (force, contactPoint) {
             if (!this.physicsImpostor) {
-                return;
+                return this;
             }
             this.physicsImpostor.applyImpulse(force, contactPoint);
             return this;
         };
         AbstractMesh.prototype.setPhysicsLinkWith = function (otherMesh, pivot1, pivot2, options) {
             if (!this.physicsImpostor || !otherMesh.physicsImpostor) {
-                return;
+                return this;
             }
             this.physicsImpostor.createJoint(otherMesh.physicsImpostor, BABYLON.PhysicsJoint.HingeJoint, {
                 mainPivot: pivot1,
@@ -14989,6 +14990,7 @@ var BABYLON;
                 case 3:
                     return function () { return new BABYLON.HemisphericLight(name, BABYLON.Vector3.Zero(), scene); };
             }
+            return null;
         };
         /**
          * Parses the passed "parsedLight" and returns a new instanced Light from this parsing.
@@ -20103,7 +20105,7 @@ var BABYLON;
             }
             if (!this.environmentTexture) {
                 BABYLON.Tools.Warn("Can not create default skybox without environment texture.");
-                return;
+                return null;
             }
             // Skybox
             var hdrSkybox = BABYLON.Mesh.CreateBox("hdrSkyBox", scale, this);
@@ -22121,7 +22123,7 @@ var BABYLON;
          */
         Mesh.prototype.refreshBoundingInfo = function () {
             if (this._boundingInfo.isLocked) {
-                return;
+                return this;
             }
             var data = this.getVerticesData(BABYLON.VertexBuffer.PositionKind);
             if (data) {
@@ -22162,7 +22164,7 @@ var BABYLON;
                     }
                 }
                 if (!needToRecreate) {
-                    return;
+                    return this.subMeshes[0];
                 }
             }
             this.releaseSubMeshes();
@@ -22271,7 +22273,7 @@ var BABYLON;
          */
         Mesh.prototype.updateVerticesData = function (kind, data, updateExtends, makeItUnique) {
             if (!this._geometry) {
-                return;
+                return this;
             }
             if (!makeItUnique) {
                 this._geometry.updateVerticesData(kind, data, updateExtends);
@@ -22308,7 +22310,7 @@ var BABYLON;
          */
         Mesh.prototype.makeGeometryUnique = function () {
             if (!this._geometry) {
-                return;
+                return this;
             }
             var oldGeometry = this._geometry;
             var geometry = this._geometry.copy(BABYLON.Geometry.RandomId());
@@ -22342,7 +22344,7 @@ var BABYLON;
          */
         Mesh.prototype.updateIndices = function (indices, offset) {
             if (!this._geometry) {
-                return;
+                return this;
             }
             this._geometry.updateIndices(indices, offset);
             return this;
@@ -22353,7 +22355,7 @@ var BABYLON;
          */
         Mesh.prototype.toLeftHanded = function () {
             if (!this._geometry) {
-                return;
+                return this;
             }
             this._geometry.toLeftHanded();
             return this;
@@ -22574,7 +22576,7 @@ var BABYLON;
         Mesh.prototype.render = function (subMesh, enableAlphaMode) {
             this.checkOcclusionQuery();
             if (this._isOccluded) {
-                return;
+                return this;
             }
             var scene = this.getScene();
             // Managing instances
@@ -24461,12 +24463,12 @@ var BABYLON;
         SubMesh.prototype.refreshBoundingInfo = function () {
             this._lastColliderWorldVertices = null;
             if (this.IsGlobal) {
-                return;
+                return this;
             }
             var data = this._renderingMesh.getVerticesData(BABYLON.VertexBuffer.PositionKind);
             if (!data) {
                 this._boundingInfo = this._mesh._boundingInfo;
-                return;
+                return this;
             }
             var indices = this._renderingMesh.getIndices();
             var extend;
@@ -25309,7 +25311,7 @@ var BABYLON;
         };
         Effect.prototype.setMatrices = function (uniformName, matrices) {
             if (!matrices) {
-                return;
+                return this;
             }
             this._valueCache[uniformName] = null;
             this._engine.setMatrices(this.getUniform(uniformName), matrices);
@@ -36604,6 +36606,7 @@ var BABYLON;
                 var mouse = this.inputs.attached["mouse"];
                 if (mouse)
                     return mouse.angularSensibility;
+                return null;
             },
             set: function (value) {
                 var mouse = this.inputs.attached["mouse"];
@@ -36618,6 +36621,7 @@ var BABYLON;
                 var keyboard = this.inputs.attached["keyboard"];
                 if (keyboard)
                     return keyboard.keysUp;
+                return null;
             },
             set: function (value) {
                 var keyboard = this.inputs.attached["keyboard"];
@@ -36632,6 +36636,7 @@ var BABYLON;
                 var keyboard = this.inputs.attached["keyboard"];
                 if (keyboard)
                     return keyboard.keysDown;
+                return null;
             },
             set: function (value) {
                 var keyboard = this.inputs.attached["keyboard"];
@@ -36646,6 +36651,7 @@ var BABYLON;
                 var keyboard = this.inputs.attached["keyboard"];
                 if (keyboard)
                     return keyboard.keysLeft;
+                return null;
             },
             set: function (value) {
                 var keyboard = this.inputs.attached["keyboard"];
@@ -36660,6 +36666,7 @@ var BABYLON;
                 var keyboard = this.inputs.attached["keyboard"];
                 if (keyboard)
                     return keyboard.keysRight;
+                return null;
             },
             set: function (value) {
                 var keyboard = this.inputs.attached["keyboard"];
@@ -37397,6 +37404,7 @@ var BABYLON;
                 var pointers = this.inputs.attached["pointers"];
                 if (pointers)
                     return pointers.angularSensibilityX;
+                return null;
             },
             set: function (value) {
                 var pointers = this.inputs.attached["pointers"];
@@ -37412,6 +37420,7 @@ var BABYLON;
                 var pointers = this.inputs.attached["pointers"];
                 if (pointers)
                     return pointers.angularSensibilityY;
+                return null;
             },
             set: function (value) {
                 var pointers = this.inputs.attached["pointers"];
@@ -37427,6 +37436,7 @@ var BABYLON;
                 var pointers = this.inputs.attached["pointers"];
                 if (pointers)
                     return pointers.pinchPrecision;
+                return null;
             },
             set: function (value) {
                 var pointers = this.inputs.attached["pointers"];
@@ -37442,6 +37452,7 @@ var BABYLON;
                 var pointers = this.inputs.attached["pointers"];
                 if (pointers)
                     return pointers.pinchDeltaPercentage;
+                return null;
             },
             set: function (value) {
                 var pointers = this.inputs.attached["pointers"];
@@ -37457,6 +37468,7 @@ var BABYLON;
                 var pointers = this.inputs.attached["pointers"];
                 if (pointers)
                     return pointers.panningSensibility;
+                return null;
             },
             set: function (value) {
                 var pointers = this.inputs.attached["pointers"];
@@ -37472,6 +37484,7 @@ var BABYLON;
                 var keyboard = this.inputs.attached["keyboard"];
                 if (keyboard)
                     return keyboard.keysUp;
+                return null;
             },
             set: function (value) {
                 var keyboard = this.inputs.attached["keyboard"];
@@ -37486,6 +37499,7 @@ var BABYLON;
                 var keyboard = this.inputs.attached["keyboard"];
                 if (keyboard)
                     return keyboard.keysDown;
+                return null;
             },
             set: function (value) {
                 var keyboard = this.inputs.attached["keyboard"];
@@ -37500,6 +37514,7 @@ var BABYLON;
                 var keyboard = this.inputs.attached["keyboard"];
                 if (keyboard)
                     return keyboard.keysLeft;
+                return null;
             },
             set: function (value) {
                 var keyboard = this.inputs.attached["keyboard"];
@@ -37514,6 +37529,7 @@ var BABYLON;
                 var keyboard = this.inputs.attached["keyboard"];
                 if (keyboard)
                     return keyboard.keysRight;
+                return null;
             },
             set: function (value) {
                 var keyboard = this.inputs.attached["keyboard"];
@@ -37528,6 +37544,7 @@ var BABYLON;
                 var mousewheel = this.inputs.attached["mousewheel"];
                 if (mousewheel)
                     return mousewheel.wheelPrecision;
+                return null;
             },
             set: function (value) {
                 var mousewheel = this.inputs.attached["mousewheel"];
@@ -37542,6 +37559,7 @@ var BABYLON;
                 var mousewheel = this.inputs.attached["mousewheel"];
                 if (mousewheel)
                     return mousewheel.wheelDeltaPercentage;
+                return null;
             },
             set: function (value) {
                 var mousewheel = this.inputs.attached["mousewheel"];
@@ -38981,7 +38999,7 @@ var BABYLON;
                 if (onAnimationEnd) {
                     onAnimationEnd();
                 }
-                return;
+                return null;
             }
             var endFrame = frameRate * (duration / 1000);
             transition.setKeys([{
@@ -44042,7 +44060,7 @@ var BABYLON;
             if (end === void 0) { end = this.nbParticles - 1; }
             if (update === void 0) { update = true; }
             if (!this._updatable) {
-                return;
+                return this;
             }
             // custom beforeUpdate
             this.beforeUpdateParticles(start, end, update);
@@ -51029,6 +51047,7 @@ var BABYLON;
                         BABYLON.Tools.Log(logOperation("importMesh", parsedData ? parsedData.producer : "Unknown") + (BABYLON.SceneLoader.loggingLevel !== BABYLON.SceneLoader.MINIMAL_LOGGING ? log : ""));
                     }
                 }
+                return false;
             },
             load: function (scene, data, rootUrl, onError) {
                 // Entire method running in try block, so ALWAYS logs as far as it got, only actually writes details
@@ -51375,6 +51394,7 @@ var BABYLON;
                         BABYLON.Tools.Log(logOperation("importScene", parsedData ? parsedData.producer : "Unknown") + (BABYLON.SceneLoader.loggingLevel !== BABYLON.SceneLoader.MINIMAL_LOGGING ? log : ""));
                     }
                 }
+                return false;
             }
         });
     })(Internals = BABYLON.Internals || (BABYLON.Internals = {}));
@@ -52805,6 +52825,7 @@ var BABYLON;
                 var touch = this.inputs.attached["touch"];
                 if (touch)
                     return touch.touchAngularSensibility;
+                return null;
             },
             set: function (value) {
                 var touch = this.inputs.attached["touch"];
@@ -52819,6 +52840,7 @@ var BABYLON;
                 var touch = this.inputs.attached["touch"];
                 if (touch)
                     return touch.touchMoveSensibility;
+                return null;
             },
             set: function (value) {
                 var touch = this.inputs.attached["touch"];
@@ -55038,6 +55060,7 @@ var BABYLON;
                 var gamepad = this.inputs.attached["gamepad"];
                 if (gamepad)
                     return gamepad.gamepadAngularSensibility;
+                return null;
             },
             set: function (value) {
                 var gamepad = this.inputs.attached["gamepad"];
@@ -55052,6 +55075,7 @@ var BABYLON;
                 var gamepad = this.inputs.attached["gamepad"];
                 if (gamepad)
                     return gamepad.gamepadMoveSensibility;
+                return null;
             },
             set: function (value) {
                 var gamepad = this.inputs.attached["gamepad"];
@@ -55088,6 +55112,7 @@ var BABYLON;
                 var gamepad = this.inputs.attached["gamepad"];
                 if (gamepad)
                     return gamepad.gamepadAngularSensibility;
+                return null;
             },
             set: function (value) {
                 var gamepad = this.inputs.attached["gamepad"];
@@ -55102,6 +55127,7 @@ var BABYLON;
                 var gamepad = this.inputs.attached["gamepad"];
                 if (gamepad)
                     return gamepad.gamepadMoveSensibility;
+                return null;
             },
             set: function (value) {
                 var gamepad = this.inputs.attached["gamepad"];
@@ -55303,6 +55329,7 @@ var BABYLON;
                     return this._renderPasses[passName];
                 }
             }
+            return null;
         };
         PostProcessRenderEffect.prototype.emptyPasses = function () {
             this._renderPasses = {};
@@ -63877,7 +63904,7 @@ var BABYLON;
                 var parentMesh = this.object.parent;
                 return parentMesh.physicsImpostor;
             }
-            return;
+            return null;
         };
         /**
          * Should a new body be generated.
@@ -64370,6 +64397,7 @@ var BABYLON;
                     return this._impostors[i];
                 }
             }
+            return null;
         };
         PhysicsEngine.prototype.getImpostorWithPhysicsBody = function (body) {
             for (var i = 0; i < this._impostors.length; ++i) {
@@ -64377,6 +64405,7 @@ var BABYLON;
                     return this._impostors[i];
                 }
             }
+            return null;
         };
         // Statics
         PhysicsEngine.Epsilon = 0.001;

Diferenças do arquivo suprimidas por serem muito extensas
+ 1419 - 1419
dist/preview release/babylon.module.d.ts


Diferenças do arquivo suprimidas por serem muito extensas
+ 44 - 44
dist/preview release/babylon.worker.js


Diferenças do arquivo suprimidas por serem muito extensas
+ 1152 - 1152
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


Diferenças do arquivo suprimidas por serem muito extensas
+ 47 - 47
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 160 - 136
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -6668,13 +6668,14 @@ var BABYLON;
             }
             return name;
         };
-        Tools.first = function (array, predicate) {
+        Tools.First = function (array, predicate) {
             for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {
                 var el = array_1[_i];
                 if (predicate(el)) {
                     return el;
                 }
             }
+            return null;
         };
         /**
          * This method will return the name of the full name of the class, including its owning module (if any).
@@ -11682,7 +11683,7 @@ var BABYLON;
         Node.prototype.addBehavior = function (behavior) {
             var index = this._behaviors.indexOf(behavior);
             if (index !== -1) {
-                return;
+                return this;
             }
             behavior.attach(this);
             this._behaviors.push(behavior);
@@ -11691,7 +11692,7 @@ var BABYLON;
         Node.prototype.removeBehavior = function (behavior) {
             var index = this._behaviors.indexOf(behavior);
             if (index === -1) {
-                return;
+                return this;
             }
             this._behaviors[index].detach();
             this._behaviors.splice(index, 1);
@@ -13268,14 +13269,14 @@ var BABYLON;
          */
         AbstractMesh.prototype.setAbsolutePosition = function (absolutePosition) {
             if (!absolutePosition) {
-                return;
+                return this;
             }
             var absolutePositionX;
             var absolutePositionY;
             var absolutePositionZ;
             if (absolutePosition.x === undefined) {
                 if (arguments.length < 3) {
-                    return;
+                    return this;
                 }
                 absolutePositionX = arguments[0];
                 absolutePositionY = arguments[1];
@@ -13473,7 +13474,7 @@ var BABYLON;
          */
         AbstractMesh.prototype._updateSubMeshesBoundingInfo = function (matrix) {
             if (!this.subMeshes) {
-                return;
+                return this;
             }
             for (var subIndex = 0; subIndex < this.subMeshes.length; subIndex++) {
                 var subMesh = this.subMeshes[subIndex];
@@ -13776,14 +13777,14 @@ var BABYLON;
         };
         AbstractMesh.prototype.applyImpulse = function (force, contactPoint) {
             if (!this.physicsImpostor) {
-                return;
+                return this;
             }
             this.physicsImpostor.applyImpulse(force, contactPoint);
             return this;
         };
         AbstractMesh.prototype.setPhysicsLinkWith = function (otherMesh, pivot1, pivot2, options) {
             if (!this.physicsImpostor || !otherMesh.physicsImpostor) {
-                return;
+                return this;
             }
             this.physicsImpostor.createJoint(otherMesh.physicsImpostor, BABYLON.PhysicsJoint.HingeJoint, {
                 mainPivot: pivot1,
@@ -14989,6 +14990,7 @@ var BABYLON;
                 case 3:
                     return function () { return new BABYLON.HemisphericLight(name, BABYLON.Vector3.Zero(), scene); };
             }
+            return null;
         };
         /**
          * Parses the passed "parsedLight" and returns a new instanced Light from this parsing.
@@ -20103,7 +20105,7 @@ var BABYLON;
             }
             if (!this.environmentTexture) {
                 BABYLON.Tools.Warn("Can not create default skybox without environment texture.");
-                return;
+                return null;
             }
             // Skybox
             var hdrSkybox = BABYLON.Mesh.CreateBox("hdrSkyBox", scale, this);
@@ -22121,7 +22123,7 @@ var BABYLON;
          */
         Mesh.prototype.refreshBoundingInfo = function () {
             if (this._boundingInfo.isLocked) {
-                return;
+                return this;
             }
             var data = this.getVerticesData(BABYLON.VertexBuffer.PositionKind);
             if (data) {
@@ -22162,7 +22164,7 @@ var BABYLON;
                     }
                 }
                 if (!needToRecreate) {
-                    return;
+                    return this.subMeshes[0];
                 }
             }
             this.releaseSubMeshes();
@@ -22271,7 +22273,7 @@ var BABYLON;
          */
         Mesh.prototype.updateVerticesData = function (kind, data, updateExtends, makeItUnique) {
             if (!this._geometry) {
-                return;
+                return this;
             }
             if (!makeItUnique) {
                 this._geometry.updateVerticesData(kind, data, updateExtends);
@@ -22308,7 +22310,7 @@ var BABYLON;
          */
         Mesh.prototype.makeGeometryUnique = function () {
             if (!this._geometry) {
-                return;
+                return this;
             }
             var oldGeometry = this._geometry;
             var geometry = this._geometry.copy(BABYLON.Geometry.RandomId());
@@ -22342,7 +22344,7 @@ var BABYLON;
          */
         Mesh.prototype.updateIndices = function (indices, offset) {
             if (!this._geometry) {
-                return;
+                return this;
             }
             this._geometry.updateIndices(indices, offset);
             return this;
@@ -22353,7 +22355,7 @@ var BABYLON;
          */
         Mesh.prototype.toLeftHanded = function () {
             if (!this._geometry) {
-                return;
+                return this;
             }
             this._geometry.toLeftHanded();
             return this;
@@ -22574,7 +22576,7 @@ var BABYLON;
         Mesh.prototype.render = function (subMesh, enableAlphaMode) {
             this.checkOcclusionQuery();
             if (this._isOccluded) {
-                return;
+                return this;
             }
             var scene = this.getScene();
             // Managing instances
@@ -24461,12 +24463,12 @@ var BABYLON;
         SubMesh.prototype.refreshBoundingInfo = function () {
             this._lastColliderWorldVertices = null;
             if (this.IsGlobal) {
-                return;
+                return this;
             }
             var data = this._renderingMesh.getVerticesData(BABYLON.VertexBuffer.PositionKind);
             if (!data) {
                 this._boundingInfo = this._mesh._boundingInfo;
-                return;
+                return this;
             }
             var indices = this._renderingMesh.getIndices();
             var extend;
@@ -25309,7 +25311,7 @@ var BABYLON;
         };
         Effect.prototype.setMatrices = function (uniformName, matrices) {
             if (!matrices) {
-                return;
+                return this;
             }
             this._valueCache[uniformName] = null;
             this._engine.setMatrices(this.getUniform(uniformName), matrices);
@@ -36604,6 +36606,7 @@ var BABYLON;
                 var mouse = this.inputs.attached["mouse"];
                 if (mouse)
                     return mouse.angularSensibility;
+                return null;
             },
             set: function (value) {
                 var mouse = this.inputs.attached["mouse"];
@@ -36618,6 +36621,7 @@ var BABYLON;
                 var keyboard = this.inputs.attached["keyboard"];
                 if (keyboard)
                     return keyboard.keysUp;
+                return null;
             },
             set: function (value) {
                 var keyboard = this.inputs.attached["keyboard"];
@@ -36632,6 +36636,7 @@ var BABYLON;
                 var keyboard = this.inputs.attached["keyboard"];
                 if (keyboard)
                     return keyboard.keysDown;
+                return null;
             },
             set: function (value) {
                 var keyboard = this.inputs.attached["keyboard"];
@@ -36646,6 +36651,7 @@ var BABYLON;
                 var keyboard = this.inputs.attached["keyboard"];
                 if (keyboard)
                     return keyboard.keysLeft;
+                return null;
             },
             set: function (value) {
                 var keyboard = this.inputs.attached["keyboard"];
@@ -36660,6 +36666,7 @@ var BABYLON;
                 var keyboard = this.inputs.attached["keyboard"];
                 if (keyboard)
                     return keyboard.keysRight;
+                return null;
             },
             set: function (value) {
                 var keyboard = this.inputs.attached["keyboard"];
@@ -37397,6 +37404,7 @@ var BABYLON;
                 var pointers = this.inputs.attached["pointers"];
                 if (pointers)
                     return pointers.angularSensibilityX;
+                return null;
             },
             set: function (value) {
                 var pointers = this.inputs.attached["pointers"];
@@ -37412,6 +37420,7 @@ var BABYLON;
                 var pointers = this.inputs.attached["pointers"];
                 if (pointers)
                     return pointers.angularSensibilityY;
+                return null;
             },
             set: function (value) {
                 var pointers = this.inputs.attached["pointers"];
@@ -37427,6 +37436,7 @@ var BABYLON;
                 var pointers = this.inputs.attached["pointers"];
                 if (pointers)
                     return pointers.pinchPrecision;
+                return null;
             },
             set: function (value) {
                 var pointers = this.inputs.attached["pointers"];
@@ -37442,6 +37452,7 @@ var BABYLON;
                 var pointers = this.inputs.attached["pointers"];
                 if (pointers)
                     return pointers.pinchDeltaPercentage;
+                return null;
             },
             set: function (value) {
                 var pointers = this.inputs.attached["pointers"];
@@ -37457,6 +37468,7 @@ var BABYLON;
                 var pointers = this.inputs.attached["pointers"];
                 if (pointers)
                     return pointers.panningSensibility;
+                return null;
             },
             set: function (value) {
                 var pointers = this.inputs.attached["pointers"];
@@ -37472,6 +37484,7 @@ var BABYLON;
                 var keyboard = this.inputs.attached["keyboard"];
                 if (keyboard)
                     return keyboard.keysUp;
+                return null;
             },
             set: function (value) {
                 var keyboard = this.inputs.attached["keyboard"];
@@ -37486,6 +37499,7 @@ var BABYLON;
                 var keyboard = this.inputs.attached["keyboard"];
                 if (keyboard)
                     return keyboard.keysDown;
+                return null;
             },
             set: function (value) {
                 var keyboard = this.inputs.attached["keyboard"];
@@ -37500,6 +37514,7 @@ var BABYLON;
                 var keyboard = this.inputs.attached["keyboard"];
                 if (keyboard)
                     return keyboard.keysLeft;
+                return null;
             },
             set: function (value) {
                 var keyboard = this.inputs.attached["keyboard"];
@@ -37514,6 +37529,7 @@ var BABYLON;
                 var keyboard = this.inputs.attached["keyboard"];
                 if (keyboard)
                     return keyboard.keysRight;
+                return null;
             },
             set: function (value) {
                 var keyboard = this.inputs.attached["keyboard"];
@@ -37528,6 +37544,7 @@ var BABYLON;
                 var mousewheel = this.inputs.attached["mousewheel"];
                 if (mousewheel)
                     return mousewheel.wheelPrecision;
+                return null;
             },
             set: function (value) {
                 var mousewheel = this.inputs.attached["mousewheel"];
@@ -37542,6 +37559,7 @@ var BABYLON;
                 var mousewheel = this.inputs.attached["mousewheel"];
                 if (mousewheel)
                     return mousewheel.wheelDeltaPercentage;
+                return null;
             },
             set: function (value) {
                 var mousewheel = this.inputs.attached["mousewheel"];
@@ -38981,7 +38999,7 @@ var BABYLON;
                 if (onAnimationEnd) {
                     onAnimationEnd();
                 }
-                return;
+                return null;
             }
             var endFrame = frameRate * (duration / 1000);
             transition.setKeys([{
@@ -44042,7 +44060,7 @@ var BABYLON;
             if (end === void 0) { end = this.nbParticles - 1; }
             if (update === void 0) { update = true; }
             if (!this._updatable) {
-                return;
+                return this;
             }
             // custom beforeUpdate
             this.beforeUpdateParticles(start, end, update);
@@ -51029,6 +51047,7 @@ var BABYLON;
                         BABYLON.Tools.Log(logOperation("importMesh", parsedData ? parsedData.producer : "Unknown") + (BABYLON.SceneLoader.loggingLevel !== BABYLON.SceneLoader.MINIMAL_LOGGING ? log : ""));
                     }
                 }
+                return false;
             },
             load: function (scene, data, rootUrl, onError) {
                 // Entire method running in try block, so ALWAYS logs as far as it got, only actually writes details
@@ -51375,6 +51394,7 @@ var BABYLON;
                         BABYLON.Tools.Log(logOperation("importScene", parsedData ? parsedData.producer : "Unknown") + (BABYLON.SceneLoader.loggingLevel !== BABYLON.SceneLoader.MINIMAL_LOGGING ? log : ""));
                     }
                 }
+                return false;
             }
         });
     })(Internals = BABYLON.Internals || (BABYLON.Internals = {}));
@@ -52805,6 +52825,7 @@ var BABYLON;
                 var touch = this.inputs.attached["touch"];
                 if (touch)
                     return touch.touchAngularSensibility;
+                return null;
             },
             set: function (value) {
                 var touch = this.inputs.attached["touch"];
@@ -52819,6 +52840,7 @@ var BABYLON;
                 var touch = this.inputs.attached["touch"];
                 if (touch)
                     return touch.touchMoveSensibility;
+                return null;
             },
             set: function (value) {
                 var touch = this.inputs.attached["touch"];
@@ -55038,6 +55060,7 @@ var BABYLON;
                 var gamepad = this.inputs.attached["gamepad"];
                 if (gamepad)
                     return gamepad.gamepadAngularSensibility;
+                return null;
             },
             set: function (value) {
                 var gamepad = this.inputs.attached["gamepad"];
@@ -55052,6 +55075,7 @@ var BABYLON;
                 var gamepad = this.inputs.attached["gamepad"];
                 if (gamepad)
                     return gamepad.gamepadMoveSensibility;
+                return null;
             },
             set: function (value) {
                 var gamepad = this.inputs.attached["gamepad"];
@@ -55088,6 +55112,7 @@ var BABYLON;
                 var gamepad = this.inputs.attached["gamepad"];
                 if (gamepad)
                     return gamepad.gamepadAngularSensibility;
+                return null;
             },
             set: function (value) {
                 var gamepad = this.inputs.attached["gamepad"];
@@ -55102,6 +55127,7 @@ var BABYLON;
                 var gamepad = this.inputs.attached["gamepad"];
                 if (gamepad)
                     return gamepad.gamepadMoveSensibility;
+                return null;
             },
             set: function (value) {
                 var gamepad = this.inputs.attached["gamepad"];
@@ -55303,6 +55329,7 @@ var BABYLON;
                     return this._renderPasses[passName];
                 }
             }
+            return null;
         };
         PostProcessRenderEffect.prototype.emptyPasses = function () {
             this._renderPasses = {};
@@ -63877,7 +63904,7 @@ var BABYLON;
                 var parentMesh = this.object.parent;
                 return parentMesh.physicsImpostor;
             }
-            return;
+            return null;
         };
         /**
          * Should a new body be generated.
@@ -64370,6 +64397,7 @@ var BABYLON;
                     return this._impostors[i];
                 }
             }
+            return null;
         };
         PhysicsEngine.prototype.getImpostorWithPhysicsBody = function (body) {
             for (var i = 0; i < this._impostors.length; ++i) {
@@ -64377,6 +64405,7 @@ var BABYLON;
                     return this._impostors[i];
                 }
             }
+            return null;
         };
         // Statics
         PhysicsEngine.Epsilon = 0.001;
@@ -73747,24 +73776,13 @@ var BABYLON;
             };
         };
         GLTFFileLoader._parseVersion = function (version) {
-            if (!version) {
-                return null;
-            }
-            var parts = version.split(".");
-            if (parts.length != 2) {
-                return null;
-            }
-            var major = +parts[0];
-            if (isNaN(major)) {
-                return null;
-            }
-            var minor = +parts[1];
-            if (isNaN(minor)) {
+            var match = (version + "").match(/^(\d+)\.(\d+)$/);
+            if (!match) {
                 return null;
             }
             return {
-                major: major,
-                minor: minor
+                major: parseInt(match[1]),
+                minor: parseInt(match[2])
             };
         };
         GLTFFileLoader._compareVersion = function (a, b) {
@@ -73778,11 +73796,11 @@ var BABYLON;
                 return -1;
             return 0;
         };
-        GLTFFileLoader._decodeBufferToText = function (view) {
+        GLTFFileLoader._decodeBufferToText = function (buffer) {
             var result = "";
-            var length = view.byteLength;
+            var length = buffer.byteLength;
             for (var i = 0; i < length; ++i) {
-                result += String.fromCharCode(view[i]);
+                result += String.fromCharCode(buffer[i]);
             }
             return result;
         };
@@ -74041,6 +74059,7 @@ var BABYLON;
                 var channel = Number(attributeParameter.semantic.split("_")[1]);
                 return "uv" + (channel === 0 ? "" : channel + 1);
             }
+            return null;
         };
         /**
         * Returns the animation path (glTF -> Babylon)
@@ -76218,7 +76237,7 @@ var BABYLON;
                 if (!scene) {
                     throw new Error("Failed to find scene " + (this._gltf.scene || 0));
                 }
-                this._loadScene("scenes[" + scene.index + "]", scene, nodeNames);
+                this._loadScene("#/scenes/" + scene.index, scene, nodeNames);
             };
             GLTFLoader.prototype._loadScene = function (context, scene, nodeNames) {
                 this._rootNode = { babylonMesh: new BABYLON.Mesh("__root__", this._babylonScene) };
@@ -76263,7 +76282,7 @@ var BABYLON;
                     if (!node) {
                         throw new Error(context + ": Failed to find node " + nodeIndices[i]);
                     }
-                    this._loadNode("nodes[" + nodeIndices[i] + "]", node);
+                    this._loadNode("#/nodes/" + nodeIndices[i], node);
                 }
                 // Disable the root mesh until the asset is ready to render.
                 this._rootNode.babylonMesh.setEnabled(false);
@@ -76279,7 +76298,7 @@ var BABYLON;
                     if (!mesh) {
                         throw new Error(context + ": Failed to find mesh " + node.mesh);
                     }
-                    this._loadMesh("meshes[" + node.mesh + "]", node, mesh);
+                    this._loadMesh("#/meshes/" + node.mesh, node, mesh);
                 }
                 node.babylonMesh.parent = node.parent ? node.parent.babylonMesh : null;
                 node.babylonAnimationTargets = node.babylonAnimationTargets || [];
@@ -76289,7 +76308,7 @@ var BABYLON;
                     if (!skin) {
                         throw new Error(context + ": Failed to find skin " + node.skin);
                     }
-                    node.babylonMesh.skeleton = this._loadSkin("skins[" + node.skin + "]", skin);
+                    node.babylonMesh.skeleton = this._loadSkin("#/skins/" + node.skin, skin);
                 }
                 if (node.camera != null) {
                     // TODO: handle cameras
@@ -76300,7 +76319,7 @@ var BABYLON;
                         if (!childNode) {
                             throw new Error(context + ": Failed to find child node " + node.children[i]);
                         }
-                        this._loadNode("nodes[" + node.children[i] + "]", childNode);
+                        this._loadNode("#/nodes/" + node.children[i], childNode);
                     }
                 }
             };
@@ -76316,7 +76335,7 @@ var BABYLON;
                 var numRemainingPrimitives = mesh.primitives.length;
                 for (var index = 0; index < mesh.primitives.length; index++) {
                     var primitive = mesh.primitives[index];
-                    this._loadPrimitive(context + "/primitives[" + index + "]", node, mesh, primitive, function (subVertexData, loadMaterial) {
+                    this._loadPrimitive(context + "/primitives/" + index, node, mesh, primitive, function (subVertexData, loadMaterial) {
                         subMeshInfos.push({
                             verticesStart: vertexData.positions.length,
                             verticesCount: subVertexData.positions.length,
@@ -76358,7 +76377,7 @@ var BABYLON;
                             if (!material) {
                                 throw new Error(context + ": Failed to find material " + primitive.material);
                             }
-                            _this._loadMaterial("materials[" + material.index + "]", material, function (babylonMaterial, isNew) {
+                            _this._loadMaterial("#/materials/" + material.index, material, function (babylonMaterial, isNew) {
                                 if (isNew && _this._parent.onMaterialLoaded) {
                                     _this._parent.onMaterialLoaded(babylonMaterial);
                                 }
@@ -76391,7 +76410,7 @@ var BABYLON;
                     if (!accessor) {
                         throw new Error(context + ": Failed to find attribute '" + attribute + "' accessor " + attributes[attribute]);
                     }
-                    this_1._loadAccessorAsync("accessors[" + accessor.index + "]", accessor, function (data) {
+                    this_1._loadAccessorAsync("#/accessors/" + accessor.index, accessor, function (data) {
                         switch (attribute) {
                             case "NORMAL":
                                 vertexData.normals = data;
@@ -76432,7 +76451,7 @@ var BABYLON;
                                 if (!indicesAccessor) {
                                     throw new Error(context + ": Failed to find indices accessor " + primitive.indices);
                                 }
-                                _this._loadAccessorAsync("accessors[" + indicesAccessor.index + "]", indicesAccessor, function (data) {
+                                _this._loadAccessorAsync("#/accessors/" + indicesAccessor.index, indicesAccessor, function (data) {
                                     vertexData.indices = data;
                                     onSuccess(vertexData);
                                 });
@@ -76469,9 +76488,9 @@ var BABYLON;
                     var _loop_3 = function (attribute) {
                         accessor = GLTF2.GLTFUtils.GetArrayItem(this_2._gltf.accessors, attributes[attribute]);
                         if (!accessor) {
-                            throw new Error(context + "/targets[" + index + "]: Failed to find attribute '" + attribute + "' accessor " + attributes[attribute]);
+                            throw new Error(context + "/targets/" + index + ": Failed to find attribute '" + attribute + "' accessor " + attributes[attribute]);
                         }
-                        this_2._loadAccessorAsync("accessors[" + accessor.index + "]", accessor, function (data) {
+                        this_2._loadAccessorAsync("#/accessors/" + accessor.index, accessor, function (data) {
                             if (accessor.name) {
                                 babylonMorphTarget.name = accessor.name;
                             }
@@ -76546,7 +76565,7 @@ var BABYLON;
                     if (!accessor) {
                         throw new Error(context + ": Failed to find inverse bind matrices attribute " + skin.inverseBindMatrices);
                     }
-                    this._loadAccessorAsync("accessors[" + accessor.index + "]", accessor, function (data) {
+                    this._loadAccessorAsync("#/accessors/" + accessor.index, accessor, function (data) {
                         _this._loadBones(context, skin, data);
                     });
                 }
@@ -76624,7 +76643,7 @@ var BABYLON;
                 }
                 for (var animationIndex = 0; animationIndex < animations.length; animationIndex++) {
                     var animation = animations[animationIndex];
-                    var context = "animations[" + animationIndex + "]";
+                    var context = "#/animations/" + animationIndex;
                     for (var channelIndex = 0; channelIndex < animation.channels.length; channelIndex++) {
                         var channel = GLTF2.GLTFUtils.GetArrayItem(animation.channels, channelIndex);
                         if (!channel) {
@@ -76634,7 +76653,7 @@ var BABYLON;
                         if (!sampler) {
                             throw new Error(context + ": Failed to find sampler " + channel.sampler);
                         }
-                        this._loadAnimationChannel(animation, context + "/channels[" + channelIndex + "]", channel, context + "/samplers[" + channel.sampler + "]", sampler);
+                        this._loadAnimationChannel(animation, context + "/channels/" + channelIndex, channel, context + "/samplers/" + channel.sampler, sampler);
                     }
                 }
             };
@@ -76643,23 +76662,28 @@ var BABYLON;
                 if (!targetNode) {
                     throw new Error(channelContext + ": Failed to find target node " + channel.target.node);
                 }
-                var conversion = {
-                    "translation": "position",
-                    "rotation": "rotationQuaternion",
-                    "scale": "scaling",
-                    "weights": "influence"
-                };
-                var targetPath = conversion[channel.target.path];
-                if (!targetPath) {
-                    throw new Error(channelContext + ": Invalid target path '" + channel.target.path + "'");
-                }
-                var animationConvertion = {
-                    "position": BABYLON.Animation.ANIMATIONTYPE_VECTOR3,
-                    "rotationQuaternion": BABYLON.Animation.ANIMATIONTYPE_QUATERNION,
-                    "scaling": BABYLON.Animation.ANIMATIONTYPE_VECTOR3,
-                    "influence": BABYLON.Animation.ANIMATIONTYPE_FLOAT,
-                };
-                var animationType = animationConvertion[targetPath];
+                var targetPath;
+                var animationType;
+                switch (channel.target.path) {
+                    case "translation":
+                        targetPath = "position";
+                        animationType = BABYLON.Animation.ANIMATIONTYPE_VECTOR3;
+                        break;
+                    case "rotation":
+                        targetPath = "rotationQuaternion";
+                        animationType = BABYLON.Animation.ANIMATIONTYPE_QUATERNION;
+                        break;
+                    case "scale":
+                        targetPath = "scaling";
+                        animationType = BABYLON.Animation.ANIMATIONTYPE_VECTOR3;
+                        break;
+                    case "weights":
+                        targetPath = "influence";
+                        animationType = BABYLON.Animation.ANIMATIONTYPE_FLOAT;
+                        break;
+                    default:
+                        throw new Error(channelContext + ": Invalid target path '" + channel.target.path + "'");
+                }
                 var inputData;
                 var outputData;
                 var checkSuccess = function () {
@@ -76667,48 +76691,60 @@ var BABYLON;
                         return;
                     }
                     var outputBufferOffset = 0;
-                    var nextOutputConversion = {
-                        "position": function () {
-                            var value = BABYLON.Vector3.FromArray(outputData, outputBufferOffset);
-                            outputBufferOffset += 3;
-                            return value;
-                        },
-                        "rotationQuaternion": function () {
-                            var value = BABYLON.Quaternion.FromArray(outputData, outputBufferOffset);
-                            outputBufferOffset += 4;
-                            return value;
-                        },
-                        "scaling": function () {
-                            var value = BABYLON.Vector3.FromArray(outputData, outputBufferOffset);
-                            outputBufferOffset += 3;
-                            return value;
-                        },
-                        "influence": function () {
-                            var numTargets = targetNode.babylonMesh.morphTargetManager.numTargets;
-                            var value = new Array(numTargets);
-                            for (var i = 0; i < numTargets; i++) {
-                                value[i] = outputData[outputBufferOffset++];
-                            }
-                            return value;
-                        },
-                    };
-                    var getNextOutputValue = nextOutputConversion[targetPath];
-                    var nextKeyConversion = {
-                        "LINEAR": function (frameIndex) { return ({
-                            frame: inputData[frameIndex],
-                            value: getNextOutputValue()
-                        }); },
-                        "CUBICSPLINE": function (frameIndex) { return ({
-                            frame: inputData[frameIndex],
-                            inTangent: getNextOutputValue(),
-                            value: getNextOutputValue(),
-                            outTangent: getNextOutputValue()
-                        }); },
-                    };
-                    var getNextKey = nextKeyConversion[sampler.interpolation];
-                    if (!getNextKey) {
-                        throw new Error(samplerContext + ": Invalid interpolation '" + sampler.interpolation + "'");
+                    var getNextOutputValue;
+                    switch (targetPath) {
+                        case "position":
+                            getNextOutputValue = function () {
+                                var value = BABYLON.Vector3.FromArray(outputData, outputBufferOffset);
+                                outputBufferOffset += 3;
+                                return value;
+                            };
+                            break;
+                        case "rotationQuaternion":
+                            getNextOutputValue = function () {
+                                var value = BABYLON.Quaternion.FromArray(outputData, outputBufferOffset);
+                                outputBufferOffset += 4;
+                                return value;
+                            };
+                            break;
+                        case "scaling":
+                            getNextOutputValue = function () {
+                                var value = BABYLON.Vector3.FromArray(outputData, outputBufferOffset);
+                                outputBufferOffset += 3;
+                                return value;
+                            };
+                            break;
+                        case "influence":
+                            getNextOutputValue = function () {
+                                var numTargets = targetNode.babylonMesh.morphTargetManager.numTargets;
+                                var value = new Array(numTargets);
+                                for (var i = 0; i < numTargets; i++) {
+                                    value[i] = outputData[outputBufferOffset++];
+                                }
+                                return value;
+                            };
+                            break;
+                    }
+                    var getNextKey;
+                    switch (sampler.interpolation) {
+                        case "LINEAR":
+                            getNextKey = function (frameIndex) { return ({
+                                frame: inputData[frameIndex],
+                                value: getNextOutputValue()
+                            }); };
+                            break;
+                        case "CUBICSPLINE":
+                            getNextKey = function (frameIndex) { return ({
+                                frame: inputData[frameIndex],
+                                inTangent: getNextOutputValue(),
+                                value: getNextOutputValue(),
+                                outTangent: getNextOutputValue()
+                            }); };
+                            break;
+                        default:
+                            throw new Error(samplerContext + ": Invalid interpolation '" + sampler.interpolation + "'");
                     }
+                    ;
                     var keys = new Array(inputData.length);
                     for (var frameIndex = 0; frameIndex < inputData.length; frameIndex++) {
                         keys[frameIndex] = getNextKey(frameIndex);
@@ -76745,7 +76781,7 @@ var BABYLON;
                 if (!inputAccessor) {
                     throw new Error(samplerContext + ": Failed to find input accessor " + sampler.input);
                 }
-                this._loadAccessorAsync("accessors[" + inputAccessor.index + "]", inputAccessor, function (data) {
+                this._loadAccessorAsync("#/accessors/" + inputAccessor.index, inputAccessor, function (data) {
                     inputData = data;
                     checkSuccess();
                 });
@@ -76753,7 +76789,7 @@ var BABYLON;
                 if (!outputAccessor) {
                     throw new Error(samplerContext + ": Failed to find output accessor " + sampler.output);
                 }
-                this._loadAccessorAsync("accessors[" + outputAccessor.index + "]", outputAccessor, function (data) {
+                this._loadAccessorAsync("#/accessors/" + outputAccessor.index, outputAccessor, function (data) {
                     outputData = data;
                     checkSuccess();
                 });
@@ -76814,7 +76850,7 @@ var BABYLON;
                 if (!buffer) {
                     throw new Error(context + ": Failed to find buffer " + bufferView.buffer);
                 }
-                this._loadBufferAsync("buffers[" + buffer.index + "]", buffer, function (bufferData) {
+                this._loadBufferAsync("#/buffers/" + buffer.index, buffer, function (bufferData) {
                     if (_this._disposed) {
                         return;
                     }
@@ -76839,7 +76875,7 @@ var BABYLON;
                 if (!bufferView) {
                     throw new Error(context + ": Failed to find buffer view " + accessor.bufferView);
                 }
-                this._loadBufferViewAsync("bufferViews[" + bufferView.index + "]", bufferView, function (bufferViewData) {
+                this._loadBufferViewAsync("#/bufferViews/" + bufferView.index, bufferView, function (bufferViewData) {
                     var numComponents = _this._getNumComponentsOfType(accessor.type);
                     if (numComponents === 0) {
                         throw new Error(context + ": Invalid type (" + accessor.type + ")");
@@ -76974,14 +77010,14 @@ var BABYLON;
                     if (!texture) {
                         throw new Error(context + ": Failed to find base color texture " + properties.baseColorTexture.index);
                     }
-                    babylonMaterial.albedoTexture = this._loadTexture("textures[" + texture.index + "]", texture, properties.baseColorTexture.texCoord);
+                    babylonMaterial.albedoTexture = this._loadTexture("#/textures/" + texture.index, texture, properties.baseColorTexture.texCoord);
                 }
                 if (properties.metallicRoughnessTexture) {
                     var texture = GLTF2.GLTFUtils.GetArrayItem(this._gltf.textures, properties.metallicRoughnessTexture.index);
                     if (!texture) {
                         throw new Error(context + ": Failed to find metallic roughness texture " + properties.metallicRoughnessTexture.index);
                     }
-                    babylonMaterial.metallicTexture = this._loadTexture("textures[" + texture.index + "]", texture, properties.metallicRoughnessTexture.texCoord);
+                    babylonMaterial.metallicTexture = this._loadTexture("#/textures/" + texture.index, texture, properties.metallicRoughnessTexture.texCoord);
                     babylonMaterial.useMetallnessFromMetallicTextureBlue = true;
                     babylonMaterial.useRoughnessFromMetallicTextureGreen = true;
                     babylonMaterial.useRoughnessFromMetallicTextureAlpha = false;
@@ -77018,7 +77054,7 @@ var BABYLON;
                     if (!texture) {
                         throw new Error(context + ": Failed to find normal texture " + material.normalTexture.index);
                     }
-                    babylonMaterial.bumpTexture = this._loadTexture("textures[" + texture.index + "]", texture, material.normalTexture.texCoord);
+                    babylonMaterial.bumpTexture = this._loadTexture("#/textures/" + texture.index, texture, material.normalTexture.texCoord);
                     babylonMaterial.invertNormalMapX = !this._babylonScene.useRightHandedSystem;
                     babylonMaterial.invertNormalMapY = this._babylonScene.useRightHandedSystem;
                     if (material.normalTexture.scale != null) {
@@ -77030,7 +77066,7 @@ var BABYLON;
                     if (!texture) {
                         throw new Error(context + ": Failed to find occlusion texture " + material.occlusionTexture.index);
                     }
-                    babylonMaterial.ambientTexture = this._loadTexture("textures[" + texture.index + "]", texture, material.occlusionTexture.texCoord);
+                    babylonMaterial.ambientTexture = this._loadTexture("#/textures/" + texture.index, texture, material.occlusionTexture.texCoord);
                     babylonMaterial.useAmbientInGrayScale = true;
                     if (material.occlusionTexture.strength != null) {
                         babylonMaterial.ambientTextureStrength = material.occlusionTexture.strength;
@@ -77041,7 +77077,7 @@ var BABYLON;
                     if (!texture) {
                         throw new Error(context + ": Failed to find emissive texture " + material.emissiveTexture.index);
                     }
-                    babylonMaterial.emissiveTexture = this._loadTexture("textures[" + texture.index + "]", texture, material.emissiveTexture.texCoord);
+                    babylonMaterial.emissiveTexture = this._loadTexture("#/textures/" + texture.index, texture, material.emissiveTexture.texCoord);
                 }
             };
             GLTFLoader.prototype._loadMaterialAlphaProperties = function (context, material, colorFactor) {
@@ -77113,7 +77149,7 @@ var BABYLON;
                     if (!image) {
                         throw new Error(context + ": Failed to find source " + texture.source);
                     }
-                    this._loadImage("images[" + image.index + "]", image, function (data) {
+                    this._loadImage("#/images/" + image.index, image, function (data) {
                         texture.url = URL.createObjectURL(new Blob([data], { type: image.mimeType }));
                         texture.dataReadyObservable.notifyObservers(texture);
                     });
@@ -77157,7 +77193,7 @@ var BABYLON;
                     if (!bufferView) {
                         throw new Error(context + ": Failed to find buffer view " + image.bufferView);
                     }
-                    this._loadBufferViewAsync("bufferViews[" + bufferView.index + "]", bufferView, onSuccess);
+                    this._loadBufferViewAsync("#/bufferViews/" + bufferView.index, bufferView, onSuccess);
                 }
             };
             GLTFLoader.prototype._tryCatchOnError = function (handler) {
@@ -77276,18 +77312,6 @@ var BABYLON;
                     }
                 }
             };
-            /**
-             * Decodes a buffer view into a string
-             * @param view: the buffer view
-             */
-            GLTFUtils.DecodeBufferToText = function (view) {
-                var result = "";
-                var length = view.byteLength;
-                for (var i = 0; i < length; ++i) {
-                    result += String.fromCharCode(view[i]);
-                }
-                return result;
-            };
             return GLTFUtils;
         }());
         GLTF2.GLTFUtils = GLTFUtils;
@@ -77337,7 +77361,7 @@ var BABYLON;
             GLTFLoaderExtension._ApplyExtensions = function (action) {
                 var extensions = GLTFLoaderExtension._Extensions;
                 if (!extensions) {
-                    return;
+                    return false;
                 }
                 for (var i = 0; i < extensions.length; i++) {
                     var extension = extensions[i];

Diferenças do arquivo suprimidas por serem muito extensas
+ 1152 - 1152
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts


+ 2 - 1
dist/preview release/gui/babylon.gui.js

@@ -1,4 +1,5 @@
-var BABYLON = BABYLON || (typeof require !== 'undefined' && require("babylonjs"));
+var babylonDependency; try { babylonDependency = (typeof require !== 'undefined' && require("../babylon.max")); } catch (e) { babylonDependency = (typeof require !== 'undefined' && require("babylonjs")); } 
+var BABYLON = BABYLON || babylonDependency;
 var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);

Diferenças do arquivo suprimidas por serem muito extensas
+ 3 - 3
dist/preview release/gui/babylon.gui.min.js


Diferenças do arquivo suprimidas por serem muito extensas
+ 3 - 3
dist/preview release/inspector/babylon.inspector.bundle.js


+ 2 - 0
dist/preview release/inspector/babylon.inspector.js

@@ -2788,6 +2788,7 @@ var INSPECTOR;
                         return null;
                     }
                 }
+                return null;
             };
             for (var _i = 0, _a = this._treeItems; _i < _a.length; _i++) {
                 var item = _a[_i];
@@ -4039,6 +4040,7 @@ var INSPECTOR;
                     return tab;
                 }
             }
+            return null;
         };
         TabBar.prototype.getActiveTabIndex = function () {
             for (var i = 0; i < this._tabs.length; i++) {

Diferenças do arquivo suprimidas por serem muito extensas
+ 3 - 3
dist/preview release/inspector/babylon.inspector.min.js


+ 1 - 1
dist/preview release/loaders/babylon.glTF1FileLoader.d.ts

@@ -50,7 +50,7 @@ declare module BABYLON {
         private static _parseV2(binaryReader, onError);
         private static _parseVersion(version);
         private static _compareVersion(a, b);
-        private static _decodeBufferToText(view);
+        private static _decodeBufferToText(buffer);
     }
 }
 

+ 8 - 18
dist/preview release/loaders/babylon.glTF1FileLoader.js

@@ -184,24 +184,13 @@ var BABYLON;
             };
         };
         GLTFFileLoader._parseVersion = function (version) {
-            if (!version) {
-                return null;
-            }
-            var parts = version.split(".");
-            if (parts.length != 2) {
-                return null;
-            }
-            var major = +parts[0];
-            if (isNaN(major)) {
-                return null;
-            }
-            var minor = +parts[1];
-            if (isNaN(minor)) {
+            var match = (version + "").match(/^(\d+)\.(\d+)$/);
+            if (!match) {
                 return null;
             }
             return {
-                major: major,
-                minor: minor
+                major: parseInt(match[1]),
+                minor: parseInt(match[2])
             };
         };
         GLTFFileLoader._compareVersion = function (a, b) {
@@ -215,11 +204,11 @@ var BABYLON;
                 return -1;
             return 0;
         };
-        GLTFFileLoader._decodeBufferToText = function (view) {
+        GLTFFileLoader._decodeBufferToText = function (buffer) {
             var result = "";
-            var length = view.byteLength;
+            var length = buffer.byteLength;
             for (var i = 0; i < length; ++i) {
-                result += String.fromCharCode(view[i]);
+                result += String.fromCharCode(buffer[i]);
             }
             return result;
         };
@@ -478,6 +467,7 @@ var BABYLON;
                 var channel = Number(attributeParameter.semantic.split("_")[1]);
                 return "uv" + (channel === 0 ? "" : channel + 1);
             }
+            return null;
         };
         /**
         * Returns the animation path (glTF -> Babylon)

Diferenças do arquivo suprimidas por serem muito extensas
+ 2 - 2
dist/preview release/loaders/babylon.glTF1FileLoader.min.js


+ 1 - 6
dist/preview release/loaders/babylon.glTF2FileLoader.d.ts

@@ -50,7 +50,7 @@ declare module BABYLON {
         private static _parseV2(binaryReader, onError);
         private static _parseVersion(version);
         private static _compareVersion(a, b);
-        private static _decodeBufferToText(view);
+        private static _decodeBufferToText(buffer);
     }
 }
 
@@ -402,11 +402,6 @@ declare module BABYLON.GLTF2 {
         static GetArrayItem<T>(array: ArrayLike<T>, index: number): T;
         static GetTextureWrapMode(mode: ETextureWrapMode): number;
         static GetTextureSamplingMode(magFilter: ETextureMagFilter, minFilter: ETextureMinFilter): number;
-        /**
-         * Decodes a buffer view into a string
-         * @param view: the buffer view
-         */
-        static DecodeBufferToText(view: ArrayBufferView): string;
     }
 }
 

+ 108 - 114
dist/preview release/loaders/babylon.glTF2FileLoader.js

@@ -184,24 +184,13 @@ var BABYLON;
             };
         };
         GLTFFileLoader._parseVersion = function (version) {
-            if (!version) {
-                return null;
-            }
-            var parts = version.split(".");
-            if (parts.length != 2) {
-                return null;
-            }
-            var major = +parts[0];
-            if (isNaN(major)) {
-                return null;
-            }
-            var minor = +parts[1];
-            if (isNaN(minor)) {
+            var match = (version + "").match(/^(\d+)\.(\d+)$/);
+            if (!match) {
                 return null;
             }
             return {
-                major: major,
-                minor: minor
+                major: parseInt(match[1]),
+                minor: parseInt(match[2])
             };
         };
         GLTFFileLoader._compareVersion = function (a, b) {
@@ -215,11 +204,11 @@ var BABYLON;
                 return -1;
             return 0;
         };
-        GLTFFileLoader._decodeBufferToText = function (view) {
+        GLTFFileLoader._decodeBufferToText = function (buffer) {
             var result = "";
-            var length = view.byteLength;
+            var length = buffer.byteLength;
             for (var i = 0; i < length; ++i) {
-                result += String.fromCharCode(view[i]);
+                result += String.fromCharCode(buffer[i]);
             }
             return result;
         };
@@ -515,7 +504,7 @@ var BABYLON;
                 if (!scene) {
                     throw new Error("Failed to find scene " + (this._gltf.scene || 0));
                 }
-                this._loadScene("scenes[" + scene.index + "]", scene, nodeNames);
+                this._loadScene("#/scenes/" + scene.index, scene, nodeNames);
             };
             GLTFLoader.prototype._loadScene = function (context, scene, nodeNames) {
                 this._rootNode = { babylonMesh: new BABYLON.Mesh("__root__", this._babylonScene) };
@@ -560,7 +549,7 @@ var BABYLON;
                     if (!node) {
                         throw new Error(context + ": Failed to find node " + nodeIndices[i]);
                     }
-                    this._loadNode("nodes[" + nodeIndices[i] + "]", node);
+                    this._loadNode("#/nodes/" + nodeIndices[i], node);
                 }
                 // Disable the root mesh until the asset is ready to render.
                 this._rootNode.babylonMesh.setEnabled(false);
@@ -576,7 +565,7 @@ var BABYLON;
                     if (!mesh) {
                         throw new Error(context + ": Failed to find mesh " + node.mesh);
                     }
-                    this._loadMesh("meshes[" + node.mesh + "]", node, mesh);
+                    this._loadMesh("#/meshes/" + node.mesh, node, mesh);
                 }
                 node.babylonMesh.parent = node.parent ? node.parent.babylonMesh : null;
                 node.babylonAnimationTargets = node.babylonAnimationTargets || [];
@@ -586,7 +575,7 @@ var BABYLON;
                     if (!skin) {
                         throw new Error(context + ": Failed to find skin " + node.skin);
                     }
-                    node.babylonMesh.skeleton = this._loadSkin("skins[" + node.skin + "]", skin);
+                    node.babylonMesh.skeleton = this._loadSkin("#/skins/" + node.skin, skin);
                 }
                 if (node.camera != null) {
                     // TODO: handle cameras
@@ -597,7 +586,7 @@ var BABYLON;
                         if (!childNode) {
                             throw new Error(context + ": Failed to find child node " + node.children[i]);
                         }
-                        this._loadNode("nodes[" + node.children[i] + "]", childNode);
+                        this._loadNode("#/nodes/" + node.children[i], childNode);
                     }
                 }
             };
@@ -613,7 +602,7 @@ var BABYLON;
                 var numRemainingPrimitives = mesh.primitives.length;
                 for (var index = 0; index < mesh.primitives.length; index++) {
                     var primitive = mesh.primitives[index];
-                    this._loadPrimitive(context + "/primitives[" + index + "]", node, mesh, primitive, function (subVertexData, loadMaterial) {
+                    this._loadPrimitive(context + "/primitives/" + index, node, mesh, primitive, function (subVertexData, loadMaterial) {
                         subMeshInfos.push({
                             verticesStart: vertexData.positions.length,
                             verticesCount: subVertexData.positions.length,
@@ -655,7 +644,7 @@ var BABYLON;
                             if (!material) {
                                 throw new Error(context + ": Failed to find material " + primitive.material);
                             }
-                            _this._loadMaterial("materials[" + material.index + "]", material, function (babylonMaterial, isNew) {
+                            _this._loadMaterial("#/materials/" + material.index, material, function (babylonMaterial, isNew) {
                                 if (isNew && _this._parent.onMaterialLoaded) {
                                     _this._parent.onMaterialLoaded(babylonMaterial);
                                 }
@@ -688,7 +677,7 @@ var BABYLON;
                     if (!accessor) {
                         throw new Error(context + ": Failed to find attribute '" + attribute + "' accessor " + attributes[attribute]);
                     }
-                    this_1._loadAccessorAsync("accessors[" + accessor.index + "]", accessor, function (data) {
+                    this_1._loadAccessorAsync("#/accessors/" + accessor.index, accessor, function (data) {
                         switch (attribute) {
                             case "NORMAL":
                                 vertexData.normals = data;
@@ -729,7 +718,7 @@ var BABYLON;
                                 if (!indicesAccessor) {
                                     throw new Error(context + ": Failed to find indices accessor " + primitive.indices);
                                 }
-                                _this._loadAccessorAsync("accessors[" + indicesAccessor.index + "]", indicesAccessor, function (data) {
+                                _this._loadAccessorAsync("#/accessors/" + indicesAccessor.index, indicesAccessor, function (data) {
                                     vertexData.indices = data;
                                     onSuccess(vertexData);
                                 });
@@ -766,9 +755,9 @@ var BABYLON;
                     var _loop_3 = function (attribute) {
                         accessor = GLTF2.GLTFUtils.GetArrayItem(this_2._gltf.accessors, attributes[attribute]);
                         if (!accessor) {
-                            throw new Error(context + "/targets[" + index + "]: Failed to find attribute '" + attribute + "' accessor " + attributes[attribute]);
+                            throw new Error(context + "/targets/" + index + ": Failed to find attribute '" + attribute + "' accessor " + attributes[attribute]);
                         }
-                        this_2._loadAccessorAsync("accessors[" + accessor.index + "]", accessor, function (data) {
+                        this_2._loadAccessorAsync("#/accessors/" + accessor.index, accessor, function (data) {
                             if (accessor.name) {
                                 babylonMorphTarget.name = accessor.name;
                             }
@@ -843,7 +832,7 @@ var BABYLON;
                     if (!accessor) {
                         throw new Error(context + ": Failed to find inverse bind matrices attribute " + skin.inverseBindMatrices);
                     }
-                    this._loadAccessorAsync("accessors[" + accessor.index + "]", accessor, function (data) {
+                    this._loadAccessorAsync("#/accessors/" + accessor.index, accessor, function (data) {
                         _this._loadBones(context, skin, data);
                     });
                 }
@@ -921,7 +910,7 @@ var BABYLON;
                 }
                 for (var animationIndex = 0; animationIndex < animations.length; animationIndex++) {
                     var animation = animations[animationIndex];
-                    var context = "animations[" + animationIndex + "]";
+                    var context = "#/animations/" + animationIndex;
                     for (var channelIndex = 0; channelIndex < animation.channels.length; channelIndex++) {
                         var channel = GLTF2.GLTFUtils.GetArrayItem(animation.channels, channelIndex);
                         if (!channel) {
@@ -931,7 +920,7 @@ var BABYLON;
                         if (!sampler) {
                             throw new Error(context + ": Failed to find sampler " + channel.sampler);
                         }
-                        this._loadAnimationChannel(animation, context + "/channels[" + channelIndex + "]", channel, context + "/samplers[" + channel.sampler + "]", sampler);
+                        this._loadAnimationChannel(animation, context + "/channels/" + channelIndex, channel, context + "/samplers/" + channel.sampler, sampler);
                     }
                 }
             };
@@ -940,23 +929,28 @@ var BABYLON;
                 if (!targetNode) {
                     throw new Error(channelContext + ": Failed to find target node " + channel.target.node);
                 }
-                var conversion = {
-                    "translation": "position",
-                    "rotation": "rotationQuaternion",
-                    "scale": "scaling",
-                    "weights": "influence"
-                };
-                var targetPath = conversion[channel.target.path];
-                if (!targetPath) {
-                    throw new Error(channelContext + ": Invalid target path '" + channel.target.path + "'");
-                }
-                var animationConvertion = {
-                    "position": BABYLON.Animation.ANIMATIONTYPE_VECTOR3,
-                    "rotationQuaternion": BABYLON.Animation.ANIMATIONTYPE_QUATERNION,
-                    "scaling": BABYLON.Animation.ANIMATIONTYPE_VECTOR3,
-                    "influence": BABYLON.Animation.ANIMATIONTYPE_FLOAT,
-                };
-                var animationType = animationConvertion[targetPath];
+                var targetPath;
+                var animationType;
+                switch (channel.target.path) {
+                    case "translation":
+                        targetPath = "position";
+                        animationType = BABYLON.Animation.ANIMATIONTYPE_VECTOR3;
+                        break;
+                    case "rotation":
+                        targetPath = "rotationQuaternion";
+                        animationType = BABYLON.Animation.ANIMATIONTYPE_QUATERNION;
+                        break;
+                    case "scale":
+                        targetPath = "scaling";
+                        animationType = BABYLON.Animation.ANIMATIONTYPE_VECTOR3;
+                        break;
+                    case "weights":
+                        targetPath = "influence";
+                        animationType = BABYLON.Animation.ANIMATIONTYPE_FLOAT;
+                        break;
+                    default:
+                        throw new Error(channelContext + ": Invalid target path '" + channel.target.path + "'");
+                }
                 var inputData;
                 var outputData;
                 var checkSuccess = function () {
@@ -964,48 +958,60 @@ var BABYLON;
                         return;
                     }
                     var outputBufferOffset = 0;
-                    var nextOutputConversion = {
-                        "position": function () {
-                            var value = BABYLON.Vector3.FromArray(outputData, outputBufferOffset);
-                            outputBufferOffset += 3;
-                            return value;
-                        },
-                        "rotationQuaternion": function () {
-                            var value = BABYLON.Quaternion.FromArray(outputData, outputBufferOffset);
-                            outputBufferOffset += 4;
-                            return value;
-                        },
-                        "scaling": function () {
-                            var value = BABYLON.Vector3.FromArray(outputData, outputBufferOffset);
-                            outputBufferOffset += 3;
-                            return value;
-                        },
-                        "influence": function () {
-                            var numTargets = targetNode.babylonMesh.morphTargetManager.numTargets;
-                            var value = new Array(numTargets);
-                            for (var i = 0; i < numTargets; i++) {
-                                value[i] = outputData[outputBufferOffset++];
-                            }
-                            return value;
-                        },
-                    };
-                    var getNextOutputValue = nextOutputConversion[targetPath];
-                    var nextKeyConversion = {
-                        "LINEAR": function (frameIndex) { return ({
-                            frame: inputData[frameIndex],
-                            value: getNextOutputValue()
-                        }); },
-                        "CUBICSPLINE": function (frameIndex) { return ({
-                            frame: inputData[frameIndex],
-                            inTangent: getNextOutputValue(),
-                            value: getNextOutputValue(),
-                            outTangent: getNextOutputValue()
-                        }); },
-                    };
-                    var getNextKey = nextKeyConversion[sampler.interpolation];
-                    if (!getNextKey) {
-                        throw new Error(samplerContext + ": Invalid interpolation '" + sampler.interpolation + "'");
+                    var getNextOutputValue;
+                    switch (targetPath) {
+                        case "position":
+                            getNextOutputValue = function () {
+                                var value = BABYLON.Vector3.FromArray(outputData, outputBufferOffset);
+                                outputBufferOffset += 3;
+                                return value;
+                            };
+                            break;
+                        case "rotationQuaternion":
+                            getNextOutputValue = function () {
+                                var value = BABYLON.Quaternion.FromArray(outputData, outputBufferOffset);
+                                outputBufferOffset += 4;
+                                return value;
+                            };
+                            break;
+                        case "scaling":
+                            getNextOutputValue = function () {
+                                var value = BABYLON.Vector3.FromArray(outputData, outputBufferOffset);
+                                outputBufferOffset += 3;
+                                return value;
+                            };
+                            break;
+                        case "influence":
+                            getNextOutputValue = function () {
+                                var numTargets = targetNode.babylonMesh.morphTargetManager.numTargets;
+                                var value = new Array(numTargets);
+                                for (var i = 0; i < numTargets; i++) {
+                                    value[i] = outputData[outputBufferOffset++];
+                                }
+                                return value;
+                            };
+                            break;
+                    }
+                    var getNextKey;
+                    switch (sampler.interpolation) {
+                        case "LINEAR":
+                            getNextKey = function (frameIndex) { return ({
+                                frame: inputData[frameIndex],
+                                value: getNextOutputValue()
+                            }); };
+                            break;
+                        case "CUBICSPLINE":
+                            getNextKey = function (frameIndex) { return ({
+                                frame: inputData[frameIndex],
+                                inTangent: getNextOutputValue(),
+                                value: getNextOutputValue(),
+                                outTangent: getNextOutputValue()
+                            }); };
+                            break;
+                        default:
+                            throw new Error(samplerContext + ": Invalid interpolation '" + sampler.interpolation + "'");
                     }
+                    ;
                     var keys = new Array(inputData.length);
                     for (var frameIndex = 0; frameIndex < inputData.length; frameIndex++) {
                         keys[frameIndex] = getNextKey(frameIndex);
@@ -1042,7 +1048,7 @@ var BABYLON;
                 if (!inputAccessor) {
                     throw new Error(samplerContext + ": Failed to find input accessor " + sampler.input);
                 }
-                this._loadAccessorAsync("accessors[" + inputAccessor.index + "]", inputAccessor, function (data) {
+                this._loadAccessorAsync("#/accessors/" + inputAccessor.index, inputAccessor, function (data) {
                     inputData = data;
                     checkSuccess();
                 });
@@ -1050,7 +1056,7 @@ var BABYLON;
                 if (!outputAccessor) {
                     throw new Error(samplerContext + ": Failed to find output accessor " + sampler.output);
                 }
-                this._loadAccessorAsync("accessors[" + outputAccessor.index + "]", outputAccessor, function (data) {
+                this._loadAccessorAsync("#/accessors/" + outputAccessor.index, outputAccessor, function (data) {
                     outputData = data;
                     checkSuccess();
                 });
@@ -1111,7 +1117,7 @@ var BABYLON;
                 if (!buffer) {
                     throw new Error(context + ": Failed to find buffer " + bufferView.buffer);
                 }
-                this._loadBufferAsync("buffers[" + buffer.index + "]", buffer, function (bufferData) {
+                this._loadBufferAsync("#/buffers/" + buffer.index, buffer, function (bufferData) {
                     if (_this._disposed) {
                         return;
                     }
@@ -1136,7 +1142,7 @@ var BABYLON;
                 if (!bufferView) {
                     throw new Error(context + ": Failed to find buffer view " + accessor.bufferView);
                 }
-                this._loadBufferViewAsync("bufferViews[" + bufferView.index + "]", bufferView, function (bufferViewData) {
+                this._loadBufferViewAsync("#/bufferViews/" + bufferView.index, bufferView, function (bufferViewData) {
                     var numComponents = _this._getNumComponentsOfType(accessor.type);
                     if (numComponents === 0) {
                         throw new Error(context + ": Invalid type (" + accessor.type + ")");
@@ -1271,14 +1277,14 @@ var BABYLON;
                     if (!texture) {
                         throw new Error(context + ": Failed to find base color texture " + properties.baseColorTexture.index);
                     }
-                    babylonMaterial.albedoTexture = this._loadTexture("textures[" + texture.index + "]", texture, properties.baseColorTexture.texCoord);
+                    babylonMaterial.albedoTexture = this._loadTexture("#/textures/" + texture.index, texture, properties.baseColorTexture.texCoord);
                 }
                 if (properties.metallicRoughnessTexture) {
                     var texture = GLTF2.GLTFUtils.GetArrayItem(this._gltf.textures, properties.metallicRoughnessTexture.index);
                     if (!texture) {
                         throw new Error(context + ": Failed to find metallic roughness texture " + properties.metallicRoughnessTexture.index);
                     }
-                    babylonMaterial.metallicTexture = this._loadTexture("textures[" + texture.index + "]", texture, properties.metallicRoughnessTexture.texCoord);
+                    babylonMaterial.metallicTexture = this._loadTexture("#/textures/" + texture.index, texture, properties.metallicRoughnessTexture.texCoord);
                     babylonMaterial.useMetallnessFromMetallicTextureBlue = true;
                     babylonMaterial.useRoughnessFromMetallicTextureGreen = true;
                     babylonMaterial.useRoughnessFromMetallicTextureAlpha = false;
@@ -1315,7 +1321,7 @@ var BABYLON;
                     if (!texture) {
                         throw new Error(context + ": Failed to find normal texture " + material.normalTexture.index);
                     }
-                    babylonMaterial.bumpTexture = this._loadTexture("textures[" + texture.index + "]", texture, material.normalTexture.texCoord);
+                    babylonMaterial.bumpTexture = this._loadTexture("#/textures/" + texture.index, texture, material.normalTexture.texCoord);
                     babylonMaterial.invertNormalMapX = !this._babylonScene.useRightHandedSystem;
                     babylonMaterial.invertNormalMapY = this._babylonScene.useRightHandedSystem;
                     if (material.normalTexture.scale != null) {
@@ -1327,7 +1333,7 @@ var BABYLON;
                     if (!texture) {
                         throw new Error(context + ": Failed to find occlusion texture " + material.occlusionTexture.index);
                     }
-                    babylonMaterial.ambientTexture = this._loadTexture("textures[" + texture.index + "]", texture, material.occlusionTexture.texCoord);
+                    babylonMaterial.ambientTexture = this._loadTexture("#/textures/" + texture.index, texture, material.occlusionTexture.texCoord);
                     babylonMaterial.useAmbientInGrayScale = true;
                     if (material.occlusionTexture.strength != null) {
                         babylonMaterial.ambientTextureStrength = material.occlusionTexture.strength;
@@ -1338,7 +1344,7 @@ var BABYLON;
                     if (!texture) {
                         throw new Error(context + ": Failed to find emissive texture " + material.emissiveTexture.index);
                     }
-                    babylonMaterial.emissiveTexture = this._loadTexture("textures[" + texture.index + "]", texture, material.emissiveTexture.texCoord);
+                    babylonMaterial.emissiveTexture = this._loadTexture("#/textures/" + texture.index, texture, material.emissiveTexture.texCoord);
                 }
             };
             GLTFLoader.prototype._loadMaterialAlphaProperties = function (context, material, colorFactor) {
@@ -1410,7 +1416,7 @@ var BABYLON;
                     if (!image) {
                         throw new Error(context + ": Failed to find source " + texture.source);
                     }
-                    this._loadImage("images[" + image.index + "]", image, function (data) {
+                    this._loadImage("#/images/" + image.index, image, function (data) {
                         texture.url = URL.createObjectURL(new Blob([data], { type: image.mimeType }));
                         texture.dataReadyObservable.notifyObservers(texture);
                     });
@@ -1454,7 +1460,7 @@ var BABYLON;
                     if (!bufferView) {
                         throw new Error(context + ": Failed to find buffer view " + image.bufferView);
                     }
-                    this._loadBufferViewAsync("bufferViews[" + bufferView.index + "]", bufferView, onSuccess);
+                    this._loadBufferViewAsync("#/bufferViews/" + bufferView.index, bufferView, onSuccess);
                 }
             };
             GLTFLoader.prototype._tryCatchOnError = function (handler) {
@@ -1573,18 +1579,6 @@ var BABYLON;
                     }
                 }
             };
-            /**
-             * Decodes a buffer view into a string
-             * @param view: the buffer view
-             */
-            GLTFUtils.DecodeBufferToText = function (view) {
-                var result = "";
-                var length = view.byteLength;
-                for (var i = 0; i < length; ++i) {
-                    result += String.fromCharCode(view[i]);
-                }
-                return result;
-            };
             return GLTFUtils;
         }());
         GLTF2.GLTFUtils = GLTFUtils;
@@ -1634,7 +1628,7 @@ var BABYLON;
             GLTFLoaderExtension._ApplyExtensions = function (action) {
                 var extensions = GLTFLoaderExtension._Extensions;
                 if (!extensions) {
-                    return;
+                    return false;
                 }
                 for (var i = 0; i < extensions.length; i++) {
                     var extension = extensions[i];

Diferenças do arquivo suprimidas por serem muito extensas
+ 2 - 2
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


+ 1 - 6
dist/preview release/loaders/babylon.glTFFileLoader.d.ts

@@ -50,7 +50,7 @@ declare module BABYLON {
         private static _parseV2(binaryReader, onError);
         private static _parseVersion(version);
         private static _compareVersion(a, b);
-        private static _decodeBufferToText(view);
+        private static _decodeBufferToText(buffer);
     }
 }
 
@@ -948,11 +948,6 @@ declare module BABYLON.GLTF2 {
         static GetArrayItem<T>(array: ArrayLike<T>, index: number): T;
         static GetTextureWrapMode(mode: ETextureWrapMode): number;
         static GetTextureSamplingMode(magFilter: ETextureMagFilter, minFilter: ETextureMinFilter): number;
-        /**
-         * Decodes a buffer view into a string
-         * @param view: the buffer view
-         */
-        static DecodeBufferToText(view: ArrayBufferView): string;
     }
 }
 

+ 109 - 114
dist/preview release/loaders/babylon.glTFFileLoader.js

@@ -184,24 +184,13 @@ var BABYLON;
             };
         };
         GLTFFileLoader._parseVersion = function (version) {
-            if (!version) {
-                return null;
-            }
-            var parts = version.split(".");
-            if (parts.length != 2) {
-                return null;
-            }
-            var major = +parts[0];
-            if (isNaN(major)) {
-                return null;
-            }
-            var minor = +parts[1];
-            if (isNaN(minor)) {
+            var match = (version + "").match(/^(\d+)\.(\d+)$/);
+            if (!match) {
                 return null;
             }
             return {
-                major: major,
-                minor: minor
+                major: parseInt(match[1]),
+                minor: parseInt(match[2])
             };
         };
         GLTFFileLoader._compareVersion = function (a, b) {
@@ -215,11 +204,11 @@ var BABYLON;
                 return -1;
             return 0;
         };
-        GLTFFileLoader._decodeBufferToText = function (view) {
+        GLTFFileLoader._decodeBufferToText = function (buffer) {
             var result = "";
-            var length = view.byteLength;
+            var length = buffer.byteLength;
             for (var i = 0; i < length; ++i) {
-                result += String.fromCharCode(view[i]);
+                result += String.fromCharCode(buffer[i]);
             }
             return result;
         };
@@ -478,6 +467,7 @@ var BABYLON;
                 var channel = Number(attributeParameter.semantic.split("_")[1]);
                 return "uv" + (channel === 0 ? "" : channel + 1);
             }
+            return null;
         };
         /**
         * Returns the animation path (glTF -> Babylon)
@@ -2673,7 +2663,7 @@ var BABYLON;
                 if (!scene) {
                     throw new Error("Failed to find scene " + (this._gltf.scene || 0));
                 }
-                this._loadScene("scenes[" + scene.index + "]", scene, nodeNames);
+                this._loadScene("#/scenes/" + scene.index, scene, nodeNames);
             };
             GLTFLoader.prototype._loadScene = function (context, scene, nodeNames) {
                 this._rootNode = { babylonMesh: new BABYLON.Mesh("__root__", this._babylonScene) };
@@ -2718,7 +2708,7 @@ var BABYLON;
                     if (!node) {
                         throw new Error(context + ": Failed to find node " + nodeIndices[i]);
                     }
-                    this._loadNode("nodes[" + nodeIndices[i] + "]", node);
+                    this._loadNode("#/nodes/" + nodeIndices[i], node);
                 }
                 // Disable the root mesh until the asset is ready to render.
                 this._rootNode.babylonMesh.setEnabled(false);
@@ -2734,7 +2724,7 @@ var BABYLON;
                     if (!mesh) {
                         throw new Error(context + ": Failed to find mesh " + node.mesh);
                     }
-                    this._loadMesh("meshes[" + node.mesh + "]", node, mesh);
+                    this._loadMesh("#/meshes/" + node.mesh, node, mesh);
                 }
                 node.babylonMesh.parent = node.parent ? node.parent.babylonMesh : null;
                 node.babylonAnimationTargets = node.babylonAnimationTargets || [];
@@ -2744,7 +2734,7 @@ var BABYLON;
                     if (!skin) {
                         throw new Error(context + ": Failed to find skin " + node.skin);
                     }
-                    node.babylonMesh.skeleton = this._loadSkin("skins[" + node.skin + "]", skin);
+                    node.babylonMesh.skeleton = this._loadSkin("#/skins/" + node.skin, skin);
                 }
                 if (node.camera != null) {
                     // TODO: handle cameras
@@ -2755,7 +2745,7 @@ var BABYLON;
                         if (!childNode) {
                             throw new Error(context + ": Failed to find child node " + node.children[i]);
                         }
-                        this._loadNode("nodes[" + node.children[i] + "]", childNode);
+                        this._loadNode("#/nodes/" + node.children[i], childNode);
                     }
                 }
             };
@@ -2771,7 +2761,7 @@ var BABYLON;
                 var numRemainingPrimitives = mesh.primitives.length;
                 for (var index = 0; index < mesh.primitives.length; index++) {
                     var primitive = mesh.primitives[index];
-                    this._loadPrimitive(context + "/primitives[" + index + "]", node, mesh, primitive, function (subVertexData, loadMaterial) {
+                    this._loadPrimitive(context + "/primitives/" + index, node, mesh, primitive, function (subVertexData, loadMaterial) {
                         subMeshInfos.push({
                             verticesStart: vertexData.positions.length,
                             verticesCount: subVertexData.positions.length,
@@ -2813,7 +2803,7 @@ var BABYLON;
                             if (!material) {
                                 throw new Error(context + ": Failed to find material " + primitive.material);
                             }
-                            _this._loadMaterial("materials[" + material.index + "]", material, function (babylonMaterial, isNew) {
+                            _this._loadMaterial("#/materials/" + material.index, material, function (babylonMaterial, isNew) {
                                 if (isNew && _this._parent.onMaterialLoaded) {
                                     _this._parent.onMaterialLoaded(babylonMaterial);
                                 }
@@ -2846,7 +2836,7 @@ var BABYLON;
                     if (!accessor) {
                         throw new Error(context + ": Failed to find attribute '" + attribute + "' accessor " + attributes[attribute]);
                     }
-                    this_1._loadAccessorAsync("accessors[" + accessor.index + "]", accessor, function (data) {
+                    this_1._loadAccessorAsync("#/accessors/" + accessor.index, accessor, function (data) {
                         switch (attribute) {
                             case "NORMAL":
                                 vertexData.normals = data;
@@ -2887,7 +2877,7 @@ var BABYLON;
                                 if (!indicesAccessor) {
                                     throw new Error(context + ": Failed to find indices accessor " + primitive.indices);
                                 }
-                                _this._loadAccessorAsync("accessors[" + indicesAccessor.index + "]", indicesAccessor, function (data) {
+                                _this._loadAccessorAsync("#/accessors/" + indicesAccessor.index, indicesAccessor, function (data) {
                                     vertexData.indices = data;
                                     onSuccess(vertexData);
                                 });
@@ -2924,9 +2914,9 @@ var BABYLON;
                     var _loop_3 = function (attribute) {
                         accessor = GLTF2.GLTFUtils.GetArrayItem(this_2._gltf.accessors, attributes[attribute]);
                         if (!accessor) {
-                            throw new Error(context + "/targets[" + index + "]: Failed to find attribute '" + attribute + "' accessor " + attributes[attribute]);
+                            throw new Error(context + "/targets/" + index + ": Failed to find attribute '" + attribute + "' accessor " + attributes[attribute]);
                         }
-                        this_2._loadAccessorAsync("accessors[" + accessor.index + "]", accessor, function (data) {
+                        this_2._loadAccessorAsync("#/accessors/" + accessor.index, accessor, function (data) {
                             if (accessor.name) {
                                 babylonMorphTarget.name = accessor.name;
                             }
@@ -3001,7 +2991,7 @@ var BABYLON;
                     if (!accessor) {
                         throw new Error(context + ": Failed to find inverse bind matrices attribute " + skin.inverseBindMatrices);
                     }
-                    this._loadAccessorAsync("accessors[" + accessor.index + "]", accessor, function (data) {
+                    this._loadAccessorAsync("#/accessors/" + accessor.index, accessor, function (data) {
                         _this._loadBones(context, skin, data);
                     });
                 }
@@ -3079,7 +3069,7 @@ var BABYLON;
                 }
                 for (var animationIndex = 0; animationIndex < animations.length; animationIndex++) {
                     var animation = animations[animationIndex];
-                    var context = "animations[" + animationIndex + "]";
+                    var context = "#/animations/" + animationIndex;
                     for (var channelIndex = 0; channelIndex < animation.channels.length; channelIndex++) {
                         var channel = GLTF2.GLTFUtils.GetArrayItem(animation.channels, channelIndex);
                         if (!channel) {
@@ -3089,7 +3079,7 @@ var BABYLON;
                         if (!sampler) {
                             throw new Error(context + ": Failed to find sampler " + channel.sampler);
                         }
-                        this._loadAnimationChannel(animation, context + "/channels[" + channelIndex + "]", channel, context + "/samplers[" + channel.sampler + "]", sampler);
+                        this._loadAnimationChannel(animation, context + "/channels/" + channelIndex, channel, context + "/samplers/" + channel.sampler, sampler);
                     }
                 }
             };
@@ -3098,23 +3088,28 @@ var BABYLON;
                 if (!targetNode) {
                     throw new Error(channelContext + ": Failed to find target node " + channel.target.node);
                 }
-                var conversion = {
-                    "translation": "position",
-                    "rotation": "rotationQuaternion",
-                    "scale": "scaling",
-                    "weights": "influence"
-                };
-                var targetPath = conversion[channel.target.path];
-                if (!targetPath) {
-                    throw new Error(channelContext + ": Invalid target path '" + channel.target.path + "'");
-                }
-                var animationConvertion = {
-                    "position": BABYLON.Animation.ANIMATIONTYPE_VECTOR3,
-                    "rotationQuaternion": BABYLON.Animation.ANIMATIONTYPE_QUATERNION,
-                    "scaling": BABYLON.Animation.ANIMATIONTYPE_VECTOR3,
-                    "influence": BABYLON.Animation.ANIMATIONTYPE_FLOAT,
-                };
-                var animationType = animationConvertion[targetPath];
+                var targetPath;
+                var animationType;
+                switch (channel.target.path) {
+                    case "translation":
+                        targetPath = "position";
+                        animationType = BABYLON.Animation.ANIMATIONTYPE_VECTOR3;
+                        break;
+                    case "rotation":
+                        targetPath = "rotationQuaternion";
+                        animationType = BABYLON.Animation.ANIMATIONTYPE_QUATERNION;
+                        break;
+                    case "scale":
+                        targetPath = "scaling";
+                        animationType = BABYLON.Animation.ANIMATIONTYPE_VECTOR3;
+                        break;
+                    case "weights":
+                        targetPath = "influence";
+                        animationType = BABYLON.Animation.ANIMATIONTYPE_FLOAT;
+                        break;
+                    default:
+                        throw new Error(channelContext + ": Invalid target path '" + channel.target.path + "'");
+                }
                 var inputData;
                 var outputData;
                 var checkSuccess = function () {
@@ -3122,48 +3117,60 @@ var BABYLON;
                         return;
                     }
                     var outputBufferOffset = 0;
-                    var nextOutputConversion = {
-                        "position": function () {
-                            var value = BABYLON.Vector3.FromArray(outputData, outputBufferOffset);
-                            outputBufferOffset += 3;
-                            return value;
-                        },
-                        "rotationQuaternion": function () {
-                            var value = BABYLON.Quaternion.FromArray(outputData, outputBufferOffset);
-                            outputBufferOffset += 4;
-                            return value;
-                        },
-                        "scaling": function () {
-                            var value = BABYLON.Vector3.FromArray(outputData, outputBufferOffset);
-                            outputBufferOffset += 3;
-                            return value;
-                        },
-                        "influence": function () {
-                            var numTargets = targetNode.babylonMesh.morphTargetManager.numTargets;
-                            var value = new Array(numTargets);
-                            for (var i = 0; i < numTargets; i++) {
-                                value[i] = outputData[outputBufferOffset++];
-                            }
-                            return value;
-                        },
-                    };
-                    var getNextOutputValue = nextOutputConversion[targetPath];
-                    var nextKeyConversion = {
-                        "LINEAR": function (frameIndex) { return ({
-                            frame: inputData[frameIndex],
-                            value: getNextOutputValue()
-                        }); },
-                        "CUBICSPLINE": function (frameIndex) { return ({
-                            frame: inputData[frameIndex],
-                            inTangent: getNextOutputValue(),
-                            value: getNextOutputValue(),
-                            outTangent: getNextOutputValue()
-                        }); },
-                    };
-                    var getNextKey = nextKeyConversion[sampler.interpolation];
-                    if (!getNextKey) {
-                        throw new Error(samplerContext + ": Invalid interpolation '" + sampler.interpolation + "'");
+                    var getNextOutputValue;
+                    switch (targetPath) {
+                        case "position":
+                            getNextOutputValue = function () {
+                                var value = BABYLON.Vector3.FromArray(outputData, outputBufferOffset);
+                                outputBufferOffset += 3;
+                                return value;
+                            };
+                            break;
+                        case "rotationQuaternion":
+                            getNextOutputValue = function () {
+                                var value = BABYLON.Quaternion.FromArray(outputData, outputBufferOffset);
+                                outputBufferOffset += 4;
+                                return value;
+                            };
+                            break;
+                        case "scaling":
+                            getNextOutputValue = function () {
+                                var value = BABYLON.Vector3.FromArray(outputData, outputBufferOffset);
+                                outputBufferOffset += 3;
+                                return value;
+                            };
+                            break;
+                        case "influence":
+                            getNextOutputValue = function () {
+                                var numTargets = targetNode.babylonMesh.morphTargetManager.numTargets;
+                                var value = new Array(numTargets);
+                                for (var i = 0; i < numTargets; i++) {
+                                    value[i] = outputData[outputBufferOffset++];
+                                }
+                                return value;
+                            };
+                            break;
                     }
+                    var getNextKey;
+                    switch (sampler.interpolation) {
+                        case "LINEAR":
+                            getNextKey = function (frameIndex) { return ({
+                                frame: inputData[frameIndex],
+                                value: getNextOutputValue()
+                            }); };
+                            break;
+                        case "CUBICSPLINE":
+                            getNextKey = function (frameIndex) { return ({
+                                frame: inputData[frameIndex],
+                                inTangent: getNextOutputValue(),
+                                value: getNextOutputValue(),
+                                outTangent: getNextOutputValue()
+                            }); };
+                            break;
+                        default:
+                            throw new Error(samplerContext + ": Invalid interpolation '" + sampler.interpolation + "'");
+                    }
+                    ;
                     var keys = new Array(inputData.length);
                     for (var frameIndex = 0; frameIndex < inputData.length; frameIndex++) {
                         keys[frameIndex] = getNextKey(frameIndex);
@@ -3200,7 +3207,7 @@ var BABYLON;
                 if (!inputAccessor) {
                     throw new Error(samplerContext + ": Failed to find input accessor " + sampler.input);
                 }
-                this._loadAccessorAsync("accessors[" + inputAccessor.index + "]", inputAccessor, function (data) {
+                this._loadAccessorAsync("#/accessors/" + inputAccessor.index, inputAccessor, function (data) {
                     inputData = data;
                     checkSuccess();
                 });
@@ -3208,7 +3215,7 @@ var BABYLON;
                 if (!outputAccessor) {
                     throw new Error(samplerContext + ": Failed to find output accessor " + sampler.output);
                 }
-                this._loadAccessorAsync("accessors[" + outputAccessor.index + "]", outputAccessor, function (data) {
+                this._loadAccessorAsync("#/accessors/" + outputAccessor.index, outputAccessor, function (data) {
                     outputData = data;
                     checkSuccess();
                 });
@@ -3269,7 +3276,7 @@ var BABYLON;
                 if (!buffer) {
                     throw new Error(context + ": Failed to find buffer " + bufferView.buffer);
                 }
-                this._loadBufferAsync("buffers[" + buffer.index + "]", buffer, function (bufferData) {
+                this._loadBufferAsync("#/buffers/" + buffer.index, buffer, function (bufferData) {
                     if (_this._disposed) {
                         return;
                     }
@@ -3294,7 +3301,7 @@ var BABYLON;
                 if (!bufferView) {
                     throw new Error(context + ": Failed to find buffer view " + accessor.bufferView);
                 }
-                this._loadBufferViewAsync("bufferViews[" + bufferView.index + "]", bufferView, function (bufferViewData) {
+                this._loadBufferViewAsync("#/bufferViews/" + bufferView.index, bufferView, function (bufferViewData) {
                     var numComponents = _this._getNumComponentsOfType(accessor.type);
                     if (numComponents === 0) {
                         throw new Error(context + ": Invalid type (" + accessor.type + ")");
@@ -3429,14 +3436,14 @@ var BABYLON;
                     if (!texture) {
                         throw new Error(context + ": Failed to find base color texture " + properties.baseColorTexture.index);
                     }
-                    babylonMaterial.albedoTexture = this._loadTexture("textures[" + texture.index + "]", texture, properties.baseColorTexture.texCoord);
+                    babylonMaterial.albedoTexture = this._loadTexture("#/textures/" + texture.index, texture, properties.baseColorTexture.texCoord);
                 }
                 if (properties.metallicRoughnessTexture) {
                     var texture = GLTF2.GLTFUtils.GetArrayItem(this._gltf.textures, properties.metallicRoughnessTexture.index);
                     if (!texture) {
                         throw new Error(context + ": Failed to find metallic roughness texture " + properties.metallicRoughnessTexture.index);
                     }
-                    babylonMaterial.metallicTexture = this._loadTexture("textures[" + texture.index + "]", texture, properties.metallicRoughnessTexture.texCoord);
+                    babylonMaterial.metallicTexture = this._loadTexture("#/textures/" + texture.index, texture, properties.metallicRoughnessTexture.texCoord);
                     babylonMaterial.useMetallnessFromMetallicTextureBlue = true;
                     babylonMaterial.useRoughnessFromMetallicTextureGreen = true;
                     babylonMaterial.useRoughnessFromMetallicTextureAlpha = false;
@@ -3473,7 +3480,7 @@ var BABYLON;
                     if (!texture) {
                         throw new Error(context + ": Failed to find normal texture " + material.normalTexture.index);
                     }
-                    babylonMaterial.bumpTexture = this._loadTexture("textures[" + texture.index + "]", texture, material.normalTexture.texCoord);
+                    babylonMaterial.bumpTexture = this._loadTexture("#/textures/" + texture.index, texture, material.normalTexture.texCoord);
                     babylonMaterial.invertNormalMapX = !this._babylonScene.useRightHandedSystem;
                     babylonMaterial.invertNormalMapY = this._babylonScene.useRightHandedSystem;
                     if (material.normalTexture.scale != null) {
@@ -3485,7 +3492,7 @@ var BABYLON;
                     if (!texture) {
                         throw new Error(context + ": Failed to find occlusion texture " + material.occlusionTexture.index);
                     }
-                    babylonMaterial.ambientTexture = this._loadTexture("textures[" + texture.index + "]", texture, material.occlusionTexture.texCoord);
+                    babylonMaterial.ambientTexture = this._loadTexture("#/textures/" + texture.index, texture, material.occlusionTexture.texCoord);
                     babylonMaterial.useAmbientInGrayScale = true;
                     if (material.occlusionTexture.strength != null) {
                         babylonMaterial.ambientTextureStrength = material.occlusionTexture.strength;
@@ -3496,7 +3503,7 @@ var BABYLON;
                     if (!texture) {
                         throw new Error(context + ": Failed to find emissive texture " + material.emissiveTexture.index);
                     }
-                    babylonMaterial.emissiveTexture = this._loadTexture("textures[" + texture.index + "]", texture, material.emissiveTexture.texCoord);
+                    babylonMaterial.emissiveTexture = this._loadTexture("#/textures/" + texture.index, texture, material.emissiveTexture.texCoord);
                 }
             };
             GLTFLoader.prototype._loadMaterialAlphaProperties = function (context, material, colorFactor) {
@@ -3568,7 +3575,7 @@ var BABYLON;
                     if (!image) {
                         throw new Error(context + ": Failed to find source " + texture.source);
                     }
-                    this._loadImage("images[" + image.index + "]", image, function (data) {
+                    this._loadImage("#/images/" + image.index, image, function (data) {
                         texture.url = URL.createObjectURL(new Blob([data], { type: image.mimeType }));
                         texture.dataReadyObservable.notifyObservers(texture);
                     });
@@ -3612,7 +3619,7 @@ var BABYLON;
                     if (!bufferView) {
                         throw new Error(context + ": Failed to find buffer view " + image.bufferView);
                     }
-                    this._loadBufferViewAsync("bufferViews[" + bufferView.index + "]", bufferView, onSuccess);
+                    this._loadBufferViewAsync("#/bufferViews/" + bufferView.index, bufferView, onSuccess);
                 }
             };
             GLTFLoader.prototype._tryCatchOnError = function (handler) {
@@ -3731,18 +3738,6 @@ var BABYLON;
                     }
                 }
             };
-            /**
-             * Decodes a buffer view into a string
-             * @param view: the buffer view
-             */
-            GLTFUtils.DecodeBufferToText = function (view) {
-                var result = "";
-                var length = view.byteLength;
-                for (var i = 0; i < length; ++i) {
-                    result += String.fromCharCode(view[i]);
-                }
-                return result;
-            };
             return GLTFUtils;
         }());
         GLTF2.GLTFUtils = GLTFUtils;
@@ -3792,7 +3787,7 @@ var BABYLON;
             GLTFLoaderExtension._ApplyExtensions = function (action) {
                 var extensions = GLTFLoaderExtension._Extensions;
                 if (!extensions) {
-                    return;
+                    return false;
                 }
                 for (var i = 0; i < extensions.length; i++) {
                     var extension = extensions[i];

Diferenças do arquivo suprimidas por serem muito extensas
+ 3 - 3
dist/preview release/loaders/babylon.glTFFileLoader.min.js


+ 111 - 115
dist/preview release/loaders/babylonjs.loaders.js

@@ -1,4 +1,5 @@
-var BABYLON = BABYLON || (typeof require !== 'undefined' && require("babylonjs"));
+var babylonDependency; try { babylonDependency = (typeof require !== 'undefined' && require("../babylon.max")); } catch (e) { babylonDependency = (typeof require !== 'undefined' && require("babylonjs")); } 
+var BABYLON = BABYLON || babylonDependency;
 var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -1154,24 +1155,13 @@ var BABYLON;
             };
         };
         GLTFFileLoader._parseVersion = function (version) {
-            if (!version) {
-                return null;
-            }
-            var parts = version.split(".");
-            if (parts.length != 2) {
-                return null;
-            }
-            var major = +parts[0];
-            if (isNaN(major)) {
-                return null;
-            }
-            var minor = +parts[1];
-            if (isNaN(minor)) {
+            var match = (version + "").match(/^(\d+)\.(\d+)$/);
+            if (!match) {
                 return null;
             }
             return {
-                major: major,
-                minor: minor
+                major: parseInt(match[1]),
+                minor: parseInt(match[2])
             };
         };
         GLTFFileLoader._compareVersion = function (a, b) {
@@ -1185,11 +1175,11 @@ var BABYLON;
                 return -1;
             return 0;
         };
-        GLTFFileLoader._decodeBufferToText = function (view) {
+        GLTFFileLoader._decodeBufferToText = function (buffer) {
             var result = "";
-            var length = view.byteLength;
+            var length = buffer.byteLength;
             for (var i = 0; i < length; ++i) {
-                result += String.fromCharCode(view[i]);
+                result += String.fromCharCode(buffer[i]);
             }
             return result;
         };
@@ -1448,6 +1438,7 @@ var BABYLON;
                 var channel = Number(attributeParameter.semantic.split("_")[1]);
                 return "uv" + (channel === 0 ? "" : channel + 1);
             }
+            return null;
         };
         /**
         * Returns the animation path (glTF -> Babylon)
@@ -3625,7 +3616,7 @@ var BABYLON;
                 if (!scene) {
                     throw new Error("Failed to find scene " + (this._gltf.scene || 0));
                 }
-                this._loadScene("scenes[" + scene.index + "]", scene, nodeNames);
+                this._loadScene("#/scenes/" + scene.index, scene, nodeNames);
             };
             GLTFLoader.prototype._loadScene = function (context, scene, nodeNames) {
                 this._rootNode = { babylonMesh: new BABYLON.Mesh("__root__", this._babylonScene) };
@@ -3670,7 +3661,7 @@ var BABYLON;
                     if (!node) {
                         throw new Error(context + ": Failed to find node " + nodeIndices[i]);
                     }
-                    this._loadNode("nodes[" + nodeIndices[i] + "]", node);
+                    this._loadNode("#/nodes/" + nodeIndices[i], node);
                 }
                 // Disable the root mesh until the asset is ready to render.
                 this._rootNode.babylonMesh.setEnabled(false);
@@ -3686,7 +3677,7 @@ var BABYLON;
                     if (!mesh) {
                         throw new Error(context + ": Failed to find mesh " + node.mesh);
                     }
-                    this._loadMesh("meshes[" + node.mesh + "]", node, mesh);
+                    this._loadMesh("#/meshes/" + node.mesh, node, mesh);
                 }
                 node.babylonMesh.parent = node.parent ? node.parent.babylonMesh : null;
                 node.babylonAnimationTargets = node.babylonAnimationTargets || [];
@@ -3696,7 +3687,7 @@ var BABYLON;
                     if (!skin) {
                         throw new Error(context + ": Failed to find skin " + node.skin);
                     }
-                    node.babylonMesh.skeleton = this._loadSkin("skins[" + node.skin + "]", skin);
+                    node.babylonMesh.skeleton = this._loadSkin("#/skins/" + node.skin, skin);
                 }
                 if (node.camera != null) {
                     // TODO: handle cameras
@@ -3707,7 +3698,7 @@ var BABYLON;
                         if (!childNode) {
                             throw new Error(context + ": Failed to find child node " + node.children[i]);
                         }
-                        this._loadNode("nodes[" + node.children[i] + "]", childNode);
+                        this._loadNode("#/nodes/" + node.children[i], childNode);
                     }
                 }
             };
@@ -3723,7 +3714,7 @@ var BABYLON;
                 var numRemainingPrimitives = mesh.primitives.length;
                 for (var index = 0; index < mesh.primitives.length; index++) {
                     var primitive = mesh.primitives[index];
-                    this._loadPrimitive(context + "/primitives[" + index + "]", node, mesh, primitive, function (subVertexData, loadMaterial) {
+                    this._loadPrimitive(context + "/primitives/" + index, node, mesh, primitive, function (subVertexData, loadMaterial) {
                         subMeshInfos.push({
                             verticesStart: vertexData.positions.length,
                             verticesCount: subVertexData.positions.length,
@@ -3765,7 +3756,7 @@ var BABYLON;
                             if (!material) {
                                 throw new Error(context + ": Failed to find material " + primitive.material);
                             }
-                            _this._loadMaterial("materials[" + material.index + "]", material, function (babylonMaterial, isNew) {
+                            _this._loadMaterial("#/materials/" + material.index, material, function (babylonMaterial, isNew) {
                                 if (isNew && _this._parent.onMaterialLoaded) {
                                     _this._parent.onMaterialLoaded(babylonMaterial);
                                 }
@@ -3798,7 +3789,7 @@ var BABYLON;
                     if (!accessor) {
                         throw new Error(context + ": Failed to find attribute '" + attribute + "' accessor " + attributes[attribute]);
                     }
-                    this_1._loadAccessorAsync("accessors[" + accessor.index + "]", accessor, function (data) {
+                    this_1._loadAccessorAsync("#/accessors/" + accessor.index, accessor, function (data) {
                         switch (attribute) {
                             case "NORMAL":
                                 vertexData.normals = data;
@@ -3839,7 +3830,7 @@ var BABYLON;
                                 if (!indicesAccessor) {
                                     throw new Error(context + ": Failed to find indices accessor " + primitive.indices);
                                 }
-                                _this._loadAccessorAsync("accessors[" + indicesAccessor.index + "]", indicesAccessor, function (data) {
+                                _this._loadAccessorAsync("#/accessors/" + indicesAccessor.index, indicesAccessor, function (data) {
                                     vertexData.indices = data;
                                     onSuccess(vertexData);
                                 });
@@ -3876,9 +3867,9 @@ var BABYLON;
                     var _loop_3 = function (attribute) {
                         accessor = GLTF2.GLTFUtils.GetArrayItem(this_2._gltf.accessors, attributes[attribute]);
                         if (!accessor) {
-                            throw new Error(context + "/targets[" + index + "]: Failed to find attribute '" + attribute + "' accessor " + attributes[attribute]);
+                            throw new Error(context + "/targets/" + index + ": Failed to find attribute '" + attribute + "' accessor " + attributes[attribute]);
                         }
-                        this_2._loadAccessorAsync("accessors[" + accessor.index + "]", accessor, function (data) {
+                        this_2._loadAccessorAsync("#/accessors/" + accessor.index, accessor, function (data) {
                             if (accessor.name) {
                                 babylonMorphTarget.name = accessor.name;
                             }
@@ -3953,7 +3944,7 @@ var BABYLON;
                     if (!accessor) {
                         throw new Error(context + ": Failed to find inverse bind matrices attribute " + skin.inverseBindMatrices);
                     }
-                    this._loadAccessorAsync("accessors[" + accessor.index + "]", accessor, function (data) {
+                    this._loadAccessorAsync("#/accessors/" + accessor.index, accessor, function (data) {
                         _this._loadBones(context, skin, data);
                     });
                 }
@@ -4031,7 +4022,7 @@ var BABYLON;
                 }
                 for (var animationIndex = 0; animationIndex < animations.length; animationIndex++) {
                     var animation = animations[animationIndex];
-                    var context = "animations[" + animationIndex + "]";
+                    var context = "#/animations/" + animationIndex;
                     for (var channelIndex = 0; channelIndex < animation.channels.length; channelIndex++) {
                         var channel = GLTF2.GLTFUtils.GetArrayItem(animation.channels, channelIndex);
                         if (!channel) {
@@ -4041,7 +4032,7 @@ var BABYLON;
                         if (!sampler) {
                             throw new Error(context + ": Failed to find sampler " + channel.sampler);
                         }
-                        this._loadAnimationChannel(animation, context + "/channels[" + channelIndex + "]", channel, context + "/samplers[" + channel.sampler + "]", sampler);
+                        this._loadAnimationChannel(animation, context + "/channels/" + channelIndex, channel, context + "/samplers/" + channel.sampler, sampler);
                     }
                 }
             };
@@ -4050,23 +4041,28 @@ var BABYLON;
                 if (!targetNode) {
                     throw new Error(channelContext + ": Failed to find target node " + channel.target.node);
                 }
-                var conversion = {
-                    "translation": "position",
-                    "rotation": "rotationQuaternion",
-                    "scale": "scaling",
-                    "weights": "influence"
-                };
-                var targetPath = conversion[channel.target.path];
-                if (!targetPath) {
-                    throw new Error(channelContext + ": Invalid target path '" + channel.target.path + "'");
-                }
-                var animationConvertion = {
-                    "position": BABYLON.Animation.ANIMATIONTYPE_VECTOR3,
-                    "rotationQuaternion": BABYLON.Animation.ANIMATIONTYPE_QUATERNION,
-                    "scaling": BABYLON.Animation.ANIMATIONTYPE_VECTOR3,
-                    "influence": BABYLON.Animation.ANIMATIONTYPE_FLOAT,
-                };
-                var animationType = animationConvertion[targetPath];
+                var targetPath;
+                var animationType;
+                switch (channel.target.path) {
+                    case "translation":
+                        targetPath = "position";
+                        animationType = BABYLON.Animation.ANIMATIONTYPE_VECTOR3;
+                        break;
+                    case "rotation":
+                        targetPath = "rotationQuaternion";
+                        animationType = BABYLON.Animation.ANIMATIONTYPE_QUATERNION;
+                        break;
+                    case "scale":
+                        targetPath = "scaling";
+                        animationType = BABYLON.Animation.ANIMATIONTYPE_VECTOR3;
+                        break;
+                    case "weights":
+                        targetPath = "influence";
+                        animationType = BABYLON.Animation.ANIMATIONTYPE_FLOAT;
+                        break;
+                    default:
+                        throw new Error(channelContext + ": Invalid target path '" + channel.target.path + "'");
+                }
                 var inputData;
                 var outputData;
                 var checkSuccess = function () {
@@ -4074,48 +4070,60 @@ var BABYLON;
                         return;
                     }
                     var outputBufferOffset = 0;
-                    var nextOutputConversion = {
-                        "position": function () {
-                            var value = BABYLON.Vector3.FromArray(outputData, outputBufferOffset);
-                            outputBufferOffset += 3;
-                            return value;
-                        },
-                        "rotationQuaternion": function () {
-                            var value = BABYLON.Quaternion.FromArray(outputData, outputBufferOffset);
-                            outputBufferOffset += 4;
-                            return value;
-                        },
-                        "scaling": function () {
-                            var value = BABYLON.Vector3.FromArray(outputData, outputBufferOffset);
-                            outputBufferOffset += 3;
-                            return value;
-                        },
-                        "influence": function () {
-                            var numTargets = targetNode.babylonMesh.morphTargetManager.numTargets;
-                            var value = new Array(numTargets);
-                            for (var i = 0; i < numTargets; i++) {
-                                value[i] = outputData[outputBufferOffset++];
-                            }
-                            return value;
-                        },
-                    };
-                    var getNextOutputValue = nextOutputConversion[targetPath];
-                    var nextKeyConversion = {
-                        "LINEAR": function (frameIndex) { return ({
-                            frame: inputData[frameIndex],
-                            value: getNextOutputValue()
-                        }); },
-                        "CUBICSPLINE": function (frameIndex) { return ({
-                            frame: inputData[frameIndex],
-                            inTangent: getNextOutputValue(),
-                            value: getNextOutputValue(),
-                            outTangent: getNextOutputValue()
-                        }); },
-                    };
-                    var getNextKey = nextKeyConversion[sampler.interpolation];
-                    if (!getNextKey) {
-                        throw new Error(samplerContext + ": Invalid interpolation '" + sampler.interpolation + "'");
+                    var getNextOutputValue;
+                    switch (targetPath) {
+                        case "position":
+                            getNextOutputValue = function () {
+                                var value = BABYLON.Vector3.FromArray(outputData, outputBufferOffset);
+                                outputBufferOffset += 3;
+                                return value;
+                            };
+                            break;
+                        case "rotationQuaternion":
+                            getNextOutputValue = function () {
+                                var value = BABYLON.Quaternion.FromArray(outputData, outputBufferOffset);
+                                outputBufferOffset += 4;
+                                return value;
+                            };
+                            break;
+                        case "scaling":
+                            getNextOutputValue = function () {
+                                var value = BABYLON.Vector3.FromArray(outputData, outputBufferOffset);
+                                outputBufferOffset += 3;
+                                return value;
+                            };
+                            break;
+                        case "influence":
+                            getNextOutputValue = function () {
+                                var numTargets = targetNode.babylonMesh.morphTargetManager.numTargets;
+                                var value = new Array(numTargets);
+                                for (var i = 0; i < numTargets; i++) {
+                                    value[i] = outputData[outputBufferOffset++];
+                                }
+                                return value;
+                            };
+                            break;
                     }
+                    var getNextKey;
+                    switch (sampler.interpolation) {
+                        case "LINEAR":
+                            getNextKey = function (frameIndex) { return ({
+                                frame: inputData[frameIndex],
+                                value: getNextOutputValue()
+                            }); };
+                            break;
+                        case "CUBICSPLINE":
+                            getNextKey = function (frameIndex) { return ({
+                                frame: inputData[frameIndex],
+                                inTangent: getNextOutputValue(),
+                                value: getNextOutputValue(),
+                                outTangent: getNextOutputValue()
+                            }); };
+                            break;
+                        default:
+                            throw new Error(samplerContext + ": Invalid interpolation '" + sampler.interpolation + "'");
+                    }
+                    ;
                     var keys = new Array(inputData.length);
                     for (var frameIndex = 0; frameIndex < inputData.length; frameIndex++) {
                         keys[frameIndex] = getNextKey(frameIndex);
@@ -4152,7 +4160,7 @@ var BABYLON;
                 if (!inputAccessor) {
                     throw new Error(samplerContext + ": Failed to find input accessor " + sampler.input);
                 }
-                this._loadAccessorAsync("accessors[" + inputAccessor.index + "]", inputAccessor, function (data) {
+                this._loadAccessorAsync("#/accessors/" + inputAccessor.index, inputAccessor, function (data) {
                     inputData = data;
                     checkSuccess();
                 });
@@ -4160,7 +4168,7 @@ var BABYLON;
                 if (!outputAccessor) {
                     throw new Error(samplerContext + ": Failed to find output accessor " + sampler.output);
                 }
-                this._loadAccessorAsync("accessors[" + outputAccessor.index + "]", outputAccessor, function (data) {
+                this._loadAccessorAsync("#/accessors/" + outputAccessor.index, outputAccessor, function (data) {
                     outputData = data;
                     checkSuccess();
                 });
@@ -4221,7 +4229,7 @@ var BABYLON;
                 if (!buffer) {
                     throw new Error(context + ": Failed to find buffer " + bufferView.buffer);
                 }
-                this._loadBufferAsync("buffers[" + buffer.index + "]", buffer, function (bufferData) {
+                this._loadBufferAsync("#/buffers/" + buffer.index, buffer, function (bufferData) {
                     if (_this._disposed) {
                         return;
                     }
@@ -4246,7 +4254,7 @@ var BABYLON;
                 if (!bufferView) {
                     throw new Error(context + ": Failed to find buffer view " + accessor.bufferView);
                 }
-                this._loadBufferViewAsync("bufferViews[" + bufferView.index + "]", bufferView, function (bufferViewData) {
+                this._loadBufferViewAsync("#/bufferViews/" + bufferView.index, bufferView, function (bufferViewData) {
                     var numComponents = _this._getNumComponentsOfType(accessor.type);
                     if (numComponents === 0) {
                         throw new Error(context + ": Invalid type (" + accessor.type + ")");
@@ -4381,14 +4389,14 @@ var BABYLON;
                     if (!texture) {
                         throw new Error(context + ": Failed to find base color texture " + properties.baseColorTexture.index);
                     }
-                    babylonMaterial.albedoTexture = this._loadTexture("textures[" + texture.index + "]", texture, properties.baseColorTexture.texCoord);
+                    babylonMaterial.albedoTexture = this._loadTexture("#/textures/" + texture.index, texture, properties.baseColorTexture.texCoord);
                 }
                 if (properties.metallicRoughnessTexture) {
                     var texture = GLTF2.GLTFUtils.GetArrayItem(this._gltf.textures, properties.metallicRoughnessTexture.index);
                     if (!texture) {
                         throw new Error(context + ": Failed to find metallic roughness texture " + properties.metallicRoughnessTexture.index);
                     }
-                    babylonMaterial.metallicTexture = this._loadTexture("textures[" + texture.index + "]", texture, properties.metallicRoughnessTexture.texCoord);
+                    babylonMaterial.metallicTexture = this._loadTexture("#/textures/" + texture.index, texture, properties.metallicRoughnessTexture.texCoord);
                     babylonMaterial.useMetallnessFromMetallicTextureBlue = true;
                     babylonMaterial.useRoughnessFromMetallicTextureGreen = true;
                     babylonMaterial.useRoughnessFromMetallicTextureAlpha = false;
@@ -4425,7 +4433,7 @@ var BABYLON;
                     if (!texture) {
                         throw new Error(context + ": Failed to find normal texture " + material.normalTexture.index);
                     }
-                    babylonMaterial.bumpTexture = this._loadTexture("textures[" + texture.index + "]", texture, material.normalTexture.texCoord);
+                    babylonMaterial.bumpTexture = this._loadTexture("#/textures/" + texture.index, texture, material.normalTexture.texCoord);
                     babylonMaterial.invertNormalMapX = !this._babylonScene.useRightHandedSystem;
                     babylonMaterial.invertNormalMapY = this._babylonScene.useRightHandedSystem;
                     if (material.normalTexture.scale != null) {
@@ -4437,7 +4445,7 @@ var BABYLON;
                     if (!texture) {
                         throw new Error(context + ": Failed to find occlusion texture " + material.occlusionTexture.index);
                     }
-                    babylonMaterial.ambientTexture = this._loadTexture("textures[" + texture.index + "]", texture, material.occlusionTexture.texCoord);
+                    babylonMaterial.ambientTexture = this._loadTexture("#/textures/" + texture.index, texture, material.occlusionTexture.texCoord);
                     babylonMaterial.useAmbientInGrayScale = true;
                     if (material.occlusionTexture.strength != null) {
                         babylonMaterial.ambientTextureStrength = material.occlusionTexture.strength;
@@ -4448,7 +4456,7 @@ var BABYLON;
                     if (!texture) {
                         throw new Error(context + ": Failed to find emissive texture " + material.emissiveTexture.index);
                     }
-                    babylonMaterial.emissiveTexture = this._loadTexture("textures[" + texture.index + "]", texture, material.emissiveTexture.texCoord);
+                    babylonMaterial.emissiveTexture = this._loadTexture("#/textures/" + texture.index, texture, material.emissiveTexture.texCoord);
                 }
             };
             GLTFLoader.prototype._loadMaterialAlphaProperties = function (context, material, colorFactor) {
@@ -4520,7 +4528,7 @@ var BABYLON;
                     if (!image) {
                         throw new Error(context + ": Failed to find source " + texture.source);
                     }
-                    this._loadImage("images[" + image.index + "]", image, function (data) {
+                    this._loadImage("#/images/" + image.index, image, function (data) {
                         texture.url = URL.createObjectURL(new Blob([data], { type: image.mimeType }));
                         texture.dataReadyObservable.notifyObservers(texture);
                     });
@@ -4564,7 +4572,7 @@ var BABYLON;
                     if (!bufferView) {
                         throw new Error(context + ": Failed to find buffer view " + image.bufferView);
                     }
-                    this._loadBufferViewAsync("bufferViews[" + bufferView.index + "]", bufferView, onSuccess);
+                    this._loadBufferViewAsync("#/bufferViews/" + bufferView.index, bufferView, onSuccess);
                 }
             };
             GLTFLoader.prototype._tryCatchOnError = function (handler) {
@@ -4683,18 +4691,6 @@ var BABYLON;
                     }
                 }
             };
-            /**
-             * Decodes a buffer view into a string
-             * @param view: the buffer view
-             */
-            GLTFUtils.DecodeBufferToText = function (view) {
-                var result = "";
-                var length = view.byteLength;
-                for (var i = 0; i < length; ++i) {
-                    result += String.fromCharCode(view[i]);
-                }
-                return result;
-            };
             return GLTFUtils;
         }());
         GLTF2.GLTFUtils = GLTFUtils;
@@ -4744,7 +4740,7 @@ var BABYLON;
             GLTFLoaderExtension._ApplyExtensions = function (action) {
                 var extensions = GLTFLoaderExtension._Extensions;
                 if (!extensions) {
-                    return;
+                    return false;
                 }
                 for (var i = 0; i < extensions.length; i++) {
                     var extension = extensions[i];

Diferenças do arquivo suprimidas por serem muito extensas
+ 3 - 3
dist/preview release/loaders/babylonjs.loaders.min.js


+ 1 - 6
dist/preview release/loaders/babylonjs.loaders.module.d.ts

@@ -148,7 +148,7 @@ declare module BABYLON {
         private static _parseV2(binaryReader, onError);
         private static _parseVersion(version);
         private static _compareVersion(a, b);
-        private static _decodeBufferToText(view);
+        private static _decodeBufferToText(buffer);
     }
 }
 
@@ -1046,11 +1046,6 @@ declare module BABYLON.GLTF2 {
         static GetArrayItem<T>(array: ArrayLike<T>, index: number): T;
         static GetTextureWrapMode(mode: ETextureWrapMode): number;
         static GetTextureSamplingMode(magFilter: ETextureMagFilter, minFilter: ETextureMinFilter): number;
-        /**
-         * Decodes a buffer view into a string
-         * @param view: the buffer view
-         */
-        static DecodeBufferToText(view: ArrayBufferView): string;
     }
 }
 

+ 2 - 1
dist/preview release/materialsLibrary/babylonjs.materials.js

@@ -1,4 +1,5 @@
-var BABYLON = BABYLON || (typeof require !== 'undefined' && require("babylonjs"));
+var babylonDependency; try { babylonDependency = (typeof require !== 'undefined' && require("../babylon.max")); } catch (e) { babylonDependency = (typeof require !== 'undefined' && require("babylonjs")); } 
+var BABYLON = BABYLON || babylonDependency;
 var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);

Diferenças do arquivo suprimidas por serem muito extensas
+ 2 - 2
dist/preview release/materialsLibrary/babylonjs.materials.min.js


+ 2 - 1
dist/preview release/postProcessesLibrary/babylonjs.postProcess.js

@@ -1,4 +1,5 @@
-var BABYLON = BABYLON || (typeof require !== 'undefined' && require("babylonjs"));
+var babylonDependency; try { babylonDependency = (typeof require !== 'undefined' && require("../babylon.max")); } catch (e) { babylonDependency = (typeof require !== 'undefined' && require("babylonjs")); } 
+var BABYLON = BABYLON || babylonDependency;
 var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);

Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 1
dist/preview release/postProcessesLibrary/babylonjs.postProcess.min.js


+ 2 - 1
dist/preview release/proceduralTexturesLibrary/babylonjs.proceduralTextures.js

@@ -1,4 +1,5 @@
-var BABYLON = BABYLON || (typeof require !== 'undefined' && require("babylonjs"));
+var babylonDependency; try { babylonDependency = (typeof require !== 'undefined' && require("../babylon.max")); } catch (e) { babylonDependency = (typeof require !== 'undefined' && require("babylonjs")); } 
+var BABYLON = BABYLON || babylonDependency;
 var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);

Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 1
dist/preview release/proceduralTexturesLibrary/babylonjs.proceduralTextures.min.js


+ 2 - 1
dist/preview release/serializers/babylonjs.serializers.js

@@ -1,4 +1,5 @@
-var BABYLON = BABYLON || (typeof require !== 'undefined' && require("babylonjs"));
+var babylonDependency; try { babylonDependency = (typeof require !== 'undefined' && require("../babylon.max")); } catch (e) { babylonDependency = (typeof require !== 'undefined' && require("babylonjs")); } 
+var BABYLON = BABYLON || babylonDependency;
 var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);

Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 1
dist/preview release/serializers/babylonjs.serializers.min.js


+ 1 - 0
dist/preview release/what's new.md

@@ -16,6 +16,7 @@
 - Added support for `material.separateCullingPass`. [Doc here](http://doc.babylonjs.com/tutorials/transparency_and_how_meshes_are_rendered#things-to-do-and-not-to-do) ([sebavan](https://github.com/sebavan))
 - Added support for Windows Motion Controllers ([Lewis Weaver](https://github.com/leweaver))
 - Added support for Particle animation in ParticleSystem. [Doc here](http://doc.babylonjs.com/tutorials/particles#particle-animation) ([Ibraheem Osama](https://github.com/IbraheemOsama))
+- More robust TypeScript code with noImplicitAny and noImplicitReturns compiler options ([deltakosh](https://github.com/deltakosh))
 
 ## Updates
 - Added `MultiObserver`. [Doc here](http://doc.babylonjs.com/overviews/observables#multiobserver) ([deltakosh](https://github.com/deltakosh))

+ 2 - 1
gui/src/tsconfig.json

@@ -3,6 +3,7 @@
     "experimentalDecorators": true,
     "module": "commonjs",
     "target": "es5",
-    "noImplicitAny": true
+    "noImplicitAny": true,
+    "noImplicitReturns": true
   }
 }

+ 4 - 2
inspector/src/tabs/PropertyTab.ts

@@ -114,7 +114,7 @@ module INSPECTOR{
                 if(treeItem.correspondsTo(object)) {
                     return treeItem;
                 }
-                else{
+                else {
                     if(treeItem.children.length > 0){
                         for (let item of treeItem.children) {
                             let it = searchObjectInTree(obj, item);
@@ -123,10 +123,12 @@ module INSPECTOR{
                             }
                         }
                     }
-                    else{
+                    else {
                         return null;
                     }
                 } 
+
+                return null;
             }
 
             for (let item of this._treeItems) {

+ 2 - 0
inspector/src/tabs/TabBar.ts

@@ -141,6 +141,8 @@ module INSPECTOR {
                     return tab;
                 }
             }
+
+            return null;
         }
 
         public getActiveTabIndex(): number {

+ 2 - 1
inspector/src/tsconfig.json

@@ -3,6 +3,7 @@
         "experimentalDecorators": true,
         "module": "commonjs", 
         "target": "es5",
-        "noImplicitAny": true
+        "noImplicitAny": true,
+        "noImplicitReturns": true
     }
 }

+ 3 - 1
loaders/src/glTF/1.0/babylon.glTFLoader.ts

@@ -118,7 +118,7 @@ module BABYLON.GLTF1 {
         return str;
     };
 
-    var getAttribute = (attributeParameter: IGLTFTechniqueParameter) => {
+    var getAttribute = (attributeParameter: IGLTFTechniqueParameter): string => {
         if (attributeParameter.semantic === "NORMAL") {
             return "normal";
         } else if (attributeParameter.semantic === "POSITION") {
@@ -133,6 +133,8 @@ module BABYLON.GLTF1 {
             var channel = Number(attributeParameter.semantic.split("_")[1]);
             return "uv" + (channel === 0 ? "" : channel + 1);
         }
+
+        return null;
     };
 
     /**

+ 1 - 1
loaders/src/glTF/2.0/babylon.glTFLoaderExtension.ts

@@ -54,7 +54,7 @@ module BABYLON.GLTF2 {
         private static _ApplyExtensions(action: (extension: GLTFLoaderExtension) => boolean) {
             var extensions = GLTFLoaderExtension._Extensions;
             if (!extensions) {
-                return;
+                return false;
             }
 
             for (var i = 0; i < extensions.length; i++) {

+ 2 - 1
loaders/src/tsconfig.json

@@ -6,6 +6,7 @@
     "target": "es5",
     "sourceMap": true,
     "lib": ["dom", "es2015.promise", "es5"],
-    "noImplicitAny": true
+    "noImplicitAny": true,
+    "noImplicitReturns": true
   }
 }

+ 2 - 1
materialsLibrary/src/tsconfig.json

@@ -3,6 +3,7 @@
     "experimentalDecorators": true,
     "module": "commonjs",
     "target": "es5",
-    "noImplicitAny": true
+    "noImplicitAny": true,
+    "noImplicitReturns": true
   }
 }

+ 2 - 1
postProcessLibrary/src/tsconfig.json

@@ -3,6 +3,7 @@
     "experimentalDecorators": true,
     "module": "commonjs",
     "target": "es5",
-    "noImplicitAny": true
+    "noImplicitAny": true,
+    "noImplicitReturns": true
   }
 }

+ 2 - 1
proceduralTexturesLibrary/src/tsconfig.json

@@ -3,6 +3,7 @@
     "experimentalDecorators": true,
     "module": "commonjs",
     "target": "es5",
-    "noImplicitAny": true
+    "noImplicitAny": true,
+    "noImplicitReturns": true
   }
 }

+ 2 - 1
serializers/src/tsconfig.json

@@ -3,6 +3,7 @@
     "experimentalDecorators": true,
     "module": "commonjs",
     "target": "es5",
-    "noImplicitAny": true
+    "noImplicitAny": true,
+    "noImplicitReturns": true
   }
 }

+ 1 - 1
src/Animations/babylon.animation.ts

@@ -196,7 +196,7 @@
 				if (onAnimationEnd) {
                     onAnimationEnd();
                 }
-				return;
+				return null;
 			}
 
 			var endFrame: number = frameRate * (duration / 1000);

+ 22 - 0
src/Cameras/babylon.arcRotateCamera.ts

@@ -73,6 +73,8 @@ module BABYLON {
             var pointers = <ArcRotateCameraPointersInput>this.inputs.attached["pointers"];
             if (pointers)
                 return pointers.angularSensibilityX;
+
+            return null;
         }
 
         public set angularSensibilityX(value: number) {
@@ -86,6 +88,8 @@ module BABYLON {
             var pointers = <ArcRotateCameraPointersInput>this.inputs.attached["pointers"];
             if (pointers)
                 return pointers.angularSensibilityY;
+            
+            return null;
         }
 
         public set angularSensibilityY(value: number) {
@@ -99,6 +103,8 @@ module BABYLON {
             var pointers = <ArcRotateCameraPointersInput>this.inputs.attached["pointers"];
             if (pointers)
                 return pointers.pinchPrecision;
+
+            return null;
         }
 
         public set pinchPrecision(value: number) {
@@ -112,6 +118,8 @@ module BABYLON {
             var pointers = <ArcRotateCameraPointersInput>this.inputs.attached["pointers"];
             if (pointers)
                 return pointers.pinchDeltaPercentage;
+
+            return null;
         }
 
         public set pinchDeltaPercentage(value: number) {
@@ -125,6 +133,8 @@ module BABYLON {
             var pointers = <ArcRotateCameraPointersInput>this.inputs.attached["pointers"];
             if (pointers)
                 return pointers.panningSensibility;
+
+            return null;
         }
 
         public set panningSensibility(value: number) {
@@ -138,6 +148,8 @@ module BABYLON {
             var keyboard = <ArcRotateCameraKeyboardMoveInput>this.inputs.attached["keyboard"];
             if (keyboard)
                 return keyboard.keysUp;
+
+            return null;
         }
 
         public set keysUp(value: number[]) {
@@ -150,6 +162,8 @@ module BABYLON {
             var keyboard = <ArcRotateCameraKeyboardMoveInput>this.inputs.attached["keyboard"];
             if (keyboard)
                 return keyboard.keysDown;
+
+            return null;
         }
 
         public set keysDown(value: number[]) {
@@ -162,6 +176,8 @@ module BABYLON {
             var keyboard = <ArcRotateCameraKeyboardMoveInput>this.inputs.attached["keyboard"];
             if (keyboard)
                 return keyboard.keysLeft;
+
+            return null;
         }
 
         public set keysLeft(value: number[]) {
@@ -174,6 +190,8 @@ module BABYLON {
             var keyboard = <ArcRotateCameraKeyboardMoveInput>this.inputs.attached["keyboard"];
             if (keyboard)
                 return keyboard.keysRight;
+
+            return null;
         }
 
         public set keysRight(value: number[]) {
@@ -186,6 +204,8 @@ module BABYLON {
             var mousewheel = <ArcRotateCameraMouseWheelInput>this.inputs.attached["mousewheel"];
             if (mousewheel)
                 return mousewheel.wheelPrecision;
+
+            return null;
         }
 
         public set wheelPrecision(value: number) {
@@ -198,6 +218,8 @@ module BABYLON {
             var mousewheel = <ArcRotateCameraMouseWheelInput>this.inputs.attached["mousewheel"];
             if (mousewheel)
                 return mousewheel.wheelDeltaPercentage;
+
+            return null;
         }
 
         public set wheelDeltaPercentage(value: number) {

+ 10 - 0
src/Cameras/babylon.freeCamera.ts

@@ -16,6 +16,8 @@
             var mouse = <FreeCameraMouseInput>this.inputs.attached["mouse"];
             if (mouse)
                 return mouse.angularSensibility;
+
+            return null;
         }
         
         public set angularSensibility(value) {
@@ -28,6 +30,8 @@
             var keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached["keyboard"];
             if (keyboard)
                 return keyboard.keysUp;
+
+            return null;
         }
         
         public set keysUp(value) {
@@ -40,6 +44,8 @@
             var keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached["keyboard"];
             if (keyboard)
                 return keyboard.keysDown;
+
+            return null;
         }
         
         public set keysDown(value) {
@@ -52,6 +58,8 @@
             var keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached["keyboard"];
             if (keyboard)
                 return keyboard.keysLeft;
+
+            return null;
         }
         
         public set keysLeft(value) {
@@ -64,6 +72,8 @@
             var keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached["keyboard"];
             if (keyboard)
                 return keyboard.keysRight;
+
+            return null;
         }
         
         public set keysRight(value) {

+ 4 - 0
src/Cameras/babylon.gamepadCamera.ts

@@ -8,6 +8,8 @@ module BABYLON {
             var gamepad = <FreeCameraGamepadInput>this.inputs.attached["gamepad"];
             if (gamepad)
                 return gamepad.gamepadAngularSensibility;
+
+            return null;
         }
         
         public set gamepadAngularSensibility(value) {
@@ -20,6 +22,8 @@ module BABYLON {
             var gamepad = <FreeCameraGamepadInput>this.inputs.attached["gamepad"];
             if (gamepad)
                 return gamepad.gamepadMoveSensibility;
+
+            return null;
         }
         
         public set gamepadMoveSensibility(value) {

+ 4 - 0
src/Cameras/babylon.touchCamera.ts

@@ -8,6 +8,8 @@ module BABYLON {
             var touch = <FreeCameraTouchInput>this.inputs.attached["touch"];
             if (touch)
                 return touch.touchAngularSensibility;
+
+            return null;
         }
         
         public set touchAngularSensibility(value) {
@@ -20,6 +22,8 @@ module BABYLON {
             var touch = <FreeCameraTouchInput>this.inputs.attached["touch"];
             if (touch)
                 return touch.touchMoveSensibility;
+
+            return null;
         }
         
         public set touchMoveSensibility(value) {

+ 4 - 0
src/Cameras/babylon.universalCamera.ts

@@ -8,6 +8,8 @@ module BABYLON {
             var gamepad = <FreeCameraGamepadInput>this.inputs.attached["gamepad"];
             if (gamepad)
                 return gamepad.gamepadAngularSensibility;
+
+            return null;                
         }
         
         public set gamepadAngularSensibility(value) {
@@ -20,6 +22,8 @@ module BABYLON {
             var gamepad = <FreeCameraGamepadInput>this.inputs.attached["gamepad"];
             if (gamepad)
                 return gamepad.gamepadMoveSensibility;
+
+            return null;
         }
         
         public set gamepadMoveSensibility(value) {

+ 2 - 0
src/Lights/babylon.light.ts

@@ -481,6 +481,8 @@
                 case 3:
                     return () => new HemisphericLight(name, Vector3.Zero(), scene);
             }
+
+            return null;
         }
 
         /**

+ 4 - 0
src/Loading/Plugins/babylon.babylonFileLoader.ts

@@ -222,6 +222,8 @@
                     Tools.Log(logOperation("importMesh", parsedData ? parsedData.producer : "Unknown") + (SceneLoader.loggingLevel !== SceneLoader.MINIMAL_LOGGING ? log : ""));
                 }
             }
+
+            return false;
         },
         load: (scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void): boolean => {
             // Entire method running in try block, so ALWAYS logs as far as it got, only actually writes details
@@ -594,6 +596,8 @@
                     Tools.Log(logOperation("importScene", parsedData ? parsedData.producer : "Unknown") + (SceneLoader.loggingLevel !== SceneLoader.MINIMAL_LOGGING ? log : ""));
                 }
             }
+
+            return false;
         }
     });
 }

+ 1 - 1
src/Materials/babylon.effect.ts

@@ -805,7 +805,7 @@
 
         public setMatrices(uniformName: string, matrices: Float32Array): Effect {
             if (!matrices) {
-                return;
+                return this;
             }
 
             this._valueCache[uniformName] = null;

+ 5 - 5
src/Mesh/babylon.abstractMesh.ts

@@ -989,14 +989,14 @@
          */
         public setAbsolutePosition(absolutePosition: Vector3): AbstractMesh {
             if (!absolutePosition) {
-                return;
+                return this;
             }
             var absolutePositionX;
             var absolutePositionY;
             var absolutePositionZ;
             if (absolutePosition.x === undefined) {
                 if (arguments.length < 3) {
-                    return;
+                    return this;
                 }
                 absolutePositionX = arguments[0];
                 absolutePositionY = arguments[1];
@@ -1221,7 +1221,7 @@
          */
         public _updateSubMeshesBoundingInfo(matrix: Matrix): AbstractMesh {
             if (!this.subMeshes) {
-                return;
+                return this;
             }
             for (var subIndex = 0; subIndex < this.subMeshes.length; subIndex++) {
                 var subMesh = this.subMeshes[subIndex];
@@ -1565,7 +1565,7 @@
 
         public applyImpulse(force: Vector3, contactPoint: Vector3): AbstractMesh {
             if (!this.physicsImpostor) {
-                return;
+                return this;
             }
             this.physicsImpostor.applyImpulse(force, contactPoint);
             return this;
@@ -1573,7 +1573,7 @@
 
         public setPhysicsLinkWith(otherMesh: Mesh, pivot1: Vector3, pivot2: Vector3, options?: any): AbstractMesh {
             if (!this.physicsImpostor || !otherMesh.physicsImpostor) {
-                return;
+                return this;
             }
             this.physicsImpostor.createJoint(otherMesh.physicsImpostor, PhysicsJoint.HingeJoint, {
                 mainPivot: pivot1,

+ 7 - 7
src/Mesh/babylon.mesh.ts

@@ -614,7 +614,7 @@
          */
         public refreshBoundingInfo(): Mesh {
             if (this._boundingInfo.isLocked) {
-                return;
+                return this;
             }
             var data = this.getVerticesData(VertexBuffer.PositionKind);
 
@@ -661,7 +661,7 @@
                 }
 
                 if (!needToRecreate) {
-                    return;
+                    return this.subMeshes[0];
                 }
             }
 
@@ -786,7 +786,7 @@
          */
         public updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean, makeItUnique?: boolean): Mesh {
             if (!this._geometry) {
-                return;
+                return this;
             }
             if (!makeItUnique) {
                 this._geometry.updateVerticesData(kind, data, updateExtends);
@@ -824,7 +824,7 @@
          */
         public makeGeometryUnique(): Mesh {
             if (!this._geometry) {
-                return;
+                return this;
             }
             var oldGeometry = this._geometry;
             var geometry = this._geometry.copy(Geometry.RandomId());
@@ -862,7 +862,7 @@
          */
         public updateIndices(indices: IndicesArray, offset?: number): Mesh {
             if (!this._geometry) {
-                return;
+                return this;
             }
 
             this._geometry.updateIndices(indices, offset);
@@ -876,7 +876,7 @@
          */
         public toLeftHanded(): Mesh {
             if (!this._geometry) {
-                return;
+                return this;
             }
             this._geometry.toLeftHanded();
             return this;
@@ -1135,7 +1135,7 @@
 
             this.checkOcclusionQuery();
             if (this._isOccluded) {
-                return;
+                return this;
             }
 
             var scene = this.getScene();

+ 2 - 2
src/Mesh/babylon.subMesh.ts

@@ -125,13 +125,13 @@
             this._lastColliderWorldVertices = null;
 
             if (this.IsGlobal) {
-                return;
+                return this;
             }
             var data = this._renderingMesh.getVerticesData(VertexBuffer.PositionKind);
 
             if (!data) {
                 this._boundingInfo = this._mesh._boundingInfo;
-                return;
+                return this;
             }
 
             var indices = this._renderingMesh.getIndices();

+ 1 - 1
src/Particles/babylon.solidParticleSystem.ts

@@ -583,7 +583,7 @@
         */
         public setParticles(start: number = 0, end: number = this.nbParticles - 1, update: boolean = true): SolidParticleSystem {
             if (!this._updatable) {
-                return;
+                return this;
             }
 
             // custom beforeUpdate

+ 5 - 1
src/Physics/babylon.physicsEngine.ts

@@ -147,12 +147,14 @@
             return this._physicsPlugin;
         }
 
-        public getImpostorForPhysicsObject(object: IPhysicsEnabledObject) {
+        public getImpostorForPhysicsObject(object: IPhysicsEnabledObject): PhysicsImpostor {
             for (var i = 0; i < this._impostors.length; ++i) {
                 if (this._impostors[i].object === object) {
                     return this._impostors[i];
                 }
             }
+
+            return null;
         }
 
         public getImpostorWithPhysicsBody(body: any): PhysicsImpostor {
@@ -161,6 +163,8 @@
                     return this._impostors[i];
                 }
             }
+
+            return null;
         }
     }
 

+ 1 - 1
src/Physics/babylon.physicsImpostor.ts

@@ -146,7 +146,7 @@ module BABYLON {
                 var parentMesh: AbstractMesh = <AbstractMesh>this.object.parent;
                 return parentMesh.physicsImpostor;
             }
-            return;
+            return null;
         }
 
         /**

+ 2 - 0
src/PostProcess/RenderPipeline/babylon.postProcessRenderEffect.ts

@@ -73,6 +73,8 @@ module BABYLON {
                     return this._renderPasses[passName];
                 }
             }
+
+            return null;
         }
 
         public emptyPasses(): void {

+ 3 - 1
src/Tools/babylon.tools.ts

@@ -1199,12 +1199,14 @@
             return name;
         }
 
-        public static first<T>(array: Array<T>, predicate: (item: T) => boolean) {
+        public static First<T>(array: Array<T>, predicate: (item: T) => boolean): T {
             for (let el of array) {
                 if (predicate(el)) {
                     return el;
                 }
             }
+
+            return null;
         }
 
         /**

+ 2 - 2
src/babylon.node.ts

@@ -114,7 +114,7 @@ module BABYLON {
             var index = this._behaviors.indexOf(behavior);
 
             if (index !== -1) {
-                return;
+                return this;
             }
 
             behavior.attach(this);
@@ -127,7 +127,7 @@ module BABYLON {
             var index = this._behaviors.indexOf(behavior);
 
             if (index === -1) {
-                return;
+                return this;
             } 
 
             this._behaviors[index].detach();

+ 1 - 1
src/babylon.scene.ts

@@ -4101,7 +4101,7 @@
 
             if (!this.environmentTexture) {
                 Tools.Warn("Can not create default skybox without environment texture.");
-                return;
+                return null;
             }
 
             // Skybox

+ 2 - 1
src/tsconfig.json

@@ -6,6 +6,7 @@
     "target": "es5",
     "sourceMap": true,
     "noImplicitAny": true,
-    "lib": ["dom", "es2015.promise", "es5"]
+    "lib": ["dom", "es2015.promise", "es5"],
+    "noImplicitReturns": true
   }
 }