Browse Source

FInal merge

David Catuhe 7 years ago
parent
commit
0eeb78a9e7

File diff suppressed because it is too large
+ 14978 - 14856
Playground/babylon.d.txt


localDev/dummy.babylon → Playground/scenes/dummy.babylon


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

@@ -15,9 +15,11 @@
 - Added [GlowLayer](https://doc.babylonjs.com/how_to/glow_layer) to easily support glow from emissive materials ([sebavan](https://github.com/sebavan))
 - New [AssetContainer](http://doc.babylonjs.com/how_to/how_to_use_assetcontainer) Class and loading methods ([trevordev](https://github.com/trevordev))
 - Added depth of field, sharpening, MSAA, chromatic aberration and grain effect to the default pipeline ([trevordev](https://github.com/trevordev))
-- Particle System SubEmitters- Spawn new Sub emitter when particles dies. Cone/Sphere shapes emitters ([IbraheemOsama](https://github.com/IbraheemOsama))
+- Added [particle system SubEmitters](http://doc.babylonjs.com/babylon101/particles#sub-emitters) which will spawn new particle systems when particles dies ([IbraheemOsama](https://github.com/IbraheemOsama))
+- New [particle system emitter shapes](http://doc.babylonjs.com/babylon101/particles#particles-shapes): cone and sphere ([IbraheemOsama](https://github.com/IbraheemOsama))
 - New [Babylon.js](http://doc.babylonjs.com/resources/maya) and [glTF](http://doc.babylonjs.com/resources/maya_to_gltf) exporter for Autodesk Maya ([Noalak](https://github.com/Noalak))
 - New [glTF exporter](http://doc.babylonjs.com/resources/3dsmax_to_gltf) for Autodesk 3dsmax ([Noalak](https://github.com/Noalak))
+- Added support for [animation weights](http://doc.babylonjs.com/babylon101/animations#animation-weights). Demo [here](https://www.babylonjs-playground.com/#IQN716#2). ([deltakosh](https://github.com/deltakosh))
 
 ## Updates
 

+ 7 - 1
src/Animations/babylon.animatable.ts

@@ -18,6 +18,12 @@
         }
 
         public set weight(value: number) {
+            if (value === -1) { // -1 is ok and means no weight
+                this._weight = -1;
+                return;
+            }
+
+            // Else weight must be in [0, 1] range
             this._weight = Math.min(Math.max(value, 0), 1.0);
         }
 
@@ -95,7 +101,7 @@
             // Reset to original value
             for (index = 0; index < runtimeAnimations.length; index++) {
                 var animation = runtimeAnimations[index];
-                animation.animate(0, this.fromFrame, this.toFrame, false, this._speedRatio, 1.0);
+                animation.animate(0, this.fromFrame, this.toFrame, false, this._speedRatio);
             }
 
             this._localDelayOffset = null;

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

@@ -249,10 +249,18 @@
             
             if (enableBlending && this._blendingFactor <= 1.0 || weight !== -1.0) {
                 if (!this._originalValue) {
-                    if (destination[path].clone) {
-                        this._originalValue = destination[path].clone();
+                    let originalValue: any;
+
+                    if (destination.getRestPose) { // For bones
+                        originalValue = destination.getRestPose();
+                    } else {
+                        originalValue = destination[path]
+                    }
+
+                    if (originalValue.clone) {
+                        this._originalValue = originalValue.clone();
                     } else {
-                        this._originalValue = destination[path];
+                        this._originalValue = originalValue;
                     }
                 }
             }
@@ -320,7 +328,7 @@
         private _previousDelay: number;
         private _previousRatio: number;
 
-        public animate(delay: number, from: number, to: number, loop: boolean, speedRatio: number, weight = 1.0): boolean {
+        public animate(delay: number, from: number, to: number, loop: boolean, speedRatio: number, weight = -1.0): boolean {
             let targetPropertyPath = this._animation.targetPropertyPath
             if (!targetPropertyPath || targetPropertyPath.length < 1) {
                 this._stopped = true;

+ 3 - 3
src/Engine/babylon.engine.ts

@@ -2634,7 +2634,7 @@
             this._drawCalls.addCount(1, false);
             // Render
 
-            const drawMode = this.DrawMode(fillMode);
+            const drawMode = this._drawMode(fillMode);
             var indexFormat = this._uintIndicesCurrentlySet ? this._gl.UNSIGNED_INT : this._gl.UNSIGNED_SHORT;
             var mult = this._uintIndicesCurrentlySet ? 4 : 2;
             if (instancesCount) {
@@ -2649,7 +2649,7 @@
             this.applyStates();
             this._drawCalls.addCount(1, false);
 
-            const drawMode = this.DrawMode(fillMode);
+            const drawMode = this._drawMode(fillMode);
             if (instancesCount) {
                 this._gl.drawArraysInstanced(drawMode, verticesStart, verticesCount, instancesCount);
             } else {
@@ -2657,7 +2657,7 @@
             }
         }
 
-        private DrawMode(fillMode: number): number {
+        private _drawMode(fillMode: number): number {
             switch (fillMode) {
                 // Triangle views
                 case Material.TriangleFillMode:

+ 0 - 3
src/babylon.scene.ts

@@ -2244,9 +2244,6 @@
 
         /** @ignore */
         public _registerTargetForLateAnimationBinding(runtimeAnimation: RuntimeAnimation): void {
-            if (runtimeAnimation.weight === 0) {
-                return;
-            }
             let target = runtimeAnimation.target;
             this._registeredForLateAnimationBindings.pushNoDuplicate(target);