David Catuhe 5 年之前
父節點
當前提交
83f127207e

+ 6 - 6
dist/preview release/babylon.d.ts

@@ -32647,18 +32647,18 @@ declare module BABYLON {
          */
          */
         static AppendSerializedAnimations(source: IAnimatable, destination: any): void;
         static AppendSerializedAnimations(source: IAnimatable, destination: any): void;
         /**
         /**
-         * Creates a new animation from a snippet saved in a remote file
+         * Creates a new animation or an array of animations from a snippet saved in a remote file
          * @param name defines the name of the animation to create (can be null or empty to use the one from the json data)
          * @param name defines the name of the animation to create (can be null or empty to use the one from the json data)
          * @param url defines the url to load from
          * @param url defines the url to load from
-         * @returns a promise that will resolve to the new animation
+         * @returns a promise that will resolve to the new animation or an array of animations
          */
          */
-        static ParseFromFileAsync(name: Nullable<string>, url: string): Promise<Animation>;
+        static ParseFromFileAsync(name: Nullable<string>, url: string): Promise<Animation | Array<Animation>>;
         /**
         /**
-         * Creates an animation from a snippet saved by the Inspector
+         * Creates an animation or an array of animations from a snippet saved by the Inspector
          * @param snippetId defines the snippet to load
          * @param snippetId defines the snippet to load
-         * @returns a promise that will resolve to the new animation
+         * @returns a promise that will resolve to the new animation or a new array of animations
          */
          */
-        static CreateFromSnippetAsync(snippetId: string): Promise<Animation>;
+        static CreateFromSnippetAsync(snippetId: string): Promise<Animation | Array<Animation>>;
     }
     }
 }
 }
 declare module BABYLON {
 declare module BABYLON {

文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/babylon.js


+ 54 - 26
dist/preview release/babylon.max.js

@@ -4371,10 +4371,10 @@ var Animation = /** @class */ (function () {
         _Misc_decorators__WEBPACK_IMPORTED_MODULE_3__["SerializationHelper"].AppendSerializedAnimations(source, destination);
         _Misc_decorators__WEBPACK_IMPORTED_MODULE_3__["SerializationHelper"].AppendSerializedAnimations(source, destination);
     };
     };
     /**
     /**
-     * Creates a new animation from a snippet saved in a remote file
+     * Creates a new animation or an array of animations from a snippet saved in a remote file
      * @param name defines the name of the animation to create (can be null or empty to use the one from the json data)
      * @param name defines the name of the animation to create (can be null or empty to use the one from the json data)
      * @param url defines the url to load from
      * @param url defines the url to load from
-     * @returns a promise that will resolve to the new animation
+     * @returns a promise that will resolve to the new animation or an array of animations
      */
      */
     Animation.ParseFromFileAsync = function (name, url) {
     Animation.ParseFromFileAsync = function (name, url) {
         var _this = this;
         var _this = this;
@@ -4384,11 +4384,21 @@ var Animation = /** @class */ (function () {
                 if (request.readyState == 4) {
                 if (request.readyState == 4) {
                     if (request.status == 200) {
                     if (request.status == 200) {
                         var serializationObject = JSON.parse(request.responseText);
                         var serializationObject = JSON.parse(request.responseText);
-                        var output = _this.Parse(serializationObject);
-                        if (name) {
-                            output.name = name;
+                        if (serializationObject.length) {
+                            var output = new Array();
+                            for (var _i = 0, serializationObject_1 = serializationObject; _i < serializationObject_1.length; _i++) {
+                                var serializedAnimation = serializationObject_1[_i];
+                                output.push(_this.Parse(serializedAnimation));
+                            }
+                            resolve(output);
+                        }
+                        else {
+                            var output = _this.Parse(serializationObject);
+                            if (name) {
+                                output.name = name;
+                            }
+                            resolve(output);
                         }
                         }
-                        resolve(output);
                     }
                     }
                     else {
                     else {
                         reject("Unable to load the animation");
                         reject("Unable to load the animation");
@@ -4400,9 +4410,9 @@ var Animation = /** @class */ (function () {
         });
         });
     };
     };
     /**
     /**
-     * Creates an animation from a snippet saved by the Inspector
+     * Creates an animation or an array of animations from a snippet saved by the Inspector
      * @param snippetId defines the snippet to load
      * @param snippetId defines the snippet to load
-     * @returns a promise that will resolve to the new animation
+     * @returns a promise that will resolve to the new animation or a new array of animations
      */
      */
     Animation.CreateFromSnippetAsync = function (snippetId) {
     Animation.CreateFromSnippetAsync = function (snippetId) {
         var _this = this;
         var _this = this;
@@ -4412,10 +4422,21 @@ var Animation = /** @class */ (function () {
                 if (request.readyState == 4) {
                 if (request.readyState == 4) {
                     if (request.status == 200) {
                     if (request.status == 200) {
                         var snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);
                         var snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);
-                        var serializationObject = JSON.parse(snippet.animation);
-                        var output = _this.Parse(serializationObject);
-                        output.snippetId = snippetId;
-                        resolve(output);
+                        if (snippet.animations) {
+                            var serializationObject = JSON.parse(snippet.animations);
+                            var output = new Array();
+                            for (var _i = 0, serializationObject_2 = serializationObject; _i < serializationObject_2.length; _i++) {
+                                var serializedAnimation = serializationObject_2[_i];
+                                output.push(_this.Parse(serializedAnimation));
+                            }
+                            resolve(output);
+                        }
+                        else {
+                            var serializationObject = JSON.parse(snippet.animation);
+                            var output = _this.Parse(serializationObject);
+                            output.snippetId = snippetId;
+                            resolve(output);
+                        }
                     }
                     }
                     else {
                     else {
                         reject("Unable to load the snippet " + snippetId);
                         reject("Unable to load the snippet " + snippetId);
@@ -117011,22 +117032,24 @@ function decodeMesh(decoderModule, dataView, attributes, onIndicesData, onAttrib
             try {
             try {
                 decoder.GetAttributeFloatForAllPoints(geometry, attribute, dracoData);
                 decoder.GetAttributeFloatForAllPoints(geometry, attribute, dracoData);
                 var numComponents = attribute.num_components();
                 var numComponents = attribute.num_components();
-                if (kind === "color" && numComponents === 3) {
-                    var babylonData = new Float32Array(numPoints_1 * 4);
-                    for (var i = 0, j = 0; i < babylonData.length; i += 4, j += numComponents) {
-                        babylonData[i + 0] = dracoData.GetValue(j + 0);
-                        babylonData[i + 1] = dracoData.GetValue(j + 1);
-                        babylonData[i + 2] = dracoData.GetValue(j + 2);
-                        babylonData[i + 3] = 1;
+                if (numComponents) {
+                    if (kind === "color" && numComponents === 3) {
+                        var babylonData = new Float32Array(numPoints_1 * 4);
+                        for (var i = 0, j = 0; i < babylonData.length; i += 4, j += numComponents) {
+                            babylonData[i + 0] = dracoData.GetValue(j + 0);
+                            babylonData[i + 1] = dracoData.GetValue(j + 1);
+                            babylonData[i + 2] = dracoData.GetValue(j + 2);
+                            babylonData[i + 3] = 1;
+                        }
+                        onAttributeData(kind, babylonData);
                     }
                     }
-                    onAttributeData(kind, babylonData);
-                }
-                else {
-                    var babylonData = new Float32Array(numPoints_1 * numComponents);
-                    for (var i = 0; i < babylonData.length; i++) {
-                        babylonData[i] = dracoData.GetValue(i);
+                    else {
+                        var babylonData = new Float32Array(numPoints_1 * numComponents);
+                        for (var i = 0; i < babylonData.length; i++) {
+                            babylonData[i] = dracoData.GetValue(i);
+                        }
+                        onAttributeData(kind, babylonData);
                     }
                     }
-                    onAttributeData(kind, babylonData);
                 }
                 }
             }
             }
             finally {
             finally {
@@ -127318,6 +127341,8 @@ __webpack_require__.r(__webpack_exports__);
 /* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/buffer */ "./Meshes/buffer.ts");
 /* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/buffer */ "./Meshes/buffer.ts");
 /* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/devTools */ "./Misc/devTools.ts");
 /* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/devTools */ "./Misc/devTools.ts");
 /* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.color */ "./Maths/math.color.ts");
 /* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.color */ "./Maths/math.color.ts");
+/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Misc/logger */ "./Misc/logger.ts");
+
 
 
 
 
 
 
@@ -127334,6 +127359,9 @@ var VertexData = /** @class */ (function () {
      * @param kind the type of data that is being set, eg positions, colors etc
      * @param kind the type of data that is being set, eg positions, colors etc
      */
      */
     VertexData.prototype.set = function (data, kind) {
     VertexData.prototype.set = function (data, kind) {
+        if (!data.length) {
+            _Misc_logger__WEBPACK_IMPORTED_MODULE_4__["Logger"].Warn("Setting vertex data kind '" + kind + "' with an empty array");
+        }
         switch (kind) {
         switch (kind) {
             case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].PositionKind:
             case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].PositionKind:
                 this.positions = data;
                 this.positions = data;

文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/babylon.max.js.map


+ 12 - 12
dist/preview release/babylon.module.d.ts

@@ -33764,18 +33764,18 @@ declare module "babylonjs/Animations/animation" {
          */
          */
         static AppendSerializedAnimations(source: IAnimatable, destination: any): void;
         static AppendSerializedAnimations(source: IAnimatable, destination: any): void;
         /**
         /**
-         * Creates a new animation from a snippet saved in a remote file
+         * Creates a new animation or an array of animations from a snippet saved in a remote file
          * @param name defines the name of the animation to create (can be null or empty to use the one from the json data)
          * @param name defines the name of the animation to create (can be null or empty to use the one from the json data)
          * @param url defines the url to load from
          * @param url defines the url to load from
-         * @returns a promise that will resolve to the new animation
+         * @returns a promise that will resolve to the new animation or an array of animations
          */
          */
-        static ParseFromFileAsync(name: Nullable<string>, url: string): Promise<Animation>;
+        static ParseFromFileAsync(name: Nullable<string>, url: string): Promise<Animation | Array<Animation>>;
         /**
         /**
-         * Creates an animation from a snippet saved by the Inspector
+         * Creates an animation or an array of animations from a snippet saved by the Inspector
          * @param snippetId defines the snippet to load
          * @param snippetId defines the snippet to load
-         * @returns a promise that will resolve to the new animation
+         * @returns a promise that will resolve to the new animation or a new array of animations
          */
          */
-        static CreateFromSnippetAsync(snippetId: string): Promise<Animation>;
+        static CreateFromSnippetAsync(snippetId: string): Promise<Animation | Array<Animation>>;
     }
     }
 }
 }
 declare module "babylonjs/Animations/animatable.interface" {
 declare module "babylonjs/Animations/animatable.interface" {
@@ -110163,18 +110163,18 @@ declare module BABYLON {
          */
          */
         static AppendSerializedAnimations(source: IAnimatable, destination: any): void;
         static AppendSerializedAnimations(source: IAnimatable, destination: any): void;
         /**
         /**
-         * Creates a new animation from a snippet saved in a remote file
+         * Creates a new animation or an array of animations from a snippet saved in a remote file
          * @param name defines the name of the animation to create (can be null or empty to use the one from the json data)
          * @param name defines the name of the animation to create (can be null or empty to use the one from the json data)
          * @param url defines the url to load from
          * @param url defines the url to load from
-         * @returns a promise that will resolve to the new animation
+         * @returns a promise that will resolve to the new animation or an array of animations
          */
          */
-        static ParseFromFileAsync(name: Nullable<string>, url: string): Promise<Animation>;
+        static ParseFromFileAsync(name: Nullable<string>, url: string): Promise<Animation | Array<Animation>>;
         /**
         /**
-         * Creates an animation from a snippet saved by the Inspector
+         * Creates an animation or an array of animations from a snippet saved by the Inspector
          * @param snippetId defines the snippet to load
          * @param snippetId defines the snippet to load
-         * @returns a promise that will resolve to the new animation
+         * @returns a promise that will resolve to the new animation or a new array of animations
          */
          */
-        static CreateFromSnippetAsync(snippetId: string): Promise<Animation>;
+        static CreateFromSnippetAsync(snippetId: string): Promise<Animation | Array<Animation>>;
     }
     }
 }
 }
 declare module BABYLON {
 declare module BABYLON {

+ 6 - 6
dist/preview release/documentation.d.ts

@@ -32647,18 +32647,18 @@ declare module BABYLON {
          */
          */
         static AppendSerializedAnimations(source: IAnimatable, destination: any): void;
         static AppendSerializedAnimations(source: IAnimatable, destination: any): void;
         /**
         /**
-         * Creates a new animation from a snippet saved in a remote file
+         * Creates a new animation or an array of animations from a snippet saved in a remote file
          * @param name defines the name of the animation to create (can be null or empty to use the one from the json data)
          * @param name defines the name of the animation to create (can be null or empty to use the one from the json data)
          * @param url defines the url to load from
          * @param url defines the url to load from
-         * @returns a promise that will resolve to the new animation
+         * @returns a promise that will resolve to the new animation or an array of animations
          */
          */
-        static ParseFromFileAsync(name: Nullable<string>, url: string): Promise<Animation>;
+        static ParseFromFileAsync(name: Nullable<string>, url: string): Promise<Animation | Array<Animation>>;
         /**
         /**
-         * Creates an animation from a snippet saved by the Inspector
+         * Creates an animation or an array of animations from a snippet saved by the Inspector
          * @param snippetId defines the snippet to load
          * @param snippetId defines the snippet to load
-         * @returns a promise that will resolve to the new animation
+         * @returns a promise that will resolve to the new animation or a new array of animations
          */
          */
-        static CreateFromSnippetAsync(snippetId: string): Promise<Animation>;
+        static CreateFromSnippetAsync(snippetId: string): Promise<Animation | Array<Animation>>;
     }
     }
 }
 }
 declare module BABYLON {
 declare module BABYLON {

+ 1 - 1
dist/preview release/packagesSizeBaseLine.json

@@ -1 +1 @@
-{"thinEngineOnly":116011,"engineOnly":152414,"sceneOnly":505526,"minGridMaterial":648479,"minStandardMaterial":791757}
+{"thinEngineOnly":116011,"engineOnly":152414,"sceneOnly":505608,"minGridMaterial":648561,"minStandardMaterial":791839}

+ 12 - 12
dist/preview release/viewer/babylon.module.d.ts

@@ -33764,18 +33764,18 @@ declare module "babylonjs/Animations/animation" {
          */
          */
         static AppendSerializedAnimations(source: IAnimatable, destination: any): void;
         static AppendSerializedAnimations(source: IAnimatable, destination: any): void;
         /**
         /**
-         * Creates a new animation from a snippet saved in a remote file
+         * Creates a new animation or an array of animations from a snippet saved in a remote file
          * @param name defines the name of the animation to create (can be null or empty to use the one from the json data)
          * @param name defines the name of the animation to create (can be null or empty to use the one from the json data)
          * @param url defines the url to load from
          * @param url defines the url to load from
-         * @returns a promise that will resolve to the new animation
+         * @returns a promise that will resolve to the new animation or an array of animations
          */
          */
-        static ParseFromFileAsync(name: Nullable<string>, url: string): Promise<Animation>;
+        static ParseFromFileAsync(name: Nullable<string>, url: string): Promise<Animation | Array<Animation>>;
         /**
         /**
-         * Creates an animation from a snippet saved by the Inspector
+         * Creates an animation or an array of animations from a snippet saved by the Inspector
          * @param snippetId defines the snippet to load
          * @param snippetId defines the snippet to load
-         * @returns a promise that will resolve to the new animation
+         * @returns a promise that will resolve to the new animation or a new array of animations
          */
          */
-        static CreateFromSnippetAsync(snippetId: string): Promise<Animation>;
+        static CreateFromSnippetAsync(snippetId: string): Promise<Animation | Array<Animation>>;
     }
     }
 }
 }
 declare module "babylonjs/Animations/animatable.interface" {
 declare module "babylonjs/Animations/animatable.interface" {
@@ -110163,18 +110163,18 @@ declare module BABYLON {
          */
          */
         static AppendSerializedAnimations(source: IAnimatable, destination: any): void;
         static AppendSerializedAnimations(source: IAnimatable, destination: any): void;
         /**
         /**
-         * Creates a new animation from a snippet saved in a remote file
+         * Creates a new animation or an array of animations from a snippet saved in a remote file
          * @param name defines the name of the animation to create (can be null or empty to use the one from the json data)
          * @param name defines the name of the animation to create (can be null or empty to use the one from the json data)
          * @param url defines the url to load from
          * @param url defines the url to load from
-         * @returns a promise that will resolve to the new animation
+         * @returns a promise that will resolve to the new animation or an array of animations
          */
          */
-        static ParseFromFileAsync(name: Nullable<string>, url: string): Promise<Animation>;
+        static ParseFromFileAsync(name: Nullable<string>, url: string): Promise<Animation | Array<Animation>>;
         /**
         /**
-         * Creates an animation from a snippet saved by the Inspector
+         * Creates an animation or an array of animations from a snippet saved by the Inspector
          * @param snippetId defines the snippet to load
          * @param snippetId defines the snippet to load
-         * @returns a promise that will resolve to the new animation
+         * @returns a promise that will resolve to the new animation or a new array of animations
          */
          */
-        static CreateFromSnippetAsync(snippetId: string): Promise<Animation>;
+        static CreateFromSnippetAsync(snippetId: string): Promise<Animation | Array<Animation>>;
     }
     }
 }
 }
 declare module BABYLON {
 declare module BABYLON {

文件差異過大導致無法顯示
+ 3 - 3
dist/preview release/viewer/babylon.viewer.js


文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/viewer/babylon.viewer.max.js