Pārlūkot izejas kodu

First try to update bone scaling mechanism

David Catuhe 7 gadi atpakaļ
vecāks
revīzija
54bd696346
36 mainītis faili ar 25598 papildinājumiem un 25392 dzēšanām
  1. 13847 13841
      Playground/babylon.d.txt
  2. BIN
      Playground/scenes/aerobatic_plane.glb
  3. BIN
      Playground/scenes/emoji_heart.glb
  4. BIN
      Playground/scenes/shark.glb
  5. BIN
      Playground/scenes/solar_system.glb
  6. BIN
      Playground/scenes/ufo.glb
  7. 11125 11119
      dist/preview release/babylon.d.ts
  8. 50 50
      dist/preview release/babylon.js
  9. 87 40
      dist/preview release/babylon.max.js
  10. 87 40
      dist/preview release/babylon.no-module.max.js
  11. 52 52
      dist/preview release/babylon.worker.js
  12. 87 40
      dist/preview release/es6.js
  13. 3 3
      dist/preview release/gui/babylon.gui.min.js
  14. 4 4
      dist/preview release/inspector/babylon.inspector.bundle.js
  15. 3 3
      dist/preview release/inspector/babylon.inspector.min.js
  16. 2 2
      dist/preview release/loaders/babylon.glTF1FileLoader.min.js
  17. 2 2
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  18. 3 3
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  19. 1 1
      dist/preview release/loaders/babylon.objFileLoader.min.js
  20. 3 3
      dist/preview release/loaders/babylonjs.loaders.min.js
  21. 1 1
      dist/preview release/materialsLibrary/babylon.customMaterial.min.js
  22. 1 1
      dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js
  23. 1 1
      dist/preview release/materialsLibrary/babylon.waterMaterial.min.js
  24. 3 3
      dist/preview release/materialsLibrary/babylonjs.materials.min.js
  25. 1 1
      dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js
  26. 1 1
      dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js
  27. 1 1
      dist/preview release/postProcessesLibrary/babylonjs.postProcess.min.js
  28. 1 1
      dist/preview release/serializers/babylon.glTF2Serializer.min.js
  29. 1 1
      dist/preview release/serializers/babylonjs.serializers.min.js
  30. 58 58
      dist/preview release/viewer/babylon.viewer.js
  31. 87 40
      dist/preview release/viewer/babylon.viewer.max.js
  32. 12 10
      src/Animations/babylon.runtimeAnimation.ts
  33. 45 68
      src/Bones/babylon.bone.ts
  34. 12 1
      src/Bones/babylon.skeleton.ts
  35. 3 1
      src/babylon.node.ts
  36. 14 0
      src/babylon.scene.ts

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 13847 - 13841
Playground/babylon.d.txt


BIN
Playground/scenes/aerobatic_plane.glb


BIN
Playground/scenes/emoji_heart.glb


BIN
Playground/scenes/shark.glb


BIN
Playground/scenes/solar_system.glb


BIN
Playground/scenes/ufo.glb


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 11125 - 11119
dist/preview release/babylon.d.ts


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 50 - 50
dist/preview release/babylon.js


+ 87 - 40
dist/preview release/babylon.max.js

