@galacean/effects-specification 2.0.0-alpha.5 → 2.0.0-alpha.7
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/index.d.ts +2 -2
- package/dist/fallback.js +181 -222
- package/dist/fallback.js.map +1 -1
- package/dist/fallback.mjs +181 -222
- package/dist/fallback.mjs.map +1 -1
- package/dist/index.js +2 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -9
- package/dist/index.mjs.map +1 -1
- package/dist/src/components.d.ts +1 -1
- package/dist/src/image.d.ts +13 -25
- package/dist/src/index.d.ts +0 -1
- package/dist/src/item/base-item.d.ts +1 -2
- package/dist/src/item/camera-item.d.ts +1 -1
- package/dist/src/item/particle-item.d.ts +0 -3
- package/dist/src/item.d.ts +1 -2
- package/dist/src/scene.d.ts +1 -5
- package/dist/src/text.d.ts +0 -6
- package/dist/src/type.d.ts +0 -4
- package/package.json +1 -1
- package/dist/fallback/filter.d.ts +0 -2
- package/dist/src/item/filter-item.d.ts +0 -99
package/dist/fallback/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BaseItem, Composition, CompressedImage, Image, JSONScene, ParticleItem, RenderLevel, SpriteItem, TemplateImage
|
|
1
|
+
import type { BaseItem, Composition, CompressedImage, Image, JSONScene, ParticleItem, RenderLevel, SpriteItem, TemplateImage } from '../src';
|
|
2
2
|
export * from './utils';
|
|
3
3
|
export declare function getStandardJSON(json: any): JSONScene;
|
|
4
4
|
export declare function getStandardImage(image: any, index: number, imageTags: RenderLevel[]): TemplateImage | Image | CompressedImage;
|
|
@@ -9,4 +9,4 @@ export declare function getStandardComposition(composition: any, opt?: {
|
|
|
9
9
|
export declare function getStandardItem(item: any, opt?: {
|
|
10
10
|
plugins?: string[];
|
|
11
11
|
requires?: string[];
|
|
12
|
-
}): SpriteItem | ParticleItem | BaseItem
|
|
12
|
+
}): SpriteItem | ParticleItem | BaseItem;
|
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: v2.0.0-alpha.
|
|
5
|
+
* Version: v2.0.0-alpha.7
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
'use strict';
|
|
@@ -378,10 +378,6 @@ var ItemType;
|
|
|
378
378
|
* 预合成元素
|
|
379
379
|
*/
|
|
380
380
|
ItemType["composition"] = "7";
|
|
381
|
-
/**
|
|
382
|
-
* 滤镜图层
|
|
383
|
-
*/
|
|
384
|
-
ItemType["filter"] = "8";
|
|
385
381
|
/**
|
|
386
382
|
* Spine 元素
|
|
387
383
|
*/
|
|
@@ -530,7 +526,7 @@ var CompositionEndBehavior;
|
|
|
530
526
|
|
|
531
527
|
/**
|
|
532
528
|
* 动态换图类型
|
|
533
|
-
* @since 1.
|
|
529
|
+
* @since 1.1.0
|
|
534
530
|
*/
|
|
535
531
|
var BackgroundType;
|
|
536
532
|
(function (BackgroundType) {
|
|
@@ -1222,14 +1218,6 @@ function getStandardParticleContent(particle) {
|
|
|
1222
1218
|
ret.options.startRotationX = ensureNumberExpression(options.startRotationX);
|
|
1223
1219
|
ret.options.startRotationY = ensureNumberExpression(options.startRotationY);
|
|
1224
1220
|
}
|
|
1225
|
-
if (particle.filter) {
|
|
1226
|
-
var filter_1 = {};
|
|
1227
|
-
forEach(particle.filter, function (val, key) {
|
|
1228
|
-
// @ts-expect-error
|
|
1229
|
-
filter_1[key] = ensureValueGetter(val);
|
|
1230
|
-
});
|
|
1231
|
-
ret.filter = filter_1;
|
|
1232
|
-
}
|
|
1233
1221
|
if (transform && transform.path) {
|
|
1234
1222
|
ret.emitterTransform = {
|
|
1235
1223
|
path: ensureFixedVec3(transform.path),
|
|
@@ -1513,36 +1501,6 @@ function getStandardCameraContent(model) {
|
|
|
1513
1501
|
return ret;
|
|
1514
1502
|
}
|
|
1515
1503
|
|
|
1516
|
-
var convertParams = [
|
|
1517
|
-
'strength',
|
|
1518
|
-
'bloomAddon',
|
|
1519
|
-
'colorAddon',
|
|
1520
|
-
'period',
|
|
1521
|
-
'waveMovement',
|
|
1522
|
-
'colorThreshold',
|
|
1523
|
-
'xOpacity',
|
|
1524
|
-
'yOpacity',
|
|
1525
|
-
'feather',
|
|
1526
|
-
];
|
|
1527
|
-
var pathParams = [
|
|
1528
|
-
'path', 'position',
|
|
1529
|
-
];
|
|
1530
|
-
function getStandardFilterContent(filter) {
|
|
1531
|
-
var ret = {};
|
|
1532
|
-
forEach(filter, function (val, key) {
|
|
1533
|
-
if (convertParams.includes(key)) {
|
|
1534
|
-
ret[key] = ensureFixedNumber(val);
|
|
1535
|
-
}
|
|
1536
|
-
else if (pathParams.includes(key)) {
|
|
1537
|
-
ret[key] = ensureFixedVec3(val);
|
|
1538
|
-
}
|
|
1539
|
-
else {
|
|
1540
|
-
ret[key] = val;
|
|
1541
|
-
}
|
|
1542
|
-
});
|
|
1543
|
-
return ret;
|
|
1544
|
-
}
|
|
1545
|
-
|
|
1546
1504
|
/**
|
|
1547
1505
|
* 2.1 以下版本数据适配(mars-player@2.4.0 及以上版本支持 2.1 以下数据的适配)
|
|
1548
1506
|
*/
|
|
@@ -1581,21 +1539,18 @@ function version22Migration(json) {
|
|
|
1581
1539
|
* 3.0 以下版本数据适配(runtime 2.0及以上版本支持)
|
|
1582
1540
|
*/
|
|
1583
1541
|
function version30Migration(json) {
|
|
1584
|
-
var e_1, _a;
|
|
1585
|
-
var
|
|
1542
|
+
var e_1, _a, e_2, _b;
|
|
1543
|
+
var _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1586
1544
|
var result = __assign(__assign({}, json), { items: [], components: [], materials: [], shaders: [], geometries: [] });
|
|
1587
1545
|
// 兼容老版本数据中不存在textures的情况
|
|
1588
|
-
(
|
|
1546
|
+
(_c = result.textures) !== null && _c !== void 0 ? _c : (result.textures = []);
|
|
1589
1547
|
result.textures.forEach(function (textureOptions) {
|
|
1590
|
-
//@ts-expect-error
|
|
1591
1548
|
textureOptions.id = generateGUID();
|
|
1592
|
-
//@ts-expect-error
|
|
1593
1549
|
textureOptions.dataType = DataType.Texture;
|
|
1594
1550
|
});
|
|
1595
1551
|
if (result.textures.length < result.images.length) {
|
|
1596
1552
|
for (var i = result.textures.length; i < result.images.length; i++) {
|
|
1597
1553
|
result.textures.push({
|
|
1598
|
-
//@ts-expect-error
|
|
1599
1554
|
id: generateGUID(),
|
|
1600
1555
|
dataType: DataType.Texture,
|
|
1601
1556
|
source: i,
|
|
@@ -1603,39 +1558,53 @@ function version30Migration(json) {
|
|
|
1603
1558
|
});
|
|
1604
1559
|
}
|
|
1605
1560
|
}
|
|
1561
|
+
var itemGuidMap = {};
|
|
1606
1562
|
var _loop_1 = function (composition) {
|
|
1607
|
-
var
|
|
1563
|
+
var e_3, _q;
|
|
1608
1564
|
// composition 的 endbehaviour 兼容
|
|
1609
1565
|
if (composition.endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY || composition.endBehavior === END_BEHAVIOR_PAUSE) {
|
|
1610
1566
|
composition.endBehavior = END_BEHAVIOR_FREEZE;
|
|
1611
1567
|
}
|
|
1612
|
-
|
|
1568
|
+
// 过滤掉滤镜元素
|
|
1569
|
+
composition.items = composition.items.filter(function (item) { return item.type !== '8'; });
|
|
1570
|
+
// 过滤掉粒子滤镜(扭曲)
|
|
1571
|
+
composition.items.forEach(function (item) {
|
|
1572
|
+
if (item.type === ItemType.particle) {
|
|
1573
|
+
// @ts-expect-error
|
|
1574
|
+
var filterData = item.content['filter'];
|
|
1575
|
+
if (filterData) {
|
|
1576
|
+
// @ts-expect-error
|
|
1577
|
+
delete item.content['filter'];
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
});
|
|
1581
|
+
var itemGuidMap_1 = {};
|
|
1613
1582
|
try {
|
|
1614
|
-
for (var
|
|
1615
|
-
var item =
|
|
1616
|
-
|
|
1583
|
+
for (var _r = (e_3 = void 0, __values(composition.items)), _s = _r.next(); !_s.done; _s = _r.next()) {
|
|
1584
|
+
var item = _s.value;
|
|
1585
|
+
itemGuidMap_1[item.id] = generateGUID();
|
|
1617
1586
|
// TODO: 编辑器测试用,上线后删除
|
|
1618
1587
|
//@ts-expect-error
|
|
1619
1588
|
item.oldId = item.id;
|
|
1620
|
-
item.id =
|
|
1589
|
+
item.id = itemGuidMap_1[item.id];
|
|
1621
1590
|
}
|
|
1622
1591
|
}
|
|
1623
|
-
catch (
|
|
1592
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1624
1593
|
finally {
|
|
1625
1594
|
try {
|
|
1626
|
-
if (
|
|
1595
|
+
if (_s && !_s.done && (_q = _r.return)) _q.call(_r);
|
|
1627
1596
|
}
|
|
1628
|
-
finally { if (
|
|
1597
|
+
finally { if (e_3) throw e_3.error; }
|
|
1629
1598
|
}
|
|
1630
1599
|
composition.items.forEach(function (item, index) {
|
|
1631
1600
|
if (item.parentId) {
|
|
1632
1601
|
if (item.parentId.includes('^')) {
|
|
1633
1602
|
var parentId = (item.parentId).split('^')[0];
|
|
1634
1603
|
var nodeId = (item.parentId).split('^')[1];
|
|
1635
|
-
item.parentId =
|
|
1604
|
+
item.parentId = itemGuidMap_1[parentId] + '^' + nodeId;
|
|
1636
1605
|
}
|
|
1637
1606
|
else {
|
|
1638
|
-
item.parentId =
|
|
1607
|
+
item.parentId = itemGuidMap_1[item.parentId];
|
|
1639
1608
|
}
|
|
1640
1609
|
}
|
|
1641
1610
|
// @ts-expect-error fix item type
|
|
@@ -1643,179 +1612,177 @@ function version30Migration(json) {
|
|
|
1643
1612
|
// @ts-expect-error fix item type
|
|
1644
1613
|
composition.items[index] = { id: item.id };
|
|
1645
1614
|
});
|
|
1615
|
+
};
|
|
1616
|
+
try {
|
|
1617
|
+
// 更正Composition.endBehavior
|
|
1618
|
+
for (var _l = __values(json.compositions), _m = _l.next(); !_m.done; _m = _l.next()) {
|
|
1619
|
+
var composition = _m.value;
|
|
1620
|
+
_loop_1(composition);
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1624
|
+
finally {
|
|
1646
1625
|
try {
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
var oldTextureId = item.content.trails.texture;
|
|
1661
|
-
//@ts-expect-error
|
|
1662
|
-
item.content.trails.texture = { id: result.textures[oldTextureId].id };
|
|
1663
|
-
}
|
|
1626
|
+
if (_m && !_m.done && (_a = _l.return)) _a.call(_l);
|
|
1627
|
+
}
|
|
1628
|
+
finally { if (e_1) throw e_1.error; }
|
|
1629
|
+
}
|
|
1630
|
+
try {
|
|
1631
|
+
for (var _o = __values(result.items), _p = _o.next(); !_p.done; _p = _o.next()) {
|
|
1632
|
+
var item = _p.value;
|
|
1633
|
+
// 原 texture 索引转为统一 guid 索引
|
|
1634
|
+
if (item.content) {
|
|
1635
|
+
if (item.content.renderer) {
|
|
1636
|
+
if (item.content.renderer.texture !== undefined) {
|
|
1637
|
+
var oldTextureId = item.content.renderer.texture;
|
|
1638
|
+
item.content.renderer.texture = { id: result.textures[oldTextureId].id };
|
|
1664
1639
|
}
|
|
1665
1640
|
}
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
//@ts-expect-error
|
|
1671
|
-
var rotation = __spreadArray([], __read((_d = item.transform.rotation) !== null && _d !== void 0 ? _d : [0, 0, 0]), false);
|
|
1672
|
-
//@ts-expect-error
|
|
1673
|
-
var scale = __spreadArray([], __read((_e = item.transform.scale) !== null && _e !== void 0 ? _e : [1, 1, 1]), false);
|
|
1674
|
-
Object.assign(item, {
|
|
1675
|
-
transform: {
|
|
1676
|
-
position: { x: position[0], y: position[1], z: position[2] },
|
|
1677
|
-
eulerHint: { x: rotation[0], y: rotation[1], z: rotation[2] },
|
|
1678
|
-
scale: { x: scale[0], y: scale[1], z: scale[0] },
|
|
1679
|
-
},
|
|
1680
|
-
});
|
|
1681
|
-
// sprite 的 scale 转为 size
|
|
1682
|
-
if (item.type === ItemType.sprite) {
|
|
1683
|
-
item.transform.size = { x: scale[0], y: scale[1] };
|
|
1684
|
-
item.transform.scale = { x: 1, y: 1, z: 1 };
|
|
1685
|
-
}
|
|
1686
|
-
// sprite 的 anchor 修正
|
|
1687
|
-
if (item.type === ItemType.sprite) {
|
|
1688
|
-
var content = item.content;
|
|
1689
|
-
if (!content.renderer) {
|
|
1690
|
-
content.renderer = {};
|
|
1691
|
-
}
|
|
1692
|
-
var renderer = content.renderer;
|
|
1693
|
-
var realAnchor = convertAnchor(renderer.anchor, renderer.particleOrigin);
|
|
1694
|
-
var startSize = item.transform.size;
|
|
1695
|
-
// 兼容旧JSON(anchor和particleOrigin可能同时存在)
|
|
1696
|
-
if (!renderer.anchor && renderer.particleOrigin !== undefined) {
|
|
1697
|
-
item.transform.position.x += -realAnchor[0] * ((_f = startSize === null || startSize === void 0 ? void 0 : startSize.x) !== null && _f !== void 0 ? _f : 1);
|
|
1698
|
-
item.transform.position.y += -realAnchor[1] * ((_g = startSize === null || startSize === void 0 ? void 0 : startSize.y) !== null && _g !== void 0 ? _g : 1);
|
|
1699
|
-
}
|
|
1700
|
-
item.transform.anchor = { x: realAnchor[0] * ((_h = startSize === null || startSize === void 0 ? void 0 : startSize.x) !== null && _h !== void 0 ? _h : 1), y: realAnchor[1] * ((_j = startSize === null || startSize === void 0 ? void 0 : startSize.y) !== null && _j !== void 0 ? _j : 1) };
|
|
1641
|
+
if (item.content.trails) {
|
|
1642
|
+
if (item.content.trails.texture !== undefined) {
|
|
1643
|
+
var oldTextureId = item.content.trails.texture;
|
|
1644
|
+
item.content.trails.texture = { id: result.textures[oldTextureId].id };
|
|
1701
1645
|
}
|
|
1702
1646
|
}
|
|
1703
|
-
|
|
1647
|
+
}
|
|
1648
|
+
// item 的 transform 属性由数组转为 {x:n, y:n, z:n}
|
|
1649
|
+
if (item.transform) {
|
|
1650
|
+
//@ts-expect-error
|
|
1651
|
+
var position = __spreadArray([], __read((_d = item.transform.position) !== null && _d !== void 0 ? _d : [0, 0, 0]), false);
|
|
1652
|
+
//@ts-expect-error
|
|
1653
|
+
var rotation = __spreadArray([], __read((_e = item.transform.rotation) !== null && _e !== void 0 ? _e : [0, 0, 0]), false);
|
|
1654
|
+
//@ts-expect-error
|
|
1655
|
+
var scale = __spreadArray([], __read((_f = item.transform.scale) !== null && _f !== void 0 ? _f : [1, 1, 1]), false);
|
|
1656
|
+
Object.assign(item, {
|
|
1657
|
+
transform: {
|
|
1658
|
+
position: { x: position[0], y: position[1], z: position[2] },
|
|
1659
|
+
eulerHint: { x: rotation[0], y: rotation[1], z: rotation[2] },
|
|
1660
|
+
scale: { x: scale[0], y: scale[1], z: scale[0] },
|
|
1661
|
+
},
|
|
1662
|
+
});
|
|
1663
|
+
// sprite 的 scale 转为 size
|
|
1664
|
+
if (item.type === ItemType.sprite) {
|
|
1665
|
+
item.transform.size = { x: scale[0], y: scale[1] };
|
|
1666
|
+
item.transform.scale = { x: 1, y: 1, z: 1 };
|
|
1667
|
+
}
|
|
1668
|
+
// sprite 的 anchor 修正
|
|
1669
|
+
if (item.type === ItemType.sprite) {
|
|
1704
1670
|
var content = item.content;
|
|
1705
1671
|
if (!content.renderer) {
|
|
1706
1672
|
content.renderer = {};
|
|
1707
1673
|
}
|
|
1708
1674
|
var renderer = content.renderer;
|
|
1709
|
-
|
|
1675
|
+
var realAnchor = convertAnchor(renderer.anchor, renderer.particleOrigin);
|
|
1676
|
+
var startSize = item.transform.size;
|
|
1677
|
+
// 兼容旧JSON(anchor和particleOrigin可能同时存在)
|
|
1678
|
+
if (!renderer.anchor && renderer.particleOrigin !== undefined) {
|
|
1679
|
+
item.transform.position.x += -realAnchor[0] * ((_g = startSize === null || startSize === void 0 ? void 0 : startSize.x) !== null && _g !== void 0 ? _g : 1);
|
|
1680
|
+
item.transform.position.y += -realAnchor[1] * ((_h = startSize === null || startSize === void 0 ? void 0 : startSize.y) !== null && _h !== void 0 ? _h : 1);
|
|
1681
|
+
}
|
|
1682
|
+
item.transform.anchor = { x: realAnchor[0] * ((_j = startSize === null || startSize === void 0 ? void 0 : startSize.x) !== null && _j !== void 0 ? _j : 1), y: realAnchor[1] * ((_k = startSize === null || startSize === void 0 ? void 0 : startSize.y) !== null && _k !== void 0 ? _k : 1) };
|
|
1710
1683
|
}
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
var
|
|
1714
|
-
if (
|
|
1715
|
-
|
|
1716
|
-
clips: [
|
|
1717
|
-
{
|
|
1718
|
-
dataType: 'TransformAnimationPlayableAsset',
|
|
1719
|
-
animationClip: {
|
|
1720
|
-
sizeOverLifetime: item.content.sizeOverLifetime,
|
|
1721
|
-
rotationOverLifetime: item.content.rotationOverLifetime,
|
|
1722
|
-
positionOverLifetime: item.content.positionOverLifetime,
|
|
1723
|
-
},
|
|
1724
|
-
},
|
|
1725
|
-
],
|
|
1726
|
-
});
|
|
1684
|
+
}
|
|
1685
|
+
if (item.type === ItemType.particle) {
|
|
1686
|
+
var content = item.content;
|
|
1687
|
+
if (!content.renderer) {
|
|
1688
|
+
content.renderer = {};
|
|
1727
1689
|
}
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1690
|
+
var renderer = content.renderer;
|
|
1691
|
+
content.renderer.anchor = convertAnchor(renderer.anchor, renderer.particleOrigin);
|
|
1692
|
+
}
|
|
1693
|
+
// 动画数据转化 TODO: 动画数据移到 TimelineComponentData
|
|
1694
|
+
item.content.tracks = [];
|
|
1695
|
+
var tracks = item.content.tracks;
|
|
1696
|
+
if (item.type !== ItemType.particle) {
|
|
1697
|
+
tracks.push({
|
|
1698
|
+
clips: [
|
|
1699
|
+
{
|
|
1700
|
+
dataType: 'TransformAnimationPlayableAsset',
|
|
1701
|
+
animationClip: {
|
|
1702
|
+
sizeOverLifetime: item.content.sizeOverLifetime,
|
|
1703
|
+
rotationOverLifetime: item.content.rotationOverLifetime,
|
|
1704
|
+
positionOverLifetime: item.content.positionOverLifetime,
|
|
1737
1705
|
},
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
}
|
|
1741
|
-
// gizmo 的 target id 转换为新的 item guid
|
|
1742
|
-
if (item.content.options.target) {
|
|
1743
|
-
item.content.options.target = itemGuidMap[item.content.options.target];
|
|
1744
|
-
}
|
|
1745
|
-
// item 的 content 转为 component data 加入 JSONScene.components
|
|
1746
|
-
var uuid = generateGUID();
|
|
1747
|
-
if (item.type === ItemType.sprite ||
|
|
1748
|
-
item.type === ItemType.particle ||
|
|
1749
|
-
item.type === ItemType.mesh ||
|
|
1750
|
-
item.type === ItemType.skybox ||
|
|
1751
|
-
item.type === ItemType.light ||
|
|
1752
|
-
item.type === 'camera' ||
|
|
1753
|
-
item.type === ItemType.tree ||
|
|
1754
|
-
item.type === ItemType.interact ||
|
|
1755
|
-
item.type === ItemType.camera ||
|
|
1756
|
-
item.type === ItemType.text) {
|
|
1757
|
-
item.components = [];
|
|
1758
|
-
result.components.push(item.content);
|
|
1759
|
-
item.content.id = uuid;
|
|
1760
|
-
item.content.item = { id: item.id };
|
|
1761
|
-
item.dataType = DataType.VFXItemData;
|
|
1762
|
-
item.components.push({ id: item.content.id });
|
|
1763
|
-
}
|
|
1764
|
-
switch (item.type) {
|
|
1765
|
-
case ItemType.sprite:
|
|
1766
|
-
item.content.dataType = DataType.SpriteComponent;
|
|
1767
|
-
break;
|
|
1768
|
-
case ItemType.particle:
|
|
1769
|
-
item.content.dataType = DataType.ParticleSystem;
|
|
1770
|
-
break;
|
|
1771
|
-
case ItemType.mesh:
|
|
1772
|
-
item.content.dataType = DataType.MeshComponent;
|
|
1773
|
-
break;
|
|
1774
|
-
case ItemType.skybox:
|
|
1775
|
-
item.content.dataType = DataType.SkyboxComponent;
|
|
1776
|
-
break;
|
|
1777
|
-
case ItemType.light:
|
|
1778
|
-
item.content.dataType = DataType.LightComponent;
|
|
1779
|
-
break;
|
|
1780
|
-
case 'camera':
|
|
1781
|
-
item.content.dataType = DataType.CameraComponent;
|
|
1782
|
-
break;
|
|
1783
|
-
case ItemType.tree:
|
|
1784
|
-
item.content.dataType = DataType.TreeComponent;
|
|
1785
|
-
break;
|
|
1786
|
-
case ItemType.interact:
|
|
1787
|
-
item.content.dataType = DataType.InteractComponent;
|
|
1788
|
-
break;
|
|
1789
|
-
case ItemType.camera:
|
|
1790
|
-
item.content.dataType = DataType.CameraController;
|
|
1791
|
-
break;
|
|
1792
|
-
case ItemType.text:
|
|
1793
|
-
item.content.dataType = DataType.TextComponent;
|
|
1794
|
-
break;
|
|
1795
|
-
}
|
|
1706
|
+
},
|
|
1707
|
+
],
|
|
1708
|
+
});
|
|
1796
1709
|
}
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1710
|
+
if (item.type === ItemType.sprite) {
|
|
1711
|
+
tracks.push({
|
|
1712
|
+
clips: [
|
|
1713
|
+
{
|
|
1714
|
+
dataType: 'SpriteColorAnimationPlayableAsset',
|
|
1715
|
+
animationClip: {
|
|
1716
|
+
colorOverLifetime: item.content.colorOverLifetime,
|
|
1717
|
+
startColor: item.content.options.startColor,
|
|
1718
|
+
},
|
|
1719
|
+
},
|
|
1720
|
+
],
|
|
1721
|
+
});
|
|
1722
|
+
}
|
|
1723
|
+
// gizmo 的 target id 转换为新的 item guid
|
|
1724
|
+
if (item.content.options.target) {
|
|
1725
|
+
item.content.options.target = itemGuidMap[item.content.options.target];
|
|
1726
|
+
}
|
|
1727
|
+
// item 的 content 转为 component data 加入 JSONScene.components
|
|
1728
|
+
var uuid = generateGUID();
|
|
1729
|
+
if (item.type === ItemType.sprite ||
|
|
1730
|
+
item.type === ItemType.particle ||
|
|
1731
|
+
item.type === ItemType.mesh ||
|
|
1732
|
+
item.type === ItemType.skybox ||
|
|
1733
|
+
item.type === ItemType.light ||
|
|
1734
|
+
item.type === 'camera' ||
|
|
1735
|
+
item.type === ItemType.tree ||
|
|
1736
|
+
item.type === ItemType.interact ||
|
|
1737
|
+
item.type === ItemType.camera ||
|
|
1738
|
+
item.type === ItemType.text) {
|
|
1739
|
+
item.components = [];
|
|
1740
|
+
result.components.push(item.content);
|
|
1741
|
+
item.content.id = uuid;
|
|
1742
|
+
item.content.item = { id: item.id };
|
|
1743
|
+
item.dataType = DataType.VFXItemData;
|
|
1744
|
+
item.components.push({ id: item.content.id });
|
|
1745
|
+
}
|
|
1746
|
+
switch (item.type) {
|
|
1747
|
+
case ItemType.sprite:
|
|
1748
|
+
item.content.dataType = DataType.SpriteComponent;
|
|
1749
|
+
break;
|
|
1750
|
+
case ItemType.particle:
|
|
1751
|
+
item.content.dataType = DataType.ParticleSystem;
|
|
1752
|
+
break;
|
|
1753
|
+
case ItemType.mesh:
|
|
1754
|
+
item.content.dataType = DataType.MeshComponent;
|
|
1755
|
+
break;
|
|
1756
|
+
case ItemType.skybox:
|
|
1757
|
+
item.content.dataType = DataType.SkyboxComponent;
|
|
1758
|
+
break;
|
|
1759
|
+
case ItemType.light:
|
|
1760
|
+
item.content.dataType = DataType.LightComponent;
|
|
1761
|
+
break;
|
|
1762
|
+
case 'camera':
|
|
1763
|
+
item.content.dataType = DataType.CameraComponent;
|
|
1764
|
+
break;
|
|
1765
|
+
case ItemType.tree:
|
|
1766
|
+
item.content.dataType = DataType.TreeComponent;
|
|
1767
|
+
break;
|
|
1768
|
+
case ItemType.interact:
|
|
1769
|
+
item.content.dataType = DataType.InteractComponent;
|
|
1770
|
+
break;
|
|
1771
|
+
case ItemType.camera:
|
|
1772
|
+
item.content.dataType = DataType.CameraController;
|
|
1773
|
+
break;
|
|
1774
|
+
case ItemType.text:
|
|
1775
|
+
item.content.dataType = DataType.TextComponent;
|
|
1776
|
+
break;
|
|
1802
1777
|
}
|
|
1803
|
-
finally { if (e_3) throw e_3.error; }
|
|
1804
|
-
}
|
|
1805
|
-
};
|
|
1806
|
-
try {
|
|
1807
|
-
// 更正Composition.endBehavior
|
|
1808
|
-
for (var _k = __values(json.compositions), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
1809
|
-
var composition = _l.value;
|
|
1810
|
-
_loop_1(composition);
|
|
1811
1778
|
}
|
|
1812
1779
|
}
|
|
1813
|
-
catch (
|
|
1780
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1814
1781
|
finally {
|
|
1815
1782
|
try {
|
|
1816
|
-
if (
|
|
1783
|
+
if (_p && !_p.done && (_b = _o.return)) _b.call(_o);
|
|
1817
1784
|
}
|
|
1818
|
-
finally { if (
|
|
1785
|
+
finally { if (e_2) throw e_2.error; }
|
|
1819
1786
|
}
|
|
1820
1787
|
result.version = '3.0';
|
|
1821
1788
|
return result;
|
|
@@ -1974,14 +1941,6 @@ function getStandardItem(item, opt) {
|
|
|
1974
1941
|
duration = item.duration;
|
|
1975
1942
|
}
|
|
1976
1943
|
transform = item.transform || getTransform(originContent.transform);
|
|
1977
|
-
if (type === ItemType.filter) {
|
|
1978
|
-
if (currentVersion < '1.1') {
|
|
1979
|
-
currentVersion = '1.1';
|
|
1980
|
-
}
|
|
1981
|
-
content = getStandardSpriteContent(originContent, transform);
|
|
1982
|
-
// @ts-expect-error
|
|
1983
|
-
content.filter = getStandardFilterContent(originContent.filter);
|
|
1984
|
-
}
|
|
1985
1944
|
}
|
|
1986
1945
|
else if (item.particle) {
|
|
1987
1946
|
type = ItemType.particle;
|