@galacean/effects-specification 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fallback/migration.d.ts +4 -0
- package/dist/fallback.js +23 -3
- package/dist/fallback.js.map +1 -1
- package/dist/fallback.mjs +23 -3
- package/dist/fallback.mjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/src/item/base-item.d.ts +1 -1
- package/dist/src/scene.d.ts +2 -1
- package/package.json +1 -1
package/dist/fallback.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Name: @galacean/effects-specification
|
|
3
3
|
* Description: Galacean Effects JSON Specification
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
|
-
* Version: v0.0.
|
|
5
|
+
* Version: v0.0.2
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
/*********************************************/
|
|
@@ -473,7 +473,7 @@ var ItemEndBehavior;
|
|
|
473
473
|
(function (ItemEndBehavior) {
|
|
474
474
|
ItemEndBehavior[ItemEndBehavior["destroy"] = END_BEHAVIOR_DESTROY] = "destroy";
|
|
475
475
|
ItemEndBehavior[ItemEndBehavior["loop"] = END_BEHAVIOR_RESTART] = "loop";
|
|
476
|
-
ItemEndBehavior[ItemEndBehavior["
|
|
476
|
+
ItemEndBehavior[ItemEndBehavior["freeze"] = END_BEHAVIOR_FREEZE] = "freeze";
|
|
477
477
|
})(ItemEndBehavior || (ItemEndBehavior = {}));
|
|
478
478
|
var ParentItemEndBehavior;
|
|
479
479
|
(function (ParentItemEndBehavior) {
|
|
@@ -1341,7 +1341,7 @@ function version21Migration(json) {
|
|
|
1341
1341
|
composition.items.forEach(function (item) {
|
|
1342
1342
|
if (item.type === ItemType.null) {
|
|
1343
1343
|
if (item.endBehavior === ItemEndBehavior.destroy) {
|
|
1344
|
-
item.endBehavior = ItemEndBehavior.
|
|
1344
|
+
item.endBehavior = ItemEndBehavior.freeze;
|
|
1345
1345
|
}
|
|
1346
1346
|
}
|
|
1347
1347
|
});
|
|
@@ -1349,6 +1349,24 @@ function version21Migration(json) {
|
|
|
1349
1349
|
json.version = '2.1';
|
|
1350
1350
|
return json;
|
|
1351
1351
|
}
|
|
1352
|
+
/**
|
|
1353
|
+
* 2.2 以下版本数据适配(mars-player@2.5.0 及以上版本支持 2.2 以下数据的适配)
|
|
1354
|
+
*/
|
|
1355
|
+
function version22Migration(json) {
|
|
1356
|
+
var _a;
|
|
1357
|
+
var singleVersion = (_a = json.version) === null || _a === void 0 ? void 0 : _a.split('.');
|
|
1358
|
+
if (!singleVersion || Number(singleVersion[0]) > 2 || (Number(singleVersion[0]) === 2 && Number(singleVersion[1]) >= 2)) {
|
|
1359
|
+
return json;
|
|
1360
|
+
}
|
|
1361
|
+
json.compositions.forEach(function (composition) {
|
|
1362
|
+
composition.items.forEach(function (item) {
|
|
1363
|
+
if (item.type === ItemType.mesh || item.type === ItemType.light) {
|
|
1364
|
+
item.endBehavior = item.endBehavior === 1 ? ItemEndBehavior.destroy : item.endBehavior;
|
|
1365
|
+
}
|
|
1366
|
+
});
|
|
1367
|
+
});
|
|
1368
|
+
return json;
|
|
1369
|
+
}
|
|
1352
1370
|
|
|
1353
1371
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
1354
1372
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
@@ -1358,6 +1376,8 @@ function getStandardJSON(json) {
|
|
|
1358
1376
|
if (!json || typeof json !== 'object') {
|
|
1359
1377
|
throw Error('expect a json object');
|
|
1360
1378
|
}
|
|
1379
|
+
// 修正老版本数据中,meshItem以及lightItem结束行为错误问题
|
|
1380
|
+
version22Migration(json);
|
|
1361
1381
|
if (v0.test(json.version)) {
|
|
1362
1382
|
reverseParticle = ((_a = (/^(\d+)/).exec(json.version)) === null || _a === void 0 ? void 0 : _a[0]) === '0';
|
|
1363
1383
|
return version21Migration(getStandardJSONFromV0(json));
|