@galacean/effects-core 2.4.0-beta.0 → 2.4.0-beta.1
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/asset-loader.d.ts +1 -2
- package/dist/binary-asset.d.ts +0 -2
- package/dist/comp-vfx-item.d.ts +2 -2
- package/dist/components/component.d.ts +1 -0
- package/dist/components/post-process-volume.d.ts +2 -2
- package/dist/components/renderer-component.d.ts +0 -5
- package/dist/composition.d.ts +2 -8
- package/dist/effects-object.d.ts +1 -1
- package/dist/engine.d.ts +5 -3
- package/dist/fallback/migration.d.ts +1 -0
- package/dist/index.js +710 -1004
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +706 -998
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/camera/camera-controller-node.d.ts +2 -2
- package/dist/plugins/particle/trail-mesh.d.ts +1 -1
- package/dist/serialization-helper.d.ts +0 -4
- package/dist/vfx-item.d.ts +10 -4
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime core for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.4.0-beta.
|
|
6
|
+
* Version: v2.4.0-beta.1
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -2000,7 +2000,7 @@ function getDirectStore(target) {
|
|
|
2000
2000
|
function EffectsObject(engine) {
|
|
2001
2001
|
this.engine = engine;
|
|
2002
2002
|
this.guid = generateGUID();
|
|
2003
|
-
this.
|
|
2003
|
+
this.defination = {};
|
|
2004
2004
|
this.engine.addInstance(this);
|
|
2005
2005
|
}
|
|
2006
2006
|
var _proto = EffectsObject.prototype;
|
|
@@ -2025,11 +2025,7 @@ function getDirectStore(target) {
|
|
|
2025
2025
|
* 反序列化函数
|
|
2026
2026
|
*
|
|
2027
2027
|
* @param data - 对象的序列化的数据
|
|
2028
|
-
*/ _proto.fromData = function fromData(data) {
|
|
2029
|
-
if (data.id) {
|
|
2030
|
-
this.setInstanceId(data.id);
|
|
2031
|
-
}
|
|
2032
|
-
};
|
|
2028
|
+
*/ _proto.fromData = function fromData(data) {};
|
|
2033
2029
|
/**
|
|
2034
2030
|
*
|
|
2035
2031
|
*/ _proto.dispose = function dispose() {};
|
|
@@ -2125,9 +2121,6 @@ function getDirectStore(target) {
|
|
|
2125
2121
|
};
|
|
2126
2122
|
_proto.fromData = function fromData(data) {
|
|
2127
2123
|
EffectsObject.prototype.fromData.call(this, data);
|
|
2128
|
-
if (data.item) {
|
|
2129
|
-
this.item = data.item;
|
|
2130
|
-
}
|
|
2131
2124
|
};
|
|
2132
2125
|
_proto.dispose = function dispose() {
|
|
2133
2126
|
if (this.isEnableCalled) {
|
|
@@ -2192,11 +2185,15 @@ function getDirectStore(target) {
|
|
|
2192
2185
|
]);
|
|
2193
2186
|
return Component;
|
|
2194
2187
|
}(EffectsObject);
|
|
2188
|
+
__decorate([
|
|
2189
|
+
serialize()
|
|
2190
|
+
], Component.prototype, "item", void 0);
|
|
2195
2191
|
__decorate([
|
|
2196
2192
|
serialize()
|
|
2197
2193
|
], Component.prototype, "_enabled", void 0);
|
|
2198
2194
|
/**
|
|
2199
2195
|
* @since 2.0.0
|
|
2196
|
+
* @deprecated 2.4.0 Please use Component instead
|
|
2200
2197
|
*/ var Behaviour = /*#__PURE__*/ function(Component) {
|
|
2201
2198
|
_inherits(Behaviour, Component);
|
|
2202
2199
|
function Behaviour() {
|
|
@@ -2226,10 +2223,6 @@ __decorate([
|
|
|
2226
2223
|
}
|
|
2227
2224
|
var _proto = RendererComponent.prototype;
|
|
2228
2225
|
_proto.render = function render(renderer) {};
|
|
2229
|
-
_proto.setVFXItem = function setVFXItem(item) {
|
|
2230
|
-
Component.prototype.setVFXItem.call(this, item);
|
|
2231
|
-
this.item.rendererComponents.push(this);
|
|
2232
|
-
};
|
|
2233
2226
|
_proto.onEnable = function onEnable() {
|
|
2234
2227
|
var _this_item_composition;
|
|
2235
2228
|
(_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderFrame.addMeshToDefaultRenderPass(this);
|
|
@@ -2238,18 +2231,6 @@ __decorate([
|
|
|
2238
2231
|
var _this_item_composition;
|
|
2239
2232
|
(_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderFrame.removeMeshFromDefaultRenderPass(this);
|
|
2240
2233
|
};
|
|
2241
|
-
_proto.fromData = function fromData(data) {
|
|
2242
|
-
Component.prototype.fromData.call(this, data);
|
|
2243
|
-
};
|
|
2244
|
-
_proto.toData = function toData() {
|
|
2245
|
-
Component.prototype.toData.call(this);
|
|
2246
|
-
};
|
|
2247
|
-
_proto.dispose = function dispose() {
|
|
2248
|
-
if (this.item) {
|
|
2249
|
-
removeItem(this.item.rendererComponents, this);
|
|
2250
|
-
}
|
|
2251
|
-
Component.prototype.dispose.call(this);
|
|
2252
|
-
};
|
|
2253
2234
|
_create_class(RendererComponent, [
|
|
2254
2235
|
{
|
|
2255
2236
|
key: "priority",
|
|
@@ -3872,11 +3853,11 @@ EffectComponent = __decorate([
|
|
|
3872
3853
|
effectsClass(DataType.EffectComponent)
|
|
3873
3854
|
], EffectComponent);
|
|
3874
3855
|
|
|
3875
|
-
var PostProcessVolume = /*#__PURE__*/ function(
|
|
3876
|
-
_inherits(PostProcessVolume,
|
|
3856
|
+
var PostProcessVolume = /*#__PURE__*/ function(Component) {
|
|
3857
|
+
_inherits(PostProcessVolume, Component);
|
|
3877
3858
|
function PostProcessVolume(engine) {
|
|
3878
3859
|
var _this;
|
|
3879
|
-
_this =
|
|
3860
|
+
_this = Component.call(this, engine) || this;
|
|
3880
3861
|
_this.bloom = {
|
|
3881
3862
|
threshold: 0,
|
|
3882
3863
|
intensity: 0,
|
|
@@ -3907,7 +3888,7 @@ var PostProcessVolume = /*#__PURE__*/ function(Behaviour) {
|
|
|
3907
3888
|
}
|
|
3908
3889
|
};
|
|
3909
3890
|
return PostProcessVolume;
|
|
3910
|
-
}(
|
|
3891
|
+
}(Component);
|
|
3911
3892
|
__decorate([
|
|
3912
3893
|
serialize()
|
|
3913
3894
|
], PostProcessVolume.prototype, "bloom", void 0);
|
|
@@ -12744,6 +12725,10 @@ function getBezier2DValue(out, t, p0, p1, cpx0, cpy0, cpx1, cpy1) {
|
|
|
12744
12725
|
RendererComponent.prototype.fromData.call(this, data);
|
|
12745
12726
|
var _data_renderer;
|
|
12746
12727
|
var renderer = (_data_renderer = data.renderer) != null ? _data_renderer : {};
|
|
12728
|
+
var maskProps = data.mask;
|
|
12729
|
+
if (maskProps && maskProps.ref) {
|
|
12730
|
+
maskProps.ref = this.engine.findObject(maskProps.ref);
|
|
12731
|
+
}
|
|
12747
12732
|
var maskMode = this.maskManager.getMaskMode(data);
|
|
12748
12733
|
// TODO 新蒙板上线后移除
|
|
12749
12734
|
//-------------------------------------------------------------------------
|
|
@@ -12751,15 +12736,15 @@ function getBezier2DValue(out, t, p0, p1, cpx0, cpy0, cpx1, cpy1) {
|
|
|
12751
12736
|
//@ts-expect-error
|
|
12752
12737
|
var split = data.splits && !data.textureSheetAnimation ? data.splits[0] : undefined;
|
|
12753
12738
|
var shapeGeometry = undefined;
|
|
12754
|
-
if (shapeData !== undefined && !("aPoint" in shapeData && "index" in shapeData)) {
|
|
12739
|
+
if (shapeData !== undefined && shapeData !== null && !("aPoint" in shapeData && "index" in shapeData)) {
|
|
12755
12740
|
shapeGeometry = getGeometryByShape(shapeData, split);
|
|
12756
12741
|
}
|
|
12757
|
-
var _renderer_renderMode, _renderer_blending,
|
|
12742
|
+
var _renderer_renderMode, _renderer_blending, _renderer_side;
|
|
12758
12743
|
//-------------------------------------------------------------------------
|
|
12759
12744
|
this.renderer = {
|
|
12760
12745
|
renderMode: (_renderer_renderMode = renderer.renderMode) != null ? _renderer_renderMode : RenderMode.MESH,
|
|
12761
12746
|
blending: (_renderer_blending = renderer.blending) != null ? _renderer_blending : BlendingMode.ALPHA,
|
|
12762
|
-
texture:
|
|
12747
|
+
texture: renderer.texture ? this.engine.findObject(renderer.texture) : this.engine.emptyTexture,
|
|
12763
12748
|
occlusion: !!renderer.occlusion,
|
|
12764
12749
|
transparentOcclusion: !!renderer.transparentOcclusion || maskMode === MaskMode.MASK,
|
|
12765
12750
|
side: (_renderer_side = renderer.side) != null ? _renderer_side : SideMode.DOUBLE,
|
|
@@ -12976,14 +12961,14 @@ var ShapeComponent = /*#__PURE__*/ function(BaseRenderComponent) {
|
|
|
12976
12961
|
var control2 = easingIns[pointIndex.easingIn];
|
|
12977
12962
|
this.graphicsPath.bezierCurveTo(control1.x + lastPoint.x, control1.y + lastPoint.y, control2.x + point.x, control2.y + point.y, point.x, point.y, 1);
|
|
12978
12963
|
}
|
|
12979
|
-
var pointIndex1 = indices[0];
|
|
12980
|
-
var lastPointIndex1 = indices[indices.length - 1];
|
|
12981
|
-
var point1 = points[pointIndex1.point];
|
|
12982
|
-
var lastPoint1 = points[lastPointIndex1.point];
|
|
12983
|
-
var control11 = easingOuts[lastPointIndex1.easingOut];
|
|
12984
|
-
var control21 = easingIns[pointIndex1.easingIn];
|
|
12985
|
-
this.graphicsPath.bezierCurveTo(control11.x + lastPoint1.x, control11.y + lastPoint1.y, control21.x + point1.x, control21.y + point1.y, point1.x, point1.y, 1);
|
|
12986
12964
|
if (shape.close) {
|
|
12965
|
+
var pointIndex1 = indices[0];
|
|
12966
|
+
var lastPointIndex1 = indices[indices.length - 1];
|
|
12967
|
+
var point1 = points[pointIndex1.point];
|
|
12968
|
+
var lastPoint1 = points[lastPointIndex1.point];
|
|
12969
|
+
var control11 = easingOuts[lastPointIndex1.easingOut];
|
|
12970
|
+
var control21 = easingIns[pointIndex1.easingIn];
|
|
12971
|
+
this.graphicsPath.bezierCurveTo(control11.x + lastPoint1.x, control11.y + lastPoint1.y, control21.x + point1.x, control21.y + point1.y, point1.x, point1.y, 1);
|
|
12987
12972
|
this.graphicsPath.closePath();
|
|
12988
12973
|
}
|
|
12989
12974
|
}
|
|
@@ -13113,6 +13098,10 @@ var ShapeComponent = /*#__PURE__*/ function(BaseRenderComponent) {
|
|
|
13113
13098
|
break;
|
|
13114
13099
|
}
|
|
13115
13100
|
}
|
|
13101
|
+
var maskProps = data.mask;
|
|
13102
|
+
if (maskProps && maskProps.ref) {
|
|
13103
|
+
maskProps.ref = this.engine.findObject(maskProps.ref);
|
|
13104
|
+
}
|
|
13116
13105
|
var maskMode = this.maskManager.getMaskMode(data);
|
|
13117
13106
|
var maskRef = this.maskManager.getRefValue();
|
|
13118
13107
|
this.material.stencilRef = maskRef !== undefined ? [
|
|
@@ -13262,11 +13251,11 @@ var Fake3DAnimationMode;
|
|
|
13262
13251
|
Fake3DAnimationMode[Fake3DAnimationMode["Linear"] = 1] = "Linear";
|
|
13263
13252
|
})(Fake3DAnimationMode || (Fake3DAnimationMode = {}));
|
|
13264
13253
|
|
|
13265
|
-
var CameraController = /*#__PURE__*/ function(
|
|
13266
|
-
_inherits(CameraController,
|
|
13254
|
+
var CameraController = /*#__PURE__*/ function(Component) {
|
|
13255
|
+
_inherits(CameraController, Component);
|
|
13267
13256
|
function CameraController(engine, props) {
|
|
13268
13257
|
var _this;
|
|
13269
|
-
_this =
|
|
13258
|
+
_this = Component.call(this, engine) || this;
|
|
13270
13259
|
if (props) {
|
|
13271
13260
|
_this.fromData(props);
|
|
13272
13261
|
}
|
|
@@ -13287,11 +13276,11 @@ var CameraController = /*#__PURE__*/ function(Behaviour) {
|
|
|
13287
13276
|
}
|
|
13288
13277
|
};
|
|
13289
13278
|
_proto.fromData = function fromData(data) {
|
|
13290
|
-
|
|
13279
|
+
Component.prototype.fromData.call(this, data);
|
|
13291
13280
|
this.options = data.options;
|
|
13292
13281
|
};
|
|
13293
13282
|
return CameraController;
|
|
13294
|
-
}(
|
|
13283
|
+
}(Component);
|
|
13295
13284
|
CameraController = __decorate([
|
|
13296
13285
|
effectsClass(DataType.CameraController)
|
|
13297
13286
|
], CameraController);
|
|
@@ -19439,7 +19428,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
19439
19428
|
mask: maskProps.maskRef,
|
|
19440
19429
|
maskMode: maskProps.maskMode,
|
|
19441
19430
|
forceTarget: forceTarget,
|
|
19442
|
-
diffuse: renderer.texture,
|
|
19431
|
+
diffuse: renderer.texture ? this.engine.findObject(renderer.texture) : undefined,
|
|
19443
19432
|
sizeOverLifetime: sizeOverLifetimeGetter,
|
|
19444
19433
|
anchor: anchor
|
|
19445
19434
|
};
|
|
@@ -19526,7 +19515,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
19526
19515
|
maxTrailCount: options.maxCount,
|
|
19527
19516
|
pointCountPerTrail: Math.round(trails.maxPointPerTrail) || 32,
|
|
19528
19517
|
blending: trails.blending,
|
|
19529
|
-
texture: trails.texture,
|
|
19518
|
+
texture: trails.texture ? this.engine.findObject(trails.texture) : undefined,
|
|
19530
19519
|
opacityOverLifetime: createValueGetter(trails.opacityOverLifetime || 1),
|
|
19531
19520
|
widthOverTrail: createValueGetter(trails.widthOverTrail || 1),
|
|
19532
19521
|
// order: vfxItem.listIndex + (trails.orderOffset || 0),
|
|
@@ -19565,8 +19554,9 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
19565
19554
|
var maskRef = 0;
|
|
19566
19555
|
if (data.mask) {
|
|
19567
19556
|
var _data_mask = data.mask, mode = _data_mask.mode, ref = _data_mask.ref;
|
|
19557
|
+
var refComponent = this.engine.findObject(ref);
|
|
19568
19558
|
maskMode = mode;
|
|
19569
|
-
maskRef =
|
|
19559
|
+
maskRef = refComponent.maskManager.getRefValue();
|
|
19570
19560
|
}
|
|
19571
19561
|
return {
|
|
19572
19562
|
maskMode: maskMode,
|
|
@@ -20654,13 +20644,11 @@ Vector2PropertyPlayableAsset = __decorate([
|
|
|
20654
20644
|
effectsClass(DataType.Vector2PropertyPlayableAsset)
|
|
20655
20645
|
], Vector2PropertyPlayableAsset);
|
|
20656
20646
|
|
|
20657
|
-
|
|
20658
|
-
|
|
20659
|
-
*/ var CompositionComponent = /*#__PURE__*/ function(Behaviour) {
|
|
20660
|
-
_inherits(CompositionComponent, Behaviour);
|
|
20647
|
+
var CompositionComponent = /*#__PURE__*/ function(Component) {
|
|
20648
|
+
_inherits(CompositionComponent, Component);
|
|
20661
20649
|
function CompositionComponent() {
|
|
20662
20650
|
var _this;
|
|
20663
|
-
_this =
|
|
20651
|
+
_this = Component.apply(this, arguments) || this;
|
|
20664
20652
|
_this.time = 0;
|
|
20665
20653
|
_this.startTime = 0;
|
|
20666
20654
|
_this.items = [] // 场景的所有元素
|
|
@@ -20836,13 +20824,10 @@ Vector2PropertyPlayableAsset = __decorate([
|
|
|
20836
20824
|
return startOrder;
|
|
20837
20825
|
};
|
|
20838
20826
|
_proto.fromData = function fromData(data) {
|
|
20839
|
-
|
|
20827
|
+
Component.prototype.fromData.call(this, data);
|
|
20840
20828
|
var compositionData = data;
|
|
20841
|
-
this.items = compositionData.items;
|
|
20842
20829
|
var _compositionData_startTime;
|
|
20843
20830
|
this.startTime = (_compositionData_startTime = compositionData.startTime) != null ? _compositionData_startTime : 0;
|
|
20844
|
-
this.sceneBindings = compositionData.sceneBindings;
|
|
20845
|
-
this.timelineAsset = compositionData.timelineAsset;
|
|
20846
20831
|
};
|
|
20847
20832
|
_proto.resolveBindings = function resolveBindings() {
|
|
20848
20833
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.sceneBindings), _step; !(_step = _iterator()).done;){
|
|
@@ -20865,7 +20850,19 @@ Vector2PropertyPlayableAsset = __decorate([
|
|
|
20865
20850
|
}
|
|
20866
20851
|
};
|
|
20867
20852
|
return CompositionComponent;
|
|
20868
|
-
}(
|
|
20853
|
+
}(Component);
|
|
20854
|
+
__decorate([
|
|
20855
|
+
serialize()
|
|
20856
|
+
], CompositionComponent.prototype, "items", void 0);
|
|
20857
|
+
__decorate([
|
|
20858
|
+
serialize()
|
|
20859
|
+
], CompositionComponent.prototype, "sceneBindings", void 0);
|
|
20860
|
+
__decorate([
|
|
20861
|
+
serialize()
|
|
20862
|
+
], CompositionComponent.prototype, "timelineAsset", void 0);
|
|
20863
|
+
CompositionComponent = __decorate([
|
|
20864
|
+
effectsClass("CompositionComponent")
|
|
20865
|
+
], CompositionComponent);
|
|
20869
20866
|
|
|
20870
20867
|
/**
|
|
20871
20868
|
*
|
|
@@ -21057,636 +21054,166 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
21057
21054
|
// }
|
|
21058
21055
|
(TickData);
|
|
21059
21056
|
|
|
21060
|
-
|
|
21061
|
-
|
|
21062
|
-
|
|
21063
|
-
|
|
21064
|
-
|
|
21057
|
+
/**
|
|
21058
|
+
* 合成抽象类:核心对象,通常一个场景只包含一个合成,可能会有多个合成。
|
|
21059
|
+
* 合成中包含了相关的 Item 元素,支持对 Item 元素的创建、更新和销毁。
|
|
21060
|
+
* 也负责 Item 相关的动画播放控制,和持有渲染帧数据。
|
|
21061
|
+
*/ var Composition = /*#__PURE__*/ function(EventEmitter) {
|
|
21062
|
+
_inherits(Composition, EventEmitter);
|
|
21063
|
+
function Composition(props, scene) {
|
|
21064
|
+
var _this;
|
|
21065
|
+
var _scene_jsonScene_renderSettings;
|
|
21066
|
+
_this = EventEmitter.call(this) || this;
|
|
21067
|
+
/**
|
|
21068
|
+
*
|
|
21069
|
+
*/ _this.sceneTicking = new SceneTicking();
|
|
21070
|
+
/**
|
|
21071
|
+
* 动画播放速度
|
|
21072
|
+
*/ _this.speed = 1;
|
|
21073
|
+
/**
|
|
21074
|
+
* 合成是否结束
|
|
21075
|
+
*/ _this.isEnded = false;
|
|
21076
|
+
/**
|
|
21077
|
+
* 用于保存与当前合成相关的插件数据
|
|
21078
|
+
*/ _this.loaderData = {};
|
|
21079
|
+
/**
|
|
21080
|
+
* 预合成数组
|
|
21081
|
+
*/ _this.refContent = [];
|
|
21082
|
+
/**
|
|
21083
|
+
* 是否开启后处理
|
|
21084
|
+
*/ _this.postProcessingEnabled = false;
|
|
21085
|
+
// TODO: 待优化
|
|
21086
|
+
_this.assigned = false;
|
|
21087
|
+
/**
|
|
21088
|
+
* 销毁状态位
|
|
21089
|
+
*/ _this.destroyed = false;
|
|
21090
|
+
_this.postLoaders = [];
|
|
21091
|
+
/**
|
|
21092
|
+
* 合成暂停/播放 标识
|
|
21093
|
+
*/ _this.paused = false;
|
|
21094
|
+
_this.lastVideoUpdateTime = 0;
|
|
21095
|
+
_this.isEndCalled = false;
|
|
21096
|
+
_this._textures = [];
|
|
21097
|
+
var _props_reusable = props.reusable, reusable = _props_reusable === void 0 ? false : _props_reusable, _props_speed = props.speed, speed = _props_speed === void 0 ? 1 : _props_speed, _props_baseRenderOrder = props.baseRenderOrder, baseRenderOrder = _props_baseRenderOrder === void 0 ? 0 : _props_baseRenderOrder, renderer = props.renderer, event = props.event, width = props.width, height = props.height, handleItemMessage = props.handleItemMessage;
|
|
21098
|
+
_this.renderer = renderer;
|
|
21099
|
+
_this._textures = scene.textureOptions;
|
|
21100
|
+
var _scene_jsonScene_renderSettings_postProcessingEnabled;
|
|
21101
|
+
_this.postProcessingEnabled = (_scene_jsonScene_renderSettings_postProcessingEnabled = (_scene_jsonScene_renderSettings = scene.jsonScene.renderSettings) == null ? void 0 : _scene_jsonScene_renderSettings.postProcessingEnabled) != null ? _scene_jsonScene_renderSettings_postProcessingEnabled : false;
|
|
21102
|
+
_this.getEngine().renderLevel = scene.renderLevel;
|
|
21103
|
+
if (reusable) {
|
|
21104
|
+
_this.keepResource = true;
|
|
21105
|
+
scene.textures = undefined;
|
|
21106
|
+
scene.consumed = true;
|
|
21065
21107
|
}
|
|
21066
|
-
|
|
21067
|
-
|
|
21068
|
-
|
|
21069
|
-
|
|
21070
|
-
|
|
21071
|
-
var key = _step.value;
|
|
21072
|
-
// TODO 待移除,序列化属性通过 effectsObject 对象直接获取
|
|
21073
|
-
var value = effectsObject.taggedProperties[key];
|
|
21074
|
-
if (value === undefined) {
|
|
21075
|
-
value = effectsObject[key];
|
|
21076
|
-
}
|
|
21077
|
-
if (EffectsObject.is(value)) {
|
|
21078
|
-
SerializationHelper.collectSerializableObject(value, res);
|
|
21079
|
-
} else if (isArray(value)) {
|
|
21080
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(value), _step1; !(_step1 = _iterator1()).done;){
|
|
21081
|
-
var arrayValue = _step1.value;
|
|
21082
|
-
if (EffectsObject.is(arrayValue)) {
|
|
21083
|
-
SerializationHelper.collectSerializableObject(arrayValue, res);
|
|
21084
|
-
}
|
|
21085
|
-
}
|
|
21086
|
-
} else if (isObject(value)) {
|
|
21087
|
-
// 非 EffectsObject 对象只递归一层
|
|
21088
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(Object.keys(value)), _step2; !(_step2 = _iterator2()).done;){
|
|
21089
|
-
var objectKey = _step2.value;
|
|
21090
|
-
var objectValue = value[objectKey];
|
|
21091
|
-
if (EffectsObject.is(objectValue)) {
|
|
21092
|
-
SerializationHelper.collectSerializableObject(objectValue, res);
|
|
21093
|
-
}
|
|
21094
|
-
}
|
|
21095
|
-
}
|
|
21108
|
+
var sourceContent = scene.jsonScene.compositions[0];
|
|
21109
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(scene.jsonScene.compositions), _step; !(_step = _iterator()).done;){
|
|
21110
|
+
var composition = _step.value;
|
|
21111
|
+
if (composition.id === scene.jsonScene.compositionId) {
|
|
21112
|
+
sourceContent = composition;
|
|
21096
21113
|
}
|
|
21097
21114
|
}
|
|
21115
|
+
assertExist(sourceContent);
|
|
21116
|
+
// Instantiate composition rootItem
|
|
21117
|
+
_this.rootItem = new VFXItem(_this.getEngine());
|
|
21118
|
+
_this.rootItem.name = "rootItem";
|
|
21119
|
+
_this.rootItem.duration = sourceContent.duration;
|
|
21120
|
+
_this.rootItem.endBehavior = sourceContent.endBehavior;
|
|
21121
|
+
_this.rootItem.composition = _assert_this_initialized(_this);
|
|
21122
|
+
// Create rootItem components
|
|
21123
|
+
//@ts-expect-error TODO update spec.
|
|
21124
|
+
var componentPaths = sourceContent.components;
|
|
21125
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(componentPaths), _step1; !(_step1 = _iterator1()).done;){
|
|
21126
|
+
var componentPath = _step1.value;
|
|
21127
|
+
var component = _this.getEngine().findObject(componentPath);
|
|
21128
|
+
_this.rootItem.components.push(component);
|
|
21129
|
+
component.item = _this.rootItem;
|
|
21130
|
+
}
|
|
21131
|
+
_this.rootComposition = _this.rootItem.getComponent(CompositionComponent);
|
|
21132
|
+
_this.width = width;
|
|
21133
|
+
_this.height = height;
|
|
21134
|
+
_this.renderOrder = baseRenderOrder;
|
|
21135
|
+
_this.id = sourceContent.id;
|
|
21136
|
+
_this.renderer = renderer;
|
|
21137
|
+
_this.event = event;
|
|
21138
|
+
var _scene_startTime, _scene_totalTime;
|
|
21139
|
+
_this.statistic = {
|
|
21140
|
+
loadStart: (_scene_startTime = scene.startTime) != null ? _scene_startTime : 0,
|
|
21141
|
+
loadTime: (_scene_totalTime = scene.totalTime) != null ? _scene_totalTime : 0,
|
|
21142
|
+
compileTime: 0,
|
|
21143
|
+
firstFrameTime: 0
|
|
21144
|
+
};
|
|
21145
|
+
_this.reusable = reusable;
|
|
21146
|
+
_this.speed = speed;
|
|
21147
|
+
_this.name = sourceContent.name;
|
|
21148
|
+
_this.pluginSystem = scene.pluginSystem;
|
|
21149
|
+
_this.pluginSystem.initializeComposition(_assert_this_initialized(_this), scene);
|
|
21150
|
+
_this.camera = new Camera(_this.name, _extends({}, sourceContent == null ? void 0 : sourceContent.camera, {
|
|
21151
|
+
aspect: width / height
|
|
21152
|
+
}));
|
|
21153
|
+
_this.url = scene.url;
|
|
21154
|
+
_this.assigned = true;
|
|
21155
|
+
_this.interactive = true;
|
|
21156
|
+
_this.handleItemMessage = handleItemMessage;
|
|
21157
|
+
_this.createRenderFrame();
|
|
21158
|
+
_this.rendererOptions = null;
|
|
21159
|
+
Composition.buildItemTree(_this.rootItem);
|
|
21160
|
+
_this.rootComposition.setChildrenRenderOrder(0);
|
|
21161
|
+
_this.pluginSystem.resetComposition(_assert_this_initialized(_this), _this.renderFrame);
|
|
21162
|
+
return _this;
|
|
21163
|
+
}
|
|
21164
|
+
var _proto = Composition.prototype;
|
|
21165
|
+
/**
|
|
21166
|
+
* 获取合成的时长
|
|
21167
|
+
*/ _proto.getDuration = function getDuration() {
|
|
21168
|
+
return this.rootItem.duration;
|
|
21098
21169
|
};
|
|
21099
|
-
|
|
21100
|
-
|
|
21101
|
-
|
|
21102
|
-
|
|
21103
|
-
|
|
21104
|
-
var serializedDatas = _extends({}, engine.jsonSceneData);
|
|
21105
|
-
// 递归收集所有需要序列化的对象
|
|
21106
|
-
SerializationHelper.collectSerializableObject(effectsObject, serializableMap);
|
|
21107
|
-
// 依次序列化
|
|
21108
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(serializableMap)), _step; !(_step = _iterator()).done;){
|
|
21109
|
-
var guid = _step.value;
|
|
21110
|
-
var serializeObject = serializableMap[guid];
|
|
21111
|
-
if (!serializedDatas[serializeObject.getInstanceId()]) {
|
|
21112
|
-
serializedDatas[serializeObject.getInstanceId()] = {};
|
|
21113
|
-
}
|
|
21114
|
-
SerializationHelper.serialize(serializeObject, serializedDatas[serializeObject.getInstanceId()]);
|
|
21115
|
-
}
|
|
21116
|
-
return serializedDatas;
|
|
21170
|
+
/**
|
|
21171
|
+
* 重新开始合成
|
|
21172
|
+
*/ _proto.restart = function restart() {
|
|
21173
|
+
this.reset();
|
|
21174
|
+
this.forwardTime(this.startTime);
|
|
21117
21175
|
};
|
|
21118
|
-
|
|
21119
|
-
|
|
21120
|
-
|
|
21121
|
-
|
|
21122
|
-
|
|
21123
|
-
|
|
21124
|
-
|
|
21125
|
-
|
|
21126
|
-
|
|
21127
|
-
|
|
21128
|
-
|
|
21129
|
-
|
|
21130
|
-
|
|
21131
|
-
|
|
21132
|
-
|
|
21133
|
-
|
|
21134
|
-
|
|
21135
|
-
|
|
21136
|
-
|
|
21137
|
-
|
|
21138
|
-
|
|
21139
|
-
|
|
21140
|
-
|
|
21141
|
-
|
|
21142
|
-
|
|
21143
|
-
|
|
21144
|
-
|
|
21145
|
-
|
|
21146
|
-
|
|
21147
|
-
|
|
21176
|
+
/**
|
|
21177
|
+
* 设置当前合成的渲染顺序
|
|
21178
|
+
* @param index - 序号,大的后绘制
|
|
21179
|
+
*/ _proto.setIndex = function setIndex(index) {
|
|
21180
|
+
this.renderOrder = index;
|
|
21181
|
+
};
|
|
21182
|
+
/**
|
|
21183
|
+
* 获取当前合成的渲染顺序
|
|
21184
|
+
* @returns
|
|
21185
|
+
*/ _proto.getIndex = function getIndex() {
|
|
21186
|
+
return this.renderOrder;
|
|
21187
|
+
};
|
|
21188
|
+
/**
|
|
21189
|
+
* 设置合成的动画速度
|
|
21190
|
+
* @param speed - 速度
|
|
21191
|
+
*/ _proto.setSpeed = function setSpeed(speed) {
|
|
21192
|
+
this.speed = speed;
|
|
21193
|
+
};
|
|
21194
|
+
/**
|
|
21195
|
+
* 设置合成的可见性
|
|
21196
|
+
* @since 2.0.0
|
|
21197
|
+
* @param visible - 是否可见
|
|
21198
|
+
*/ _proto.setVisible = function setVisible(visible) {
|
|
21199
|
+
this.rootItem.setVisible(visible);
|
|
21200
|
+
};
|
|
21201
|
+
/**
|
|
21202
|
+
* 获取合成的动画速度
|
|
21203
|
+
* @returns
|
|
21204
|
+
*/ _proto.getSpeed = function getSpeed() {
|
|
21205
|
+
return this.speed;
|
|
21206
|
+
};
|
|
21207
|
+
/**
|
|
21208
|
+
*
|
|
21209
|
+
*/ _proto.play = function play() {
|
|
21210
|
+
if (this.isEnded && this.reusable) {
|
|
21211
|
+
this.restart();
|
|
21148
21212
|
}
|
|
21149
|
-
|
|
21150
|
-
|
|
21151
|
-
|
|
21152
|
-
|
|
21153
|
-
if (typeof value1 === "number" || typeof value1 === "string" || typeof value1 === "boolean" || SerializationHelper.checkTypedArray(value1)) {
|
|
21154
|
-
// TODO json 数据避免传 typedArray
|
|
21155
|
-
serializedData[key1] = value1;
|
|
21156
|
-
} else if (isArray(value1)) {
|
|
21157
|
-
if (!serializedData[key1]) {
|
|
21158
|
-
serializedData[key1] = [];
|
|
21159
|
-
}
|
|
21160
|
-
SerializationHelper.serializeArrayProperty(value1, serializedData[key1], 0);
|
|
21161
|
-
} else if (EffectsObject.is(value1)) {
|
|
21162
|
-
// TODO 处理 EffectsObject 递归序列化
|
|
21163
|
-
serializedData[key1] = {
|
|
21164
|
-
id: value1.getInstanceId()
|
|
21165
|
-
};
|
|
21166
|
-
} else if (isObject(value1)) {
|
|
21167
|
-
if (!serializedData[key1]) {
|
|
21168
|
-
serializedData[key1] = {};
|
|
21169
|
-
}
|
|
21170
|
-
SerializationHelper.serializeObjectProperty(value1, serializedData[key1], 0);
|
|
21171
|
-
}
|
|
21172
|
-
}
|
|
21173
|
-
return serializedData;
|
|
21174
|
-
};
|
|
21175
|
-
SerializationHelper.deserialize = function deserialize(serializedData, effectsObject) {
|
|
21176
|
-
var taggedProperties = effectsObject.taggedProperties;
|
|
21177
|
-
var serializedProperties = getMergedStore(effectsObject);
|
|
21178
|
-
var engine = effectsObject.engine;
|
|
21179
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(serializedData)), _step; !(_step = _iterator()).done;){
|
|
21180
|
-
var key = _step.value;
|
|
21181
|
-
if (serializedProperties && serializedProperties[key]) {
|
|
21182
|
-
continue;
|
|
21183
|
-
}
|
|
21184
|
-
var value = serializedData[key];
|
|
21185
|
-
taggedProperties[key] = SerializationHelper.deserializeProperty(value, engine, 0);
|
|
21186
|
-
}
|
|
21187
|
-
if (serializedProperties) {
|
|
21188
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(Object.keys(serializedProperties)), _step1; !(_step1 = _iterator1()).done;){
|
|
21189
|
-
var key1 = _step1.value;
|
|
21190
|
-
var value1 = serializedData[key1];
|
|
21191
|
-
if (value1 === undefined) {
|
|
21192
|
-
continue;
|
|
21193
|
-
}
|
|
21194
|
-
var propertyType = serializedProperties[key1].type;
|
|
21195
|
-
// FIXME: taggedProperties 为 readonly,这里存在强制赋值
|
|
21196
|
-
// @ts-expect-error
|
|
21197
|
-
effectsObject[key1] = SerializationHelper.deserializeProperty(value1, engine, 0, propertyType);
|
|
21198
|
-
}
|
|
21199
|
-
}
|
|
21200
|
-
effectsObject.fromData(taggedProperties);
|
|
21201
|
-
};
|
|
21202
|
-
SerializationHelper.deserializeAsync = function deserializeAsync(serializedData, effectsObject) {
|
|
21203
|
-
return _async_to_generator(function() {
|
|
21204
|
-
var taggedProperties, serializedProperties, engine, _iterator, _step, key, value, _iterator1, _step1, key1, value1, propertyType;
|
|
21205
|
-
return __generator(this, function(_state) {
|
|
21206
|
-
switch(_state.label){
|
|
21207
|
-
case 0:
|
|
21208
|
-
taggedProperties = effectsObject.taggedProperties;
|
|
21209
|
-
serializedProperties = getMergedStore(effectsObject);
|
|
21210
|
-
engine = effectsObject.engine;
|
|
21211
|
-
_iterator = _create_for_of_iterator_helper_loose(Object.keys(serializedData));
|
|
21212
|
-
_state.label = 1;
|
|
21213
|
-
case 1:
|
|
21214
|
-
if (!!(_step = _iterator()).done) return [
|
|
21215
|
-
3,
|
|
21216
|
-
4
|
|
21217
|
-
];
|
|
21218
|
-
key = _step.value;
|
|
21219
|
-
if (serializedProperties && serializedProperties[key]) {
|
|
21220
|
-
return [
|
|
21221
|
-
3,
|
|
21222
|
-
3
|
|
21223
|
-
];
|
|
21224
|
-
}
|
|
21225
|
-
value = serializedData[key];
|
|
21226
|
-
return [
|
|
21227
|
-
4,
|
|
21228
|
-
SerializationHelper.deserializePropertyAsync(value, engine, 0)
|
|
21229
|
-
];
|
|
21230
|
-
case 2:
|
|
21231
|
-
taggedProperties[key] = _state.sent();
|
|
21232
|
-
_state.label = 3;
|
|
21233
|
-
case 3:
|
|
21234
|
-
return [
|
|
21235
|
-
3,
|
|
21236
|
-
1
|
|
21237
|
-
];
|
|
21238
|
-
case 4:
|
|
21239
|
-
if (!serializedProperties) return [
|
|
21240
|
-
3,
|
|
21241
|
-
8
|
|
21242
|
-
];
|
|
21243
|
-
_iterator1 = _create_for_of_iterator_helper_loose(Object.keys(serializedProperties));
|
|
21244
|
-
_state.label = 5;
|
|
21245
|
-
case 5:
|
|
21246
|
-
if (!!(_step1 = _iterator1()).done) return [
|
|
21247
|
-
3,
|
|
21248
|
-
8
|
|
21249
|
-
];
|
|
21250
|
-
key1 = _step1.value;
|
|
21251
|
-
value1 = serializedData[key1];
|
|
21252
|
-
if (value1 === undefined) {
|
|
21253
|
-
return [
|
|
21254
|
-
3,
|
|
21255
|
-
7
|
|
21256
|
-
];
|
|
21257
|
-
}
|
|
21258
|
-
propertyType = serializedProperties[key1].type;
|
|
21259
|
-
return [
|
|
21260
|
-
4,
|
|
21261
|
-
SerializationHelper.deserializePropertyAsync(value1, engine, 0, propertyType)
|
|
21262
|
-
];
|
|
21263
|
-
case 6:
|
|
21264
|
-
// FIXME: taggedProperties 为 readonly,这里存在强制赋值
|
|
21265
|
-
// @ts-expect-error
|
|
21266
|
-
effectsObject[key1] = _state.sent();
|
|
21267
|
-
_state.label = 7;
|
|
21268
|
-
case 7:
|
|
21269
|
-
return [
|
|
21270
|
-
3,
|
|
21271
|
-
5
|
|
21272
|
-
];
|
|
21273
|
-
case 8:
|
|
21274
|
-
effectsObject.fromData(taggedProperties);
|
|
21275
|
-
return [
|
|
21276
|
-
2
|
|
21277
|
-
];
|
|
21278
|
-
}
|
|
21279
|
-
});
|
|
21280
|
-
})();
|
|
21281
|
-
};
|
|
21282
|
-
SerializationHelper.checkTypedArray = function checkTypedArray(obj) {
|
|
21283
|
-
return _instanceof1(obj, Int8Array) || _instanceof1(obj, Uint8Array) || _instanceof1(obj, Uint8ClampedArray) || _instanceof1(obj, Int16Array) || _instanceof1(obj, Uint16Array) || _instanceof1(obj, Int32Array) || _instanceof1(obj, Uint32Array) || _instanceof1(obj, Float32Array) || _instanceof1(obj, Float64Array) || _instanceof1(obj, ArrayBuffer);
|
|
21284
|
-
};
|
|
21285
|
-
// check value is { id: 7e69662e964e4892ae8933f24562395b }
|
|
21286
|
-
SerializationHelper.checkDataPath = function checkDataPath(value) {
|
|
21287
|
-
return !!(isObject(value) && Object.keys(value).length === 1 && "id" in value && isString(value.id) && value.id.length === 32);
|
|
21288
|
-
};
|
|
21289
|
-
// TODO 测试函数,2.0 上线后移除
|
|
21290
|
-
SerializationHelper.checkGLTFNode = function checkGLTFNode(value) {
|
|
21291
|
-
return isObject(value) && value.nodeIndex !== undefined && value.isJoint !== undefined;
|
|
21292
|
-
};
|
|
21293
|
-
SerializationHelper.checkImageSource = function checkImageSource(value) {
|
|
21294
|
-
return isCanvas(value) || _instanceof1(value, HTMLImageElement);
|
|
21295
|
-
};
|
|
21296
|
-
SerializationHelper.deserializeProperty = function deserializeProperty(property, engine, level, type) {
|
|
21297
|
-
if (level > 14) {
|
|
21298
|
-
console.error("The nested object layers of the serialized data exceed the maximum limit.");
|
|
21299
|
-
return;
|
|
21300
|
-
}
|
|
21301
|
-
// 加载并链接 DataPath 字段表示的 EffectsObject 引用。Class 对象 copy [key, value] 会丢失对象信息,因此只递归数组对象和普通 js Object 结构对象。
|
|
21302
|
-
if (isArray(property)) {
|
|
21303
|
-
var res = [];
|
|
21304
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(property), _step; !(_step = _iterator()).done;){
|
|
21305
|
-
var value = _step.value;
|
|
21306
|
-
res.push(SerializationHelper.deserializeProperty(value, engine, level + 1, type));
|
|
21307
|
-
}
|
|
21308
|
-
return res;
|
|
21309
|
-
// TODO json 数据避免传 typedArray
|
|
21310
|
-
} else if (SerializationHelper.checkDataPath(property)) {
|
|
21311
|
-
return engine.assetLoader.loadGUID(property.id);
|
|
21312
|
-
} else if (isObject(property) && property.constructor === Object) {
|
|
21313
|
-
var res1;
|
|
21314
|
-
if (type) {
|
|
21315
|
-
res1 = new type();
|
|
21316
|
-
} else {
|
|
21317
|
-
res1 = {};
|
|
21318
|
-
}
|
|
21319
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(Object.keys(property)), _step1; !(_step1 = _iterator1()).done;){
|
|
21320
|
-
var key = _step1.value;
|
|
21321
|
-
res1[key] = SerializationHelper.deserializeProperty(property[key], engine, level + 1);
|
|
21322
|
-
}
|
|
21323
|
-
return res1;
|
|
21324
|
-
} else {
|
|
21325
|
-
return property;
|
|
21326
|
-
}
|
|
21327
|
-
};
|
|
21328
|
-
SerializationHelper.deserializePropertyAsync = function deserializePropertyAsync(property, engine, level, type) {
|
|
21329
|
-
return _async_to_generator(function() {
|
|
21330
|
-
var res, _iterator, _step, value, _, res1, res2, _iterator1, _step1, key;
|
|
21331
|
-
return __generator(this, function(_state) {
|
|
21332
|
-
switch(_state.label){
|
|
21333
|
-
case 0:
|
|
21334
|
-
if (level > 14) {
|
|
21335
|
-
console.error("The nested object layers of the serialized data exceed the maximum limit.");
|
|
21336
|
-
return [
|
|
21337
|
-
2
|
|
21338
|
-
];
|
|
21339
|
-
}
|
|
21340
|
-
if (!isArray(property)) return [
|
|
21341
|
-
3,
|
|
21342
|
-
5
|
|
21343
|
-
];
|
|
21344
|
-
res = [];
|
|
21345
|
-
_iterator = _create_for_of_iterator_helper_loose(property);
|
|
21346
|
-
_state.label = 1;
|
|
21347
|
-
case 1:
|
|
21348
|
-
if (!!(_step = _iterator()).done) return [
|
|
21349
|
-
3,
|
|
21350
|
-
4
|
|
21351
|
-
];
|
|
21352
|
-
value = _step.value;
|
|
21353
|
-
_ = res.push;
|
|
21354
|
-
return [
|
|
21355
|
-
4,
|
|
21356
|
-
SerializationHelper.deserializePropertyAsync(value, engine, level + 1, type)
|
|
21357
|
-
];
|
|
21358
|
-
case 2:
|
|
21359
|
-
_.apply(res, [
|
|
21360
|
-
_state.sent()
|
|
21361
|
-
]);
|
|
21362
|
-
_state.label = 3;
|
|
21363
|
-
case 3:
|
|
21364
|
-
return [
|
|
21365
|
-
3,
|
|
21366
|
-
1
|
|
21367
|
-
];
|
|
21368
|
-
case 4:
|
|
21369
|
-
return [
|
|
21370
|
-
2,
|
|
21371
|
-
res
|
|
21372
|
-
];
|
|
21373
|
-
case 5:
|
|
21374
|
-
if (!SerializationHelper.checkDataPath(property)) return [
|
|
21375
|
-
3,
|
|
21376
|
-
7
|
|
21377
|
-
];
|
|
21378
|
-
return [
|
|
21379
|
-
4,
|
|
21380
|
-
engine.assetLoader.loadGUIDAsync(property.id)
|
|
21381
|
-
];
|
|
21382
|
-
case 6:
|
|
21383
|
-
res1 = _state.sent();
|
|
21384
|
-
return [
|
|
21385
|
-
2,
|
|
21386
|
-
res1
|
|
21387
|
-
];
|
|
21388
|
-
case 7:
|
|
21389
|
-
if (!(isObject(property) && property.constructor === Object)) return [
|
|
21390
|
-
3,
|
|
21391
|
-
12
|
|
21392
|
-
];
|
|
21393
|
-
if (type) {
|
|
21394
|
-
res2 = new type();
|
|
21395
|
-
} else {
|
|
21396
|
-
res2 = {};
|
|
21397
|
-
}
|
|
21398
|
-
_iterator1 = _create_for_of_iterator_helper_loose(Object.keys(property));
|
|
21399
|
-
_state.label = 8;
|
|
21400
|
-
case 8:
|
|
21401
|
-
if (!!(_step1 = _iterator1()).done) return [
|
|
21402
|
-
3,
|
|
21403
|
-
11
|
|
21404
|
-
];
|
|
21405
|
-
key = _step1.value;
|
|
21406
|
-
return [
|
|
21407
|
-
4,
|
|
21408
|
-
SerializationHelper.deserializePropertyAsync(property[key], engine, level + 1)
|
|
21409
|
-
];
|
|
21410
|
-
case 9:
|
|
21411
|
-
res2[key] = _state.sent();
|
|
21412
|
-
_state.label = 10;
|
|
21413
|
-
case 10:
|
|
21414
|
-
return [
|
|
21415
|
-
3,
|
|
21416
|
-
8
|
|
21417
|
-
];
|
|
21418
|
-
case 11:
|
|
21419
|
-
return [
|
|
21420
|
-
2,
|
|
21421
|
-
res2
|
|
21422
|
-
];
|
|
21423
|
-
case 12:
|
|
21424
|
-
return [
|
|
21425
|
-
2,
|
|
21426
|
-
property
|
|
21427
|
-
];
|
|
21428
|
-
case 13:
|
|
21429
|
-
return [
|
|
21430
|
-
2
|
|
21431
|
-
];
|
|
21432
|
-
}
|
|
21433
|
-
});
|
|
21434
|
-
})();
|
|
21435
|
-
};
|
|
21436
|
-
SerializationHelper.serializeObjectProperty = function serializeObjectProperty(objectProperty, serializedData, level) {
|
|
21437
|
-
if (level > 14) {
|
|
21438
|
-
console.error("The nested object layers of the serialized data exceed the maximum limit.");
|
|
21439
|
-
return;
|
|
21440
|
-
}
|
|
21441
|
-
if (!serializedData) {
|
|
21442
|
-
serializedData = {};
|
|
21443
|
-
}
|
|
21444
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(objectProperty)), _step; !(_step = _iterator()).done;){
|
|
21445
|
-
var key = _step.value;
|
|
21446
|
-
var value = objectProperty[key];
|
|
21447
|
-
if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(objectProperty)) {
|
|
21448
|
-
// TODO json 数据避免传 typedArray
|
|
21449
|
-
serializedData[key] = value;
|
|
21450
|
-
} else if (isArray(value)) {
|
|
21451
|
-
if (!serializedData[key]) {
|
|
21452
|
-
serializedData[key] = [];
|
|
21453
|
-
}
|
|
21454
|
-
SerializationHelper.serializeArrayProperty(value, serializedData[key], level + 1);
|
|
21455
|
-
} else if (EffectsObject.is(value)) {
|
|
21456
|
-
// TODO 处理 EffectsObject 递归序列化
|
|
21457
|
-
serializedData[key] = {
|
|
21458
|
-
id: value.getInstanceId()
|
|
21459
|
-
};
|
|
21460
|
-
} else if (isObject(value)) {
|
|
21461
|
-
if (!serializedData[key]) {
|
|
21462
|
-
serializedData[key] = {};
|
|
21463
|
-
}
|
|
21464
|
-
SerializationHelper.serializeObjectProperty(value, serializedData[key], level + 1);
|
|
21465
|
-
}
|
|
21466
|
-
}
|
|
21467
|
-
};
|
|
21468
|
-
SerializationHelper.serializeArrayProperty = function serializeArrayProperty(arrayProperty, serializedData, level) {
|
|
21469
|
-
if (level > 14) {
|
|
21470
|
-
console.error("The nested object layers of the serialized data exceed the maximum limit.");
|
|
21471
|
-
return;
|
|
21472
|
-
}
|
|
21473
|
-
if (!serializedData) {
|
|
21474
|
-
serializedData = [];
|
|
21475
|
-
}
|
|
21476
|
-
for(var i = 0; i < arrayProperty.length; i++){
|
|
21477
|
-
var value = arrayProperty[i];
|
|
21478
|
-
if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(arrayProperty)) {
|
|
21479
|
-
// TODO json 数据避免传 typedArray
|
|
21480
|
-
serializedData[i] = value;
|
|
21481
|
-
} else if (isArray(value)) {
|
|
21482
|
-
if (!serializedData[i]) {
|
|
21483
|
-
serializedData[i] = [];
|
|
21484
|
-
}
|
|
21485
|
-
SerializationHelper.serializeArrayProperty(value, serializedData[i], level + 1);
|
|
21486
|
-
} else if (EffectsObject.is(value)) {
|
|
21487
|
-
// TODO 处理 EffectsObject 递归序列化
|
|
21488
|
-
serializedData[i] = {
|
|
21489
|
-
id: value.getInstanceId()
|
|
21490
|
-
};
|
|
21491
|
-
} else if (isObject(value)) {
|
|
21492
|
-
if (!serializedData[i]) {
|
|
21493
|
-
serializedData[i] = {};
|
|
21494
|
-
}
|
|
21495
|
-
SerializationHelper.serializeObjectProperty(value, serializedData[i], level + 1);
|
|
21496
|
-
}
|
|
21497
|
-
}
|
|
21498
|
-
};
|
|
21499
|
-
return SerializationHelper;
|
|
21500
|
-
}();
|
|
21501
|
-
|
|
21502
|
-
var _obj$1;
|
|
21503
|
-
/**
|
|
21504
|
-
* 机型和渲染等级对应表
|
|
21505
|
-
*
|
|
21506
|
-
* 机型:B-低端机、A-中端机、S-高端机
|
|
21507
|
-
* 渲染等级:B-低、A-中、S-高、A+-中高、B+-全部
|
|
21508
|
-
*
|
|
21509
|
-
* - S(高端机):高、全部、中高
|
|
21510
|
-
* - A(中端机):中、全部、中高
|
|
21511
|
-
* - B(低端机):低、全部
|
|
21512
|
-
* - undefined(全部机型)
|
|
21513
|
-
*/ var renderLevelPassSet = (_obj$1 = {}, _obj$1[RenderLevel.S] = [
|
|
21514
|
-
RenderLevel.S,
|
|
21515
|
-
RenderLevel.BPlus,
|
|
21516
|
-
RenderLevel.APlus
|
|
21517
|
-
], _obj$1[RenderLevel.A] = [
|
|
21518
|
-
RenderLevel.A,
|
|
21519
|
-
RenderLevel.BPlus,
|
|
21520
|
-
RenderLevel.APlus
|
|
21521
|
-
], _obj$1[RenderLevel.B] = [
|
|
21522
|
-
RenderLevel.B,
|
|
21523
|
-
RenderLevel.BPlus
|
|
21524
|
-
], _obj$1);
|
|
21525
|
-
function passRenderLevel(l, renderLevel) {
|
|
21526
|
-
if (!l || !renderLevel) {
|
|
21527
|
-
return true;
|
|
21528
|
-
}
|
|
21529
|
-
var arr = renderLevelPassSet[renderLevel];
|
|
21530
|
-
if (arr) {
|
|
21531
|
-
return arr.includes(l);
|
|
21532
|
-
}
|
|
21533
|
-
return false;
|
|
21534
|
-
}
|
|
21535
|
-
|
|
21536
|
-
/**
|
|
21537
|
-
* 合成抽象类:核心对象,通常一个场景只包含一个合成,可能会有多个合成。
|
|
21538
|
-
* 合成中包含了相关的 Item 元素,支持对 Item 元素的创建、更新和销毁。
|
|
21539
|
-
* 也负责 Item 相关的动画播放控制,和持有渲染帧数据。
|
|
21540
|
-
*/ var Composition = /*#__PURE__*/ function(EventEmitter) {
|
|
21541
|
-
_inherits(Composition, EventEmitter);
|
|
21542
|
-
function Composition(props, scene) {
|
|
21543
|
-
var _this;
|
|
21544
|
-
var _scene_jsonScene_renderSettings;
|
|
21545
|
-
_this = EventEmitter.call(this) || this;
|
|
21546
|
-
/**
|
|
21547
|
-
*
|
|
21548
|
-
*/ _this.sceneTicking = new SceneTicking();
|
|
21549
|
-
/**
|
|
21550
|
-
* 动画播放速度
|
|
21551
|
-
*/ _this.speed = 1;
|
|
21552
|
-
/**
|
|
21553
|
-
* 合成是否结束
|
|
21554
|
-
*/ _this.isEnded = false;
|
|
21555
|
-
/**
|
|
21556
|
-
* 用于保存与当前合成相关的插件数据
|
|
21557
|
-
*/ _this.loaderData = {};
|
|
21558
|
-
/**
|
|
21559
|
-
* 预合成数组
|
|
21560
|
-
*/ _this.refContent = [];
|
|
21561
|
-
/**
|
|
21562
|
-
* 是否开启后处理
|
|
21563
|
-
*/ _this.postProcessingEnabled = false;
|
|
21564
|
-
// TODO: 待优化
|
|
21565
|
-
_this.assigned = false;
|
|
21566
|
-
/**
|
|
21567
|
-
* 销毁状态位
|
|
21568
|
-
*/ _this.destroyed = false;
|
|
21569
|
-
_this.postLoaders = [];
|
|
21570
|
-
/**
|
|
21571
|
-
* 合成暂停/播放 标识
|
|
21572
|
-
*/ _this.paused = false;
|
|
21573
|
-
_this.lastVideoUpdateTime = 0;
|
|
21574
|
-
_this.isEndCalled = false;
|
|
21575
|
-
_this._textures = [];
|
|
21576
|
-
var _props_reusable = props.reusable, reusable = _props_reusable === void 0 ? false : _props_reusable, _props_speed = props.speed, speed = _props_speed === void 0 ? 1 : _props_speed, _props_baseRenderOrder = props.baseRenderOrder, baseRenderOrder = _props_baseRenderOrder === void 0 ? 0 : _props_baseRenderOrder, renderer = props.renderer, event = props.event, width = props.width, height = props.height, handleItemMessage = props.handleItemMessage;
|
|
21577
|
-
_this.renderer = renderer;
|
|
21578
|
-
_this._textures = scene.textureOptions;
|
|
21579
|
-
var _scene_jsonScene_renderSettings_postProcessingEnabled;
|
|
21580
|
-
_this.postProcessingEnabled = (_scene_jsonScene_renderSettings_postProcessingEnabled = (_scene_jsonScene_renderSettings = scene.jsonScene.renderSettings) == null ? void 0 : _scene_jsonScene_renderSettings.postProcessingEnabled) != null ? _scene_jsonScene_renderSettings_postProcessingEnabled : false;
|
|
21581
|
-
_this.getEngine().renderLevel = scene.renderLevel;
|
|
21582
|
-
if (reusable) {
|
|
21583
|
-
_this.keepResource = true;
|
|
21584
|
-
scene.textures = undefined;
|
|
21585
|
-
scene.consumed = true;
|
|
21586
|
-
}
|
|
21587
|
-
var sourceContent = scene.jsonScene.compositions[0];
|
|
21588
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(scene.jsonScene.compositions), _step; !(_step = _iterator()).done;){
|
|
21589
|
-
var composition = _step.value;
|
|
21590
|
-
if (composition.id === scene.jsonScene.compositionId) {
|
|
21591
|
-
sourceContent = composition;
|
|
21592
|
-
}
|
|
21593
|
-
}
|
|
21594
|
-
assertExist(sourceContent);
|
|
21595
|
-
// Instantiate composition rootItem
|
|
21596
|
-
_this.rootItem = new VFXItem(_this.getEngine());
|
|
21597
|
-
_this.rootItem.name = "rootItem";
|
|
21598
|
-
_this.rootItem.duration = sourceContent.duration;
|
|
21599
|
-
_this.rootItem.endBehavior = sourceContent.endBehavior;
|
|
21600
|
-
_this.rootItem.composition = _assert_this_initialized(_this);
|
|
21601
|
-
// Create rootCompositionComponent
|
|
21602
|
-
_this.rootComposition = _this.rootItem.addComponent(CompositionComponent);
|
|
21603
|
-
filterItemsByRenderLevel(sourceContent, _this.getEngine(), scene.renderLevel);
|
|
21604
|
-
SerializationHelper.deserialize(sourceContent, _this.rootComposition);
|
|
21605
|
-
_this.width = width;
|
|
21606
|
-
_this.height = height;
|
|
21607
|
-
_this.renderOrder = baseRenderOrder;
|
|
21608
|
-
_this.id = sourceContent.id;
|
|
21609
|
-
_this.renderer = renderer;
|
|
21610
|
-
_this.event = event;
|
|
21611
|
-
var _scene_startTime, _scene_totalTime;
|
|
21612
|
-
_this.statistic = {
|
|
21613
|
-
loadStart: (_scene_startTime = scene.startTime) != null ? _scene_startTime : 0,
|
|
21614
|
-
loadTime: (_scene_totalTime = scene.totalTime) != null ? _scene_totalTime : 0,
|
|
21615
|
-
compileTime: 0,
|
|
21616
|
-
firstFrameTime: 0
|
|
21617
|
-
};
|
|
21618
|
-
_this.reusable = reusable;
|
|
21619
|
-
_this.speed = speed;
|
|
21620
|
-
_this.name = sourceContent.name;
|
|
21621
|
-
_this.pluginSystem = scene.pluginSystem;
|
|
21622
|
-
_this.pluginSystem.initializeComposition(_assert_this_initialized(_this), scene);
|
|
21623
|
-
_this.camera = new Camera(_this.name, _extends({}, sourceContent == null ? void 0 : sourceContent.camera, {
|
|
21624
|
-
aspect: width / height
|
|
21625
|
-
}));
|
|
21626
|
-
_this.url = scene.url;
|
|
21627
|
-
_this.assigned = true;
|
|
21628
|
-
_this.interactive = true;
|
|
21629
|
-
_this.handleItemMessage = handleItemMessage;
|
|
21630
|
-
_this.createRenderFrame();
|
|
21631
|
-
_this.rendererOptions = null;
|
|
21632
|
-
_this.buildItemTree(_this.rootItem);
|
|
21633
|
-
_this.rootComposition.setChildrenRenderOrder(0);
|
|
21634
|
-
_this.pluginSystem.resetComposition(_assert_this_initialized(_this), _this.renderFrame);
|
|
21635
|
-
return _this;
|
|
21636
|
-
}
|
|
21637
|
-
var _proto = Composition.prototype;
|
|
21638
|
-
/**
|
|
21639
|
-
* 获取合成的时长
|
|
21640
|
-
*/ _proto.getDuration = function getDuration() {
|
|
21641
|
-
return this.rootItem.duration;
|
|
21642
|
-
};
|
|
21643
|
-
/**
|
|
21644
|
-
* 重新开始合成
|
|
21645
|
-
*/ _proto.restart = function restart() {
|
|
21646
|
-
this.reset();
|
|
21647
|
-
this.forwardTime(this.startTime);
|
|
21648
|
-
};
|
|
21649
|
-
/**
|
|
21650
|
-
* 设置当前合成的渲染顺序
|
|
21651
|
-
* @param index - 序号,大的后绘制
|
|
21652
|
-
*/ _proto.setIndex = function setIndex(index) {
|
|
21653
|
-
this.renderOrder = index;
|
|
21654
|
-
};
|
|
21655
|
-
/**
|
|
21656
|
-
* 获取当前合成的渲染顺序
|
|
21657
|
-
* @returns
|
|
21658
|
-
*/ _proto.getIndex = function getIndex() {
|
|
21659
|
-
return this.renderOrder;
|
|
21660
|
-
};
|
|
21661
|
-
/**
|
|
21662
|
-
* 设置合成的动画速度
|
|
21663
|
-
* @param speed - 速度
|
|
21664
|
-
*/ _proto.setSpeed = function setSpeed(speed) {
|
|
21665
|
-
this.speed = speed;
|
|
21666
|
-
};
|
|
21667
|
-
/**
|
|
21668
|
-
* 设置合成的可见性
|
|
21669
|
-
* @since 2.0.0
|
|
21670
|
-
* @param visible - 是否可见
|
|
21671
|
-
*/ _proto.setVisible = function setVisible(visible) {
|
|
21672
|
-
this.rootItem.setVisible(visible);
|
|
21673
|
-
};
|
|
21674
|
-
/**
|
|
21675
|
-
* 获取合成的动画速度
|
|
21676
|
-
* @returns
|
|
21677
|
-
*/ _proto.getSpeed = function getSpeed() {
|
|
21678
|
-
return this.speed;
|
|
21679
|
-
};
|
|
21680
|
-
/**
|
|
21681
|
-
*
|
|
21682
|
-
*/ _proto.play = function play() {
|
|
21683
|
-
if (this.isEnded && this.reusable) {
|
|
21684
|
-
this.restart();
|
|
21685
|
-
}
|
|
21686
|
-
if (this.rootComposition.isStartCalled) {
|
|
21687
|
-
this.gotoAndPlay(this.time - this.startTime);
|
|
21688
|
-
} else {
|
|
21689
|
-
this.gotoAndPlay(0);
|
|
21213
|
+
if (this.rootComposition.isStartCalled) {
|
|
21214
|
+
this.gotoAndPlay(this.time - this.startTime);
|
|
21215
|
+
} else {
|
|
21216
|
+
this.gotoAndPlay(0);
|
|
21690
21217
|
}
|
|
21691
21218
|
};
|
|
21692
21219
|
/**
|
|
@@ -21847,38 +21374,6 @@ function passRenderLevel(l, renderLevel) {
|
|
|
21847
21374
|
}
|
|
21848
21375
|
};
|
|
21849
21376
|
/**
|
|
21850
|
-
* 构建父子树,同时保存到 itemCacheMap 中便于查找
|
|
21851
|
-
*/ _proto.buildItemTree = function buildItemTree(compVFXItem) {
|
|
21852
|
-
if (!compVFXItem.composition) {
|
|
21853
|
-
return;
|
|
21854
|
-
}
|
|
21855
|
-
var itemMap = new Map();
|
|
21856
|
-
var contentItems = compVFXItem.getComponent(CompositionComponent).items;
|
|
21857
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(contentItems), _step; !(_step = _iterator()).done;){
|
|
21858
|
-
var item = _step.value;
|
|
21859
|
-
itemMap.set(item.id, item);
|
|
21860
|
-
}
|
|
21861
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(contentItems), _step1; !(_step1 = _iterator1()).done;){
|
|
21862
|
-
var item1 = _step1.value;
|
|
21863
|
-
if (item1.parentId === undefined) {
|
|
21864
|
-
item1.setParent(compVFXItem);
|
|
21865
|
-
} else {
|
|
21866
|
-
var parent = itemMap.get(item1.parentId);
|
|
21867
|
-
if (parent) {
|
|
21868
|
-
item1.setParent(parent);
|
|
21869
|
-
} else {
|
|
21870
|
-
throw new Error("The element references a non-existent element, please check the data.");
|
|
21871
|
-
}
|
|
21872
|
-
}
|
|
21873
|
-
}
|
|
21874
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(contentItems), _step2; !(_step2 = _iterator2()).done;){
|
|
21875
|
-
var item2 = _step2.value;
|
|
21876
|
-
if (VFXItem.isComposition(item2)) {
|
|
21877
|
-
this.buildItemTree(item2);
|
|
21878
|
-
}
|
|
21879
|
-
}
|
|
21880
|
-
};
|
|
21881
|
-
/**
|
|
21882
21377
|
* 更新视频数据到纹理
|
|
21883
21378
|
* @override
|
|
21884
21379
|
*/ _proto.updateVideo = function updateVideo() {
|
|
@@ -22234,8 +21729,32 @@ function passRenderLevel(l, renderLevel) {
|
|
|
22234
21729
|
2
|
|
22235
21730
|
];
|
|
22236
21731
|
}
|
|
22237
|
-
});
|
|
22238
|
-
})();
|
|
21732
|
+
});
|
|
21733
|
+
})();
|
|
21734
|
+
};
|
|
21735
|
+
/**
|
|
21736
|
+
* @internal
|
|
21737
|
+
* 构建父子树,同时保存到 itemCacheMap 中便于查找
|
|
21738
|
+
*/ Composition.buildItemTree = function buildItemTree(compVFXItem) {
|
|
21739
|
+
var itemMap = new Map();
|
|
21740
|
+
var contentItems = compVFXItem.getComponent(CompositionComponent).items;
|
|
21741
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(contentItems), _step; !(_step = _iterator()).done;){
|
|
21742
|
+
var item = _step.value;
|
|
21743
|
+
itemMap.set(item.id, item);
|
|
21744
|
+
}
|
|
21745
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(contentItems), _step1; !(_step1 = _iterator1()).done;){
|
|
21746
|
+
var item1 = _step1.value;
|
|
21747
|
+
if (item1.parentId === undefined) {
|
|
21748
|
+
item1.setParent(compVFXItem);
|
|
21749
|
+
} else {
|
|
21750
|
+
var parent = itemMap.get(item1.parentId);
|
|
21751
|
+
if (parent) {
|
|
21752
|
+
item1.setParent(parent);
|
|
21753
|
+
} else {
|
|
21754
|
+
throw new Error("The element references a non-existent element, please check the data.");
|
|
21755
|
+
}
|
|
21756
|
+
}
|
|
21757
|
+
}
|
|
22239
21758
|
};
|
|
22240
21759
|
_create_class(Composition, [
|
|
22241
21760
|
{
|
|
@@ -22298,25 +21817,6 @@ function passRenderLevel(l, renderLevel) {
|
|
|
22298
21817
|
]);
|
|
22299
21818
|
return Composition;
|
|
22300
21819
|
}(EventEmitter);
|
|
22301
|
-
function filterItemsByRenderLevel(composition, engine, renderLevel) {
|
|
22302
|
-
var items = [];
|
|
22303
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(composition.items), _step; !(_step = _iterator()).done;){
|
|
22304
|
-
var itemDataPath = _step.value;
|
|
22305
|
-
var itemProps = engine.findEffectsObjectData(itemDataPath.id);
|
|
22306
|
-
if (passRenderLevel(itemProps.renderLevel, renderLevel)) {
|
|
22307
|
-
items.push(itemDataPath);
|
|
22308
|
-
} else {
|
|
22309
|
-
// 非预合成元素未达到渲染等级的转化为空节点。
|
|
22310
|
-
// 预合成元素有根据 item type 的子元素加载判断,没法保留空节点,这边先整体过滤掉。
|
|
22311
|
-
if (itemProps.type !== ItemType.composition) {
|
|
22312
|
-
itemProps.components = [];
|
|
22313
|
-
items.push(itemDataPath);
|
|
22314
|
-
}
|
|
22315
|
-
}
|
|
22316
|
-
}
|
|
22317
|
-
composition.items = items;
|
|
22318
|
-
return composition;
|
|
22319
|
-
}
|
|
22320
21820
|
|
|
22321
21821
|
var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
22322
21822
|
_inherits(VFXItem, EffectsObject);
|
|
@@ -22329,7 +21829,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
22329
21829
|
*/ _this.transform = new Transform();
|
|
22330
21830
|
/**
|
|
22331
21831
|
* 元素动画的当前时间
|
|
22332
|
-
*/ _this.time =
|
|
21832
|
+
*/ _this.time = -1;
|
|
22333
21833
|
/**
|
|
22334
21834
|
* 元素动画的持续时间
|
|
22335
21835
|
*/ _this.duration = 0;
|
|
@@ -22340,9 +21840,8 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
22340
21840
|
* 元素动画结束时行为(如何处理元素)
|
|
22341
21841
|
*/ _this.endBehavior = EndBehavior.forward;
|
|
22342
21842
|
_this.type = ItemType.base;
|
|
22343
|
-
_this.isDuringPlay = false;
|
|
22344
21843
|
_this.components = [];
|
|
22345
|
-
_this.
|
|
21844
|
+
_this.isDuringPlay = false;
|
|
22346
21845
|
/**
|
|
22347
21846
|
* 元素是否激活
|
|
22348
21847
|
*/ _this.active = true;
|
|
@@ -22610,6 +22109,25 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
22610
22109
|
return undefined;
|
|
22611
22110
|
};
|
|
22612
22111
|
/**
|
|
22112
|
+
* 复制 VFXItem,返回一个新的 VFXItem
|
|
22113
|
+
* @since 2.4.0
|
|
22114
|
+
* @returns 复制的新 VFXItem
|
|
22115
|
+
*/ _proto.duplicate = function duplicate() {
|
|
22116
|
+
var previousObjectIDMap = new Map();
|
|
22117
|
+
this.gatherPreviousObjectID(previousObjectIDMap);
|
|
22118
|
+
// 重新设置当前元素和组件的 ID 以及子元素和子元素组件的 ID,避免实例化新的对象时产生碰撞
|
|
22119
|
+
this.resetGUID();
|
|
22120
|
+
var newItem = this.engine.findObject({
|
|
22121
|
+
id: this.defination.id
|
|
22122
|
+
});
|
|
22123
|
+
newItem.resetGUID();
|
|
22124
|
+
this.resetGUID(previousObjectIDMap);
|
|
22125
|
+
if (this.composition) {
|
|
22126
|
+
newItem.setParent(this.composition.rootItem);
|
|
22127
|
+
}
|
|
22128
|
+
return newItem;
|
|
22129
|
+
};
|
|
22130
|
+
/**
|
|
22613
22131
|
* @internal
|
|
22614
22132
|
*/ _proto.beginPlay = function beginPlay() {
|
|
22615
22133
|
this.isDuringPlay = true;
|
|
@@ -22704,19 +22222,18 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
22704
22222
|
if (duration < 0) {
|
|
22705
22223
|
throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
|
|
22706
22224
|
}
|
|
22707
|
-
|
|
22708
|
-
|
|
22709
|
-
var
|
|
22710
|
-
|
|
22711
|
-
|
|
22712
|
-
this.
|
|
22713
|
-
|
|
22714
|
-
|
|
22715
|
-
|
|
22716
|
-
|
|
22717
|
-
|
|
22225
|
+
if (data.components) {
|
|
22226
|
+
this.components.length = 0;
|
|
22227
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(data.components), _step; !(_step = _iterator()).done;){
|
|
22228
|
+
var componentPath = _step.value;
|
|
22229
|
+
var component = this.engine.findObject(componentPath);
|
|
22230
|
+
this.components.push(component);
|
|
22231
|
+
// TODO ParticleSystemRenderer 现在是动态生成的,后面需要在 json 中单独表示为一个组件
|
|
22232
|
+
if (_instanceof1(component, ParticleSystem)) {
|
|
22233
|
+
if (!this.components.includes(component.renderer)) {
|
|
22234
|
+
this.components.push(component.renderer);
|
|
22235
|
+
}
|
|
22718
22236
|
}
|
|
22719
|
-
this.rendererComponents.push(component.renderer);
|
|
22720
22237
|
}
|
|
22721
22238
|
}
|
|
22722
22239
|
if (VFXItem.isComposition(this)) {
|
|
@@ -22725,24 +22242,24 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
22725
22242
|
};
|
|
22726
22243
|
_proto.toData = function toData() {
|
|
22727
22244
|
var _this_parent;
|
|
22728
|
-
this.
|
|
22729
|
-
this.
|
|
22730
|
-
this.
|
|
22245
|
+
this.defination.id = this.guid;
|
|
22246
|
+
this.defination.transform = this.transform.toData();
|
|
22247
|
+
this.defination.dataType = DataType.VFXItemData;
|
|
22731
22248
|
if (((_this_parent = this.parent) == null ? void 0 : _this_parent.name) !== "rootItem") {
|
|
22732
22249
|
var _this_parent1;
|
|
22733
|
-
this.
|
|
22250
|
+
this.defination.parentId = (_this_parent1 = this.parent) == null ? void 0 : _this_parent1.guid;
|
|
22734
22251
|
}
|
|
22735
22252
|
// TODO 统一 sprite 等其他组件的序列化逻辑
|
|
22736
|
-
if (!this.
|
|
22737
|
-
this.
|
|
22253
|
+
if (!this.defination.components) {
|
|
22254
|
+
this.defination.components = [];
|
|
22738
22255
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
22739
22256
|
var component = _step.value;
|
|
22740
22257
|
if (_instanceof1(component, EffectComponent)) {
|
|
22741
|
-
this.
|
|
22258
|
+
this.defination.components.push(component);
|
|
22742
22259
|
}
|
|
22743
22260
|
}
|
|
22744
22261
|
}
|
|
22745
|
-
this.
|
|
22262
|
+
this.defination.content = {};
|
|
22746
22263
|
};
|
|
22747
22264
|
_proto.translateByPixel = function translateByPixel(x, y) {
|
|
22748
22265
|
if (this.composition) {
|
|
@@ -22799,17 +22316,52 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
22799
22316
|
if (!props) {
|
|
22800
22317
|
throw new Error("Referenced precomposition with Id: " + refId + " does not exist.");
|
|
22801
22318
|
}
|
|
22802
|
-
|
|
22803
|
-
|
|
22804
|
-
|
|
22805
|
-
|
|
22806
|
-
var
|
|
22807
|
-
|
|
22808
|
-
|
|
22809
|
-
|
|
22810
|
-
|
|
22319
|
+
//@ts-expect-error TODO update spec.
|
|
22320
|
+
var componentPaths = props.components;
|
|
22321
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(componentPaths), _step; !(_step = _iterator()).done;){
|
|
22322
|
+
var componentPath = _step.value;
|
|
22323
|
+
var component = this.engine.findObject(componentPath);
|
|
22324
|
+
component.item = this;
|
|
22325
|
+
this.components.push(component);
|
|
22326
|
+
component.setInstanceId(generateGUID());
|
|
22327
|
+
if (_instanceof1(component, CompositionComponent)) {
|
|
22328
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(component.items), _step1; !(_step1 = _iterator1()).done;){
|
|
22329
|
+
var vfxItem = _step1.value;
|
|
22330
|
+
vfxItem.setInstanceId(generateGUID());
|
|
22331
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(vfxItem.components), _step2; !(_step2 = _iterator2()).done;){
|
|
22332
|
+
var component1 = _step2.value;
|
|
22333
|
+
component1.setInstanceId(generateGUID());
|
|
22334
|
+
}
|
|
22335
|
+
}
|
|
22811
22336
|
}
|
|
22812
22337
|
}
|
|
22338
|
+
Composition.buildItemTree(this);
|
|
22339
|
+
};
|
|
22340
|
+
_proto.resetGUID = function resetGUID(previousObjectIDMap) {
|
|
22341
|
+
var _previousObjectIDMap_get;
|
|
22342
|
+
var itemGUID = (_previousObjectIDMap_get = previousObjectIDMap == null ? void 0 : previousObjectIDMap.get(this)) != null ? _previousObjectIDMap_get : generateGUID();
|
|
22343
|
+
this.setInstanceId(itemGUID);
|
|
22344
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
22345
|
+
var component = _step.value;
|
|
22346
|
+
var _previousObjectIDMap_get1;
|
|
22347
|
+
var componentGUID = (_previousObjectIDMap_get1 = previousObjectIDMap == null ? void 0 : previousObjectIDMap.get(component)) != null ? _previousObjectIDMap_get1 : generateGUID();
|
|
22348
|
+
component.setInstanceId(componentGUID);
|
|
22349
|
+
}
|
|
22350
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.children), _step1; !(_step1 = _iterator1()).done;){
|
|
22351
|
+
var child = _step1.value;
|
|
22352
|
+
child.resetGUID(previousObjectIDMap);
|
|
22353
|
+
}
|
|
22354
|
+
};
|
|
22355
|
+
_proto.gatherPreviousObjectID = function gatherPreviousObjectID(previousObjectIDMap) {
|
|
22356
|
+
previousObjectIDMap.set(this, this.getInstanceId());
|
|
22357
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
22358
|
+
var component = _step.value;
|
|
22359
|
+
previousObjectIDMap.set(component, component.getInstanceId());
|
|
22360
|
+
}
|
|
22361
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.children), _step1; !(_step1 = _iterator1()).done;){
|
|
22362
|
+
var child = _step1.value;
|
|
22363
|
+
child.gatherPreviousObjectID(previousObjectIDMap);
|
|
22364
|
+
}
|
|
22813
22365
|
};
|
|
22814
22366
|
/**
|
|
22815
22367
|
*
|
|
@@ -22916,9 +22468,11 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
22916
22468
|
set: function set(value) {
|
|
22917
22469
|
if (this.listIndex !== value) {
|
|
22918
22470
|
this.listIndex = value;
|
|
22919
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.
|
|
22920
|
-
var
|
|
22921
|
-
|
|
22471
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
22472
|
+
var component = _step.value;
|
|
22473
|
+
if (_instanceof1(component, RendererComponent)) {
|
|
22474
|
+
component.priority = value;
|
|
22475
|
+
}
|
|
22922
22476
|
}
|
|
22923
22477
|
}
|
|
22924
22478
|
}
|
|
@@ -22942,9 +22496,6 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
22942
22496
|
]);
|
|
22943
22497
|
return VFXItem;
|
|
22944
22498
|
}(EffectsObject);
|
|
22945
|
-
__decorate([
|
|
22946
|
-
serialize()
|
|
22947
|
-
], VFXItem.prototype, "components", void 0);
|
|
22948
22499
|
VFXItem = __decorate([
|
|
22949
22500
|
effectsClass(DataType.VFXItemData)
|
|
22950
22501
|
], VFXItem);
|
|
@@ -26959,66 +26510,255 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
26959
26510
|
if (fontStyle !== FontStyle.normal) {
|
|
26960
26511
|
fontDesc = fontStyle + " " + fontDesc;
|
|
26961
26512
|
}
|
|
26962
|
-
return fontDesc;
|
|
26513
|
+
return fontDesc;
|
|
26514
|
+
};
|
|
26515
|
+
_proto.setupOutline = function setupOutline() {
|
|
26516
|
+
var context = this.context;
|
|
26517
|
+
var _this_textStyle = this.textStyle, outlineColor = _this_textStyle.outlineColor, outlineWidth = _this_textStyle.outlineWidth;
|
|
26518
|
+
var r = outlineColor[0], g = outlineColor[1], b = outlineColor[2], a = outlineColor[3];
|
|
26519
|
+
if (context) {
|
|
26520
|
+
context.strokeStyle = "rgba(" + r * 255 + ", " + g * 255 + ", " + b * 255 + ", " + a + ")";
|
|
26521
|
+
context.lineWidth = outlineWidth * 2;
|
|
26522
|
+
}
|
|
26523
|
+
};
|
|
26524
|
+
_proto.setupShadow = function setupShadow() {
|
|
26525
|
+
var context = this.context;
|
|
26526
|
+
var _this_textStyle = this.textStyle, outlineColor = _this_textStyle.outlineColor, shadowBlur = _this_textStyle.shadowBlur, shadowOffsetX = _this_textStyle.shadowOffsetX, shadowOffsetY = _this_textStyle.shadowOffsetY;
|
|
26527
|
+
var r = outlineColor[0], g = outlineColor[1], b = outlineColor[2], a = outlineColor[3];
|
|
26528
|
+
if (context) {
|
|
26529
|
+
context.shadowColor = "rgba(" + r * 255 + ", " + g * 255 + ", " + b * 255 + ", " + a + ")";
|
|
26530
|
+
context.shadowBlur = shadowBlur;
|
|
26531
|
+
context.shadowOffsetX = shadowOffsetX;
|
|
26532
|
+
context.shadowOffsetY = -shadowOffsetY;
|
|
26533
|
+
}
|
|
26534
|
+
};
|
|
26535
|
+
return TextComponentBase;
|
|
26536
|
+
}();
|
|
26537
|
+
applyMixins(TextComponent, [
|
|
26538
|
+
TextComponentBase
|
|
26539
|
+
]);
|
|
26540
|
+
|
|
26541
|
+
// TODO: 注册必须用
|
|
26542
|
+
var TextLoader = /*#__PURE__*/ function(AbstractPlugin) {
|
|
26543
|
+
_inherits(TextLoader, AbstractPlugin);
|
|
26544
|
+
function TextLoader() {
|
|
26545
|
+
return AbstractPlugin.apply(this, arguments);
|
|
26546
|
+
}
|
|
26547
|
+
return TextLoader;
|
|
26548
|
+
}(AbstractPlugin);
|
|
26549
|
+
|
|
26550
|
+
var Asset = /*#__PURE__*/ function(EffectsObject) {
|
|
26551
|
+
_inherits(Asset, EffectsObject);
|
|
26552
|
+
function Asset() {
|
|
26553
|
+
return EffectsObject.apply(this, arguments);
|
|
26554
|
+
}
|
|
26555
|
+
return Asset;
|
|
26556
|
+
}(EffectsObject);
|
|
26557
|
+
|
|
26558
|
+
var BinaryAsset = /*#__PURE__*/ function(EffectsObject) {
|
|
26559
|
+
_inherits(BinaryAsset, EffectsObject);
|
|
26560
|
+
function BinaryAsset() {
|
|
26561
|
+
return EffectsObject.apply(this, arguments);
|
|
26562
|
+
}
|
|
26563
|
+
return BinaryAsset;
|
|
26564
|
+
}(EffectsObject);
|
|
26565
|
+
__decorate([
|
|
26566
|
+
serialize()
|
|
26567
|
+
], BinaryAsset.prototype, "buffer", void 0);
|
|
26568
|
+
BinaryAsset = __decorate([
|
|
26569
|
+
effectsClass(DataType.BinaryAsset)
|
|
26570
|
+
], BinaryAsset);
|
|
26571
|
+
|
|
26572
|
+
var SerializationHelper = /*#__PURE__*/ function() {
|
|
26573
|
+
function SerializationHelper() {}
|
|
26574
|
+
SerializationHelper.serialize = function serialize(effectsObject, serializedData) {
|
|
26575
|
+
effectsObject.toData();
|
|
26576
|
+
if (!serializedData) {
|
|
26577
|
+
serializedData = {};
|
|
26578
|
+
}
|
|
26579
|
+
var serializedProperties = getMergedStore(effectsObject);
|
|
26580
|
+
if (serializedProperties) {
|
|
26581
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(serializedProperties)), _step; !(_step = _iterator()).done;){
|
|
26582
|
+
var key = _step.value;
|
|
26583
|
+
var value = effectsObject[key];
|
|
26584
|
+
if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(value)) {
|
|
26585
|
+
// TODO json 数据避免传 typedArray
|
|
26586
|
+
serializedData[key] = value;
|
|
26587
|
+
} else if (isArray(value)) {
|
|
26588
|
+
if (!serializedData[key]) {
|
|
26589
|
+
serializedData[key] = [];
|
|
26590
|
+
}
|
|
26591
|
+
SerializationHelper.serializeArrayProperty(value, serializedData[key], 0);
|
|
26592
|
+
} else if (EffectsObject.is(value)) {
|
|
26593
|
+
// TODO 处理 EffectsObject 递归序列化
|
|
26594
|
+
serializedData[key] = {
|
|
26595
|
+
id: value.getInstanceId()
|
|
26596
|
+
};
|
|
26597
|
+
} else if (isObject(value)) {
|
|
26598
|
+
if (!serializedData[key]) {
|
|
26599
|
+
serializedData[key] = {};
|
|
26600
|
+
}
|
|
26601
|
+
SerializationHelper.serializeObjectProperty(value, serializedData[key], 0);
|
|
26602
|
+
}
|
|
26603
|
+
}
|
|
26604
|
+
}
|
|
26605
|
+
// TODO 待移除 tagggedProperties 为没有装饰器的临时方案
|
|
26606
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(Object.keys(effectsObject.defination)), _step1; !(_step1 = _iterator1()).done;){
|
|
26607
|
+
var key1 = _step1.value;
|
|
26608
|
+
var value1 = effectsObject.defination[key1];
|
|
26609
|
+
if (typeof value1 === "number" || typeof value1 === "string" || typeof value1 === "boolean" || SerializationHelper.checkTypedArray(value1)) {
|
|
26610
|
+
// TODO json 数据避免传 typedArray
|
|
26611
|
+
serializedData[key1] = value1;
|
|
26612
|
+
} else if (isArray(value1)) {
|
|
26613
|
+
if (!serializedData[key1]) {
|
|
26614
|
+
serializedData[key1] = [];
|
|
26615
|
+
}
|
|
26616
|
+
SerializationHelper.serializeArrayProperty(value1, serializedData[key1], 0);
|
|
26617
|
+
} else if (EffectsObject.is(value1)) {
|
|
26618
|
+
// TODO 处理 EffectsObject 递归序列化
|
|
26619
|
+
serializedData[key1] = {
|
|
26620
|
+
id: value1.getInstanceId()
|
|
26621
|
+
};
|
|
26622
|
+
} else if (isObject(value1)) {
|
|
26623
|
+
if (!serializedData[key1]) {
|
|
26624
|
+
serializedData[key1] = {};
|
|
26625
|
+
}
|
|
26626
|
+
SerializationHelper.serializeObjectProperty(value1, serializedData[key1], 0);
|
|
26627
|
+
}
|
|
26628
|
+
}
|
|
26629
|
+
return serializedData;
|
|
26630
|
+
};
|
|
26631
|
+
SerializationHelper.deserialize = function deserialize(serializedData, effectsObject) {
|
|
26632
|
+
effectsObject.defination = serializedData;
|
|
26633
|
+
var serializedProperties = getMergedStore(effectsObject);
|
|
26634
|
+
var engine = effectsObject.engine;
|
|
26635
|
+
if (serializedProperties) {
|
|
26636
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(serializedProperties)), _step; !(_step = _iterator()).done;){
|
|
26637
|
+
var key = _step.value;
|
|
26638
|
+
var value = serializedData[key];
|
|
26639
|
+
if (value === undefined) {
|
|
26640
|
+
continue;
|
|
26641
|
+
}
|
|
26642
|
+
var propertyType = serializedProperties[key].type;
|
|
26643
|
+
// FIXME: taggedProperties 为 readonly,这里存在强制赋值
|
|
26644
|
+
effectsObject[key] = SerializationHelper.deserializeProperty(value, engine, 0, propertyType);
|
|
26645
|
+
}
|
|
26646
|
+
}
|
|
26647
|
+
effectsObject.fromData(effectsObject.defination);
|
|
26648
|
+
};
|
|
26649
|
+
SerializationHelper.checkTypedArray = function checkTypedArray(obj) {
|
|
26650
|
+
return _instanceof1(obj, Int8Array) || _instanceof1(obj, Uint8Array) || _instanceof1(obj, Uint8ClampedArray) || _instanceof1(obj, Int16Array) || _instanceof1(obj, Uint16Array) || _instanceof1(obj, Int32Array) || _instanceof1(obj, Uint32Array) || _instanceof1(obj, Float32Array) || _instanceof1(obj, Float64Array) || _instanceof1(obj, ArrayBuffer);
|
|
26651
|
+
};
|
|
26652
|
+
// check value is { id: 7e69662e964e4892ae8933f24562395b }
|
|
26653
|
+
SerializationHelper.checkDataPath = function checkDataPath(value) {
|
|
26654
|
+
return !!(isObject(value) && Object.keys(value).length === 1 && "id" in value && isString(value.id) && value.id.length === 32);
|
|
26655
|
+
};
|
|
26656
|
+
// TODO 测试函数,2.0 上线后移除
|
|
26657
|
+
SerializationHelper.checkGLTFNode = function checkGLTFNode(value) {
|
|
26658
|
+
return isObject(value) && value.nodeIndex !== undefined && value.isJoint !== undefined;
|
|
26659
|
+
};
|
|
26660
|
+
SerializationHelper.checkImageSource = function checkImageSource(value) {
|
|
26661
|
+
return isCanvas(value) || _instanceof1(value, HTMLImageElement);
|
|
26662
|
+
};
|
|
26663
|
+
SerializationHelper.deserializeProperty = function deserializeProperty(property, engine, level, type, overrideDataPath) {
|
|
26664
|
+
if (overrideDataPath === void 0) overrideDataPath = true;
|
|
26665
|
+
if (level > 14) {
|
|
26666
|
+
console.error("The nested object layers of the serialized data exceed the maximum limit.");
|
|
26667
|
+
return;
|
|
26668
|
+
}
|
|
26669
|
+
// 加载并链接 DataPath 字段表示的 EffectsObject 引用。Class 对象 copy [key, value] 会丢失对象信息,因此只递归数组对象和普通 js Object 结构对象。
|
|
26670
|
+
if (isArray(property)) {
|
|
26671
|
+
var res = [];
|
|
26672
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(property), _step; !(_step = _iterator()).done;){
|
|
26673
|
+
var value = _step.value;
|
|
26674
|
+
res.push(SerializationHelper.deserializeProperty(value, engine, level + 1, type, overrideDataPath));
|
|
26675
|
+
}
|
|
26676
|
+
return res;
|
|
26677
|
+
// TODO json 数据避免传 typedArray
|
|
26678
|
+
} else if (SerializationHelper.checkDataPath(property)) {
|
|
26679
|
+
var referenceObject = engine.findObject(property);
|
|
26680
|
+
return overrideDataPath ? referenceObject : property;
|
|
26681
|
+
} else if (isObject(property) && property.constructor === Object) {
|
|
26682
|
+
var res1;
|
|
26683
|
+
if (type) {
|
|
26684
|
+
res1 = new type();
|
|
26685
|
+
} else {
|
|
26686
|
+
res1 = {};
|
|
26687
|
+
}
|
|
26688
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(Object.keys(property)), _step1; !(_step1 = _iterator1()).done;){
|
|
26689
|
+
var key = _step1.value;
|
|
26690
|
+
res1[key] = SerializationHelper.deserializeProperty(property[key], engine, level + 1, undefined, overrideDataPath);
|
|
26691
|
+
}
|
|
26692
|
+
return res1;
|
|
26693
|
+
} else {
|
|
26694
|
+
return property;
|
|
26695
|
+
}
|
|
26696
|
+
};
|
|
26697
|
+
SerializationHelper.serializeObjectProperty = function serializeObjectProperty(objectProperty, serializedData, level) {
|
|
26698
|
+
if (level > 14) {
|
|
26699
|
+
console.error("The nested object layers of the serialized data exceed the maximum limit.");
|
|
26700
|
+
return;
|
|
26701
|
+
}
|
|
26702
|
+
if (!serializedData) {
|
|
26703
|
+
serializedData = {};
|
|
26704
|
+
}
|
|
26705
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(objectProperty)), _step; !(_step = _iterator()).done;){
|
|
26706
|
+
var key = _step.value;
|
|
26707
|
+
var value = objectProperty[key];
|
|
26708
|
+
if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(objectProperty)) {
|
|
26709
|
+
// TODO json 数据避免传 typedArray
|
|
26710
|
+
serializedData[key] = value;
|
|
26711
|
+
} else if (isArray(value)) {
|
|
26712
|
+
if (!serializedData[key]) {
|
|
26713
|
+
serializedData[key] = [];
|
|
26714
|
+
}
|
|
26715
|
+
SerializationHelper.serializeArrayProperty(value, serializedData[key], level + 1);
|
|
26716
|
+
} else if (EffectsObject.is(value)) {
|
|
26717
|
+
// TODO 处理 EffectsObject 递归序列化
|
|
26718
|
+
serializedData[key] = {
|
|
26719
|
+
id: value.getInstanceId()
|
|
26720
|
+
};
|
|
26721
|
+
} else if (isObject(value)) {
|
|
26722
|
+
if (!serializedData[key]) {
|
|
26723
|
+
serializedData[key] = {};
|
|
26724
|
+
}
|
|
26725
|
+
SerializationHelper.serializeObjectProperty(value, serializedData[key], level + 1);
|
|
26726
|
+
}
|
|
26727
|
+
}
|
|
26963
26728
|
};
|
|
26964
|
-
|
|
26965
|
-
|
|
26966
|
-
|
|
26967
|
-
|
|
26968
|
-
if (context) {
|
|
26969
|
-
context.strokeStyle = "rgba(" + r * 255 + ", " + g * 255 + ", " + b * 255 + ", " + a + ")";
|
|
26970
|
-
context.lineWidth = outlineWidth * 2;
|
|
26729
|
+
SerializationHelper.serializeArrayProperty = function serializeArrayProperty(arrayProperty, serializedData, level) {
|
|
26730
|
+
if (level > 14) {
|
|
26731
|
+
console.error("The nested object layers of the serialized data exceed the maximum limit.");
|
|
26732
|
+
return;
|
|
26971
26733
|
}
|
|
26972
|
-
|
|
26973
|
-
|
|
26974
|
-
|
|
26975
|
-
var
|
|
26976
|
-
|
|
26977
|
-
|
|
26978
|
-
|
|
26979
|
-
|
|
26980
|
-
|
|
26981
|
-
|
|
26734
|
+
if (!serializedData) {
|
|
26735
|
+
serializedData = [];
|
|
26736
|
+
}
|
|
26737
|
+
for(var i = 0; i < arrayProperty.length; i++){
|
|
26738
|
+
var value = arrayProperty[i];
|
|
26739
|
+
if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(arrayProperty)) {
|
|
26740
|
+
// TODO json 数据避免传 typedArray
|
|
26741
|
+
serializedData[i] = value;
|
|
26742
|
+
} else if (isArray(value)) {
|
|
26743
|
+
if (!serializedData[i]) {
|
|
26744
|
+
serializedData[i] = [];
|
|
26745
|
+
}
|
|
26746
|
+
SerializationHelper.serializeArrayProperty(value, serializedData[i], level + 1);
|
|
26747
|
+
} else if (EffectsObject.is(value)) {
|
|
26748
|
+
// TODO 处理 EffectsObject 递归序列化
|
|
26749
|
+
serializedData[i] = {
|
|
26750
|
+
id: value.getInstanceId()
|
|
26751
|
+
};
|
|
26752
|
+
} else if (isObject(value)) {
|
|
26753
|
+
if (!serializedData[i]) {
|
|
26754
|
+
serializedData[i] = {};
|
|
26755
|
+
}
|
|
26756
|
+
SerializationHelper.serializeObjectProperty(value, serializedData[i], level + 1);
|
|
26757
|
+
}
|
|
26982
26758
|
}
|
|
26983
26759
|
};
|
|
26984
|
-
return
|
|
26760
|
+
return SerializationHelper;
|
|
26985
26761
|
}();
|
|
26986
|
-
applyMixins(TextComponent, [
|
|
26987
|
-
TextComponentBase
|
|
26988
|
-
]);
|
|
26989
|
-
|
|
26990
|
-
// TODO: 注册必须用
|
|
26991
|
-
var TextLoader = /*#__PURE__*/ function(AbstractPlugin) {
|
|
26992
|
-
_inherits(TextLoader, AbstractPlugin);
|
|
26993
|
-
function TextLoader() {
|
|
26994
|
-
return AbstractPlugin.apply(this, arguments);
|
|
26995
|
-
}
|
|
26996
|
-
return TextLoader;
|
|
26997
|
-
}(AbstractPlugin);
|
|
26998
|
-
|
|
26999
|
-
var Asset = /*#__PURE__*/ function(EffectsObject) {
|
|
27000
|
-
_inherits(Asset, EffectsObject);
|
|
27001
|
-
function Asset() {
|
|
27002
|
-
return EffectsObject.apply(this, arguments);
|
|
27003
|
-
}
|
|
27004
|
-
return Asset;
|
|
27005
|
-
}(EffectsObject);
|
|
27006
|
-
|
|
27007
|
-
var BinaryAsset = /*#__PURE__*/ function(EffectsObject) {
|
|
27008
|
-
_inherits(BinaryAsset, EffectsObject);
|
|
27009
|
-
function BinaryAsset() {
|
|
27010
|
-
return EffectsObject.apply(this, arguments);
|
|
27011
|
-
}
|
|
27012
|
-
var _proto = BinaryAsset.prototype;
|
|
27013
|
-
_proto.fromData = function fromData(data) {};
|
|
27014
|
-
return BinaryAsset;
|
|
27015
|
-
}(EffectsObject);
|
|
27016
|
-
__decorate([
|
|
27017
|
-
serialize()
|
|
27018
|
-
], BinaryAsset.prototype, "buffer", void 0);
|
|
27019
|
-
BinaryAsset = __decorate([
|
|
27020
|
-
effectsClass(DataType.BinaryAsset)
|
|
27021
|
-
], BinaryAsset);
|
|
27022
26762
|
|
|
27023
26763
|
/**
|
|
27024
26764
|
* @since 2.0.0
|
|
@@ -27027,9 +26767,10 @@ BinaryAsset = __decorate([
|
|
|
27027
26767
|
this.engine = engine;
|
|
27028
26768
|
}
|
|
27029
26769
|
var _proto = AssetLoader.prototype;
|
|
27030
|
-
_proto.loadGUID = function loadGUID(
|
|
27031
|
-
|
|
27032
|
-
|
|
26770
|
+
_proto.loadGUID = function loadGUID(dataPath) {
|
|
26771
|
+
var guid = dataPath.id;
|
|
26772
|
+
if (!dataPath) {
|
|
26773
|
+
return null;
|
|
27033
26774
|
}
|
|
27034
26775
|
var effectsObjectData = this.findData(guid);
|
|
27035
26776
|
var effectsObject;
|
|
@@ -27064,92 +26805,6 @@ BinaryAsset = __decorate([
|
|
|
27064
26805
|
SerializationHelper.deserialize(effectsObjectData, effectsObject);
|
|
27065
26806
|
return effectsObject;
|
|
27066
26807
|
};
|
|
27067
|
-
// 加载本地文件资产
|
|
27068
|
-
_proto.loadGUIDAsync = function loadGUIDAsync(guid) {
|
|
27069
|
-
var _this = this;
|
|
27070
|
-
return _async_to_generator(function() {
|
|
27071
|
-
var effectsObjectData, effectsObject, classConstructor;
|
|
27072
|
-
return __generator(this, function(_state) {
|
|
27073
|
-
switch(_state.label){
|
|
27074
|
-
case 0:
|
|
27075
|
-
if (_this.engine.objectInstance[guid]) {
|
|
27076
|
-
return [
|
|
27077
|
-
2,
|
|
27078
|
-
_this.engine.objectInstance[guid]
|
|
27079
|
-
];
|
|
27080
|
-
}
|
|
27081
|
-
effectsObjectData = _this.findData(guid);
|
|
27082
|
-
if (!!effectsObjectData) return [
|
|
27083
|
-
3,
|
|
27084
|
-
2
|
|
27085
|
-
];
|
|
27086
|
-
if (!_this.engine.database) {
|
|
27087
|
-
console.error("Object data with uuid: " + guid + " not found.");
|
|
27088
|
-
return [
|
|
27089
|
-
2,
|
|
27090
|
-
undefined
|
|
27091
|
-
];
|
|
27092
|
-
}
|
|
27093
|
-
return [
|
|
27094
|
-
4,
|
|
27095
|
-
_this.engine.database.loadGUID(guid)
|
|
27096
|
-
];
|
|
27097
|
-
case 1:
|
|
27098
|
-
effectsObject = _state.sent();
|
|
27099
|
-
if (!effectsObject) {
|
|
27100
|
-
console.error("Disk data with uuid: " + guid + " not found.");
|
|
27101
|
-
return [
|
|
27102
|
-
2,
|
|
27103
|
-
undefined
|
|
27104
|
-
];
|
|
27105
|
-
}
|
|
27106
|
-
_this.engine.addInstance(effectsObject);
|
|
27107
|
-
return [
|
|
27108
|
-
2,
|
|
27109
|
-
effectsObject
|
|
27110
|
-
];
|
|
27111
|
-
case 2:
|
|
27112
|
-
switch(effectsObjectData.dataType){
|
|
27113
|
-
case DataType.Material:
|
|
27114
|
-
effectsObject = Material.create(_this.engine);
|
|
27115
|
-
break;
|
|
27116
|
-
case DataType.Geometry:
|
|
27117
|
-
effectsObject = Geometry.create(_this.engine);
|
|
27118
|
-
break;
|
|
27119
|
-
case DataType.Texture:
|
|
27120
|
-
effectsObject = Texture.create(_this.engine);
|
|
27121
|
-
break;
|
|
27122
|
-
default:
|
|
27123
|
-
{
|
|
27124
|
-
classConstructor = AssetLoader.getClass(effectsObjectData.dataType);
|
|
27125
|
-
if (classConstructor) {
|
|
27126
|
-
effectsObject = new classConstructor(_this.engine);
|
|
27127
|
-
}
|
|
27128
|
-
}
|
|
27129
|
-
}
|
|
27130
|
-
if (!effectsObject) {
|
|
27131
|
-
console.error("Constructor for DataType: " + effectsObjectData.dataType + " not found.");
|
|
27132
|
-
return [
|
|
27133
|
-
2,
|
|
27134
|
-
undefined
|
|
27135
|
-
];
|
|
27136
|
-
}
|
|
27137
|
-
effectsObject.setInstanceId(effectsObjectData.id);
|
|
27138
|
-
_this.engine.addInstance(effectsObject);
|
|
27139
|
-
return [
|
|
27140
|
-
4,
|
|
27141
|
-
SerializationHelper.deserializeAsync(effectsObjectData, effectsObject)
|
|
27142
|
-
];
|
|
27143
|
-
case 3:
|
|
27144
|
-
_state.sent();
|
|
27145
|
-
return [
|
|
27146
|
-
2,
|
|
27147
|
-
effectsObject
|
|
27148
|
-
];
|
|
27149
|
-
}
|
|
27150
|
-
});
|
|
27151
|
-
})();
|
|
27152
|
-
};
|
|
27153
26808
|
_proto.findData = function findData(uuid) {
|
|
27154
26809
|
return this.engine.jsonSceneData[uuid];
|
|
27155
26810
|
};
|
|
@@ -27499,35 +27154,35 @@ function rotationZYXFromQuat(out, quat) {
|
|
|
27499
27154
|
];
|
|
27500
27155
|
}
|
|
27501
27156
|
}
|
|
27502
|
-
var _obj;
|
|
27503
|
-
var particleOriginTranslateMap = (_obj = {}, _obj[ParticleOrigin.PARTICLE_ORIGIN_CENTER] = [
|
|
27157
|
+
var _obj$1;
|
|
27158
|
+
var particleOriginTranslateMap = (_obj$1 = {}, _obj$1[ParticleOrigin.PARTICLE_ORIGIN_CENTER] = [
|
|
27504
27159
|
0,
|
|
27505
27160
|
0
|
|
27506
|
-
], _obj[ParticleOrigin.PARTICLE_ORIGIN_CENTER_BOTTOM] = [
|
|
27161
|
+
], _obj$1[ParticleOrigin.PARTICLE_ORIGIN_CENTER_BOTTOM] = [
|
|
27507
27162
|
0,
|
|
27508
27163
|
-0.5
|
|
27509
|
-
], _obj[ParticleOrigin.PARTICLE_ORIGIN_CENTER_TOP] = [
|
|
27164
|
+
], _obj$1[ParticleOrigin.PARTICLE_ORIGIN_CENTER_TOP] = [
|
|
27510
27165
|
0,
|
|
27511
27166
|
0.5
|
|
27512
|
-
], _obj[ParticleOrigin.PARTICLE_ORIGIN_LEFT_TOP] = [
|
|
27167
|
+
], _obj$1[ParticleOrigin.PARTICLE_ORIGIN_LEFT_TOP] = [
|
|
27513
27168
|
-0.5,
|
|
27514
27169
|
0.5
|
|
27515
|
-
], _obj[ParticleOrigin.PARTICLE_ORIGIN_LEFT_CENTER] = [
|
|
27170
|
+
], _obj$1[ParticleOrigin.PARTICLE_ORIGIN_LEFT_CENTER] = [
|
|
27516
27171
|
-0.5,
|
|
27517
27172
|
0
|
|
27518
|
-
], _obj[ParticleOrigin.PARTICLE_ORIGIN_LEFT_BOTTOM] = [
|
|
27173
|
+
], _obj$1[ParticleOrigin.PARTICLE_ORIGIN_LEFT_BOTTOM] = [
|
|
27519
27174
|
-0.5,
|
|
27520
27175
|
-0.5
|
|
27521
|
-
], _obj[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_CENTER] = [
|
|
27176
|
+
], _obj$1[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_CENTER] = [
|
|
27522
27177
|
0.5,
|
|
27523
27178
|
0
|
|
27524
|
-
], _obj[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_BOTTOM] = [
|
|
27179
|
+
], _obj$1[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_BOTTOM] = [
|
|
27525
27180
|
0.5,
|
|
27526
27181
|
-0.5
|
|
27527
|
-
], _obj[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_TOP] = [
|
|
27182
|
+
], _obj$1[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_TOP] = [
|
|
27528
27183
|
0.5,
|
|
27529
27184
|
0.5
|
|
27530
|
-
], _obj);
|
|
27185
|
+
], _obj$1);
|
|
27531
27186
|
function getBezierCurveFromHermite(m0, m1, p0, p3) {
|
|
27532
27187
|
var xStart = p0[0];
|
|
27533
27188
|
var yStart = p0[1];
|
|
@@ -27766,28 +27421,6 @@ var refCompositions = new Map();
|
|
|
27766
27421
|
}
|
|
27767
27422
|
}
|
|
27768
27423
|
}
|
|
27769
|
-
// Composition id 转 guid
|
|
27770
|
-
var compositionId = json.compositionId;
|
|
27771
|
-
var compositionIdToGUIDMap = {};
|
|
27772
|
-
for(var _iterator3 = _create_for_of_iterator_helper_loose(json.compositions), _step3; !(_step3 = _iterator3()).done;){
|
|
27773
|
-
var composition = _step3.value;
|
|
27774
|
-
var guid = generateGUID();
|
|
27775
|
-
compositionIdToGUIDMap[composition.id] = guid;
|
|
27776
|
-
if (composition.id === compositionId) {
|
|
27777
|
-
json.compositionId = guid;
|
|
27778
|
-
}
|
|
27779
|
-
composition.id = guid;
|
|
27780
|
-
}
|
|
27781
|
-
// 预合成元素 refId 同步改为生成的合成 guid
|
|
27782
|
-
for(var _iterator4 = _create_for_of_iterator_helper_loose(json.items), _step4; !(_step4 = _iterator4()).done;){
|
|
27783
|
-
var item = _step4.value;
|
|
27784
|
-
if (item.content) {
|
|
27785
|
-
var compositionOptions = item.content.options;
|
|
27786
|
-
if (compositionOptions && compositionOptions.refId !== undefined) {
|
|
27787
|
-
compositionOptions.refId = compositionIdToGUIDMap[compositionOptions.refId];
|
|
27788
|
-
}
|
|
27789
|
-
}
|
|
27790
|
-
}
|
|
27791
27424
|
return json;
|
|
27792
27425
|
}
|
|
27793
27426
|
function version32Migration(json) {
|
|
@@ -27814,21 +27447,68 @@ function version32Migration(json) {
|
|
|
27814
27447
|
itemMap.set(item.id, item);
|
|
27815
27448
|
}
|
|
27816
27449
|
processContent(mainComp);
|
|
27450
|
+
return json;
|
|
27451
|
+
}
|
|
27452
|
+
function version33Migration(json) {
|
|
27817
27453
|
// 老 shape 数据兼容
|
|
27818
|
-
for(var
|
|
27819
|
-
var
|
|
27820
|
-
if (
|
|
27821
|
-
var spriteComponent = componentMap.get(
|
|
27454
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(json.items), _step; !(_step = _iterator()).done;){
|
|
27455
|
+
var item = _step.value;
|
|
27456
|
+
if (item.type === ItemType.sprite) {
|
|
27457
|
+
var spriteComponent = componentMap.get(item.components[0].id);
|
|
27822
27458
|
if (spriteComponent) {
|
|
27823
27459
|
var shape = spriteComponent.renderer.shape;
|
|
27824
27460
|
var shapeData = void 0;
|
|
27825
27461
|
if (Number.isInteger(shape)) {
|
|
27826
27462
|
shapeData = json.shapes[shape];
|
|
27463
|
+
} else {
|
|
27464
|
+
shapeData = shape;
|
|
27827
27465
|
}
|
|
27828
27466
|
spriteComponent.renderer.shape = shapeData;
|
|
27829
27467
|
}
|
|
27830
27468
|
}
|
|
27831
27469
|
}
|
|
27470
|
+
// Composition id 转 guid, Composition 分离 CompositionComponent
|
|
27471
|
+
var compositionId = json.compositionId;
|
|
27472
|
+
var compositionIdToGUIDMap = {};
|
|
27473
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(json.compositions), _step1; !(_step1 = _iterator1()).done;){
|
|
27474
|
+
var composition = _step1.value;
|
|
27475
|
+
var guid = generateGUID();
|
|
27476
|
+
compositionIdToGUIDMap[composition.id] = guid;
|
|
27477
|
+
if (composition.id === compositionId) {
|
|
27478
|
+
json.compositionId = guid;
|
|
27479
|
+
}
|
|
27480
|
+
composition.id = guid;
|
|
27481
|
+
var compositionComponent = {
|
|
27482
|
+
id: generateGUID(),
|
|
27483
|
+
dataType: "CompositionComponent",
|
|
27484
|
+
items: composition.items,
|
|
27485
|
+
timelineAsset: composition.timelineAsset,
|
|
27486
|
+
sceneBindings: composition.sceneBindings,
|
|
27487
|
+
startTime: composition.startTime
|
|
27488
|
+
};
|
|
27489
|
+
//@ts-expect-error
|
|
27490
|
+
composition.timelineAsset = undefined;
|
|
27491
|
+
//@ts-expect-error
|
|
27492
|
+
composition.sceneBindings = undefined;
|
|
27493
|
+
composition.startTime = undefined;
|
|
27494
|
+
//@ts-expect-error
|
|
27495
|
+
composition.components = [
|
|
27496
|
+
{
|
|
27497
|
+
id: compositionComponent.id
|
|
27498
|
+
}
|
|
27499
|
+
];
|
|
27500
|
+
json.components.push(compositionComponent);
|
|
27501
|
+
}
|
|
27502
|
+
// 预合成元素 refId 同步改为生成的合成 guid
|
|
27503
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(json.items), _step2; !(_step2 = _iterator2()).done;){
|
|
27504
|
+
var item1 = _step2.value;
|
|
27505
|
+
if (item1.content) {
|
|
27506
|
+
var compositionOptions = item1.content.options;
|
|
27507
|
+
if (compositionOptions && compositionOptions.refId !== undefined) {
|
|
27508
|
+
compositionOptions.refId = compositionIdToGUIDMap[compositionOptions.refId];
|
|
27509
|
+
}
|
|
27510
|
+
}
|
|
27511
|
+
}
|
|
27832
27512
|
return json;
|
|
27833
27513
|
}
|
|
27834
27514
|
function processContent(composition) {
|
|
@@ -28702,7 +28382,7 @@ function getStandardJSON(json) {
|
|
|
28702
28382
|
if (v0.test(json.version)) {
|
|
28703
28383
|
var _exec;
|
|
28704
28384
|
reverseParticle = ((_exec = /^(\d+)/.exec(json.version)) == null ? void 0 : _exec[0]) === "0";
|
|
28705
|
-
return version32Migration(version31Migration(version30Migration(version21Migration(getStandardJSONFromV0(json)))));
|
|
28385
|
+
return version33Migration(version32Migration(version31Migration(version30Migration(version21Migration(getStandardJSONFromV0(json))))));
|
|
28706
28386
|
}
|
|
28707
28387
|
reverseParticle = false;
|
|
28708
28388
|
var vs = standardVersion.exec(json.version) || [];
|
|
@@ -28727,6 +28407,9 @@ function getStandardJSON(json) {
|
|
|
28727
28407
|
if (minorVersion < 3) {
|
|
28728
28408
|
json = version32Migration(json);
|
|
28729
28409
|
}
|
|
28410
|
+
if (minorVersion < 4) {
|
|
28411
|
+
json = version33Migration(json);
|
|
28412
|
+
}
|
|
28730
28413
|
}
|
|
28731
28414
|
return json;
|
|
28732
28415
|
}
|
|
@@ -29010,6 +28693,40 @@ function getStandardItem(item, opt) {
|
|
|
29010
28693
|
}
|
|
29011
28694
|
}
|
|
29012
28695
|
|
|
28696
|
+
var _obj;
|
|
28697
|
+
/**
|
|
28698
|
+
* 机型和渲染等级对应表
|
|
28699
|
+
*
|
|
28700
|
+
* 机型:B-低端机、A-中端机、S-高端机
|
|
28701
|
+
* 渲染等级:B-低、A-中、S-高、A+-中高、B+-全部
|
|
28702
|
+
*
|
|
28703
|
+
* - S(高端机):高、全部、中高
|
|
28704
|
+
* - A(中端机):中、全部、中高
|
|
28705
|
+
* - B(低端机):低、全部
|
|
28706
|
+
* - undefined(全部机型)
|
|
28707
|
+
*/ var renderLevelPassSet = (_obj = {}, _obj[RenderLevel.S] = [
|
|
28708
|
+
RenderLevel.S,
|
|
28709
|
+
RenderLevel.BPlus,
|
|
28710
|
+
RenderLevel.APlus
|
|
28711
|
+
], _obj[RenderLevel.A] = [
|
|
28712
|
+
RenderLevel.A,
|
|
28713
|
+
RenderLevel.BPlus,
|
|
28714
|
+
RenderLevel.APlus
|
|
28715
|
+
], _obj[RenderLevel.B] = [
|
|
28716
|
+
RenderLevel.B,
|
|
28717
|
+
RenderLevel.BPlus
|
|
28718
|
+
], _obj);
|
|
28719
|
+
function passRenderLevel(l, renderLevel) {
|
|
28720
|
+
if (!l || !renderLevel) {
|
|
28721
|
+
return true;
|
|
28722
|
+
}
|
|
28723
|
+
var arr = renderLevelPassSet[renderLevel];
|
|
28724
|
+
if (arr) {
|
|
28725
|
+
return arr.includes(l);
|
|
28726
|
+
}
|
|
28727
|
+
return false;
|
|
28728
|
+
}
|
|
28729
|
+
|
|
29013
28730
|
var Scene;
|
|
29014
28731
|
(function(Scene) {
|
|
29015
28732
|
function isJSONObject(scene) {
|
|
@@ -29909,7 +29626,9 @@ function createTextureOptionsBySource(image, sourceFrom, id) {
|
|
|
29909
29626
|
if (_instanceof1(textureOptions, Texture)) {
|
|
29910
29627
|
this.engine.addInstance(textureOptions);
|
|
29911
29628
|
} else {
|
|
29912
|
-
textureOptions = this.engine.
|
|
29629
|
+
textureOptions = this.engine.findObject({
|
|
29630
|
+
id: scene.textureOptions[i].id
|
|
29631
|
+
});
|
|
29913
29632
|
scene.textureOptions[i] = textureOptions;
|
|
29914
29633
|
}
|
|
29915
29634
|
textureOptions.initialize();
|
|
@@ -31556,8 +31275,18 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
|
31556
31275
|
_proto.addInstance = function addInstance(effectsObject) {
|
|
31557
31276
|
this.objectInstance[effectsObject.getInstanceId()] = effectsObject;
|
|
31558
31277
|
};
|
|
31559
|
-
|
|
31560
|
-
|
|
31278
|
+
/**
|
|
31279
|
+
* @ignore
|
|
31280
|
+
*/ _proto.findObject = function findObject(guid) {
|
|
31281
|
+
// 编辑器可能传 Class 对象,这边判断处理一下直接返回原对象。
|
|
31282
|
+
if (!(isObject(guid) && guid.constructor === Object)) {
|
|
31283
|
+
return guid;
|
|
31284
|
+
}
|
|
31285
|
+
if (this.objectInstance[guid.id]) {
|
|
31286
|
+
return this.objectInstance[guid.id];
|
|
31287
|
+
}
|
|
31288
|
+
var result = this.assetLoader.loadGUID(guid);
|
|
31289
|
+
return result;
|
|
31561
31290
|
};
|
|
31562
31291
|
_proto.removeInstance = function removeInstance(id) {
|
|
31563
31292
|
delete this.objectInstance[id];
|
|
@@ -31571,6 +31300,10 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
|
31571
31300
|
}
|
|
31572
31301
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(items), _step1; !(_step1 = _iterator1()).done;){
|
|
31573
31302
|
var vfxItemData = _step1.value;
|
|
31303
|
+
if (!passRenderLevel(vfxItemData.renderLevel, scene.renderLevel)) {
|
|
31304
|
+
vfxItemData.components = [];
|
|
31305
|
+
vfxItemData.type = ItemType.null;
|
|
31306
|
+
}
|
|
31574
31307
|
this.addEffectsObjectData(vfxItemData);
|
|
31575
31308
|
}
|
|
31576
31309
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(materials), _step2; !(_step2 = _iterator2()).done;){
|
|
@@ -31625,45 +31358,20 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
|
31625
31358
|
return _async_to_generator(function() {
|
|
31626
31359
|
var jsonScene, _iterator, _step, itemData, itemType;
|
|
31627
31360
|
return __generator(this, function(_state) {
|
|
31628
|
-
|
|
31629
|
-
|
|
31630
|
-
|
|
31631
|
-
|
|
31632
|
-
|
|
31633
|
-
|
|
31634
|
-
|
|
31635
|
-
|
|
31636
|
-
|
|
31637
|
-
|
|
31638
|
-
itemData = _step.value;
|
|
31639
|
-
itemType = itemData.type;
|
|
31640
|
-
if (!(itemType === "ECS" || itemType === "camera" || itemType === ItemType.sprite || itemType === ItemType.particle || itemType === ItemType.mesh || itemType === ItemType.skybox || itemType === ItemType.light || itemType === ItemType.tree || itemType === ItemType.interact || itemType === ItemType.camera)) {
|
|
31641
|
-
return [
|
|
31642
|
-
3,
|
|
31643
|
-
3
|
|
31644
|
-
];
|
|
31645
|
-
}
|
|
31646
|
-
if (!_this.database) return [
|
|
31647
|
-
3,
|
|
31648
|
-
3
|
|
31649
|
-
];
|
|
31650
|
-
return [
|
|
31651
|
-
4,
|
|
31652
|
-
_this.assetLoader.loadGUIDAsync(itemData.id)
|
|
31653
|
-
];
|
|
31654
|
-
case 2:
|
|
31655
|
-
_state.sent();
|
|
31656
|
-
_state.label = 3;
|
|
31657
|
-
case 3:
|
|
31658
|
-
return [
|
|
31659
|
-
3,
|
|
31660
|
-
1
|
|
31661
|
-
];
|
|
31662
|
-
case 4:
|
|
31663
|
-
return [
|
|
31664
|
-
2
|
|
31665
|
-
];
|
|
31361
|
+
jsonScene = scene.jsonScene;
|
|
31362
|
+
for(_iterator = _create_for_of_iterator_helper_loose(jsonScene.items); !(_step = _iterator()).done;){
|
|
31363
|
+
itemData = _step.value;
|
|
31364
|
+
itemType = itemData.type;
|
|
31365
|
+
if (!(itemType === "ECS" || itemType === "camera" || itemType === ItemType.sprite || itemType === ItemType.particle || itemType === ItemType.mesh || itemType === ItemType.skybox || itemType === ItemType.light || itemType === ItemType.tree || itemType === ItemType.interact || itemType === ItemType.camera)) {
|
|
31366
|
+
continue;
|
|
31367
|
+
}
|
|
31368
|
+
if (_this.database) {
|
|
31369
|
+
_this.assetLoader.loadGUID(itemData);
|
|
31370
|
+
}
|
|
31666
31371
|
}
|
|
31372
|
+
return [
|
|
31373
|
+
2
|
|
31374
|
+
];
|
|
31667
31375
|
});
|
|
31668
31376
|
})();
|
|
31669
31377
|
};
|
|
@@ -31911,8 +31619,8 @@ registerPlugin("sprite", SpriteLoader, VFXItem);
|
|
|
31911
31619
|
registerPlugin("particle", ParticleLoader, VFXItem);
|
|
31912
31620
|
registerPlugin("cal", CalculateLoader, VFXItem);
|
|
31913
31621
|
registerPlugin("interact", InteractLoader, VFXItem);
|
|
31914
|
-
var version = "2.4.0-beta.
|
|
31622
|
+
var version = "2.4.0-beta.1";
|
|
31915
31623
|
logger.info("Core version: " + version + ".");
|
|
31916
31624
|
|
|
31917
|
-
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, Asset, AssetLoader, AssetManager, AssetService, BYTES_TYPE_MAP, BaseRenderComponent, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, Composition, CompositionComponent, DEFAULT_FONTS, DEFAULT_FPS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Ellipse, Engine, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatPropertyPlayableAsset, FloatPropertyTrack, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, GraphicsPath, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, MaskMode, MaskProcessor, MaskRefManager, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PluginSystem, PolyStar, Polygon, PostProcessVolume, PropertyTrack, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, ShapePath, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StarType, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, Vector2Curve, Vector2PropertyPlayableAsset, Vector2PropertyTrack, Vector4Curve, Vector4PropertyPlayableAsset, Vector4PropertyTrack, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, buildLine, calculateTranslation, canvasPool, closePointEps, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, curveEps, decimalEqual, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3,
|
|
31625
|
+
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, Asset, AssetLoader, AssetManager, AssetService, BYTES_TYPE_MAP, BaseRenderComponent, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, Composition, CompositionComponent, DEFAULT_FONTS, DEFAULT_FPS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Ellipse, Engine, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatPropertyPlayableAsset, FloatPropertyTrack, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, GraphicsPath, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, MaskMode, MaskProcessor, MaskRefManager, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PluginSystem, PolyStar, Polygon, PostProcessVolume, PropertyTrack, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, ShapePath, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StarType, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, Vector2Curve, Vector2PropertyPlayableAsset, Vector2PropertyTrack, Vector4Curve, Vector4PropertyPlayableAsset, Vector4PropertyTrack, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, buildLine, calculateTranslation, canvasPool, closePointEps, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, curveEps, decimalEqual, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrame_frag as itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|
|
31918
31626
|
//# sourceMappingURL=index.mjs.map
|