|
@@ -4371,10 +4371,10 @@ var Animation = /** @class */ (function () {
|
|
|
_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 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) {
|
|
|
var _this = this;
|
|
@@ -4384,11 +4384,21 @@ var Animation = /** @class */ (function () {
|
|
|
if (request.readyState == 4) {
|
|
|
if (request.status == 200) {
|
|
|
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 {
|
|
|
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
|
|
|
- * @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) {
|
|
|
var _this = this;
|
|
@@ -4412,10 +4422,21 @@ var Animation = /** @class */ (function () {
|
|
|
if (request.readyState == 4) {
|
|
|
if (request.status == 200) {
|
|
|
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 {
|
|
|
reject("Unable to load the snippet " + snippetId);
|
|
@@ -117011,22 +117032,24 @@ function decodeMesh(decoderModule, dataView, attributes, onIndicesData, onAttrib
|
|
|
try {
|
|
|
decoder.GetAttributeFloatForAllPoints(geometry, attribute, dracoData);
|
|
|
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 {
|
|
@@ -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 _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 _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
|
|
|
*/
|
|
|
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) {
|
|
|
case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].PositionKind:
|
|
|
this.positions = data;
|