@@ -17316,6 +17316,9 @@ var BABYLON;
              * Gets or sets the animation properties override
              */
             get: function () {
+                if (!this._animationPropertiesOverride) {
+                    return this._scene.animationPropertiesOverride;
+                }
                 return this._animationPropertiesOverride;
             },
             set: function (value) {
@@ -23234,6 +23237,7 @@ var BABYLON;
              * Gets or sets a boolean indicating if animations are enabled
              */
             this.animationsEnabled = true;
+            this._animationPropertiesOverride = null;
             /**
              * Gets or sets a boolean indicating if a constant deltatime has to be used
              * This is mostly useful for testing purposes when you do not want the animations to scale with the framerate
@@ -23827,6 +23831,19 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(Scene.prototype, "animationPropertiesOverride", {
+            /**
+             * Gets or sets the animation properties override
+             */
+            get: function () {
+                return this._animationPropertiesOverride;
+            },
+            set: function (value) {
+                this._animationPropertiesOverride = value;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(Scene.prototype, "onDispose", {
             /** Sets a function to be executed when this scene is disposed. */
             set: function (callback) {
@@ -51180,15 +51197,7 @@ var BABYLON;
                 }
             }
             if (enableBlending && this._blendingFactor <= 1.0) {
-                if (this._originalBlendValue.prototype) {
-                    if (this._originalBlendValue.prototype.Lerp) {
-                        this._currentValue = this._originalBlendValue.construtor.prototype.Lerp(currentValue, this._originalBlendValue, this._blendingFactor);
-                    }
-                    else {
-                        this._currentValue = currentValue;
-                    }
-                }
-                else if (this._originalBlendValue.m) {
+                if (this._originalBlendValue.m) {
                     if (BABYLON.Animation.AllowMatrixDecomposeForInterpolation) {
                         if (this._currentValue) {
                             BABYLON.Matrix.DecomposeLerpToRef(this._originalBlendValue, currentValue, this._blendingFactor, this._currentValue);
@@ -51206,6 +51215,18 @@ var BABYLON;
                         }
                     }
                 }
+                else if (this._originalBlendValue.constructor) {
+                    var constructor = this._originalBlendValue.constructor;
+                    if (constructor.Lerp) {
+                        this._currentValue = constructor.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);
+                    }
+                    else if (constructor.Slerp) {
+                        this._currentValue = constructor.Slerp(this._originalBlendValue, currentValue, this._blendingFactor);
+                    }
+                    else {
+                        this._currentValue = currentValue;
+                    }
+                }
                 else {
                     this._currentValue = this._originalBlendValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
                 }
@@ -76948,10 +76969,10 @@ var BABYLON;
             return true;
         };
         /**
-         * Translate the bone in local or world space.
-         * @param vec The amount to translate the bone.
-         * @param space The space that the translation is in.
-         * @param mesh The mesh that this bone is attached to.  This is only used in world space.
+         * Translate the bone in local or world space
+         * @param vec The amount to translate the bone
+         * @param space The space that the translation is in
+         * @param mesh The mesh that this bone is attached to.  This is only used in world space
          */
         Bone.prototype.translate = function (vec, space, mesh) {
             if (space === void 0) { space = BABYLON.Space.LOCAL; }
@@ -76991,10 +77012,10 @@ var BABYLON;
             this.markAsDirty();
         };
         /**
-         * Set the postion of the bone in local or world space.
-         * @param position The position to set the bone.
-         * @param space The space that the position is in.
-         * @param mesh The mesh that this bone is attached to.  This is only used in world space.
+         * Set the postion of the bone in local or world space
+         * @param position The position to set the bone
+         * @param space The space that the position is in
+         * @param mesh The mesh that this bone is attached to.  This is only used in world space
          */
         Bone.prototype.setPosition = function (position, space, mesh) {
             if (space === void 0) { space = BABYLON.Space.LOCAL; }
@@ -77031,19 +77052,19 @@ var BABYLON;
             this.markAsDirty();
         };
         /**
-         * Set the absolute postion of the bone (world space).
-         * @param position The position to set the bone.
-         * @param mesh The mesh that this bone is attached to.
+         * Set the absolute postion of the bone (world space)
+         * @param position The position to set the bone
+         * @param mesh The mesh that this bone is attached to
          */
         Bone.prototype.setAbsolutePosition = function (position, mesh) {
             this.setPosition(position, BABYLON.Space.WORLD, mesh);
         };
         /**
-         * Adds an additional scale to the bone on the x, y and z axes.
-         * @param x The additional scale of the bone on the x axis.
-         * @param y The additional scale of the bone on the y axis.
-         * @param z The additional scale of the bone on the z axis.
-         * @param scaleChildren Set this to true if children of the bone should be scaled.
+         * Adds an additional scale to the bone on the x, y and z axes
+         * @param x The additional scale of the bone on the x axis
+         * @param y The additional scale of the bone on the y axis
+         * @param z The additional scale of the bone on the z axis
+         * @param scaleChildren Set this to true if children of the bone should be scaled
          */
         Bone.prototype.setAdditionalScale = function (x, y, z, scaleChildren) {
             if (scaleChildren === void 0) { scaleChildren = false; }
@@ -77174,10 +77195,19 @@ var BABYLON;
          * Set the quaternion rotation of the bone in local of world space.
          * @param quat The quaternion rotation that the bone should be set to.
          * @param space The space that the rotation is in.
-         * @param mesh The mesh that this bone is attached to.  This is only used in world space.
+         * @param mesh The mesh that this bone is attached to. This is only used in world space.
          */
         Bone.prototype.setRotationQuaternion = function (quat, space, mesh) {
             if (space === void 0) { space = BABYLON.Space.LOCAL; }
+            if (space === BABYLON.Space.LOCAL) {
+                var position = Bone._tmpVecs[0];
+                var scaling = Bone._tmpVecs[1];
+                var localMatrix = this.getLocalMatrix();
+                localMatrix.decompose(scaling, undefined, position);
+                BABYLON.Matrix.ComposeToRef(scaling, quat, position, localMatrix);
+                this.markAsDirty();
+                return;
+            }
             var rotMatInv = Bone._tmpMats[0];
             if (!this._getNegativeRotationToRef(rotMatInv, space, mesh)) {
                 return;
@@ -77526,10 +77556,10 @@ var BABYLON;
             return result;
         };
         /**
-         * Copy the rotation matrix of the bone to a matrix.  The rotation can be in either local or world space.
-         * @param space The space that the rotation should be in.
-         * @param mesh The mesh that this bone is attached to.  This is only used in world space.
-         * @param result The quaternion that the rotation should be copied to.
+         * Copy the rotation matrix of the bone to a matrix.  The rotation can be in either local or world space
+         * @param space The space that the rotation should be in
+         * @param mesh The mesh that this bone is attached to.  This is only used in world space
+         * @param result The quaternion that the rotation should be copied to
          */
         Bone.prototype.getRotationMatrixToRef = function (space, mesh, result) {
             if (space === void 0) { space = BABYLON.Space.LOCAL; }
@@ -77552,9 +77582,9 @@ var BABYLON;
             }
         };
         /**
-         * Get the world position of a point that is in the local space of the bone.
+         * Get the world position of a point that is in the local space of the bone
          * @param position The local position
-         * @param mesh The mesh that this bone is attached to.
+         * @param mesh The mesh that this bone is attached to
          * @returns The world position
          */
         Bone.prototype.getAbsolutePositionFromLocal = function (position, mesh) {
@@ -77564,10 +77594,10 @@ var BABYLON;
             return result;
         };
         /**
-         * Get the world position of a point that is in the local space of the bone and copy it to the result param.
+         * Get the world position of a point that is in the local space of the bone and copy it to the result param
          * @param position The local position
-         * @param mesh The mesh that this bone is attached to.
-         * @param result The vector3 that the world position should be copied to.
+         * @param mesh The mesh that this bone is attached to
+         * @param result The vector3 that the world position should be copied to
          */
         Bone.prototype.getAbsolutePositionFromLocalToRef = function (position, mesh, result) {
             if (mesh === void 0) { mesh = null; }
@@ -77588,9 +77618,9 @@ var BABYLON;
             BABYLON.Vector3.TransformCoordinatesToRef(position, tmat, result);
         };
         /**
-         * Get the local position of a point that is in world space.
+         * Get the local position of a point that is in world space
          * @param position The world position
-         * @param mesh The mesh that this bone is attached to.
+         * @param mesh The mesh that this bone is attached to
          * @returns The local position
          */
         Bone.prototype.getLocalPositionFromAbsolute = function (position, mesh) {
@@ -77600,10 +77630,10 @@ var BABYLON;
             return result;
         };
         /**
-         * Get the local position of a point that is in world space and copy it to the result param.
+         * Get the local position of a point that is in world space and copy it to the result param
          * @param position The world position
-         * @param mesh The mesh that this bone is attached to.
-         * @param result The vector3 that the local position should be copied to.
+         * @param mesh The mesh that this bone is attached to
+         * @param result The vector3 that the local position should be copied to
          */
         Bone.prototype.getLocalPositionFromAbsoluteToRef = function (position, mesh, result) {
             if (mesh === void 0) { mesh = null; }
@@ -78313,6 +78343,7 @@ var BABYLON;
              * Specifies if the skeleton should be serialized.
              */
             this.doNotSerialize = false;
+            this._animationPropertiesOverride = null;
             // Events
             /**
              * An event triggered before computing the skeleton's matrices
@@ -78324,6 +78355,22 @@ var BABYLON;
             //make sure it will recalculate the matrix next time prepare is called.
             this._isDirty = true;
         }
+        Object.defineProperty(Skeleton.prototype, "animationPropertiesOverride", {
+            /**
+             * Gets or sets the animation properties override
+             */
+            get: function () {
+                if (!this._animationPropertiesOverride) {
+                    return this._scene.animationPropertiesOverride;
+                }
+                return this._animationPropertiesOverride;
+            },
+            set: function (value) {
+                this._animationPropertiesOverride = value;
+            },
+            enumerable: true,
+            configurable: true
+        });
         // Members
         Skeleton.prototype.getTransformMatrices = function (mesh) {
             if (this.needInitialSkinMatrix && mesh._bonesTransformMatrices) {

+ 87 - 40
dist/preview release/babylon.no-module.max.js

@@ -17283,6 +17283,9 @@ var BABYLON;
              * Gets or sets the animation properties override
              */
             get: function () {
+                if (!this._animationPropertiesOverride) {
+                    return this._scene.animationPropertiesOverride;
+                }
                 return this._animationPropertiesOverride;
             },
             set: function (value) {
@@ -23201,6 +23204,7 @@ var BABYLON;
              * Gets or sets a boolean indicating if animations are enabled
              */
             this.animationsEnabled = true;
+            this._animationPropertiesOverride = null;
             /**
              * Gets or sets a boolean indicating if a constant deltatime has to be used
              * This is mostly useful for testing purposes when you do not want the animations to scale with the framerate
@@ -23794,6 +23798,19 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(Scene.prototype, "animationPropertiesOverride", {
+            /**
+             * Gets or sets the animation properties override
+             */
+            get: function () {
+                return this._animationPropertiesOverride;
+            },
+            set: function (value) {
+                this._animationPropertiesOverride = value;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(Scene.prototype, "onDispose", {
             /** Sets a function to be executed when this scene is disposed. */
             set: function (callback) {
@@ -51147,15 +51164,7 @@ var BABYLON;
                 }
             }
             if (enableBlending && this._blendingFactor <= 1.0) {
-                if (this._originalBlendValue.prototype) {
-                    if (this._originalBlendValue.prototype.Lerp) {
-                        this._currentValue = this._originalBlendValue.construtor.prototype.Lerp(currentValue, this._originalBlendValue, this._blendingFactor);
-                    }
-                    else {
-                        this._currentValue = currentValue;
-                    }
-                }
-                else if (this._originalBlendValue.m) {
+                if (this._originalBlendValue.m) {
                     if (BABYLON.Animation.AllowMatrixDecomposeForInterpolation) {
                         if (this._currentValue) {
                             BABYLON.Matrix.DecomposeLerpToRef(this._originalBlendValue, currentValue, this._blendingFactor, this._currentValue);
@@ -51173,6 +51182,18 @@ var BABYLON;
                         }
                     }
                 }
+                else if (this._originalBlendValue.constructor) {
+                    var constructor = this._originalBlendValue.constructor;
+                    if (constructor.Lerp) {
+                        this._currentValue = constructor.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);
+                    }
+                    else if (constructor.Slerp) {
+                        this._currentValue = constructor.Slerp(this._originalBlendValue, currentValue, this._blendingFactor);
+                    }
+                    else {
+                        this._currentValue = currentValue;
+                    }
+                }
                 else {
                     this._currentValue = this._originalBlendValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
                 }
@@ -76915,10 +76936,10 @@ var BABYLON;
             return true;
         };
         /**
-         * Translate the bone in local or world space.
-         * @param vec The amount to translate the bone.
-         * @param space The space that the translation is in.
-         * @param mesh The mesh that this bone is attached to.  This is only used in world space.
+         * Translate the bone in local or world space
+         * @param vec The amount to translate the bone
+         * @param space The space that the translation is in
+         * @param mesh The mesh that this bone is attached to.  This is only used in world space
          */
         Bone.prototype.translate = function (vec, space, mesh) {
             if (space === void 0) { space = BABYLON.Space.LOCAL; }
@@ -76958,10 +76979,10 @@ var BABYLON;
             this.markAsDirty();
         };
         /**
-         * Set the postion of the bone in local or world space.
-         * @param position The position to set the bone.
-         * @param space The space that the position is in.
-         * @param mesh The mesh that this bone is attached to.  This is only used in world space.
+         * Set the postion of the bone in local or world space
+         * @param position The position to set the bone
+         * @param space The space that the position is in
+         * @param mesh The mesh that this bone is attached to.  This is only used in world space
          */
         Bone.prototype.setPosition = function (position, space, mesh) {
             if (space === void 0) { space = BABYLON.Space.LOCAL; }
@@ -76998,19 +77019,19 @@ var BABYLON;
             this.markAsDirty();
         };
         /**
-         * Set the absolute postion of the bone (world space).
-         * @param position The position to set the bone.
-         * @param mesh The mesh that this bone is attached to.
+         * Set the absolute postion of the bone (world space)
+         * @param position The position to set the bone
+         * @param mesh The mesh that this bone is attached to
          */
         Bone.prototype.setAbsolutePosition = function (position, mesh) {
             this.setPosition(position, BABYLON.Space.WORLD, mesh);
         };
         /**
-         * Adds an additional scale to the bone on the x, y and z axes.
-         * @param x The additional scale of the bone on the x axis.
-         * @param y The additional scale of the bone on the y axis.
-         * @param z The additional scale of the bone on the z axis.
-         * @param scaleChildren Set this to true if children of the bone should be scaled.
+         * Adds an additional scale to the bone on the x, y and z axes
+         * @param x The additional scale of the bone on the x axis
+         * @param y The additional scale of the bone on the y axis
+         * @param z The additional scale of the bone on the z axis
+         * @param scaleChildren Set this to true if children of the bone should be scaled
          */
         Bone.prototype.setAdditionalScale = function (x, y, z, scaleChildren) {
             if (scaleChildren === void 0) { scaleChildren = false; }
@@ -77141,10 +77162,19 @@ var BABYLON;
          * Set the quaternion rotation of the bone in local of world space.
          * @param quat The quaternion rotation that the bone should be set to.
          * @param space The space that the rotation is in.
-         * @param mesh The mesh that this bone is attached to.  This is only used in world space.
+         * @param mesh The mesh that this bone is attached to. This is only used in world space.
          */
         Bone.prototype.setRotationQuaternion = function (quat, space, mesh) {
             if (space === void 0) { space = BABYLON.Space.LOCAL; }
+            if (space === BABYLON.Space.LOCAL) {
+                var position = Bone._tmpVecs[0];
+                var scaling = Bone._tmpVecs[1];
+                var localMatrix = this.getLocalMatrix();
+                localMatrix.decompose(scaling, undefined, position);
+                BABYLON.Matrix.ComposeToRef(scaling, quat, position, localMatrix);
+                this.markAsDirty();
+                return;
+            }
             var rotMatInv = Bone._tmpMats[0];
             if (!this._getNegativeRotationToRef(rotMatInv, space, mesh)) {
                 return;
@@ -77493,10 +77523,10 @@ var BABYLON;
             return result;
         };
         /**
-         * Copy the rotation matrix of the bone to a matrix.  The rotation can be in either local or world space.
-         * @param space The space that the rotation should be in.
-         * @param mesh The mesh that this bone is attached to.  This is only used in world space.
-         * @param result The quaternion that the rotation should be copied to.
+         * Copy the rotation matrix of the bone to a matrix.  The rotation can be in either local or world space
+         * @param space The space that the rotation should be in
+         * @param mesh The mesh that this bone is attached to.  This is only used in world space
+         * @param result The quaternion that the rotation should be copied to
          */
         Bone.prototype.getRotationMatrixToRef = function (space, mesh, result) {
             if (space === void 0) { space = BABYLON.Space.LOCAL; }
@@ -77519,9 +77549,9 @@ var BABYLON;
             }
         };
         /**
-         * Get the world position of a point that is in the local space of the bone.
+         * Get the world position of a point that is in the local space of the bone
          * @param position The local position
-         * @param mesh The mesh that this bone is attached to.
+         * @param mesh The mesh that this bone is attached to
          * @returns The world position
          */
         Bone.prototype.getAbsolutePositionFromLocal = function (position, mesh) {
@@ -77531,10 +77561,10 @@ var BABYLON;
             return result;
         };
         /**
-         * Get the world position of a point that is in the local space of the bone and copy it to the result param.
+         * Get the world position of a point that is in the local space of the bone and copy it to the result param
          * @param position The local position
-         * @param mesh The mesh that this bone is attached to.
-         * @param result The vector3 that the world position should be copied to.
+         * @param mesh The mesh that this bone is attached to
+         * @param result The vector3 that the world position should be copied to
          */
         Bone.prototype.getAbsolutePositionFromLocalToRef = function (position, mesh, result) {
             if (mesh === void 0) { mesh = null; }
@@ -77555,9 +77585,9 @@ var BABYLON;
             BABYLON.Vector3.TransformCoordinatesToRef(position, tmat, result);
         };
         /**
-         * Get the local position of a point that is in world space.
+         * Get the local position of a point that is in world space
          * @param position The world position
-         * @param mesh The mesh that this bone is attached to.
+         * @param mesh The mesh that this bone is attached to
          * @returns The local position
          */
         Bone.prototype.getLocalPositionFromAbsolute = function (position, mesh) {
@@ -77567,10 +77597,10 @@ var BABYLON;
             return result;
         };
         /**
-         * Get the local position of a point that is in world space and copy it to the result param.
+         * Get the local position of a point that is in world space and copy it to the result param
          * @param position The world position
-         * @param mesh The mesh that this bone is attached to.
-         * @param result The vector3 that the local position should be copied to.
+         * @param mesh The mesh that this bone is attached to
+         * @param result The vector3 that the local position should be copied to
          */
         Bone.prototype.getLocalPositionFromAbsoluteToRef = function (position, mesh, result) {
             if (mesh === void 0) { mesh = null; }
@@ -78280,6 +78310,7 @@ var BABYLON;
              * Specifies if the skeleton should be serialized.
              */
             this.doNotSerialize = false;
+            this._animationPropertiesOverride = null;
             // Events
             /**
              * An event triggered before computing the skeleton's matrices
@@ -78291,6 +78322,22 @@ var BABYLON;
             //make sure it will recalculate the matrix next time prepare is called.
             this._isDirty = true;
         }
+        Object.defineProperty(Skeleton.prototype, "animationPropertiesOverride", {
+            /**
+             * Gets or sets the animation properties override
+             */
+            get: function () {
+                if (!this._animationPropertiesOverride) {
+                    return this._scene.animationPropertiesOverride;
+                }
+                return this._animationPropertiesOverride;
+            },
+            set: function (value) {
+                this._animationPropertiesOverride = value;
+            },
+            enumerable: true,
+            configurable: true
+        });
         // Members
         Skeleton.prototype.getTransformMatrices = function (mesh) {
             if (this.needInitialSkinMatrix && mesh._bonesTransformMatrices) {

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 52 - 52
dist/preview release/babylon.worker.js


+ 87 - 40
dist/preview release/es6.js

@@ -17283,6 +17283,9 @@ var BABYLON;
              * Gets or sets the animation properties override
              */
             get: function () {
+                if (!this._animationPropertiesOverride) {
+                    return this._scene.animationPropertiesOverride;
+                }
                 return this._animationPropertiesOverride;
             },
             set: function (value) {
@@ -23201,6 +23204,7 @@ var BABYLON;
              * Gets or sets a boolean indicating if animations are enabled
              */
             this.animationsEnabled = true;
+            this._animationPropertiesOverride = null;
             /**
              * Gets or sets a boolean indicating if a constant deltatime has to be used
              * This is mostly useful for testing purposes when you do not want the animations to scale with the framerate
@@ -23794,6 +23798,19 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(Scene.prototype, "animationPropertiesOverride", {
+            /**
+             * Gets or sets the animation properties override
+             */
+            get: function () {
+                return this._animationPropertiesOverride;
+            },
+            set: function (value) {
+                this._animationPropertiesOverride = value;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(Scene.prototype, "onDispose", {
             /** Sets a function to be executed when this scene is disposed. */
             set: function (callback) {
@@ -51147,15 +51164,7 @@ var BABYLON;
                 }
             }
             if (enableBlending && this._blendingFactor <= 1.0) {
-                if (this._originalBlendValue.prototype) {
-                    if (this._originalBlendValue.prototype.Lerp) {
-                        this._currentValue = this._originalBlendValue.construtor.prototype.Lerp(currentValue, this._originalBlendValue, this._blendingFactor);
-                    }
-                    else {
-                        this._currentValue = currentValue;
-                    }
-                }
-                else if (this._originalBlendValue.m) {
+                if (this._originalBlendValue.m) {
                     if (BABYLON.Animation.AllowMatrixDecomposeForInterpolation) {
                         if (this._currentValue) {
                             BABYLON.Matrix.DecomposeLerpToRef(this._originalBlendValue, currentValue, this._blendingFactor, this._currentValue);
@@ -51173,6 +51182,18 @@ var BABYLON;
                         }
                     }
                 }
+                else if (this._originalBlendValue.constructor) {
+                    var constructor = this._originalBlendValue.constructor;
+                    if (constructor.Lerp) {
+                        this._currentValue = constructor.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);
+                    }
+                    else if (constructor.Slerp) {
+                        this._currentValue = constructor.Slerp(this._originalBlendValue, currentValue, this._blendingFactor);
+                    }
+                    else {
+                        this._currentValue = currentValue;
+                    }
+                }
                 else {
                     this._currentValue = this._originalBlendValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
                 }
@@ -76915,10 +76936,10 @@ var BABYLON;
             return true;
         };
         /**
-         * Translate the bone in local or world space.
-         * @param vec The amount to translate the bone.
-         * @param space The space that the translation is in.
-         * @param mesh The mesh that this bone is attached to.  This is only used in world space.
+         * Translate the bone in local or world space
+         * @param vec The amount to translate the bone
+         * @param space The space that the translation is in
+         * @param mesh The mesh that this bone is attached to.  This is only used in world space
          */
         Bone.prototype.translate = function (vec, space, mesh) {
             if (space === void 0) { space = BABYLON.Space.LOCAL; }
@@ -76958,10 +76979,10 @@ var BABYLON;
             this.markAsDirty();
         };
         /**
-         * Set the postion of the bone in local or world space.
-         * @param position The position to set the bone.
-         * @param space The space that the position is in.
-         * @param mesh The mesh that this bone is attached to.  This is only used in world space.
+         * Set the postion of the bone in local or world space
+         * @param position The position to set the bone
+         * @param space The space that the position is in
+         * @param mesh The mesh that this bone is attached to.  This is only used in world space
          */
         Bone.prototype.setPosition = function (position, space, mesh) {
             if (space === void 0) { space = BABYLON.Space.LOCAL; }
@@ -76998,19 +77019,19 @@ var BABYLON;
             this.markAsDirty();
         };
         /**
-         * Set the absolute postion of the bone (world space).
-         * @param position The position to set the bone.
-         * @param mesh The mesh that this bone is attached to.
+         * Set the absolute postion of the bone (world space)
+         * @param position The position to set the bone
+         * @param mesh The mesh that this bone is attached to
          */
         Bone.prototype.setAbsolutePosition = function (position, mesh) {
             this.setPosition(position, BABYLON.Space.WORLD, mesh);
         };
         /**
-         * Adds an additional scale to the bone on the x, y and z axes.
-         * @param x The additional scale of the bone on the x axis.
-         * @param y The additional scale of the bone on the y axis.
-         * @param z The additional scale of the bone on the z axis.
-         * @param scaleChildren Set this to true if children of the bone should be scaled.
+         * Adds an additional scale to the bone on the x, y and z axes
+         * @param x The additional scale of the bone on the x axis
+         * @param y The additional scale of the bone on the y axis
+         * @param z The additional scale of the bone on the z axis
+         * @param scaleChildren Set this to true if children of the bone should be scaled
          */
         Bone.prototype.setAdditionalScale = function (x, y, z, scaleChildren) {
             if (scaleChildren === void 0) { scaleChildren = false; }
@@ -77141,10 +77162,19 @@ var BABYLON;
          * Set the quaternion rotation of the bone in local of world space.
          * @param quat The quaternion rotation that the bone should be set to.
          * @param space The space that the rotation is in.
-         * @param mesh The mesh that this bone is attached to.  This is only used in world space.
+         * @param mesh The mesh that this bone is attached to. This is only used in world space.
          */
         Bone.prototype.setRotationQuaternion = function (quat, space, mesh) {
             if (space === void 0) { space = BABYLON.Space.LOCAL; }
+            if (space === BABYLON.Space.LOCAL) {
+                var position = Bone._tmpVecs[0];
+                var scaling = Bone._tmpVecs[1];
+                var localMatrix = this.getLocalMatrix();
+                localMatrix.decompose(scaling, undefined, position);
+                BABYLON.Matrix.ComposeToRef(scaling, quat, position, localMatrix);
+                this.markAsDirty();
+                return;
+            }
             var rotMatInv = Bone._tmpMats[0];
             if (!this._getNegativeRotationToRef(rotMatInv, space, mesh)) {
                 return;
@@ -77493,10 +77523,10 @@ var BABYLON;
             return result;
         };
         /**
-         * Copy the rotation matrix of the bone to a matrix.  The rotation can be in either local or world space.
-         * @param space The space that the rotation should be in.
-         * @param mesh The mesh that this bone is attached to.  This is only used in world space.
-         * @param result The quaternion that the rotation should be copied to.
+         * Copy the rotation matrix of the bone to a matrix.  The rotation can be in either local or world space
+         * @param space The space that the rotation should be in
+         * @param mesh The mesh that this bone is attached to.  This is only used in world space
+         * @param result The quaternion that the rotation should be copied to
          */
         Bone.prototype.getRotationMatrixToRef = function (space, mesh, result) {
             if (space === void 0) { space = BABYLON.Space.LOCAL; }
@@ -77519,9 +77549,9 @@ var BABYLON;
             }
         };
         /**
-         * Get the world position of a point that is in the local space of the bone.
+         * Get the world position of a point that is in the local space of the bone
          * @param position The local position
-         * @param mesh The mesh that this bone is attached to.
+         * @param mesh The mesh that this bone is attached to
          * @returns The world position
          */
         Bone.prototype.getAbsolutePositionFromLocal = function (position, mesh) {
@@ -77531,10 +77561,10 @@ var BABYLON;
             return result;
         };
         /**
-         * Get the world position of a point that is in the local space of the bone and copy it to the result param.
+         * Get the world position of a point that is in the local space of the bone and copy it to the result param
          * @param position The local position
-         * @param mesh The mesh that this bone is attached to.
-         * @param result The vector3 that the world position should be copied to.
+         * @param mesh The mesh that this bone is attached to
+         * @param result The vector3 that the world position should be copied to
          */
         Bone.prototype.getAbsolutePositionFromLocalToRef = function (position, mesh, result) {
             if (mesh === void 0) { mesh = null; }
@@ -77555,9 +77585,9 @@ var BABYLON;
             BABYLON.Vector3.TransformCoordinatesToRef(position, tmat, result);
         };
         /**
-         * Get the local position of a point that is in world space.
+         * Get the local position of a point that is in world space
          * @param position The world position
-         * @param mesh The mesh that this bone is attached to.
+         * @param mesh The mesh that this bone is attached to
          * @returns The local position
          */
         Bone.prototype.getLocalPositionFromAbsolute = function (position, mesh) {
@@ -77567,10 +77597,10 @@ var BABYLON;
             return result;
         };
         /**
-         * Get the local position of a point that is in world space and copy it to the result param.
+         * Get the local position of a point that is in world space and copy it to the result param
          * @param position The world position
-         * @param mesh The mesh that this bone is attached to.
-         * @param result The vector3 that the local position should be copied to.
+         * @param mesh The mesh that this bone is attached to
+         * @param result The vector3 that the local position should be copied to
          */
         Bone.prototype.getLocalPositionFromAbsoluteToRef = function (position, mesh, result) {
             if (mesh === void 0) { mesh = null; }
@@ -78280,6 +78310,7 @@ var BABYLON;
              * Specifies if the skeleton should be serialized.
              */
             this.doNotSerialize = false;
+            this._animationPropertiesOverride = null;
             // Events
             /**
              * An event triggered before computing the skeleton's matrices
@@ -78291,6 +78322,22 @@ var BABYLON;
             //make sure it will recalculate the matrix next time prepare is called.
             this._isDirty = true;
         }
+        Object.defineProperty(Skeleton.prototype, "animationPropertiesOverride", {
+            /**
+             * Gets or sets the animation properties override
+             */
+            get: function () {
+                if (!this._animationPropertiesOverride) {
+                    return this._scene.animationPropertiesOverride;
+                }
+                return this._animationPropertiesOverride;
+            },
+            set: function (value) {
+                this._animationPropertiesOverride = value;
+            },
+            enumerable: true,
+            configurable: true
+        });
         // Members
         Skeleton.prototype.getTransformMatrices = function (mesh) {
             if (this.needInitialSkinMatrix && mesh._bonesTransformMatrices) {

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 3 - 3
dist/preview release/gui/babylon.gui.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 4 - 4
dist/preview release/inspector/babylon.inspector.bundle.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 3 - 3
dist/preview release/inspector/babylon.inspector.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 2 - 2
dist/preview release/loaders/babylon.glTF1FileLoader.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 2 - 2
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 3 - 3
dist/preview release/loaders/babylon.glTFFileLoader.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/loaders/babylon.objFileLoader.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 3 - 3
dist/preview release/loaders/babylonjs.loaders.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/materialsLibrary/babylon.customMaterial.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/materialsLibrary/babylon.waterMaterial.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 3 - 3
dist/preview release/materialsLibrary/babylonjs.materials.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/postProcessesLibrary/babylonjs.postProcess.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/serializers/babylon.glTF2Serializer.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/serializers/babylonjs.serializers.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 58 - 58
dist/preview release/viewer/babylon.viewer.js


+ 87 - 40
dist/preview release/viewer/babylon.viewer.max.js

@@ -17404,6 +17404,9 @@ var BABYLON;
              * Gets or sets the animation properties override
              */
             get: function () {
+                if (!this._animationPropertiesOverride) {
+                    return this._scene.animationPropertiesOverride;
+                }
                 return this._animationPropertiesOverride;
             },
             set: function (value) {
@@ -23322,6 +23325,7 @@ var BABYLON;
              * Gets or sets a boolean indicating if animations are enabled
              */
             this.animationsEnabled = true;
+            this._animationPropertiesOverride = null;
             /**
              * Gets or sets a boolean indicating if a constant deltatime has to be used
              * This is mostly useful for testing purposes when you do not want the animations to scale with the framerate
@@ -23915,6 +23919,19 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(Scene.prototype, "animationPropertiesOverride", {
+            /**
+             * Gets or sets the animation properties override
+             */
+            get: function () {
+                return this._animationPropertiesOverride;
+            },
+            set: function (value) {
+                this._animationPropertiesOverride = value;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(Scene.prototype, "onDispose", {
             /** Sets a function to be executed when this scene is disposed. */
             set: function (callback) {
@@ -51268,15 +51285,7 @@ var BABYLON;
                 }
             }
             if (enableBlending && this._blendingFactor <= 1.0) {
-                if (this._originalBlendValue.prototype) {
-                    if (this._originalBlendValue.prototype.Lerp) {
-                        this._currentValue = this._originalBlendValue.construtor.prototype.Lerp(currentValue, this._originalBlendValue, this._blendingFactor);
-                    }
-                    else {
-                        this._currentValue = currentValue;
-                    }
-                }
-                else if (this._originalBlendValue.m) {
+                if (this._originalBlendValue.m) {
                     if (BABYLON.Animation.AllowMatrixDecomposeForInterpolation) {
                         if (this._currentValue) {
                             BABYLON.Matrix.DecomposeLerpToRef(this._originalBlendValue, currentValue, this._blendingFactor, this._currentValue);
@@ -51294,6 +51303,18 @@ var BABYLON;
                         }
                     }
                 }
+                else if (this._originalBlendValue.constructor) {
+                    var constructor = this._originalBlendValue.constructor;
+                    if (constructor.Lerp) {
+                        this._currentValue = constructor.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);
+                    }
+                    else if (constructor.Slerp) {
+                        this._currentValue = constructor.Slerp(this._originalBlendValue, currentValue, this._blendingFactor);
+                    }
+                    else {
+                        this._currentValue = currentValue;
+                    }
+                }
                 else {
                     this._currentValue = this._originalBlendValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
                 }
@@ -77036,10 +77057,10 @@ var BABYLON;
             return true;
         };
         /**
-         * Translate the bone in local or world space.
-         * @param vec The amount to translate the bone.
-         * @param space The space that the translation is in.
-         * @param mesh The mesh that this bone is attached to.  This is only used in world space.
+         * Translate the bone in local or world space
+         * @param vec The amount to translate the bone
+         * @param space The space that the translation is in
+         * @param mesh The mesh that this bone is attached to.  This is only used in world space
          */
         Bone.prototype.translate = function (vec, space, mesh) {
             if (space === void 0) { space = BABYLON.Space.LOCAL; }
@@ -77079,10 +77100,10 @@ var BABYLON;
             this.markAsDirty();
         };
         /**
-         * Set the postion of the bone in local or world space.
-         * @param position The position to set the bone.
-         * @param space The space that the position is in.
-         * @param mesh The mesh that this bone is attached to.  This is only used in world space.
+         * Set the postion of the bone in local or world space
+         * @param position The position to set the bone
+         * @param space The space that the position is in
+         * @param mesh The mesh that this bone is attached to.  This is only used in world space
          */
         Bone.prototype.setPosition = function (position, space, mesh) {
             if (space === void 0) { space = BABYLON.Space.LOCAL; }
@@ -77119,19 +77140,19 @@ var BABYLON;
             this.markAsDirty();
         };
         /**
-         * Set the absolute postion of the bone (world space).
-         * @param position The position to set the bone.
-         * @param mesh The mesh that this bone is attached to.
+         * Set the absolute postion of the bone (world space)
+         * @param position The position to set the bone
+         * @param mesh The mesh that this bone is attached to
          */
         Bone.prototype.setAbsolutePosition = function (position, mesh) {
             this.setPosition(position, BABYLON.Space.WORLD, mesh);
         };
         /**
-         * Adds an additional scale to the bone on the x, y and z axes.
-         * @param x The additional scale of the bone on the x axis.
-         * @param y The additional scale of the bone on the y axis.
-         * @param z The additional scale of the bone on the z axis.
-         * @param scaleChildren Set this to true if children of the bone should be scaled.
+         * Adds an additional scale to the bone on the x, y and z axes
+         * @param x The additional scale of the bone on the x axis
+         * @param y The additional scale of the bone on the y axis
+         * @param z The additional scale of the bone on the z axis
+         * @param scaleChildren Set this to true if children of the bone should be scaled
          */
         Bone.prototype.setAdditionalScale = function (x, y, z, scaleChildren) {
             if (scaleChildren === void 0) { scaleChildren = false; }
@@ -77262,10 +77283,19 @@ var BABYLON;
          * Set the quaternion rotation of the bone in local of world space.
          * @param quat The quaternion rotation that the bone should be set to.
          * @param space The space that the rotation is in.
-         * @param mesh The mesh that this bone is attached to.  This is only used in world space.
+         * @param mesh The mesh that this bone is attached to. This is only used in world space.
          */
         Bone.prototype.setRotationQuaternion = function (quat, space, mesh) {
             if (space === void 0) { space = BABYLON.Space.LOCAL; }
+            if (space === BABYLON.Space.LOCAL) {
+                var position = Bone._tmpVecs[0];
+                var scaling = Bone._tmpVecs[1];
+                var localMatrix = this.getLocalMatrix();
+                localMatrix.decompose(scaling, undefined, position);
+                BABYLON.Matrix.ComposeToRef(scaling, quat, position, localMatrix);
+                this.markAsDirty();
+                return;
+            }
             var rotMatInv = Bone._tmpMats[0];
             if (!this._getNegativeRotationToRef(rotMatInv, space, mesh)) {
                 return;
@@ -77614,10 +77644,10 @@ var BABYLON;
             return result;
         };
         /**
-         * Copy the rotation matrix of the bone to a matrix.  The rotation can be in either local or world space.
-         * @param space The space that the rotation should be in.
-         * @param mesh The mesh that this bone is attached to.  This is only used in world space.
-         * @param result The quaternion that the rotation should be copied to.
+         * Copy the rotation matrix of the bone to a matrix.  The rotation can be in either local or world space
+         * @param space The space that the rotation should be in
+         * @param mesh The mesh that this bone is attached to.  This is only used in world space
+         * @param result The quaternion that the rotation should be copied to
          */
         Bone.prototype.getRotationMatrixToRef = function (space, mesh, result) {
             if (space === void 0) { space = BABYLON.Space.LOCAL; }
@@ -77640,9 +77670,9 @@ var BABYLON;
             }
         };
         /**
-         * Get the world position of a point that is in the local space of the bone.
+         * Get the world position of a point that is in the local space of the bone
          * @param position The local position
-         * @param mesh The mesh that this bone is attached to.
+         * @param mesh The mesh that this bone is attached to
          * @returns The world position
          */
         Bone.prototype.getAbsolutePositionFromLocal = function (position, mesh) {
@@ -77652,10 +77682,10 @@ var BABYLON;
             return result;
         };
         /**
-         * Get the world position of a point that is in the local space of the bone and copy it to the result param.
+         * Get the world position of a point that is in the local space of the bone and copy it to the result param
          * @param position The local position
-         * @param mesh The mesh that this bone is attached to.
-         * @param result The vector3 that the world position should be copied to.
+         * @param mesh The mesh that this bone is attached to
+         * @param result The vector3 that the world position should be copied to
          */
         Bone.prototype.getAbsolutePositionFromLocalToRef = function (position, mesh, result) {
             if (mesh === void 0) { mesh = null; }
@@ -77676,9 +77706,9 @@ var BABYLON;
             BABYLON.Vector3.TransformCoordinatesToRef(position, tmat, result);
         };
         /**
-         * Get the local position of a point that is in world space.
+         * Get the local position of a point that is in world space
          * @param position The world position
-         * @param mesh The mesh that this bone is attached to.
+         * @param mesh The mesh that this bone is attached to
          * @returns The local position
          */
         Bone.prototype.getLocalPositionFromAbsolute = function (position, mesh) {
@@ -77688,10 +77718,10 @@ var BABYLON;
             return result;
         };
         /**
-         * Get the local position of a point that is in world space and copy it to the result param.
+         * Get the local position of a point that is in world space and copy it to the result param
          * @param position The world position
-         * @param mesh The mesh that this bone is attached to.
-         * @param result The vector3 that the local position should be copied to.
+         * @param mesh The mesh that this bone is attached to
+         * @param result The vector3 that the local position should be copied to
          */
         Bone.prototype.getLocalPositionFromAbsoluteToRef = function (position, mesh, result) {
             if (mesh === void 0) { mesh = null; }
@@ -78401,6 +78431,7 @@ var BABYLON;
              * Specifies if the skeleton should be serialized.
              */
             this.doNotSerialize = false;
+            this._animationPropertiesOverride = null;
             // Events
             /**
              * An event triggered before computing the skeleton's matrices
@@ -78412,6 +78443,22 @@ var BABYLON;
             //make sure it will recalculate the matrix next time prepare is called.
             this._isDirty = true;
         }
+        Object.defineProperty(Skeleton.prototype, "animationPropertiesOverride", {
+            /**
+             * Gets or sets the animation properties override
+             */
+            get: function () {
+                if (!this._animationPropertiesOverride) {
+                    return this._scene.animationPropertiesOverride;
+                }
+                return this._animationPropertiesOverride;
+            },
+            set: function (value) {
+                this._animationPropertiesOverride = value;
+            },
+            enumerable: true,
+            configurable: true
+        });
         // Members
         Skeleton.prototype.getTransformMatrices = function (mesh) {
             if (this.needInitialSkinMatrix && mesh._bonesTransformMatrices) {

+ 12 - 10
src/Animations/babylon.runtimeAnimation.ts

@@ -313,15 +313,7 @@
             }
 
             if (enableBlending && this._blendingFactor <= 1.0) {
-                if (this._originalBlendValue.prototype) { // Complex value
-                    
-                    if (this._originalBlendValue.prototype.Lerp) { // Lerp supported
-                        this._currentValue = this._originalBlendValue.construtor.prototype.Lerp(currentValue, this._originalBlendValue, this._blendingFactor);
-                    } else { // Blending not supported
-                        this._currentValue = currentValue;
-                    }
-
-                } else if (this._originalBlendValue.m) { // Matrix
+                if (this._originalBlendValue.m) { // Matrix
                     if (Animation.AllowMatrixDecomposeForInterpolation) {
                         if (this._currentValue) {
                             Matrix.DecomposeLerpToRef(this._originalBlendValue, currentValue, this._blendingFactor, this._currentValue);
@@ -335,7 +327,17 @@
                             this._currentValue = Matrix.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);
                         }
                     }
-                } else { // Direct value
+                } else if (this._originalBlendValue.constructor) { // Complex value
+                    let constructor = this._originalBlendValue.constructor;
+                    if (constructor.Lerp) { // Lerp supported
+                        this._currentValue = constructor.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);
+                    } else if (constructor.Slerp) { // Slerp supported
+                        this._currentValue = constructor.Slerp(this._originalBlendValue, currentValue, this._blendingFactor);
+                    } else { // Blending not supported
+                        this._currentValue = currentValue;
+                    }
+
+                } else  { // Direct value
                     this._currentValue = this._originalBlendValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
                 }
                 this._blendingFactor += blendingSpeed;

+ 45 - 68
src/Bones/babylon.bone.ts

@@ -153,7 +153,7 @@
         /**
          * Gets the animation properties override
          */
-        public get animationPropertiesOverride(): AnimationPropertiesOverride {
+        public get animationPropertiesOverride(): Nullable<AnimationPropertiesOverride> {
             return this._skeleton.animationPropertiesOverride;
         }
 
@@ -258,10 +258,10 @@
         }
 
         /**
-         * Translate the bone in local or world space.
-         * @param vec The amount to translate the bone.
-         * @param space The space that the translation is in.
-         * @param mesh The mesh that this bone is attached to.  This is only used in world space.
+         * Translate the bone in local or world space
+         * @param vec The amount to translate the bone
+         * @param space The space that the translation is in
+         * @param mesh The mesh that this bone is attached to.  This is only used in world space
          */
         public translate(vec: Vector3, space = Space.LOCAL, mesh?: AbstractMesh): void {
             var lm = this.getLocalMatrix();
@@ -305,17 +305,15 @@
             }
 
             this.markAsDirty();
-
         }
 
         /**
-         * Set the postion of the bone in local or world space.
-         * @param position The position to set the bone.
-         * @param space The space that the position is in.
-         * @param mesh The mesh that this bone is attached to.  This is only used in world space.
+         * Set the postion of the bone in local or world space
+         * @param position The position to set the bone
+         * @param space The space that the position is in
+         * @param mesh The mesh that this bone is attached to.  This is only used in world space
          */
         public setPosition(position: Vector3, space = Space.LOCAL, mesh?: AbstractMesh): void {
-
             var lm = this.getLocalMatrix();
 
             if (space == Space.LOCAL) {
@@ -354,26 +352,23 @@
             }
 
             this.markAsDirty();
-
         }
 
         /**
-         * Set the absolute postion of the bone (world space).
-         * @param position The position to set the bone.
-         * @param mesh The mesh that this bone is attached to.
+         * Set the absolute postion of the bone (world space)
+         * @param position The position to set the bone
+         * @param mesh The mesh that this bone is attached to
          */
         public setAbsolutePosition(position: Vector3, mesh?: AbstractMesh) {
-
             this.setPosition(position, Space.WORLD, mesh);
-
         }
 
         /**
-         * Adds an additional scale to the bone on the x, y and z axes.
-         * @param x The additional scale of the bone on the x axis.
-         * @param y The additional scale of the bone on the y axis.
-         * @param z The additional scale of the bone on the z axis.
-         * @param scaleChildren Set this to true if children of the bone should be scaled.
+         * Adds an additional scale to the bone on the x, y and z axes
+         * @param x The additional scale of the bone on the x axis
+         * @param y The additional scale of the bone on the y axis
+         * @param z The additional scale of the bone on the z axis
+         * @param scaleChildren Set this to true if children of the bone should be scaled
          */
         public setAdditionalScale(x: number, y: number, z: number, scaleChildren = false): void {
 
@@ -483,7 +478,6 @@
          * @param mesh The mesh that this bone is attached to.  This is only used in world space.
          */
         public rotate(axis: Vector3, amount: number, space = Space.LOCAL, mesh?: AbstractMesh): void {
-
             var rmat = Bone._tmpMats[0];
             rmat.m[12] = 0;
             rmat.m[13] = 0;
@@ -492,7 +486,6 @@
             Matrix.RotationAxisToRef(axis, amount, rmat);
 
             this._rotateWithMatrix(rmat, space, mesh);
-
         }
 
         /**
@@ -503,7 +496,6 @@
          * @param mesh The mesh that this bone is attached to.  This is only used in world space.
          */
         public setAxisAngle(axis: Vector3, angle: number, space = Space.LOCAL, mesh?: AbstractMesh): void {
-
             var rotMatInv = Bone._tmpMats[0];
             if (!this._getNegativeRotationToRef(rotMatInv, space, mesh)) {
                 return;
@@ -514,7 +506,6 @@
 
             rotMatInv.multiplyToRef(rotMat, rotMat);
             this._rotateWithMatrix(rotMat, space, mesh);
-
         }
 
         /**
@@ -524,18 +515,29 @@
          * @param mesh The mesh that this bone is attached to.  This is only used in world space.
          */
         public setRotation(rotation: Vector3, space = Space.LOCAL, mesh?: AbstractMesh): void {
-
             this.setYawPitchRoll(rotation.y, rotation.x, rotation.z, space, mesh);
-
         }
 
         /**
          * Set the quaternion rotation of the bone in local of world space.
          * @param quat The quaternion rotation that the bone should be set to.
          * @param space The space that the rotation is in.
-         * @param mesh The mesh that this bone is attached to.  This is only used in world space.
+         * @param mesh The mesh that this bone is attached to. This is only used in world space.
          */
         public setRotationQuaternion(quat: Quaternion, space = Space.LOCAL, mesh?: AbstractMesh): void {
+            if (space === Space.LOCAL) {
+                let position = Bone._tmpVecs[0];
+                let scaling = Bone._tmpVecs[1];
+                let localMatrix = this.getLocalMatrix();
+
+                localMatrix.decompose(scaling, undefined, position);
+
+                Matrix.ComposeToRef(scaling, quat, position, localMatrix);
+
+                this.markAsDirty();
+    
+                return;
+            }
 
             var rotMatInv = Bone._tmpMats[0];
             if (!this._getNegativeRotationToRef(rotMatInv, space, mesh)) {
@@ -617,9 +619,7 @@
             lmat.m[14] = lz;
 
             this.computeAbsoluteTransforms();
-
             this.markAsDirty();
-
         }
 
         private _getNegativeRotationToRef(rotMatInv: Matrix, space = Space.LOCAL, mesh?: AbstractMesh): boolean {
@@ -748,13 +748,11 @@
          * @returns The absolute position of the bone
          */
         public getAbsolutePosition(mesh: Nullable<AbstractMesh> = null): Vector3 {
-
             var pos = Vector3.Zero();
 
             this.getPositionToRef(Space.WORLD, mesh, pos);
 
             return pos;
-
         }
 
         /**
@@ -763,16 +761,13 @@
          * @param result The vector3 to copy the absolute position to.
          */
         public getAbsolutePositionToRef(mesh: AbstractMesh, result: Vector3) {
-
             this.getPositionToRef(Space.WORLD, mesh, result);
-
         }
 
         /**
          * Compute the absolute transforms of this bone and its children.
          */
         public computeAbsoluteTransforms(): void {
-
             if (this._parent) {
                 this._localMatrix.multiplyToRef(this._parent._absoluteTransform, this._absoluteTransform);
             } else {
@@ -791,11 +786,9 @@
             for (var i = 0; i < len; i++) {
                 children[i].computeAbsoluteTransforms();
             }
-
         }
 
         private _syncScaleVector(): void {
-
             var lm = this.getLocalMatrix();
 
             var xsq = (lm.m[0] * lm.m[0] + lm.m[1] * lm.m[1] + lm.m[2] * lm.m[2]);
@@ -817,7 +810,6 @@
             }
 
             Matrix.FromValuesToRef(this._scaleVector.x, 0, 0, 0, 0, this._scaleVector.y, 0, 0, 0, 0, this._scaleVector.z, 0, 0, 0, 0, 1, this._scaleMatrix);
-
         }
 
         /**
@@ -906,13 +898,11 @@
          * @returns The quaternion rotation
          */
         public getRotationQuaternion(space = Space.LOCAL, mesh: Nullable<AbstractMesh> = null): Quaternion {
-
             var result = Quaternion.Identity();
 
             this.getRotationQuaternionToRef(space, mesh, result);
 
             return result;
-
         }
 
         /**
@@ -922,13 +912,9 @@
          * @param result The quaternion that the rotation should be copied to.
          */
         public getRotationQuaternionToRef(space = Space.LOCAL, mesh: Nullable<AbstractMesh> = null, result: Quaternion): void {
-
             if (space == Space.LOCAL) {
-
                 this.getLocalMatrix().decompose(undefined, result, undefined);
-
             } else {
-
                 var mat = Bone._tmpMats[0];
                 var amat = this.getAbsoluteTransform();
 
@@ -943,7 +929,6 @@
                 mat.m[2] *= this._scalingDeterminant;
 
                 mat.decompose(undefined, result, undefined);
-
             }
         }
 
@@ -954,23 +939,20 @@
          * @returns The rotation matrix
          */
         public getRotationMatrix(space = Space.LOCAL, mesh: AbstractMesh): Matrix {
-
             var result = Matrix.Identity();
 
             this.getRotationMatrixToRef(space, mesh, result);
 
             return result;
-
         }
 
         /**
-         * Copy the rotation matrix of the bone to a matrix.  The rotation can be in either local or world space.
-         * @param space The space that the rotation should be in.
-         * @param mesh The mesh that this bone is attached to.  This is only used in world space.
-         * @param result The quaternion that the rotation should be copied to.
+         * Copy the rotation matrix of the bone to a matrix.  The rotation can be in either local or world space
+         * @param space The space that the rotation should be in
+         * @param mesh The mesh that this bone is attached to.  This is only used in world space
+         * @param result The quaternion that the rotation should be copied to
          */
         public getRotationMatrixToRef(space = Space.LOCAL, mesh: AbstractMesh, result: Matrix): void {
-
             if (space == Space.LOCAL) {
 
                 this.getLocalMatrix().getRotationMatrixToRef(result);
@@ -991,15 +973,13 @@
                 mat.m[2] *= this._scalingDeterminant;
 
                 mat.getRotationMatrixToRef(result);
-
             }
-
         }
 
         /**
-         * Get the world position of a point that is in the local space of the bone.
+         * Get the world position of a point that is in the local space of the bone
          * @param position The local position
-         * @param mesh The mesh that this bone is attached to.
+         * @param mesh The mesh that this bone is attached to
          * @returns The world position
          */
         public getAbsolutePositionFromLocal(position: Vector3, mesh: Nullable<AbstractMesh> = null): Vector3 {
@@ -1013,10 +993,10 @@
         }
 
         /**
-         * Get the world position of a point that is in the local space of the bone and copy it to the result param.
+         * Get the world position of a point that is in the local space of the bone and copy it to the result param
          * @param position The local position
-         * @param mesh The mesh that this bone is attached to.
-         * @param result The vector3 that the world position should be copied to.
+         * @param mesh The mesh that this bone is attached to
+         * @param result The vector3 that the world position should be copied to
          */
         public getAbsolutePositionFromLocalToRef(position: Vector3, mesh: Nullable<AbstractMesh> = null, result: Vector3): void {
 
@@ -1043,9 +1023,9 @@
         }
 
         /**
-         * Get the local position of a point that is in world space.
+         * Get the local position of a point that is in world space
          * @param position The world position
-         * @param mesh The mesh that this bone is attached to.
+         * @param mesh The mesh that this bone is attached to
          * @returns The local position
          */
         public getLocalPositionFromAbsolute(position: Vector3, mesh: Nullable<AbstractMesh> = null): Vector3 {
@@ -1059,13 +1039,12 @@
         }
 
         /**
-         * Get the local position of a point that is in world space and copy it to the result param.
+         * Get the local position of a point that is in world space and copy it to the result param
          * @param position The world position
-         * @param mesh The mesh that this bone is attached to.
-         * @param result The vector3 that the local position should be copied to.
+         * @param mesh The mesh that this bone is attached to
+         * @param result The vector3 that the local position should be copied to
          */
         public getLocalPositionFromAbsoluteToRef(position: Vector3, mesh: Nullable<AbstractMesh> = null, result: Vector3): void {
-
             var wm: Nullable<Matrix> = null;
 
             //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()
@@ -1086,8 +1065,6 @@
             tmat.invert();
 
             Vector3.TransformCoordinatesToRef(position, tmat, result);
-
         }
-
     }
 } 

+ 12 - 1
src/Bones/babylon.skeleton.ts

@@ -23,10 +23,21 @@
          */
         public doNotSerialize = false;        
 
+        private _animationPropertiesOverride: Nullable<AnimationPropertiesOverride> = null;
+
         /**
          * Gets or sets the animation properties override
          */
-        public animationPropertiesOverride: AnimationPropertiesOverride;        
+        public get animationPropertiesOverride(): Nullable<AnimationPropertiesOverride> {
+            if (!this._animationPropertiesOverride) {
+                return this._scene.animationPropertiesOverride;
+            }
+            return this._animationPropertiesOverride;
+        }
+
+        public set animationPropertiesOverride(value: Nullable<AnimationPropertiesOverride>) {
+            this._animationPropertiesOverride = value;
+        }    
 
         // Events
         /**

+ 3 - 1
src/babylon.node.ts

@@ -109,7 +109,6 @@
         public get parent(): Nullable<Node> {
             return this._parentNode;
         }
-
         
         private _animationPropertiesOverride: Nullable<AnimationPropertiesOverride> = null;
 
@@ -117,6 +116,9 @@
          * Gets or sets the animation properties override
          */
         public get animationPropertiesOverride(): Nullable<AnimationPropertiesOverride> {
+            if (!this._animationPropertiesOverride) {
+                return this._scene.animationPropertiesOverride;
+            }
             return this._animationPropertiesOverride;
         }
 

+ 14 - 0
src/babylon.scene.ts

@@ -256,6 +256,20 @@
          * Gets or sets a boolean indicating if animations are enabled
          */
         public animationsEnabled = true;
+
+        private _animationPropertiesOverride: Nullable<AnimationPropertiesOverride> = null;
+
+        /**
+         * Gets or sets the animation properties override
+         */
+        public get animationPropertiesOverride(): Nullable<AnimationPropertiesOverride> {
+            return this._animationPropertiesOverride;
+        }
+
+        public set animationPropertiesOverride(value: Nullable<AnimationPropertiesOverride>) {
+            this._animationPropertiesOverride = value;
+        }
+
         /**
          * Gets or sets a boolean indicating if a constant deltatime has to be used
          * This is mostly useful for testing purposes when you do not want the animations to scale with the framerate