@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
|
@@ -3,3 +3,7 @@ import type { JSONScene } from '../src/scene';
|
|
|
3
3
|
* 2.1 以下版本数据适配(mars-player@2.4.0 及以上版本支持 2.1 以下数据的适配)
|
|
4
4
|
*/
|
|
5
5
|
export declare function version21Migration(json: JSONScene): JSONScene;
|
|
6
|
+
/**
|
|
7
|
+
* 2.2 以下版本数据适配(mars-player@2.5.0 及以上版本支持 2.2 以下数据的适配)
|
|
8
|
+
*/
|
|
9
|
+
export declare function version22Migration(json: JSONScene): JSONScene;
|
package/dist/fallback.js
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
|
'use strict';
|
|
@@ -477,7 +477,7 @@ var ItemEndBehavior;
|
|
|
477
477
|
(function (ItemEndBehavior) {
|
|
478
478
|
ItemEndBehavior[ItemEndBehavior["destroy"] = END_BEHAVIOR_DESTROY] = "destroy";
|
|
479
479
|
ItemEndBehavior[ItemEndBehavior["loop"] = END_BEHAVIOR_RESTART] = "loop";
|
|
480
|
-
ItemEndBehavior[ItemEndBehavior["
|
|
480
|
+
ItemEndBehavior[ItemEndBehavior["freeze"] = END_BEHAVIOR_FREEZE] = "freeze";
|
|
481
481
|
})(ItemEndBehavior || (ItemEndBehavior = {}));
|
|
482
482
|
var ParentItemEndBehavior;
|
|
483
483
|
(function (ParentItemEndBehavior) {
|
|
@@ -1345,7 +1345,7 @@ function version21Migration(json) {
|
|
|
1345
1345
|
composition.items.forEach(function (item) {
|
|
1346
1346
|
if (item.type === ItemType.null) {
|
|
1347
1347
|
if (item.endBehavior === ItemEndBehavior.destroy) {
|
|
1348
|
-
item.endBehavior = ItemEndBehavior.
|
|
1348
|
+
item.endBehavior = ItemEndBehavior.freeze;
|
|
1349
1349
|
}
|
|
1350
1350
|
}
|
|
1351
1351
|
});
|
|
@@ -1353,6 +1353,24 @@ function version21Migration(json) {
|
|
|
1353
1353
|
json.version = '2.1';
|
|
1354
1354
|
return json;
|
|
1355
1355
|
}
|
|
1356
|
+
/**
|
|
1357
|
+
* 2.2 以下版本数据适配(mars-player@2.5.0 及以上版本支持 2.2 以下数据的适配)
|
|
1358
|
+
*/
|
|
1359
|
+
function version22Migration(json) {
|
|
1360
|
+
var _a;
|
|
1361
|
+
var singleVersion = (_a = json.version) === null || _a === void 0 ? void 0 : _a.split('.');
|
|
1362
|
+
if (!singleVersion || Number(singleVersion[0]) > 2 || (Number(singleVersion[0]) === 2 && Number(singleVersion[1]) >= 2)) {
|
|
1363
|
+
return json;
|
|
1364
|
+
}
|
|
1365
|
+
json.compositions.forEach(function (composition) {
|
|
1366
|
+
composition.items.forEach(function (item) {
|
|
1367
|
+
if (item.type === ItemType.mesh || item.type === ItemType.light) {
|
|
1368
|
+
item.endBehavior = item.endBehavior === 1 ? ItemEndBehavior.destroy : item.endBehavior;
|
|
1369
|
+
}
|
|
1370
|
+
});
|
|
1371
|
+
});
|
|
1372
|
+
return json;
|
|
1373
|
+
}
|
|
1356
1374
|
|
|
1357
1375
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
1358
1376
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
@@ -1362,6 +1380,8 @@ function getStandardJSON(json) {
|
|
|
1362
1380
|
if (!json || typeof json !== 'object') {
|
|
1363
1381
|
throw Error('expect a json object');
|
|
1364
1382
|
}
|
|
1383
|
+
// 修正老版本数据中,meshItem以及lightItem结束行为错误问题
|
|
1384
|
+
version22Migration(json);
|
|
1365
1385
|
if (v0.test(json.version)) {
|
|
1366
1386
|
reverseParticle = ((_a = (/^(\d+)/).exec(json.version)) === null || _a === void 0 ? void 0 : _a[0]) === '0';
|
|
1367
1387
|
return version21Migration(getStandardJSONFromV0(json));
|