@galacean/effects-specification 2.0.0-alpha.2 → 2.0.0-alpha.4
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 +173 -195
- package/dist/fallback.js.map +1 -1
- package/dist/fallback.mjs +173 -195
- package/dist/fallback.mjs.map +1 -1
- package/dist/index.js +42 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -2
- package/dist/index.mjs.map +1 -1
- package/dist/src/components.d.ts +38 -0
- package/dist/src/image.d.ts +9 -4
- package/dist/src/index.d.ts +1 -0
- package/dist/src/item/effect-item.d.ts +20 -2
- package/dist/src/item/model/mesh.d.ts +3 -3
- package/dist/src/scene.d.ts +2 -1
- package/dist/src/type.d.ts +20 -4
- package/dist/src/vfx-item-data.d.ts +2 -2
- package/package.json +2 -2
package/dist/fallback/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { BaseItem, Composition, CompressedImage, Image, JSONScene, ParticleItem, RenderLevel, SpriteItem, TemplateImage,
|
|
1
|
+
import type { BaseItem, Composition, CompressedImage, Image, JSONScene, ParticleItem, RenderLevel, SpriteItem, TemplateImage, FilterItem } from '../src';
|
|
2
2
|
export * from './utils';
|
|
3
3
|
export declare function getStandardJSON(json: any): JSONScene;
|
|
4
|
-
export declare function getStandardImage(image: any, index: number, imageTags: RenderLevel[]): TemplateImage | Image | CompressedImage
|
|
4
|
+
export declare function getStandardImage(image: any, index: number, imageTags: RenderLevel[]): TemplateImage | Image | CompressedImage;
|
|
5
5
|
export declare function getStandardComposition(composition: any, opt?: {
|
|
6
6
|
plugins?: string[];
|
|
7
7
|
requires?: string[];
|
package/dist/fallback.js
CHANGED
|
@@ -2,13 +2,83 @@
|
|
|
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.4
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
|
+
/******************************************************************************
|
|
13
|
+
Copyright (c) Microsoft Corporation.
|
|
14
|
+
|
|
15
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
16
|
+
purpose with or without fee is hereby granted.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
19
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
20
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
21
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
22
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
23
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
24
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
25
|
+
***************************************************************************** */
|
|
26
|
+
|
|
27
|
+
var __assign = function() {
|
|
28
|
+
__assign = Object.assign || function __assign(t) {
|
|
29
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
30
|
+
s = arguments[i];
|
|
31
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
32
|
+
}
|
|
33
|
+
return t;
|
|
34
|
+
};
|
|
35
|
+
return __assign.apply(this, arguments);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
function __values(o) {
|
|
39
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
40
|
+
if (m) return m.call(o);
|
|
41
|
+
if (o && typeof o.length === "number") return {
|
|
42
|
+
next: function () {
|
|
43
|
+
if (o && i >= o.length) o = void 0;
|
|
44
|
+
return { value: o && o[i++], done: !o };
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function __read(o, n) {
|
|
51
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
52
|
+
if (!m) return o;
|
|
53
|
+
var i = m.call(o), r, ar = [], e;
|
|
54
|
+
try {
|
|
55
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
56
|
+
}
|
|
57
|
+
catch (error) { e = { error: error }; }
|
|
58
|
+
finally {
|
|
59
|
+
try {
|
|
60
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
61
|
+
}
|
|
62
|
+
finally { if (e) throw e.error; }
|
|
63
|
+
}
|
|
64
|
+
return ar;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function __spreadArray(to, from, pack) {
|
|
68
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
69
|
+
if (ar || !(i in from)) {
|
|
70
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
71
|
+
ar[i] = from[i];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
78
|
+
var e = new Error(message);
|
|
79
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
80
|
+
};
|
|
81
|
+
|
|
12
82
|
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
13
83
|
var native = {
|
|
14
84
|
randomUUID
|
|
@@ -458,6 +528,16 @@ var CompositionEndBehavior;
|
|
|
458
528
|
CompositionEndBehavior[CompositionEndBehavior["freeze"] = END_BEHAVIOR_FREEZE] = "freeze";
|
|
459
529
|
})(CompositionEndBehavior || (CompositionEndBehavior = {}));
|
|
460
530
|
|
|
531
|
+
/**
|
|
532
|
+
* 动态换图类型
|
|
533
|
+
* @since 1.3.0
|
|
534
|
+
*/
|
|
535
|
+
var BackgroundType;
|
|
536
|
+
(function (BackgroundType) {
|
|
537
|
+
BackgroundType["video"] = "video";
|
|
538
|
+
BackgroundType["image"] = "image";
|
|
539
|
+
})(BackgroundType || (BackgroundType = {}));
|
|
540
|
+
|
|
461
541
|
/*********************************************/
|
|
462
542
|
/* 基本数值属性参数 */
|
|
463
543
|
/*********************************************/
|
|
@@ -790,76 +870,37 @@ var DataType;
|
|
|
790
870
|
DataType["ModelPluginComponent"] = "ModelPluginComponent";
|
|
791
871
|
DataType["TreeComponent"] = "TreeComponent";
|
|
792
872
|
})(DataType || (DataType = {}));
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
next: function () {
|
|
825
|
-
if (o && i >= o.length) o = void 0;
|
|
826
|
-
return { value: o && o[i++], done: !o };
|
|
827
|
-
}
|
|
828
|
-
};
|
|
829
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
function __read(o, n) {
|
|
833
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
834
|
-
if (!m) return o;
|
|
835
|
-
var i = m.call(o), r, ar = [], e;
|
|
836
|
-
try {
|
|
837
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
838
|
-
}
|
|
839
|
-
catch (error) { e = { error: error }; }
|
|
840
|
-
finally {
|
|
841
|
-
try {
|
|
842
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
843
|
-
}
|
|
844
|
-
finally { if (e) throw e.error; }
|
|
845
|
-
}
|
|
846
|
-
return ar;
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
function __spreadArray(to, from, pack) {
|
|
850
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
851
|
-
if (ar || !(i in from)) {
|
|
852
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
853
|
-
ar[i] = from[i];
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
860
|
-
var e = new Error(message);
|
|
861
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
862
|
-
};
|
|
873
|
+
var GeometryType;
|
|
874
|
+
(function (GeometryType) {
|
|
875
|
+
/**
|
|
876
|
+
* Draw single points.
|
|
877
|
+
*/
|
|
878
|
+
GeometryType[GeometryType["POINTS"] = 0] = "POINTS";
|
|
879
|
+
/**
|
|
880
|
+
* Draw lines. Each vertex connects to the one after it.
|
|
881
|
+
*/
|
|
882
|
+
GeometryType[GeometryType["LINES"] = 1] = "LINES";
|
|
883
|
+
/**
|
|
884
|
+
* Draw lines. Each set of two vertices is treated as a separate line segment.
|
|
885
|
+
*/
|
|
886
|
+
GeometryType[GeometryType["LINE_LOOP"] = 2] = "LINE_LOOP";
|
|
887
|
+
/**
|
|
888
|
+
* Draw a connected group of line segments from the first vertex to the last.
|
|
889
|
+
*/
|
|
890
|
+
GeometryType[GeometryType["LINE_STRIP"] = 3] = "LINE_STRIP";
|
|
891
|
+
/**
|
|
892
|
+
* Draw triangles. Each set of three vertices creates a separate triangle.
|
|
893
|
+
*/
|
|
894
|
+
GeometryType[GeometryType["TRIANGLES"] = 4] = "TRIANGLES";
|
|
895
|
+
/**
|
|
896
|
+
* Draw a connected strip of triangles.
|
|
897
|
+
*/
|
|
898
|
+
GeometryType[GeometryType["TRIANGLE_STRIP"] = 5] = "TRIANGLE_STRIP";
|
|
899
|
+
/**
|
|
900
|
+
* Draw a connected group of triangles. Each vertex connects to the previous and the first vertex in the fan.
|
|
901
|
+
*/
|
|
902
|
+
GeometryType[GeometryType["TRIANGLE_FAN"] = 6] = "TRIANGLE_FAN";
|
|
903
|
+
})(GeometryType || (GeometryType = {}));
|
|
863
904
|
|
|
864
905
|
var _a;
|
|
865
906
|
function arrAdd(arr, item) {
|
|
@@ -1541,21 +1582,14 @@ function version22Migration(json) {
|
|
|
1541
1582
|
*/
|
|
1542
1583
|
function version30Migration(json) {
|
|
1543
1584
|
var e_1, _a;
|
|
1544
|
-
var _b, _c, _d, _e;
|
|
1545
|
-
var result =
|
|
1546
|
-
items: [],
|
|
1547
|
-
components: [],
|
|
1548
|
-
materials: [],
|
|
1549
|
-
shaders: [],
|
|
1550
|
-
geometries: [],
|
|
1551
|
-
});
|
|
1585
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1586
|
+
var result = __assign(__assign({}, json), { items: [], components: [], materials: [], shaders: [], geometries: [] });
|
|
1552
1587
|
// 兼容老版本数据中不存在textures的情况
|
|
1553
1588
|
(_b = result.textures) !== null && _b !== void 0 ? _b : (result.textures = []);
|
|
1554
1589
|
result.textures.forEach(function (textureOptions) {
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
dataType: DataType.Texture
|
|
1558
|
-
});
|
|
1590
|
+
textureOptions = __assign(__assign({}, textureOptions), {
|
|
1591
|
+
// @ts-expect-error
|
|
1592
|
+
id: generateGUID(), dataType: DataType.Texture });
|
|
1559
1593
|
});
|
|
1560
1594
|
if (result.textures.length < result.images.length) {
|
|
1561
1595
|
for (var i = result.textures.length; i < result.images.length; i++) {
|
|
@@ -1569,15 +1603,15 @@ function version30Migration(json) {
|
|
|
1569
1603
|
}
|
|
1570
1604
|
}
|
|
1571
1605
|
var _loop_1 = function (composition) {
|
|
1572
|
-
var e_2,
|
|
1606
|
+
var e_2, _m, e_3, _o;
|
|
1573
1607
|
// composition 的 endbehaviour 兼容
|
|
1574
1608
|
if (composition.endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY || composition.endBehavior === END_BEHAVIOR_PAUSE) {
|
|
1575
1609
|
composition.endBehavior = END_BEHAVIOR_FREEZE;
|
|
1576
1610
|
}
|
|
1577
1611
|
var itemGuidMap = {};
|
|
1578
1612
|
try {
|
|
1579
|
-
for (var
|
|
1580
|
-
var item =
|
|
1613
|
+
for (var _p = (e_2 = void 0, __values(composition.items)), _q = _p.next(); !_q.done; _q = _p.next()) {
|
|
1614
|
+
var item = _q.value;
|
|
1581
1615
|
itemGuidMap[item.id] = generateGUID();
|
|
1582
1616
|
// TODO: 编辑器测试用,上线后删除
|
|
1583
1617
|
//@ts-expect-error
|
|
@@ -1588,7 +1622,7 @@ function version30Migration(json) {
|
|
|
1588
1622
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1589
1623
|
finally {
|
|
1590
1624
|
try {
|
|
1591
|
-
if (
|
|
1625
|
+
if (_q && !_q.done && (_m = _p.return)) _m.call(_p);
|
|
1592
1626
|
}
|
|
1593
1627
|
finally { if (e_2) throw e_2.error; }
|
|
1594
1628
|
}
|
|
@@ -1609,8 +1643,8 @@ function version30Migration(json) {
|
|
|
1609
1643
|
composition.items[index] = { id: item.id };
|
|
1610
1644
|
});
|
|
1611
1645
|
try {
|
|
1612
|
-
for (var
|
|
1613
|
-
var item =
|
|
1646
|
+
for (var _r = (e_3 = void 0, __values(result.items)), _s = _r.next(); !_s.done; _s = _r.next()) {
|
|
1647
|
+
var item = _s.value;
|
|
1614
1648
|
// 原 texture 索引转为统一 guid 索引
|
|
1615
1649
|
if (item.content) {
|
|
1616
1650
|
if (item.content.renderer) {
|
|
@@ -1639,7 +1673,7 @@ function version30Migration(json) {
|
|
|
1639
1673
|
Object.assign(item, {
|
|
1640
1674
|
transform: {
|
|
1641
1675
|
position: { x: position[0], y: position[1], z: position[2] },
|
|
1642
|
-
|
|
1676
|
+
eulerHint: { x: rotation[0], y: rotation[1], z: rotation[2] },
|
|
1643
1677
|
scale: { x: scale[0], y: scale[1], z: scale[0] },
|
|
1644
1678
|
},
|
|
1645
1679
|
});
|
|
@@ -1659,13 +1693,10 @@ function version30Migration(json) {
|
|
|
1659
1693
|
var startSize = item.transform.size;
|
|
1660
1694
|
// 兼容旧JSON(anchor和particleOrigin可能同时存在)
|
|
1661
1695
|
if (!renderer.anchor && renderer.particleOrigin !== undefined) {
|
|
1662
|
-
|
|
1663
|
-
item.transform.position.
|
|
1664
|
-
//@ts-expect-error
|
|
1665
|
-
item.transform.position.y += -realAnchor[1] * startSize.y;
|
|
1696
|
+
item.transform.position.x += -realAnchor[0] * ((_f = startSize === null || startSize === void 0 ? void 0 : startSize.x) !== null && _f !== void 0 ? _f : 1);
|
|
1697
|
+
item.transform.position.y += -realAnchor[1] * ((_g = startSize === null || startSize === void 0 ? void 0 : startSize.y) !== null && _g !== void 0 ? _g : 1);
|
|
1666
1698
|
}
|
|
1667
|
-
|
|
1668
|
-
item.transform.anchor = { x: realAnchor[0] * startSize.x, y: realAnchor[1] * startSize.y };
|
|
1699
|
+
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) };
|
|
1669
1700
|
}
|
|
1670
1701
|
}
|
|
1671
1702
|
if (item.type === ItemType.particle) {
|
|
@@ -1712,127 +1743,76 @@ function version30Migration(json) {
|
|
|
1712
1743
|
}
|
|
1713
1744
|
// item 的 content 转为 component data 加入 JSONScene.components
|
|
1714
1745
|
var uuid = generateGUID();
|
|
1715
|
-
if (item.type === ItemType.sprite
|
|
1746
|
+
if (item.type === ItemType.sprite ||
|
|
1747
|
+
item.type === ItemType.particle ||
|
|
1748
|
+
item.type === ItemType.mesh ||
|
|
1749
|
+
item.type === ItemType.skybox ||
|
|
1750
|
+
item.type === ItemType.light ||
|
|
1751
|
+
item.type === 'camera' ||
|
|
1752
|
+
item.type === ItemType.tree ||
|
|
1753
|
+
item.type === ItemType.interact ||
|
|
1754
|
+
item.type === ItemType.camera ||
|
|
1755
|
+
item.type === ItemType.text) {
|
|
1716
1756
|
item.components = [];
|
|
1717
1757
|
result.components.push(item.content);
|
|
1718
1758
|
item.content.id = uuid;
|
|
1719
|
-
item.content.dataType = DataType.SpriteComponent;
|
|
1720
1759
|
item.content.item = { id: item.id };
|
|
1721
1760
|
item.dataType = DataType.VFXItemData;
|
|
1722
|
-
//@ts-expect-error
|
|
1723
|
-
item.components.push({ id: item.content.id });
|
|
1724
|
-
}
|
|
1725
|
-
else if (item.type === ItemType.particle) {
|
|
1726
|
-
item.components = [];
|
|
1727
|
-
result.components.push(item.content);
|
|
1728
|
-
item.content.id = uuid;
|
|
1729
|
-
item.content.dataType = DataType.ParticleSystem;
|
|
1730
|
-
item.content.item = { id: item.id };
|
|
1731
|
-
item.dataType = DataType.VFXItemData;
|
|
1732
|
-
//@ts-expect-error
|
|
1733
1761
|
item.components.push({ id: item.content.id });
|
|
1734
1762
|
}
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
item.components = [];
|
|
1767
|
-
result.components.push(item.content);
|
|
1768
|
-
item.content.id = uuid;
|
|
1769
|
-
item.content.dataType = DataType.CameraComponent;
|
|
1770
|
-
item.content.item = { id: item.id };
|
|
1771
|
-
item.dataType = DataType.VFXItemData;
|
|
1772
|
-
//@ts-expect-error
|
|
1773
|
-
item.components.push({ id: item.content.id });
|
|
1774
|
-
}
|
|
1775
|
-
else if (item.type === ItemType.tree) {
|
|
1776
|
-
item.components = [];
|
|
1777
|
-
result.components.push(item.content);
|
|
1778
|
-
item.content.id = uuid;
|
|
1779
|
-
item.content.dataType = DataType.TreeComponent;
|
|
1780
|
-
item.content.item = { id: item.id };
|
|
1781
|
-
item.dataType = DataType.VFXItemData;
|
|
1782
|
-
//@ts-expect-error
|
|
1783
|
-
item.components.push({ id: item.content.id });
|
|
1784
|
-
}
|
|
1785
|
-
else if (item.type === ItemType.interact) {
|
|
1786
|
-
item.components = [];
|
|
1787
|
-
result.components.push(item.content);
|
|
1788
|
-
item.content.id = uuid;
|
|
1789
|
-
item.content.dataType = DataType.InteractComponent;
|
|
1790
|
-
item.content.item = { id: item.id };
|
|
1791
|
-
item.dataType = DataType.VFXItemData;
|
|
1792
|
-
//@ts-expect-error
|
|
1793
|
-
item.components.push({ id: item.content.id });
|
|
1794
|
-
}
|
|
1795
|
-
else if (item.type === ItemType.camera) {
|
|
1796
|
-
item.components = [];
|
|
1797
|
-
result.components.push(item.content);
|
|
1798
|
-
item.content.id = uuid;
|
|
1799
|
-
item.content.dataType = DataType.CameraController;
|
|
1800
|
-
item.content.item = { id: item.id };
|
|
1801
|
-
item.dataType = DataType.VFXItemData;
|
|
1802
|
-
//@ts-expect-error
|
|
1803
|
-
item.components.push({ id: item.content.id });
|
|
1804
|
-
}
|
|
1805
|
-
else if (item.type === ItemType.text) {
|
|
1806
|
-
item.components = [];
|
|
1807
|
-
result.components.push(item.content);
|
|
1808
|
-
item.content.id = uuid;
|
|
1809
|
-
item.content.dataType = DataType.TextComponent;
|
|
1810
|
-
item.content.item = { id: item.id };
|
|
1811
|
-
item.dataType = DataType.VFXItemData;
|
|
1812
|
-
//@ts-expect-error
|
|
1813
|
-
item.components.push({ id: item.content.id });
|
|
1763
|
+
switch (item.type) {
|
|
1764
|
+
case ItemType.sprite:
|
|
1765
|
+
item.content.dataType = DataType.SpriteComponent;
|
|
1766
|
+
break;
|
|
1767
|
+
case ItemType.particle:
|
|
1768
|
+
item.content.dataType = DataType.ParticleSystem;
|
|
1769
|
+
break;
|
|
1770
|
+
case ItemType.mesh:
|
|
1771
|
+
item.content.dataType = DataType.MeshComponent;
|
|
1772
|
+
break;
|
|
1773
|
+
case ItemType.skybox:
|
|
1774
|
+
item.content.dataType = DataType.SkyboxComponent;
|
|
1775
|
+
break;
|
|
1776
|
+
case ItemType.light:
|
|
1777
|
+
item.content.dataType = DataType.LightComponent;
|
|
1778
|
+
break;
|
|
1779
|
+
case 'camera':
|
|
1780
|
+
item.content.dataType = DataType.CameraComponent;
|
|
1781
|
+
break;
|
|
1782
|
+
case ItemType.tree:
|
|
1783
|
+
item.content.dataType = DataType.TreeComponent;
|
|
1784
|
+
break;
|
|
1785
|
+
case ItemType.interact:
|
|
1786
|
+
item.content.dataType = DataType.InteractComponent;
|
|
1787
|
+
break;
|
|
1788
|
+
case ItemType.camera:
|
|
1789
|
+
item.content.dataType = DataType.CameraController;
|
|
1790
|
+
break;
|
|
1791
|
+
case ItemType.text:
|
|
1792
|
+
item.content.dataType = DataType.TextComponent;
|
|
1793
|
+
break;
|
|
1814
1794
|
}
|
|
1815
1795
|
}
|
|
1816
1796
|
}
|
|
1817
1797
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1818
1798
|
finally {
|
|
1819
1799
|
try {
|
|
1820
|
-
if (
|
|
1800
|
+
if (_s && !_s.done && (_o = _r.return)) _o.call(_r);
|
|
1821
1801
|
}
|
|
1822
1802
|
finally { if (e_3) throw e_3.error; }
|
|
1823
1803
|
}
|
|
1824
1804
|
};
|
|
1825
1805
|
try {
|
|
1826
1806
|
// 更正Composition.endBehavior
|
|
1827
|
-
for (var
|
|
1828
|
-
var composition =
|
|
1807
|
+
for (var _k = __values(json.compositions), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
1808
|
+
var composition = _l.value;
|
|
1829
1809
|
_loop_1(composition);
|
|
1830
1810
|
}
|
|
1831
1811
|
}
|
|
1832
1812
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1833
1813
|
finally {
|
|
1834
1814
|
try {
|
|
1835
|
-
if (
|
|
1815
|
+
if (_l && !_l.done && (_a = _k.return)) _a.call(_k);
|
|
1836
1816
|
}
|
|
1837
1817
|
finally { if (e_1) throw e_1.error; }
|
|
1838
1818
|
}
|
|
@@ -1932,11 +1912,9 @@ function getStandardImage(image, index, imageTags) {
|
|
|
1932
1912
|
else if (image.url) {
|
|
1933
1913
|
return {
|
|
1934
1914
|
url: image.url,
|
|
1935
|
-
type: image.type,
|
|
1936
1915
|
webp: image.webp,
|
|
1937
1916
|
renderLevel: renderLevel,
|
|
1938
1917
|
oriY: oriY,
|
|
1939
|
-
loop: image.loop,
|
|
1940
1918
|
};
|
|
1941
1919
|
}
|
|
1942
1920
|
else if (image && image.sourceType) {
|
|
@@ -1949,7 +1927,7 @@ function getStandardComposition(composition, opt) {
|
|
|
1949
1927
|
if (opt === void 0) { opt = {}; }
|
|
1950
1928
|
var ret = {
|
|
1951
1929
|
id: composition.id + '',
|
|
1952
|
-
camera:
|
|
1930
|
+
camera: __assign({ clipMode: CAMERA_CLIP_MODE_NORMAL }, composition.camera),
|
|
1953
1931
|
duration: composition.duration,
|
|
1954
1932
|
endBehavior: composition.endBehavior,
|
|
1955
1933
|
items: composition.items.map(function (item) { return getStandardItem(item, opt); }),
|