@galacean/effects-threejs 2.4.0-beta.0 → 2.4.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +571 -836
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +566 -829
- package/dist/index.mjs.map +1 -1
- package/dist/material/three-material.d.ts +5 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin 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.2
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -2026,7 +2026,7 @@ function getDirectStore(target) {
|
|
|
2026
2026
|
function EffectsObject(engine) {
|
|
2027
2027
|
this.engine = engine;
|
|
2028
2028
|
this.guid = generateGUID();
|
|
2029
|
-
this.
|
|
2029
|
+
this.defination = {};
|
|
2030
2030
|
this.engine.addInstance(this);
|
|
2031
2031
|
}
|
|
2032
2032
|
var _proto = EffectsObject.prototype;
|
|
@@ -2051,11 +2051,7 @@ function getDirectStore(target) {
|
|
|
2051
2051
|
* 反序列化函数
|
|
2052
2052
|
*
|
|
2053
2053
|
* @param data - 对象的序列化的数据
|
|
2054
|
-
*/ _proto.fromData = function fromData(data) {
|
|
2055
|
-
if (data.id) {
|
|
2056
|
-
this.setInstanceId(data.id);
|
|
2057
|
-
}
|
|
2058
|
-
};
|
|
2054
|
+
*/ _proto.fromData = function fromData(data) {};
|
|
2059
2055
|
/**
|
|
2060
2056
|
*
|
|
2061
2057
|
*/ _proto.dispose = function dispose() {};
|
|
@@ -2151,9 +2147,6 @@ function getDirectStore(target) {
|
|
|
2151
2147
|
};
|
|
2152
2148
|
_proto.fromData = function fromData(data) {
|
|
2153
2149
|
EffectsObject.prototype.fromData.call(this, data);
|
|
2154
|
-
if (data.item) {
|
|
2155
|
-
this.item = data.item;
|
|
2156
|
-
}
|
|
2157
2150
|
};
|
|
2158
2151
|
_proto.dispose = function dispose() {
|
|
2159
2152
|
if (this.isEnableCalled) {
|
|
@@ -2218,11 +2211,15 @@ function getDirectStore(target) {
|
|
|
2218
2211
|
]);
|
|
2219
2212
|
return Component;
|
|
2220
2213
|
}(EffectsObject);
|
|
2214
|
+
__decorate([
|
|
2215
|
+
serialize()
|
|
2216
|
+
], Component.prototype, "item", void 0);
|
|
2221
2217
|
__decorate([
|
|
2222
2218
|
serialize()
|
|
2223
2219
|
], Component.prototype, "_enabled", void 0);
|
|
2224
2220
|
/**
|
|
2225
2221
|
* @since 2.0.0
|
|
2222
|
+
* @deprecated 2.4.0 Please use Component instead
|
|
2226
2223
|
*/ var Behaviour = /*#__PURE__*/ function(Component) {
|
|
2227
2224
|
_inherits(Behaviour, Component);
|
|
2228
2225
|
function Behaviour() {
|
|
@@ -2252,10 +2249,6 @@ __decorate([
|
|
|
2252
2249
|
}
|
|
2253
2250
|
var _proto = RendererComponent.prototype;
|
|
2254
2251
|
_proto.render = function render(renderer) {};
|
|
2255
|
-
_proto.setVFXItem = function setVFXItem(item) {
|
|
2256
|
-
Component.prototype.setVFXItem.call(this, item);
|
|
2257
|
-
this.item.rendererComponents.push(this);
|
|
2258
|
-
};
|
|
2259
2252
|
_proto.onEnable = function onEnable() {
|
|
2260
2253
|
var _this_item_composition;
|
|
2261
2254
|
(_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderFrame.addMeshToDefaultRenderPass(this);
|
|
@@ -2264,18 +2257,6 @@ __decorate([
|
|
|
2264
2257
|
var _this_item_composition;
|
|
2265
2258
|
(_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderFrame.removeMeshFromDefaultRenderPass(this);
|
|
2266
2259
|
};
|
|
2267
|
-
_proto.fromData = function fromData(data) {
|
|
2268
|
-
Component.prototype.fromData.call(this, data);
|
|
2269
|
-
};
|
|
2270
|
-
_proto.toData = function toData() {
|
|
2271
|
-
Component.prototype.toData.call(this);
|
|
2272
|
-
};
|
|
2273
|
-
_proto.dispose = function dispose() {
|
|
2274
|
-
if (this.item) {
|
|
2275
|
-
removeItem(this.item.rendererComponents, this);
|
|
2276
|
-
}
|
|
2277
|
-
Component.prototype.dispose.call(this);
|
|
2278
|
-
};
|
|
2279
2260
|
_create_class(RendererComponent, [
|
|
2280
2261
|
{
|
|
2281
2262
|
key: "priority",
|
|
@@ -3898,11 +3879,11 @@ exports.EffectComponent = __decorate([
|
|
|
3898
3879
|
effectsClass(DataType.EffectComponent)
|
|
3899
3880
|
], exports.EffectComponent);
|
|
3900
3881
|
|
|
3901
|
-
exports.PostProcessVolume = /*#__PURE__*/ function(
|
|
3902
|
-
_inherits(PostProcessVolume,
|
|
3882
|
+
exports.PostProcessVolume = /*#__PURE__*/ function(Component) {
|
|
3883
|
+
_inherits(PostProcessVolume, Component);
|
|
3903
3884
|
function PostProcessVolume(engine) {
|
|
3904
3885
|
var _this;
|
|
3905
|
-
_this =
|
|
3886
|
+
_this = Component.call(this, engine) || this;
|
|
3906
3887
|
_this.bloom = {
|
|
3907
3888
|
threshold: 0,
|
|
3908
3889
|
intensity: 0,
|
|
@@ -3933,7 +3914,7 @@ exports.PostProcessVolume = /*#__PURE__*/ function(Behaviour) {
|
|
|
3933
3914
|
}
|
|
3934
3915
|
};
|
|
3935
3916
|
return PostProcessVolume;
|
|
3936
|
-
}(
|
|
3917
|
+
}(Component);
|
|
3937
3918
|
__decorate([
|
|
3938
3919
|
serialize()
|
|
3939
3920
|
], exports.PostProcessVolume.prototype, "bloom", void 0);
|
|
@@ -6166,12 +6147,7 @@ function setMaskMode(material, maskMode, colorMask) {
|
|
|
6166
6147
|
glContext.REPLACE
|
|
6167
6148
|
];
|
|
6168
6149
|
// 关闭/开启蒙版元素的颜色写入
|
|
6169
|
-
material.colorMask =
|
|
6170
|
-
colorMask,
|
|
6171
|
-
colorMask,
|
|
6172
|
-
colorMask,
|
|
6173
|
-
colorMask
|
|
6174
|
-
];
|
|
6150
|
+
material.colorMask = colorMask;
|
|
6175
6151
|
break;
|
|
6176
6152
|
case exports.MaskMode.OBSCURED:
|
|
6177
6153
|
material.stencilTest = true;
|
|
@@ -7643,13 +7619,6 @@ exports.MaterialRenderType = void 0;
|
|
|
7643
7619
|
set: /**
|
|
7644
7620
|
* 设置 Material 的通过 alpha 值决定临时覆盖值计算的开关
|
|
7645
7621
|
* @param value - 是否开启 alpha 抖动
|
|
7646
|
-
*/ function set(value) {}
|
|
7647
|
-
},
|
|
7648
|
-
{
|
|
7649
|
-
key: "colorMask",
|
|
7650
|
-
set: /**
|
|
7651
|
-
* 设置 Material 颜色缓冲区的写入开关
|
|
7652
|
-
* @param value
|
|
7653
7622
|
*/ function set(value) {}
|
|
7654
7623
|
},
|
|
7655
7624
|
{
|
|
@@ -7708,10 +7677,15 @@ var MaskProcessor = /*#__PURE__*/ function() {
|
|
|
7708
7677
|
} else if (mode === ObscuredMode.OBSCURED || mode === ObscuredMode.REVERSE_OBSCURED) {
|
|
7709
7678
|
maskMode = mode === ObscuredMode.OBSCURED ? exports.MaskMode.OBSCURED : exports.MaskMode.REVERSE_OBSCURED;
|
|
7710
7679
|
this.maskRef = ref.maskManager.getRefValue();
|
|
7680
|
+
this.maskable = ref;
|
|
7711
7681
|
}
|
|
7712
7682
|
}
|
|
7713
7683
|
return maskMode;
|
|
7714
7684
|
};
|
|
7685
|
+
_proto.drawStencilMask = function drawStencilMask(renderer) {
|
|
7686
|
+
var _this_maskable;
|
|
7687
|
+
(_this_maskable = this.maskable) == null ? void 0 : _this_maskable.drawStencilMask(renderer);
|
|
7688
|
+
};
|
|
7715
7689
|
return MaskProcessor;
|
|
7716
7690
|
}();
|
|
7717
7691
|
|
|
@@ -12618,17 +12592,16 @@ function getBezier2DValue(out, t, p0, p1, cpx0, cpy0, cpx1, cpy1) {
|
|
|
12618
12592
|
if (!this.getVisible()) {
|
|
12619
12593
|
return;
|
|
12620
12594
|
}
|
|
12621
|
-
|
|
12622
|
-
|
|
12623
|
-
|
|
12624
|
-
|
|
12625
|
-
|
|
12626
|
-
|
|
12627
|
-
|
|
12628
|
-
|
|
12629
|
-
|
|
12630
|
-
|
|
12631
|
-
}
|
|
12595
|
+
this.maskManager.drawStencilMask(renderer);
|
|
12596
|
+
this.draw(renderer);
|
|
12597
|
+
};
|
|
12598
|
+
/**
|
|
12599
|
+
* @internal
|
|
12600
|
+
*/ _proto.drawStencilMask = function drawStencilMask(renderer) {
|
|
12601
|
+
var previousColorMask = this.material.colorMask;
|
|
12602
|
+
this.material.colorMask = false;
|
|
12603
|
+
this.draw(renderer);
|
|
12604
|
+
this.material.colorMask = previousColorMask;
|
|
12632
12605
|
};
|
|
12633
12606
|
_proto.onStart = function onStart() {
|
|
12634
12607
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
@@ -12766,10 +12739,27 @@ function getBezier2DValue(out, t, p0, p1, cpx0, cpy0, cpx1, cpy1) {
|
|
|
12766
12739
|
}
|
|
12767
12740
|
return material;
|
|
12768
12741
|
};
|
|
12742
|
+
_proto.draw = function draw(renderer) {
|
|
12743
|
+
if (renderer.renderingData.currentFrame.globalUniforms) {
|
|
12744
|
+
renderer.setGlobalMatrix("effects_ObjectToWorld", this.transform.getWorldMatrix());
|
|
12745
|
+
}
|
|
12746
|
+
for(var i = 0; i < this.materials.length; i++){
|
|
12747
|
+
var material = this.materials[i];
|
|
12748
|
+
material.setVector2("_Size", this.transform.size);
|
|
12749
|
+
if (this.renderer.renderMode === RenderMode.BILLBOARD || this.renderer.renderMode === RenderMode.VERTICAL_BILLBOARD || this.renderer.renderMode === RenderMode.HORIZONTAL_BILLBOARD) {
|
|
12750
|
+
material.setVector3("_Scale", this.transform.scale);
|
|
12751
|
+
}
|
|
12752
|
+
renderer.drawGeometry(this.geometry, material, i);
|
|
12753
|
+
}
|
|
12754
|
+
};
|
|
12769
12755
|
_proto.fromData = function fromData(data) {
|
|
12770
12756
|
RendererComponent.prototype.fromData.call(this, data);
|
|
12771
12757
|
var _data_renderer;
|
|
12772
12758
|
var renderer = (_data_renderer = data.renderer) != null ? _data_renderer : {};
|
|
12759
|
+
var maskProps = data.mask;
|
|
12760
|
+
if (maskProps && maskProps.ref) {
|
|
12761
|
+
maskProps.ref = this.engine.findObject(maskProps.ref);
|
|
12762
|
+
}
|
|
12773
12763
|
var maskMode = this.maskManager.getMaskMode(data);
|
|
12774
12764
|
// TODO 新蒙板上线后移除
|
|
12775
12765
|
//-------------------------------------------------------------------------
|
|
@@ -12777,15 +12767,15 @@ function getBezier2DValue(out, t, p0, p1, cpx0, cpy0, cpx1, cpy1) {
|
|
|
12777
12767
|
//@ts-expect-error
|
|
12778
12768
|
var split = data.splits && !data.textureSheetAnimation ? data.splits[0] : undefined;
|
|
12779
12769
|
var shapeGeometry = undefined;
|
|
12780
|
-
if (shapeData !== undefined && !("aPoint" in shapeData && "index" in shapeData)) {
|
|
12770
|
+
if (shapeData !== undefined && shapeData !== null && !("aPoint" in shapeData && "index" in shapeData)) {
|
|
12781
12771
|
shapeGeometry = getGeometryByShape(shapeData, split);
|
|
12782
12772
|
}
|
|
12783
|
-
var _renderer_renderMode, _renderer_blending,
|
|
12773
|
+
var _renderer_renderMode, _renderer_blending, _renderer_side;
|
|
12784
12774
|
//-------------------------------------------------------------------------
|
|
12785
12775
|
this.renderer = {
|
|
12786
12776
|
renderMode: (_renderer_renderMode = renderer.renderMode) != null ? _renderer_renderMode : RenderMode.MESH,
|
|
12787
12777
|
blending: (_renderer_blending = renderer.blending) != null ? _renderer_blending : BlendingMode.ALPHA,
|
|
12788
|
-
texture:
|
|
12778
|
+
texture: renderer.texture ? this.engine.findObject(renderer.texture) : this.engine.emptyTexture,
|
|
12789
12779
|
occlusion: !!renderer.occlusion,
|
|
12790
12780
|
transparentOcclusion: !!renderer.transparentOcclusion || maskMode === exports.MaskMode.MASK,
|
|
12791
12781
|
side: (_renderer_side = renderer.side) != null ? _renderer_side : SideMode.DOUBLE,
|
|
@@ -13002,14 +12992,14 @@ exports.ShapeComponent = /*#__PURE__*/ function(BaseRenderComponent) {
|
|
|
13002
12992
|
var control2 = easingIns[pointIndex.easingIn];
|
|
13003
12993
|
this.graphicsPath.bezierCurveTo(control1.x + lastPoint.x, control1.y + lastPoint.y, control2.x + point.x, control2.y + point.y, point.x, point.y, 1);
|
|
13004
12994
|
}
|
|
13005
|
-
var pointIndex1 = indices[0];
|
|
13006
|
-
var lastPointIndex1 = indices[indices.length - 1];
|
|
13007
|
-
var point1 = points[pointIndex1.point];
|
|
13008
|
-
var lastPoint1 = points[lastPointIndex1.point];
|
|
13009
|
-
var control11 = easingOuts[lastPointIndex1.easingOut];
|
|
13010
|
-
var control21 = easingIns[pointIndex1.easingIn];
|
|
13011
|
-
this.graphicsPath.bezierCurveTo(control11.x + lastPoint1.x, control11.y + lastPoint1.y, control21.x + point1.x, control21.y + point1.y, point1.x, point1.y, 1);
|
|
13012
12995
|
if (shape.close) {
|
|
12996
|
+
var pointIndex1 = indices[0];
|
|
12997
|
+
var lastPointIndex1 = indices[indices.length - 1];
|
|
12998
|
+
var point1 = points[pointIndex1.point];
|
|
12999
|
+
var lastPoint1 = points[lastPointIndex1.point];
|
|
13000
|
+
var control11 = easingOuts[lastPointIndex1.easingOut];
|
|
13001
|
+
var control21 = easingIns[pointIndex1.easingIn];
|
|
13002
|
+
this.graphicsPath.bezierCurveTo(control11.x + lastPoint1.x, control11.y + lastPoint1.y, control21.x + point1.x, control21.y + point1.y, point1.x, point1.y, 1);
|
|
13013
13003
|
this.graphicsPath.closePath();
|
|
13014
13004
|
}
|
|
13015
13005
|
}
|
|
@@ -13139,6 +13129,10 @@ exports.ShapeComponent = /*#__PURE__*/ function(BaseRenderComponent) {
|
|
|
13139
13129
|
break;
|
|
13140
13130
|
}
|
|
13141
13131
|
}
|
|
13132
|
+
var maskProps = data.mask;
|
|
13133
|
+
if (maskProps && maskProps.ref) {
|
|
13134
|
+
maskProps.ref = this.engine.findObject(maskProps.ref);
|
|
13135
|
+
}
|
|
13142
13136
|
var maskMode = this.maskManager.getMaskMode(data);
|
|
13143
13137
|
var maskRef = this.maskManager.getRefValue();
|
|
13144
13138
|
this.material.stencilRef = maskRef !== undefined ? [
|
|
@@ -13288,11 +13282,11 @@ exports.Fake3DAnimationMode = void 0;
|
|
|
13288
13282
|
Fake3DAnimationMode[Fake3DAnimationMode["Linear"] = 1] = "Linear";
|
|
13289
13283
|
})(exports.Fake3DAnimationMode || (exports.Fake3DAnimationMode = {}));
|
|
13290
13284
|
|
|
13291
|
-
exports.CameraController = /*#__PURE__*/ function(
|
|
13292
|
-
_inherits(CameraController,
|
|
13285
|
+
exports.CameraController = /*#__PURE__*/ function(Component) {
|
|
13286
|
+
_inherits(CameraController, Component);
|
|
13293
13287
|
function CameraController(engine, props) {
|
|
13294
13288
|
var _this;
|
|
13295
|
-
_this =
|
|
13289
|
+
_this = Component.call(this, engine) || this;
|
|
13296
13290
|
if (props) {
|
|
13297
13291
|
_this.fromData(props);
|
|
13298
13292
|
}
|
|
@@ -13313,11 +13307,11 @@ exports.CameraController = /*#__PURE__*/ function(Behaviour) {
|
|
|
13313
13307
|
}
|
|
13314
13308
|
};
|
|
13315
13309
|
_proto.fromData = function fromData(data) {
|
|
13316
|
-
|
|
13310
|
+
Component.prototype.fromData.call(this, data);
|
|
13317
13311
|
this.options = data.options;
|
|
13318
13312
|
};
|
|
13319
13313
|
return CameraController;
|
|
13320
|
-
}(
|
|
13314
|
+
}(Component);
|
|
13321
13315
|
exports.CameraController = __decorate([
|
|
13322
13316
|
effectsClass(DataType.CameraController)
|
|
13323
13317
|
], exports.CameraController);
|
|
@@ -15398,6 +15392,7 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
15398
15392
|
};
|
|
15399
15393
|
_this.duringPlay = false;
|
|
15400
15394
|
/** 是否响应点击和拖拽交互事件 */ _this._interactive = true;
|
|
15395
|
+
_this.lastTime = -1;
|
|
15401
15396
|
_this.getHitTestParams = function(force) {
|
|
15402
15397
|
if (!_this.clickable) {
|
|
15403
15398
|
return;
|
|
@@ -15488,11 +15483,21 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
15488
15483
|
var _this_previewContent;
|
|
15489
15484
|
this.duringPlay = true;
|
|
15490
15485
|
// trigger messageBegin when item enter
|
|
15491
|
-
if (this.
|
|
15492
|
-
|
|
15493
|
-
|
|
15494
|
-
|
|
15486
|
+
if (this.lastTime <= this.item.time) {
|
|
15487
|
+
if (this.item.time >= 0 && this.lastTime < 0) {
|
|
15488
|
+
var _this_item_composition;
|
|
15489
|
+
var options = this.item.props.content.options;
|
|
15490
|
+
(_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.addInteractiveItem(this.item, options.type);
|
|
15491
|
+
}
|
|
15492
|
+
} else {
|
|
15493
|
+
// loop trigger
|
|
15494
|
+
if (this.item.time >= 0) {
|
|
15495
|
+
var _this_item_composition1;
|
|
15496
|
+
var options1 = this.item.props.content.options;
|
|
15497
|
+
(_this_item_composition1 = this.item.composition) == null ? void 0 : _this_item_composition1.addInteractiveItem(this.item, options1.type);
|
|
15498
|
+
}
|
|
15495
15499
|
}
|
|
15500
|
+
this.lastTime = this.item.time;
|
|
15496
15501
|
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
|
|
15497
15502
|
if (!this.dragEvent || !this.bouncingArg) {
|
|
15498
15503
|
return;
|
|
@@ -18624,6 +18629,7 @@ function modifyMaxKeyframeShader(shader, maxVertex, maxFrag) {
|
|
|
18624
18629
|
this.particleMesh.mesh.material.setVector4("uParams", uParams.set(time, this.item.duration, 0, 0));
|
|
18625
18630
|
};
|
|
18626
18631
|
_proto.render = function render(renderer) {
|
|
18632
|
+
this.maskManager.drawStencilMask(renderer);
|
|
18627
18633
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.meshes), _step; !(_step = _iterator()).done;){
|
|
18628
18634
|
var mesh = _step.value;
|
|
18629
18635
|
mesh.render(renderer);
|
|
@@ -19465,7 +19471,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
19465
19471
|
mask: maskProps.maskRef,
|
|
19466
19472
|
maskMode: maskProps.maskMode,
|
|
19467
19473
|
forceTarget: forceTarget,
|
|
19468
|
-
diffuse: renderer.texture,
|
|
19474
|
+
diffuse: renderer.texture ? this.engine.findObject(renderer.texture) : undefined,
|
|
19469
19475
|
sizeOverLifetime: sizeOverLifetimeGetter,
|
|
19470
19476
|
anchor: anchor
|
|
19471
19477
|
};
|
|
@@ -19552,7 +19558,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
19552
19558
|
maxTrailCount: options.maxCount,
|
|
19553
19559
|
pointCountPerTrail: Math.round(trails.maxPointPerTrail) || 32,
|
|
19554
19560
|
blending: trails.blending,
|
|
19555
|
-
texture: trails.texture,
|
|
19561
|
+
texture: trails.texture ? this.engine.findObject(trails.texture) : undefined,
|
|
19556
19562
|
opacityOverLifetime: createValueGetter(trails.opacityOverLifetime || 1),
|
|
19557
19563
|
widthOverTrail: createValueGetter(trails.widthOverTrail || 1),
|
|
19558
19564
|
// order: vfxItem.listIndex + (trails.orderOffset || 0),
|
|
@@ -19573,6 +19579,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
19573
19579
|
}
|
|
19574
19580
|
this.renderer = new ParticleSystemRenderer(this.engine, particleMeshProps, trailMeshProps);
|
|
19575
19581
|
this.renderer.item = this.item;
|
|
19582
|
+
this.renderer.maskManager = this.maskManager;
|
|
19576
19583
|
this.meshes = this.renderer.meshes;
|
|
19577
19584
|
var interaction = props.interaction;
|
|
19578
19585
|
if (interaction) {
|
|
@@ -19591,8 +19598,9 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
19591
19598
|
var maskRef = 0;
|
|
19592
19599
|
if (data.mask) {
|
|
19593
19600
|
var _data_mask = data.mask, mode = _data_mask.mode, ref = _data_mask.ref;
|
|
19601
|
+
var refComponent = this.engine.findObject(ref);
|
|
19594
19602
|
maskMode = mode;
|
|
19595
|
-
maskRef =
|
|
19603
|
+
maskRef = refComponent.maskManager.getRefValue();
|
|
19596
19604
|
}
|
|
19597
19605
|
return {
|
|
19598
19606
|
maskMode: maskMode,
|
|
@@ -19880,7 +19888,7 @@ var SubCompositionClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
19880
19888
|
var _proto = SubCompositionClipPlayable.prototype;
|
|
19881
19889
|
_proto.processFrame = function processFrame(context) {
|
|
19882
19890
|
var boundObject = context.output.getUserData();
|
|
19883
|
-
if (_instanceof1(boundObject, CompositionComponent)) {
|
|
19891
|
+
if (_instanceof1(boundObject, exports.CompositionComponent)) {
|
|
19884
19892
|
boundObject.time = this.getTime();
|
|
19885
19893
|
}
|
|
19886
19894
|
};
|
|
@@ -19895,7 +19903,7 @@ var SubCompositionMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
|
|
|
19895
19903
|
var _proto = SubCompositionMixerPlayable.prototype;
|
|
19896
19904
|
_proto.evaluate = function evaluate(context) {
|
|
19897
19905
|
var boundObject = context.output.getUserData();
|
|
19898
|
-
if (!_instanceof1(boundObject, CompositionComponent)) {
|
|
19906
|
+
if (!_instanceof1(boundObject, exports.CompositionComponent)) {
|
|
19899
19907
|
return;
|
|
19900
19908
|
}
|
|
19901
19909
|
var compositionComponent = boundObject;
|
|
@@ -20263,7 +20271,7 @@ exports.SubCompositionTrack = /*#__PURE__*/ function(TrackAsset) {
|
|
|
20263
20271
|
if (!this.parent || !_instanceof1(this.parent.boundObject, exports.VFXItem)) {
|
|
20264
20272
|
throw new Error("SubCompositionTrack needs to be set under the VFXItem track.");
|
|
20265
20273
|
}
|
|
20266
|
-
this.boundObject = this.parent.boundObject.getComponent(CompositionComponent);
|
|
20274
|
+
this.boundObject = this.parent.boundObject.getComponent(exports.CompositionComponent);
|
|
20267
20275
|
};
|
|
20268
20276
|
_proto.createTrackMixer = function createTrackMixer(graph) {
|
|
20269
20277
|
return new SubCompositionMixerPlayable(graph);
|
|
@@ -20680,13 +20688,11 @@ exports.Vector2PropertyPlayableAsset = __decorate([
|
|
|
20680
20688
|
effectsClass(DataType.Vector2PropertyPlayableAsset)
|
|
20681
20689
|
], exports.Vector2PropertyPlayableAsset);
|
|
20682
20690
|
|
|
20683
|
-
|
|
20684
|
-
|
|
20685
|
-
*/ var CompositionComponent = /*#__PURE__*/ function(Behaviour) {
|
|
20686
|
-
_inherits(CompositionComponent, Behaviour);
|
|
20691
|
+
exports.CompositionComponent = /*#__PURE__*/ function(Component) {
|
|
20692
|
+
_inherits(CompositionComponent, Component);
|
|
20687
20693
|
function CompositionComponent() {
|
|
20688
20694
|
var _this;
|
|
20689
|
-
_this =
|
|
20695
|
+
_this = Component.apply(this, arguments) || this;
|
|
20690
20696
|
_this.time = 0;
|
|
20691
20697
|
_this.startTime = 0;
|
|
20692
20698
|
_this.items = [] // 场景的所有元素
|
|
@@ -20862,13 +20868,10 @@ exports.Vector2PropertyPlayableAsset = __decorate([
|
|
|
20862
20868
|
return startOrder;
|
|
20863
20869
|
};
|
|
20864
20870
|
_proto.fromData = function fromData(data) {
|
|
20865
|
-
|
|
20871
|
+
Component.prototype.fromData.call(this, data);
|
|
20866
20872
|
var compositionData = data;
|
|
20867
|
-
this.items = compositionData.items;
|
|
20868
20873
|
var _compositionData_startTime;
|
|
20869
20874
|
this.startTime = (_compositionData_startTime = compositionData.startTime) != null ? _compositionData_startTime : 0;
|
|
20870
|
-
this.sceneBindings = compositionData.sceneBindings;
|
|
20871
|
-
this.timelineAsset = compositionData.timelineAsset;
|
|
20872
20875
|
};
|
|
20873
20876
|
_proto.resolveBindings = function resolveBindings() {
|
|
20874
20877
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.sceneBindings), _step; !(_step = _iterator()).done;){
|
|
@@ -20891,7 +20894,19 @@ exports.Vector2PropertyPlayableAsset = __decorate([
|
|
|
20891
20894
|
}
|
|
20892
20895
|
};
|
|
20893
20896
|
return CompositionComponent;
|
|
20894
|
-
}(
|
|
20897
|
+
}(Component);
|
|
20898
|
+
__decorate([
|
|
20899
|
+
serialize()
|
|
20900
|
+
], exports.CompositionComponent.prototype, "items", void 0);
|
|
20901
|
+
__decorate([
|
|
20902
|
+
serialize()
|
|
20903
|
+
], exports.CompositionComponent.prototype, "sceneBindings", void 0);
|
|
20904
|
+
__decorate([
|
|
20905
|
+
serialize()
|
|
20906
|
+
], exports.CompositionComponent.prototype, "timelineAsset", void 0);
|
|
20907
|
+
exports.CompositionComponent = __decorate([
|
|
20908
|
+
effectsClass("CompositionComponent")
|
|
20909
|
+
], exports.CompositionComponent);
|
|
20895
20910
|
|
|
20896
20911
|
/**
|
|
20897
20912
|
*
|
|
@@ -21083,482 +21098,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
21083
21098
|
// }
|
|
21084
21099
|
(TickData);
|
|
21085
21100
|
|
|
21086
|
-
var SerializationHelper = /*#__PURE__*/ function() {
|
|
21087
|
-
function SerializationHelper() {}
|
|
21088
|
-
SerializationHelper.collectSerializableObject = function collectSerializableObject(effectsObject, res) {
|
|
21089
|
-
if (res[effectsObject.getInstanceId()]) {
|
|
21090
|
-
return;
|
|
21091
|
-
}
|
|
21092
|
-
effectsObject.toData();
|
|
21093
|
-
res[effectsObject.getInstanceId()] = effectsObject;
|
|
21094
|
-
var serializedProperties = getMergedStore(effectsObject);
|
|
21095
|
-
if (serializedProperties) {
|
|
21096
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(serializedProperties)), _step; !(_step = _iterator()).done;){
|
|
21097
|
-
var key = _step.value;
|
|
21098
|
-
// TODO 待移除,序列化属性通过 effectsObject 对象直接获取
|
|
21099
|
-
var value = effectsObject.taggedProperties[key];
|
|
21100
|
-
if (value === undefined) {
|
|
21101
|
-
value = effectsObject[key];
|
|
21102
|
-
}
|
|
21103
|
-
if (EffectsObject.is(value)) {
|
|
21104
|
-
SerializationHelper.collectSerializableObject(value, res);
|
|
21105
|
-
} else if (isArray(value)) {
|
|
21106
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(value), _step1; !(_step1 = _iterator1()).done;){
|
|
21107
|
-
var arrayValue = _step1.value;
|
|
21108
|
-
if (EffectsObject.is(arrayValue)) {
|
|
21109
|
-
SerializationHelper.collectSerializableObject(arrayValue, res);
|
|
21110
|
-
}
|
|
21111
|
-
}
|
|
21112
|
-
} else if (isObject(value)) {
|
|
21113
|
-
// 非 EffectsObject 对象只递归一层
|
|
21114
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(Object.keys(value)), _step2; !(_step2 = _iterator2()).done;){
|
|
21115
|
-
var objectKey = _step2.value;
|
|
21116
|
-
var objectValue = value[objectKey];
|
|
21117
|
-
if (EffectsObject.is(objectValue)) {
|
|
21118
|
-
SerializationHelper.collectSerializableObject(objectValue, res);
|
|
21119
|
-
}
|
|
21120
|
-
}
|
|
21121
|
-
}
|
|
21122
|
-
}
|
|
21123
|
-
}
|
|
21124
|
-
};
|
|
21125
|
-
SerializationHelper.serializeEffectObject = function serializeEffectObject(effectsObject) {
|
|
21126
|
-
// 持有所有需要序列化的引擎对象
|
|
21127
|
-
var serializableMap = {};
|
|
21128
|
-
var engine = effectsObject.engine;
|
|
21129
|
-
// 加入内存中已加载的资产数据,避免重复创建资产数据
|
|
21130
|
-
var serializedDatas = _extends({}, engine.jsonSceneData);
|
|
21131
|
-
// 递归收集所有需要序列化的对象
|
|
21132
|
-
SerializationHelper.collectSerializableObject(effectsObject, serializableMap);
|
|
21133
|
-
// 依次序列化
|
|
21134
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(serializableMap)), _step; !(_step = _iterator()).done;){
|
|
21135
|
-
var guid = _step.value;
|
|
21136
|
-
var serializeObject = serializableMap[guid];
|
|
21137
|
-
if (!serializedDatas[serializeObject.getInstanceId()]) {
|
|
21138
|
-
serializedDatas[serializeObject.getInstanceId()] = {};
|
|
21139
|
-
}
|
|
21140
|
-
SerializationHelper.serialize(serializeObject, serializedDatas[serializeObject.getInstanceId()]);
|
|
21141
|
-
}
|
|
21142
|
-
return serializedDatas;
|
|
21143
|
-
};
|
|
21144
|
-
SerializationHelper.serialize = function serialize(effectsObject, serializedData) {
|
|
21145
|
-
effectsObject.toData();
|
|
21146
|
-
if (!serializedData) {
|
|
21147
|
-
serializedData = {};
|
|
21148
|
-
}
|
|
21149
|
-
var serializedProperties = getMergedStore(effectsObject);
|
|
21150
|
-
if (serializedProperties) {
|
|
21151
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(serializedProperties)), _step; !(_step = _iterator()).done;){
|
|
21152
|
-
var key = _step.value;
|
|
21153
|
-
var value = effectsObject[key];
|
|
21154
|
-
if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(value)) {
|
|
21155
|
-
// TODO json 数据避免传 typedArray
|
|
21156
|
-
serializedData[key] = value;
|
|
21157
|
-
} else if (isArray(value)) {
|
|
21158
|
-
if (!serializedData[key]) {
|
|
21159
|
-
serializedData[key] = [];
|
|
21160
|
-
}
|
|
21161
|
-
SerializationHelper.serializeArrayProperty(value, serializedData[key], 0);
|
|
21162
|
-
} else if (EffectsObject.is(value)) {
|
|
21163
|
-
// TODO 处理 EffectsObject 递归序列化
|
|
21164
|
-
serializedData[key] = {
|
|
21165
|
-
id: value.getInstanceId()
|
|
21166
|
-
};
|
|
21167
|
-
} else if (isObject(value)) {
|
|
21168
|
-
if (!serializedData[key]) {
|
|
21169
|
-
serializedData[key] = {};
|
|
21170
|
-
}
|
|
21171
|
-
SerializationHelper.serializeObjectProperty(value, serializedData[key], 0);
|
|
21172
|
-
}
|
|
21173
|
-
}
|
|
21174
|
-
}
|
|
21175
|
-
// TODO 待移除 tagggedProperties 为没有装饰器的临时方案
|
|
21176
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(Object.keys(effectsObject.taggedProperties)), _step1; !(_step1 = _iterator1()).done;){
|
|
21177
|
-
var key1 = _step1.value;
|
|
21178
|
-
var value1 = effectsObject.taggedProperties[key1];
|
|
21179
|
-
if (typeof value1 === "number" || typeof value1 === "string" || typeof value1 === "boolean" || SerializationHelper.checkTypedArray(value1)) {
|
|
21180
|
-
// TODO json 数据避免传 typedArray
|
|
21181
|
-
serializedData[key1] = value1;
|
|
21182
|
-
} else if (isArray(value1)) {
|
|
21183
|
-
if (!serializedData[key1]) {
|
|
21184
|
-
serializedData[key1] = [];
|
|
21185
|
-
}
|
|
21186
|
-
SerializationHelper.serializeArrayProperty(value1, serializedData[key1], 0);
|
|
21187
|
-
} else if (EffectsObject.is(value1)) {
|
|
21188
|
-
// TODO 处理 EffectsObject 递归序列化
|
|
21189
|
-
serializedData[key1] = {
|
|
21190
|
-
id: value1.getInstanceId()
|
|
21191
|
-
};
|
|
21192
|
-
} else if (isObject(value1)) {
|
|
21193
|
-
if (!serializedData[key1]) {
|
|
21194
|
-
serializedData[key1] = {};
|
|
21195
|
-
}
|
|
21196
|
-
SerializationHelper.serializeObjectProperty(value1, serializedData[key1], 0);
|
|
21197
|
-
}
|
|
21198
|
-
}
|
|
21199
|
-
return serializedData;
|
|
21200
|
-
};
|
|
21201
|
-
SerializationHelper.deserialize = function deserialize(serializedData, effectsObject) {
|
|
21202
|
-
var taggedProperties = effectsObject.taggedProperties;
|
|
21203
|
-
var serializedProperties = getMergedStore(effectsObject);
|
|
21204
|
-
var engine = effectsObject.engine;
|
|
21205
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(serializedData)), _step; !(_step = _iterator()).done;){
|
|
21206
|
-
var key = _step.value;
|
|
21207
|
-
if (serializedProperties && serializedProperties[key]) {
|
|
21208
|
-
continue;
|
|
21209
|
-
}
|
|
21210
|
-
var value = serializedData[key];
|
|
21211
|
-
taggedProperties[key] = SerializationHelper.deserializeProperty(value, engine, 0);
|
|
21212
|
-
}
|
|
21213
|
-
if (serializedProperties) {
|
|
21214
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(Object.keys(serializedProperties)), _step1; !(_step1 = _iterator1()).done;){
|
|
21215
|
-
var key1 = _step1.value;
|
|
21216
|
-
var value1 = serializedData[key1];
|
|
21217
|
-
if (value1 === undefined) {
|
|
21218
|
-
continue;
|
|
21219
|
-
}
|
|
21220
|
-
var propertyType = serializedProperties[key1].type;
|
|
21221
|
-
// FIXME: taggedProperties 为 readonly,这里存在强制赋值
|
|
21222
|
-
// @ts-expect-error
|
|
21223
|
-
effectsObject[key1] = SerializationHelper.deserializeProperty(value1, engine, 0, propertyType);
|
|
21224
|
-
}
|
|
21225
|
-
}
|
|
21226
|
-
effectsObject.fromData(taggedProperties);
|
|
21227
|
-
};
|
|
21228
|
-
SerializationHelper.deserializeAsync = function deserializeAsync(serializedData, effectsObject) {
|
|
21229
|
-
return _async_to_generator(function() {
|
|
21230
|
-
var taggedProperties, serializedProperties, engine, _iterator, _step, key, value, _iterator1, _step1, key1, value1, propertyType;
|
|
21231
|
-
return __generator(this, function(_state) {
|
|
21232
|
-
switch(_state.label){
|
|
21233
|
-
case 0:
|
|
21234
|
-
taggedProperties = effectsObject.taggedProperties;
|
|
21235
|
-
serializedProperties = getMergedStore(effectsObject);
|
|
21236
|
-
engine = effectsObject.engine;
|
|
21237
|
-
_iterator = _create_for_of_iterator_helper_loose(Object.keys(serializedData));
|
|
21238
|
-
_state.label = 1;
|
|
21239
|
-
case 1:
|
|
21240
|
-
if (!!(_step = _iterator()).done) return [
|
|
21241
|
-
3,
|
|
21242
|
-
4
|
|
21243
|
-
];
|
|
21244
|
-
key = _step.value;
|
|
21245
|
-
if (serializedProperties && serializedProperties[key]) {
|
|
21246
|
-
return [
|
|
21247
|
-
3,
|
|
21248
|
-
3
|
|
21249
|
-
];
|
|
21250
|
-
}
|
|
21251
|
-
value = serializedData[key];
|
|
21252
|
-
return [
|
|
21253
|
-
4,
|
|
21254
|
-
SerializationHelper.deserializePropertyAsync(value, engine, 0)
|
|
21255
|
-
];
|
|
21256
|
-
case 2:
|
|
21257
|
-
taggedProperties[key] = _state.sent();
|
|
21258
|
-
_state.label = 3;
|
|
21259
|
-
case 3:
|
|
21260
|
-
return [
|
|
21261
|
-
3,
|
|
21262
|
-
1
|
|
21263
|
-
];
|
|
21264
|
-
case 4:
|
|
21265
|
-
if (!serializedProperties) return [
|
|
21266
|
-
3,
|
|
21267
|
-
8
|
|
21268
|
-
];
|
|
21269
|
-
_iterator1 = _create_for_of_iterator_helper_loose(Object.keys(serializedProperties));
|
|
21270
|
-
_state.label = 5;
|
|
21271
|
-
case 5:
|
|
21272
|
-
if (!!(_step1 = _iterator1()).done) return [
|
|
21273
|
-
3,
|
|
21274
|
-
8
|
|
21275
|
-
];
|
|
21276
|
-
key1 = _step1.value;
|
|
21277
|
-
value1 = serializedData[key1];
|
|
21278
|
-
if (value1 === undefined) {
|
|
21279
|
-
return [
|
|
21280
|
-
3,
|
|
21281
|
-
7
|
|
21282
|
-
];
|
|
21283
|
-
}
|
|
21284
|
-
propertyType = serializedProperties[key1].type;
|
|
21285
|
-
return [
|
|
21286
|
-
4,
|
|
21287
|
-
SerializationHelper.deserializePropertyAsync(value1, engine, 0, propertyType)
|
|
21288
|
-
];
|
|
21289
|
-
case 6:
|
|
21290
|
-
// FIXME: taggedProperties 为 readonly,这里存在强制赋值
|
|
21291
|
-
// @ts-expect-error
|
|
21292
|
-
effectsObject[key1] = _state.sent();
|
|
21293
|
-
_state.label = 7;
|
|
21294
|
-
case 7:
|
|
21295
|
-
return [
|
|
21296
|
-
3,
|
|
21297
|
-
5
|
|
21298
|
-
];
|
|
21299
|
-
case 8:
|
|
21300
|
-
effectsObject.fromData(taggedProperties);
|
|
21301
|
-
return [
|
|
21302
|
-
2
|
|
21303
|
-
];
|
|
21304
|
-
}
|
|
21305
|
-
});
|
|
21306
|
-
})();
|
|
21307
|
-
};
|
|
21308
|
-
SerializationHelper.checkTypedArray = function checkTypedArray(obj) {
|
|
21309
|
-
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);
|
|
21310
|
-
};
|
|
21311
|
-
// check value is { id: 7e69662e964e4892ae8933f24562395b }
|
|
21312
|
-
SerializationHelper.checkDataPath = function checkDataPath(value) {
|
|
21313
|
-
return !!(isObject(value) && Object.keys(value).length === 1 && "id" in value && isString(value.id) && value.id.length === 32);
|
|
21314
|
-
};
|
|
21315
|
-
// TODO 测试函数,2.0 上线后移除
|
|
21316
|
-
SerializationHelper.checkGLTFNode = function checkGLTFNode(value) {
|
|
21317
|
-
return isObject(value) && value.nodeIndex !== undefined && value.isJoint !== undefined;
|
|
21318
|
-
};
|
|
21319
|
-
SerializationHelper.checkImageSource = function checkImageSource(value) {
|
|
21320
|
-
return isCanvas(value) || _instanceof1(value, HTMLImageElement);
|
|
21321
|
-
};
|
|
21322
|
-
SerializationHelper.deserializeProperty = function deserializeProperty(property, engine, level, type) {
|
|
21323
|
-
if (level > 14) {
|
|
21324
|
-
console.error("The nested object layers of the serialized data exceed the maximum limit.");
|
|
21325
|
-
return;
|
|
21326
|
-
}
|
|
21327
|
-
// 加载并链接 DataPath 字段表示的 EffectsObject 引用。Class 对象 copy [key, value] 会丢失对象信息,因此只递归数组对象和普通 js Object 结构对象。
|
|
21328
|
-
if (isArray(property)) {
|
|
21329
|
-
var res = [];
|
|
21330
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(property), _step; !(_step = _iterator()).done;){
|
|
21331
|
-
var value = _step.value;
|
|
21332
|
-
res.push(SerializationHelper.deserializeProperty(value, engine, level + 1, type));
|
|
21333
|
-
}
|
|
21334
|
-
return res;
|
|
21335
|
-
// TODO json 数据避免传 typedArray
|
|
21336
|
-
} else if (SerializationHelper.checkDataPath(property)) {
|
|
21337
|
-
return engine.assetLoader.loadGUID(property.id);
|
|
21338
|
-
} else if (isObject(property) && property.constructor === Object) {
|
|
21339
|
-
var res1;
|
|
21340
|
-
if (type) {
|
|
21341
|
-
res1 = new type();
|
|
21342
|
-
} else {
|
|
21343
|
-
res1 = {};
|
|
21344
|
-
}
|
|
21345
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(Object.keys(property)), _step1; !(_step1 = _iterator1()).done;){
|
|
21346
|
-
var key = _step1.value;
|
|
21347
|
-
res1[key] = SerializationHelper.deserializeProperty(property[key], engine, level + 1);
|
|
21348
|
-
}
|
|
21349
|
-
return res1;
|
|
21350
|
-
} else {
|
|
21351
|
-
return property;
|
|
21352
|
-
}
|
|
21353
|
-
};
|
|
21354
|
-
SerializationHelper.deserializePropertyAsync = function deserializePropertyAsync(property, engine, level, type) {
|
|
21355
|
-
return _async_to_generator(function() {
|
|
21356
|
-
var res, _iterator, _step, value, _, res1, res2, _iterator1, _step1, key;
|
|
21357
|
-
return __generator(this, function(_state) {
|
|
21358
|
-
switch(_state.label){
|
|
21359
|
-
case 0:
|
|
21360
|
-
if (level > 14) {
|
|
21361
|
-
console.error("The nested object layers of the serialized data exceed the maximum limit.");
|
|
21362
|
-
return [
|
|
21363
|
-
2
|
|
21364
|
-
];
|
|
21365
|
-
}
|
|
21366
|
-
if (!isArray(property)) return [
|
|
21367
|
-
3,
|
|
21368
|
-
5
|
|
21369
|
-
];
|
|
21370
|
-
res = [];
|
|
21371
|
-
_iterator = _create_for_of_iterator_helper_loose(property);
|
|
21372
|
-
_state.label = 1;
|
|
21373
|
-
case 1:
|
|
21374
|
-
if (!!(_step = _iterator()).done) return [
|
|
21375
|
-
3,
|
|
21376
|
-
4
|
|
21377
|
-
];
|
|
21378
|
-
value = _step.value;
|
|
21379
|
-
_ = res.push;
|
|
21380
|
-
return [
|
|
21381
|
-
4,
|
|
21382
|
-
SerializationHelper.deserializePropertyAsync(value, engine, level + 1, type)
|
|
21383
|
-
];
|
|
21384
|
-
case 2:
|
|
21385
|
-
_.apply(res, [
|
|
21386
|
-
_state.sent()
|
|
21387
|
-
]);
|
|
21388
|
-
_state.label = 3;
|
|
21389
|
-
case 3:
|
|
21390
|
-
return [
|
|
21391
|
-
3,
|
|
21392
|
-
1
|
|
21393
|
-
];
|
|
21394
|
-
case 4:
|
|
21395
|
-
return [
|
|
21396
|
-
2,
|
|
21397
|
-
res
|
|
21398
|
-
];
|
|
21399
|
-
case 5:
|
|
21400
|
-
if (!SerializationHelper.checkDataPath(property)) return [
|
|
21401
|
-
3,
|
|
21402
|
-
7
|
|
21403
|
-
];
|
|
21404
|
-
return [
|
|
21405
|
-
4,
|
|
21406
|
-
engine.assetLoader.loadGUIDAsync(property.id)
|
|
21407
|
-
];
|
|
21408
|
-
case 6:
|
|
21409
|
-
res1 = _state.sent();
|
|
21410
|
-
return [
|
|
21411
|
-
2,
|
|
21412
|
-
res1
|
|
21413
|
-
];
|
|
21414
|
-
case 7:
|
|
21415
|
-
if (!(isObject(property) && property.constructor === Object)) return [
|
|
21416
|
-
3,
|
|
21417
|
-
12
|
|
21418
|
-
];
|
|
21419
|
-
if (type) {
|
|
21420
|
-
res2 = new type();
|
|
21421
|
-
} else {
|
|
21422
|
-
res2 = {};
|
|
21423
|
-
}
|
|
21424
|
-
_iterator1 = _create_for_of_iterator_helper_loose(Object.keys(property));
|
|
21425
|
-
_state.label = 8;
|
|
21426
|
-
case 8:
|
|
21427
|
-
if (!!(_step1 = _iterator1()).done) return [
|
|
21428
|
-
3,
|
|
21429
|
-
11
|
|
21430
|
-
];
|
|
21431
|
-
key = _step1.value;
|
|
21432
|
-
return [
|
|
21433
|
-
4,
|
|
21434
|
-
SerializationHelper.deserializePropertyAsync(property[key], engine, level + 1)
|
|
21435
|
-
];
|
|
21436
|
-
case 9:
|
|
21437
|
-
res2[key] = _state.sent();
|
|
21438
|
-
_state.label = 10;
|
|
21439
|
-
case 10:
|
|
21440
|
-
return [
|
|
21441
|
-
3,
|
|
21442
|
-
8
|
|
21443
|
-
];
|
|
21444
|
-
case 11:
|
|
21445
|
-
return [
|
|
21446
|
-
2,
|
|
21447
|
-
res2
|
|
21448
|
-
];
|
|
21449
|
-
case 12:
|
|
21450
|
-
return [
|
|
21451
|
-
2,
|
|
21452
|
-
property
|
|
21453
|
-
];
|
|
21454
|
-
case 13:
|
|
21455
|
-
return [
|
|
21456
|
-
2
|
|
21457
|
-
];
|
|
21458
|
-
}
|
|
21459
|
-
});
|
|
21460
|
-
})();
|
|
21461
|
-
};
|
|
21462
|
-
SerializationHelper.serializeObjectProperty = function serializeObjectProperty(objectProperty, serializedData, level) {
|
|
21463
|
-
if (level > 14) {
|
|
21464
|
-
console.error("The nested object layers of the serialized data exceed the maximum limit.");
|
|
21465
|
-
return;
|
|
21466
|
-
}
|
|
21467
|
-
if (!serializedData) {
|
|
21468
|
-
serializedData = {};
|
|
21469
|
-
}
|
|
21470
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(objectProperty)), _step; !(_step = _iterator()).done;){
|
|
21471
|
-
var key = _step.value;
|
|
21472
|
-
var value = objectProperty[key];
|
|
21473
|
-
if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(objectProperty)) {
|
|
21474
|
-
// TODO json 数据避免传 typedArray
|
|
21475
|
-
serializedData[key] = value;
|
|
21476
|
-
} else if (isArray(value)) {
|
|
21477
|
-
if (!serializedData[key]) {
|
|
21478
|
-
serializedData[key] = [];
|
|
21479
|
-
}
|
|
21480
|
-
SerializationHelper.serializeArrayProperty(value, serializedData[key], level + 1);
|
|
21481
|
-
} else if (EffectsObject.is(value)) {
|
|
21482
|
-
// TODO 处理 EffectsObject 递归序列化
|
|
21483
|
-
serializedData[key] = {
|
|
21484
|
-
id: value.getInstanceId()
|
|
21485
|
-
};
|
|
21486
|
-
} else if (isObject(value)) {
|
|
21487
|
-
if (!serializedData[key]) {
|
|
21488
|
-
serializedData[key] = {};
|
|
21489
|
-
}
|
|
21490
|
-
SerializationHelper.serializeObjectProperty(value, serializedData[key], level + 1);
|
|
21491
|
-
}
|
|
21492
|
-
}
|
|
21493
|
-
};
|
|
21494
|
-
SerializationHelper.serializeArrayProperty = function serializeArrayProperty(arrayProperty, serializedData, level) {
|
|
21495
|
-
if (level > 14) {
|
|
21496
|
-
console.error("The nested object layers of the serialized data exceed the maximum limit.");
|
|
21497
|
-
return;
|
|
21498
|
-
}
|
|
21499
|
-
if (!serializedData) {
|
|
21500
|
-
serializedData = [];
|
|
21501
|
-
}
|
|
21502
|
-
for(var i = 0; i < arrayProperty.length; i++){
|
|
21503
|
-
var value = arrayProperty[i];
|
|
21504
|
-
if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(arrayProperty)) {
|
|
21505
|
-
// TODO json 数据避免传 typedArray
|
|
21506
|
-
serializedData[i] = value;
|
|
21507
|
-
} else if (isArray(value)) {
|
|
21508
|
-
if (!serializedData[i]) {
|
|
21509
|
-
serializedData[i] = [];
|
|
21510
|
-
}
|
|
21511
|
-
SerializationHelper.serializeArrayProperty(value, serializedData[i], level + 1);
|
|
21512
|
-
} else if (EffectsObject.is(value)) {
|
|
21513
|
-
// TODO 处理 EffectsObject 递归序列化
|
|
21514
|
-
serializedData[i] = {
|
|
21515
|
-
id: value.getInstanceId()
|
|
21516
|
-
};
|
|
21517
|
-
} else if (isObject(value)) {
|
|
21518
|
-
if (!serializedData[i]) {
|
|
21519
|
-
serializedData[i] = {};
|
|
21520
|
-
}
|
|
21521
|
-
SerializationHelper.serializeObjectProperty(value, serializedData[i], level + 1);
|
|
21522
|
-
}
|
|
21523
|
-
}
|
|
21524
|
-
};
|
|
21525
|
-
return SerializationHelper;
|
|
21526
|
-
}();
|
|
21527
|
-
|
|
21528
|
-
var _obj$2;
|
|
21529
|
-
/**
|
|
21530
|
-
* 机型和渲染等级对应表
|
|
21531
|
-
*
|
|
21532
|
-
* 机型:B-低端机、A-中端机、S-高端机
|
|
21533
|
-
* 渲染等级:B-低、A-中、S-高、A+-中高、B+-全部
|
|
21534
|
-
*
|
|
21535
|
-
* - S(高端机):高、全部、中高
|
|
21536
|
-
* - A(中端机):中、全部、中高
|
|
21537
|
-
* - B(低端机):低、全部
|
|
21538
|
-
* - undefined(全部机型)
|
|
21539
|
-
*/ var renderLevelPassSet = (_obj$2 = {}, _obj$2[RenderLevel.S] = [
|
|
21540
|
-
RenderLevel.S,
|
|
21541
|
-
RenderLevel.BPlus,
|
|
21542
|
-
RenderLevel.APlus
|
|
21543
|
-
], _obj$2[RenderLevel.A] = [
|
|
21544
|
-
RenderLevel.A,
|
|
21545
|
-
RenderLevel.BPlus,
|
|
21546
|
-
RenderLevel.APlus
|
|
21547
|
-
], _obj$2[RenderLevel.B] = [
|
|
21548
|
-
RenderLevel.B,
|
|
21549
|
-
RenderLevel.BPlus
|
|
21550
|
-
], _obj$2);
|
|
21551
|
-
function passRenderLevel(l, renderLevel) {
|
|
21552
|
-
if (!l || !renderLevel) {
|
|
21553
|
-
return true;
|
|
21554
|
-
}
|
|
21555
|
-
var arr = renderLevelPassSet[renderLevel];
|
|
21556
|
-
if (arr) {
|
|
21557
|
-
return arr.includes(l);
|
|
21558
|
-
}
|
|
21559
|
-
return false;
|
|
21560
|
-
}
|
|
21561
|
-
|
|
21562
21101
|
/**
|
|
21563
21102
|
* 合成抽象类:核心对象,通常一个场景只包含一个合成,可能会有多个合成。
|
|
21564
21103
|
* 合成中包含了相关的 Item 元素,支持对 Item 元素的创建、更新和销毁。
|
|
@@ -21624,10 +21163,16 @@ function passRenderLevel(l, renderLevel) {
|
|
|
21624
21163
|
_this.rootItem.duration = sourceContent.duration;
|
|
21625
21164
|
_this.rootItem.endBehavior = sourceContent.endBehavior;
|
|
21626
21165
|
_this.rootItem.composition = _assert_this_initialized(_this);
|
|
21627
|
-
// Create
|
|
21628
|
-
|
|
21629
|
-
|
|
21630
|
-
|
|
21166
|
+
// Create rootItem components
|
|
21167
|
+
//@ts-expect-error TODO update spec.
|
|
21168
|
+
var componentPaths = sourceContent.components;
|
|
21169
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(componentPaths), _step1; !(_step1 = _iterator1()).done;){
|
|
21170
|
+
var componentPath = _step1.value;
|
|
21171
|
+
var component = _this.getEngine().findObject(componentPath);
|
|
21172
|
+
_this.rootItem.components.push(component);
|
|
21173
|
+
component.item = _this.rootItem;
|
|
21174
|
+
}
|
|
21175
|
+
_this.rootComposition = _this.rootItem.getComponent(exports.CompositionComponent);
|
|
21631
21176
|
_this.width = width;
|
|
21632
21177
|
_this.height = height;
|
|
21633
21178
|
_this.renderOrder = baseRenderOrder;
|
|
@@ -21655,7 +21200,7 @@ function passRenderLevel(l, renderLevel) {
|
|
|
21655
21200
|
_this.handleItemMessage = handleItemMessage;
|
|
21656
21201
|
_this.createRenderFrame();
|
|
21657
21202
|
_this.rendererOptions = null;
|
|
21658
|
-
|
|
21203
|
+
Composition.buildItemTree(_this.rootItem);
|
|
21659
21204
|
_this.rootComposition.setChildrenRenderOrder(0);
|
|
21660
21205
|
_this.pluginSystem.resetComposition(_assert_this_initialized(_this), _this.renderFrame);
|
|
21661
21206
|
return _this;
|
|
@@ -21873,38 +21418,6 @@ function passRenderLevel(l, renderLevel) {
|
|
|
21873
21418
|
}
|
|
21874
21419
|
};
|
|
21875
21420
|
/**
|
|
21876
|
-
* 构建父子树,同时保存到 itemCacheMap 中便于查找
|
|
21877
|
-
*/ _proto.buildItemTree = function buildItemTree(compVFXItem) {
|
|
21878
|
-
if (!compVFXItem.composition) {
|
|
21879
|
-
return;
|
|
21880
|
-
}
|
|
21881
|
-
var itemMap = new Map();
|
|
21882
|
-
var contentItems = compVFXItem.getComponent(CompositionComponent).items;
|
|
21883
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(contentItems), _step; !(_step = _iterator()).done;){
|
|
21884
|
-
var item = _step.value;
|
|
21885
|
-
itemMap.set(item.id, item);
|
|
21886
|
-
}
|
|
21887
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(contentItems), _step1; !(_step1 = _iterator1()).done;){
|
|
21888
|
-
var item1 = _step1.value;
|
|
21889
|
-
if (item1.parentId === undefined) {
|
|
21890
|
-
item1.setParent(compVFXItem);
|
|
21891
|
-
} else {
|
|
21892
|
-
var parent = itemMap.get(item1.parentId);
|
|
21893
|
-
if (parent) {
|
|
21894
|
-
item1.setParent(parent);
|
|
21895
|
-
} else {
|
|
21896
|
-
throw new Error("The element references a non-existent element, please check the data.");
|
|
21897
|
-
}
|
|
21898
|
-
}
|
|
21899
|
-
}
|
|
21900
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(contentItems), _step2; !(_step2 = _iterator2()).done;){
|
|
21901
|
-
var item2 = _step2.value;
|
|
21902
|
-
if (exports.VFXItem.isComposition(item2)) {
|
|
21903
|
-
this.buildItemTree(item2);
|
|
21904
|
-
}
|
|
21905
|
-
}
|
|
21906
|
-
};
|
|
21907
|
-
/**
|
|
21908
21421
|
* 更新视频数据到纹理
|
|
21909
21422
|
* @override
|
|
21910
21423
|
*/ _proto.updateVideo = function updateVideo() {
|
|
@@ -22015,7 +21528,7 @@ function passRenderLevel(l, renderLevel) {
|
|
|
22015
21528
|
var ray = this.getHitTestRay(x, y);
|
|
22016
21529
|
this.refContent.forEach(function(ref) {
|
|
22017
21530
|
var _ref_getComponent;
|
|
22018
|
-
(_ref_getComponent = ref.getComponent(CompositionComponent)) == null ? void 0 : _ref_getComponent.hitTest(ray, x, y, regions, force, options);
|
|
21531
|
+
(_ref_getComponent = ref.getComponent(exports.CompositionComponent)) == null ? void 0 : _ref_getComponent.hitTest(ray, x, y, regions, force, options);
|
|
22019
21532
|
});
|
|
22020
21533
|
return regions;
|
|
22021
21534
|
};
|
|
@@ -22068,7 +21581,7 @@ function passRenderLevel(l, renderLevel) {
|
|
|
22068
21581
|
// 预合成元素销毁时销毁其中的item
|
|
22069
21582
|
if (item.type == ItemType.composition) {
|
|
22070
21583
|
if (item.endBehavior !== EndBehavior.freeze) {
|
|
22071
|
-
var contentItems = item.getComponent(CompositionComponent).items;
|
|
21584
|
+
var contentItems = item.getComponent(exports.CompositionComponent).items;
|
|
22072
21585
|
contentItems.forEach(function(it) {
|
|
22073
21586
|
return _this.pluginSystem.plugins.forEach(function(loader) {
|
|
22074
21587
|
return loader.onCompositionItemRemoved(_this, it);
|
|
@@ -22263,6 +21776,30 @@ function passRenderLevel(l, renderLevel) {
|
|
|
22263
21776
|
});
|
|
22264
21777
|
})();
|
|
22265
21778
|
};
|
|
21779
|
+
/**
|
|
21780
|
+
* @internal
|
|
21781
|
+
* 构建父子树,同时保存到 itemCacheMap 中便于查找
|
|
21782
|
+
*/ Composition.buildItemTree = function buildItemTree(compVFXItem) {
|
|
21783
|
+
var itemMap = new Map();
|
|
21784
|
+
var contentItems = compVFXItem.getComponent(exports.CompositionComponent).items;
|
|
21785
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(contentItems), _step; !(_step = _iterator()).done;){
|
|
21786
|
+
var item = _step.value;
|
|
21787
|
+
itemMap.set(item.id, item);
|
|
21788
|
+
}
|
|
21789
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(contentItems), _step1; !(_step1 = _iterator1()).done;){
|
|
21790
|
+
var item1 = _step1.value;
|
|
21791
|
+
if (item1.parentId === undefined) {
|
|
21792
|
+
item1.setParent(compVFXItem);
|
|
21793
|
+
} else {
|
|
21794
|
+
var parent = itemMap.get(item1.parentId);
|
|
21795
|
+
if (parent) {
|
|
21796
|
+
item1.setParent(parent);
|
|
21797
|
+
} else {
|
|
21798
|
+
throw new Error("The element references a non-existent element, please check the data.");
|
|
21799
|
+
}
|
|
21800
|
+
}
|
|
21801
|
+
}
|
|
21802
|
+
};
|
|
22266
21803
|
_create_class(Composition, [
|
|
22267
21804
|
{
|
|
22268
21805
|
key: "transform",
|
|
@@ -22324,25 +21861,6 @@ function passRenderLevel(l, renderLevel) {
|
|
|
22324
21861
|
]);
|
|
22325
21862
|
return Composition;
|
|
22326
21863
|
}(EventEmitter);
|
|
22327
|
-
function filterItemsByRenderLevel(composition, engine, renderLevel) {
|
|
22328
|
-
var items = [];
|
|
22329
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(composition.items), _step; !(_step = _iterator()).done;){
|
|
22330
|
-
var itemDataPath = _step.value;
|
|
22331
|
-
var itemProps = engine.findEffectsObjectData(itemDataPath.id);
|
|
22332
|
-
if (passRenderLevel(itemProps.renderLevel, renderLevel)) {
|
|
22333
|
-
items.push(itemDataPath);
|
|
22334
|
-
} else {
|
|
22335
|
-
// 非预合成元素未达到渲染等级的转化为空节点。
|
|
22336
|
-
// 预合成元素有根据 item type 的子元素加载判断,没法保留空节点,这边先整体过滤掉。
|
|
22337
|
-
if (itemProps.type !== ItemType.composition) {
|
|
22338
|
-
itemProps.components = [];
|
|
22339
|
-
items.push(itemDataPath);
|
|
22340
|
-
}
|
|
22341
|
-
}
|
|
22342
|
-
}
|
|
22343
|
-
composition.items = items;
|
|
22344
|
-
return composition;
|
|
22345
|
-
}
|
|
22346
21864
|
|
|
22347
21865
|
exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
22348
21866
|
_inherits(VFXItem, EffectsObject);
|
|
@@ -22355,7 +21873,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
22355
21873
|
*/ _this.transform = new Transform();
|
|
22356
21874
|
/**
|
|
22357
21875
|
* 元素动画的当前时间
|
|
22358
|
-
*/ _this.time =
|
|
21876
|
+
*/ _this.time = -1;
|
|
22359
21877
|
/**
|
|
22360
21878
|
* 元素动画的持续时间
|
|
22361
21879
|
*/ _this.duration = 0;
|
|
@@ -22366,9 +21884,8 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
22366
21884
|
* 元素动画结束时行为(如何处理元素)
|
|
22367
21885
|
*/ _this.endBehavior = EndBehavior.forward;
|
|
22368
21886
|
_this.type = ItemType.base;
|
|
22369
|
-
_this.isDuringPlay = false;
|
|
22370
21887
|
_this.components = [];
|
|
22371
|
-
_this.
|
|
21888
|
+
_this.isDuringPlay = false;
|
|
22372
21889
|
/**
|
|
22373
21890
|
* 元素是否激活
|
|
22374
21891
|
*/ _this.active = true;
|
|
@@ -22636,6 +22153,25 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
22636
22153
|
return undefined;
|
|
22637
22154
|
};
|
|
22638
22155
|
/**
|
|
22156
|
+
* 复制 VFXItem,返回一个新的 VFXItem
|
|
22157
|
+
* @since 2.4.0
|
|
22158
|
+
* @returns 复制的新 VFXItem
|
|
22159
|
+
*/ _proto.duplicate = function duplicate() {
|
|
22160
|
+
var previousObjectIDMap = new Map();
|
|
22161
|
+
this.gatherPreviousObjectID(previousObjectIDMap);
|
|
22162
|
+
// 重新设置当前元素和组件的 ID 以及子元素和子元素组件的 ID,避免实例化新的对象时产生碰撞
|
|
22163
|
+
this.resetGUID();
|
|
22164
|
+
var newItem = this.engine.findObject({
|
|
22165
|
+
id: this.defination.id
|
|
22166
|
+
});
|
|
22167
|
+
newItem.resetGUID();
|
|
22168
|
+
this.resetGUID(previousObjectIDMap);
|
|
22169
|
+
if (this.composition) {
|
|
22170
|
+
newItem.setParent(this.composition.rootItem);
|
|
22171
|
+
}
|
|
22172
|
+
return newItem;
|
|
22173
|
+
};
|
|
22174
|
+
/**
|
|
22639
22175
|
* @internal
|
|
22640
22176
|
*/ _proto.beginPlay = function beginPlay() {
|
|
22641
22177
|
this.isDuringPlay = true;
|
|
@@ -22730,19 +22266,18 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
22730
22266
|
if (duration < 0) {
|
|
22731
22267
|
throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
|
|
22732
22268
|
}
|
|
22733
|
-
|
|
22734
|
-
|
|
22735
|
-
var
|
|
22736
|
-
|
|
22737
|
-
|
|
22738
|
-
this.
|
|
22739
|
-
|
|
22740
|
-
|
|
22741
|
-
|
|
22742
|
-
|
|
22743
|
-
|
|
22269
|
+
if (data.components) {
|
|
22270
|
+
this.components.length = 0;
|
|
22271
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(data.components), _step; !(_step = _iterator()).done;){
|
|
22272
|
+
var componentPath = _step.value;
|
|
22273
|
+
var component = this.engine.findObject(componentPath);
|
|
22274
|
+
this.components.push(component);
|
|
22275
|
+
// TODO ParticleSystemRenderer 现在是动态生成的,后面需要在 json 中单独表示为一个组件
|
|
22276
|
+
if (_instanceof1(component, exports.ParticleSystem)) {
|
|
22277
|
+
if (!this.components.includes(component.renderer)) {
|
|
22278
|
+
this.components.push(component.renderer);
|
|
22279
|
+
}
|
|
22744
22280
|
}
|
|
22745
|
-
this.rendererComponents.push(component.renderer);
|
|
22746
22281
|
}
|
|
22747
22282
|
}
|
|
22748
22283
|
if (VFXItem.isComposition(this)) {
|
|
@@ -22751,24 +22286,24 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
22751
22286
|
};
|
|
22752
22287
|
_proto.toData = function toData() {
|
|
22753
22288
|
var _this_parent;
|
|
22754
|
-
this.
|
|
22755
|
-
this.
|
|
22756
|
-
this.
|
|
22289
|
+
this.defination.id = this.guid;
|
|
22290
|
+
this.defination.transform = this.transform.toData();
|
|
22291
|
+
this.defination.dataType = DataType.VFXItemData;
|
|
22757
22292
|
if (((_this_parent = this.parent) == null ? void 0 : _this_parent.name) !== "rootItem") {
|
|
22758
22293
|
var _this_parent1;
|
|
22759
|
-
this.
|
|
22294
|
+
this.defination.parentId = (_this_parent1 = this.parent) == null ? void 0 : _this_parent1.guid;
|
|
22760
22295
|
}
|
|
22761
22296
|
// TODO 统一 sprite 等其他组件的序列化逻辑
|
|
22762
|
-
if (!this.
|
|
22763
|
-
this.
|
|
22297
|
+
if (!this.defination.components) {
|
|
22298
|
+
this.defination.components = [];
|
|
22764
22299
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
22765
22300
|
var component = _step.value;
|
|
22766
22301
|
if (_instanceof1(component, exports.EffectComponent)) {
|
|
22767
|
-
this.
|
|
22302
|
+
this.defination.components.push(component);
|
|
22768
22303
|
}
|
|
22769
22304
|
}
|
|
22770
22305
|
}
|
|
22771
|
-
this.
|
|
22306
|
+
this.defination.content = {};
|
|
22772
22307
|
};
|
|
22773
22308
|
_proto.translateByPixel = function translateByPixel(x, y) {
|
|
22774
22309
|
if (this.composition) {
|
|
@@ -22825,17 +22360,52 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
22825
22360
|
if (!props) {
|
|
22826
22361
|
throw new Error("Referenced precomposition with Id: " + refId + " does not exist.");
|
|
22827
22362
|
}
|
|
22828
|
-
|
|
22829
|
-
|
|
22830
|
-
|
|
22831
|
-
|
|
22832
|
-
var
|
|
22833
|
-
|
|
22834
|
-
|
|
22835
|
-
|
|
22836
|
-
|
|
22363
|
+
//@ts-expect-error TODO update spec.
|
|
22364
|
+
var componentPaths = props.components;
|
|
22365
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(componentPaths), _step; !(_step = _iterator()).done;){
|
|
22366
|
+
var componentPath = _step.value;
|
|
22367
|
+
var component = this.engine.findObject(componentPath);
|
|
22368
|
+
component.item = this;
|
|
22369
|
+
this.components.push(component);
|
|
22370
|
+
component.setInstanceId(generateGUID());
|
|
22371
|
+
if (_instanceof1(component, exports.CompositionComponent)) {
|
|
22372
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(component.items), _step1; !(_step1 = _iterator1()).done;){
|
|
22373
|
+
var vfxItem = _step1.value;
|
|
22374
|
+
vfxItem.setInstanceId(generateGUID());
|
|
22375
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(vfxItem.components), _step2; !(_step2 = _iterator2()).done;){
|
|
22376
|
+
var component1 = _step2.value;
|
|
22377
|
+
component1.setInstanceId(generateGUID());
|
|
22378
|
+
}
|
|
22379
|
+
}
|
|
22837
22380
|
}
|
|
22838
22381
|
}
|
|
22382
|
+
Composition.buildItemTree(this);
|
|
22383
|
+
};
|
|
22384
|
+
_proto.resetGUID = function resetGUID(previousObjectIDMap) {
|
|
22385
|
+
var _previousObjectIDMap_get;
|
|
22386
|
+
var itemGUID = (_previousObjectIDMap_get = previousObjectIDMap == null ? void 0 : previousObjectIDMap.get(this)) != null ? _previousObjectIDMap_get : generateGUID();
|
|
22387
|
+
this.setInstanceId(itemGUID);
|
|
22388
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
22389
|
+
var component = _step.value;
|
|
22390
|
+
var _previousObjectIDMap_get1;
|
|
22391
|
+
var componentGUID = (_previousObjectIDMap_get1 = previousObjectIDMap == null ? void 0 : previousObjectIDMap.get(component)) != null ? _previousObjectIDMap_get1 : generateGUID();
|
|
22392
|
+
component.setInstanceId(componentGUID);
|
|
22393
|
+
}
|
|
22394
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.children), _step1; !(_step1 = _iterator1()).done;){
|
|
22395
|
+
var child = _step1.value;
|
|
22396
|
+
child.resetGUID(previousObjectIDMap);
|
|
22397
|
+
}
|
|
22398
|
+
};
|
|
22399
|
+
_proto.gatherPreviousObjectID = function gatherPreviousObjectID(previousObjectIDMap) {
|
|
22400
|
+
previousObjectIDMap.set(this, this.getInstanceId());
|
|
22401
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
22402
|
+
var component = _step.value;
|
|
22403
|
+
previousObjectIDMap.set(component, component.getInstanceId());
|
|
22404
|
+
}
|
|
22405
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.children), _step1; !(_step1 = _iterator1()).done;){
|
|
22406
|
+
var child = _step1.value;
|
|
22407
|
+
child.gatherPreviousObjectID(previousObjectIDMap);
|
|
22408
|
+
}
|
|
22839
22409
|
};
|
|
22840
22410
|
/**
|
|
22841
22411
|
*
|
|
@@ -22942,9 +22512,11 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
22942
22512
|
set: function set(value) {
|
|
22943
22513
|
if (this.listIndex !== value) {
|
|
22944
22514
|
this.listIndex = value;
|
|
22945
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.
|
|
22946
|
-
var
|
|
22947
|
-
|
|
22515
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
22516
|
+
var component = _step.value;
|
|
22517
|
+
if (_instanceof1(component, RendererComponent)) {
|
|
22518
|
+
component.priority = value;
|
|
22519
|
+
}
|
|
22948
22520
|
}
|
|
22949
22521
|
}
|
|
22950
22522
|
}
|
|
@@ -22968,9 +22540,6 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
22968
22540
|
]);
|
|
22969
22541
|
return VFXItem;
|
|
22970
22542
|
}(EffectsObject);
|
|
22971
|
-
__decorate([
|
|
22972
|
-
serialize()
|
|
22973
|
-
], exports.VFXItem.prototype, "components", void 0);
|
|
22974
22543
|
exports.VFXItem = __decorate([
|
|
22975
22544
|
effectsClass(DataType.VFXItemData)
|
|
22976
22545
|
], exports.VFXItem);
|
|
@@ -27035,8 +26604,6 @@ exports.BinaryAsset = /*#__PURE__*/ function(EffectsObject) {
|
|
|
27035
26604
|
function BinaryAsset() {
|
|
27036
26605
|
return EffectsObject.apply(this, arguments);
|
|
27037
26606
|
}
|
|
27038
|
-
var _proto = BinaryAsset.prototype;
|
|
27039
|
-
_proto.fromData = function fromData(data) {};
|
|
27040
26607
|
return BinaryAsset;
|
|
27041
26608
|
}(EffectsObject);
|
|
27042
26609
|
__decorate([
|
|
@@ -27046,6 +26613,197 @@ exports.BinaryAsset = __decorate([
|
|
|
27046
26613
|
effectsClass(DataType.BinaryAsset)
|
|
27047
26614
|
], exports.BinaryAsset);
|
|
27048
26615
|
|
|
26616
|
+
var SerializationHelper = /*#__PURE__*/ function() {
|
|
26617
|
+
function SerializationHelper() {}
|
|
26618
|
+
SerializationHelper.serialize = function serialize(effectsObject, serializedData) {
|
|
26619
|
+
effectsObject.toData();
|
|
26620
|
+
if (!serializedData) {
|
|
26621
|
+
serializedData = {};
|
|
26622
|
+
}
|
|
26623
|
+
var serializedProperties = getMergedStore(effectsObject);
|
|
26624
|
+
if (serializedProperties) {
|
|
26625
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(serializedProperties)), _step; !(_step = _iterator()).done;){
|
|
26626
|
+
var key = _step.value;
|
|
26627
|
+
var value = effectsObject[key];
|
|
26628
|
+
if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(value)) {
|
|
26629
|
+
// TODO json 数据避免传 typedArray
|
|
26630
|
+
serializedData[key] = value;
|
|
26631
|
+
} else if (isArray(value)) {
|
|
26632
|
+
if (!serializedData[key]) {
|
|
26633
|
+
serializedData[key] = [];
|
|
26634
|
+
}
|
|
26635
|
+
SerializationHelper.serializeArrayProperty(value, serializedData[key], 0);
|
|
26636
|
+
} else if (EffectsObject.is(value)) {
|
|
26637
|
+
// TODO 处理 EffectsObject 递归序列化
|
|
26638
|
+
serializedData[key] = {
|
|
26639
|
+
id: value.getInstanceId()
|
|
26640
|
+
};
|
|
26641
|
+
} else if (isObject(value)) {
|
|
26642
|
+
if (!serializedData[key]) {
|
|
26643
|
+
serializedData[key] = {};
|
|
26644
|
+
}
|
|
26645
|
+
SerializationHelper.serializeObjectProperty(value, serializedData[key], 0);
|
|
26646
|
+
}
|
|
26647
|
+
}
|
|
26648
|
+
}
|
|
26649
|
+
// TODO 待移除 tagggedProperties 为没有装饰器的临时方案
|
|
26650
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(Object.keys(effectsObject.defination)), _step1; !(_step1 = _iterator1()).done;){
|
|
26651
|
+
var key1 = _step1.value;
|
|
26652
|
+
var value1 = effectsObject.defination[key1];
|
|
26653
|
+
if (typeof value1 === "number" || typeof value1 === "string" || typeof value1 === "boolean" || SerializationHelper.checkTypedArray(value1)) {
|
|
26654
|
+
// TODO json 数据避免传 typedArray
|
|
26655
|
+
serializedData[key1] = value1;
|
|
26656
|
+
} else if (isArray(value1)) {
|
|
26657
|
+
if (!serializedData[key1]) {
|
|
26658
|
+
serializedData[key1] = [];
|
|
26659
|
+
}
|
|
26660
|
+
SerializationHelper.serializeArrayProperty(value1, serializedData[key1], 0);
|
|
26661
|
+
} else if (EffectsObject.is(value1)) {
|
|
26662
|
+
// TODO 处理 EffectsObject 递归序列化
|
|
26663
|
+
serializedData[key1] = {
|
|
26664
|
+
id: value1.getInstanceId()
|
|
26665
|
+
};
|
|
26666
|
+
} else if (isObject(value1)) {
|
|
26667
|
+
if (!serializedData[key1]) {
|
|
26668
|
+
serializedData[key1] = {};
|
|
26669
|
+
}
|
|
26670
|
+
SerializationHelper.serializeObjectProperty(value1, serializedData[key1], 0);
|
|
26671
|
+
}
|
|
26672
|
+
}
|
|
26673
|
+
return serializedData;
|
|
26674
|
+
};
|
|
26675
|
+
SerializationHelper.deserialize = function deserialize(serializedData, effectsObject) {
|
|
26676
|
+
effectsObject.defination = serializedData;
|
|
26677
|
+
var serializedProperties = getMergedStore(effectsObject);
|
|
26678
|
+
var engine = effectsObject.engine;
|
|
26679
|
+
if (serializedProperties) {
|
|
26680
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(serializedProperties)), _step; !(_step = _iterator()).done;){
|
|
26681
|
+
var key = _step.value;
|
|
26682
|
+
var value = serializedData[key];
|
|
26683
|
+
if (value === undefined) {
|
|
26684
|
+
continue;
|
|
26685
|
+
}
|
|
26686
|
+
var propertyType = serializedProperties[key].type;
|
|
26687
|
+
// FIXME: taggedProperties 为 readonly,这里存在强制赋值
|
|
26688
|
+
effectsObject[key] = SerializationHelper.deserializeProperty(value, engine, 0, propertyType);
|
|
26689
|
+
}
|
|
26690
|
+
}
|
|
26691
|
+
effectsObject.fromData(effectsObject.defination);
|
|
26692
|
+
};
|
|
26693
|
+
SerializationHelper.checkTypedArray = function checkTypedArray(obj) {
|
|
26694
|
+
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);
|
|
26695
|
+
};
|
|
26696
|
+
// check value is { id: 7e69662e964e4892ae8933f24562395b }
|
|
26697
|
+
SerializationHelper.checkDataPath = function checkDataPath(value) {
|
|
26698
|
+
return !!(isObject(value) && Object.keys(value).length === 1 && "id" in value && isString(value.id) && value.id.length === 32);
|
|
26699
|
+
};
|
|
26700
|
+
// TODO 测试函数,2.0 上线后移除
|
|
26701
|
+
SerializationHelper.checkGLTFNode = function checkGLTFNode(value) {
|
|
26702
|
+
return isObject(value) && value.nodeIndex !== undefined && value.isJoint !== undefined;
|
|
26703
|
+
};
|
|
26704
|
+
SerializationHelper.checkImageSource = function checkImageSource(value) {
|
|
26705
|
+
return isCanvas(value) || _instanceof1(value, HTMLImageElement);
|
|
26706
|
+
};
|
|
26707
|
+
SerializationHelper.deserializeProperty = function deserializeProperty(property, engine, level, type, overrideDataPath) {
|
|
26708
|
+
if (overrideDataPath === void 0) overrideDataPath = true;
|
|
26709
|
+
if (level > 14) {
|
|
26710
|
+
console.error("The nested object layers of the serialized data exceed the maximum limit.");
|
|
26711
|
+
return;
|
|
26712
|
+
}
|
|
26713
|
+
// 加载并链接 DataPath 字段表示的 EffectsObject 引用。Class 对象 copy [key, value] 会丢失对象信息,因此只递归数组对象和普通 js Object 结构对象。
|
|
26714
|
+
if (isArray(property)) {
|
|
26715
|
+
var res = [];
|
|
26716
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(property), _step; !(_step = _iterator()).done;){
|
|
26717
|
+
var value = _step.value;
|
|
26718
|
+
res.push(SerializationHelper.deserializeProperty(value, engine, level + 1, type, overrideDataPath));
|
|
26719
|
+
}
|
|
26720
|
+
return res;
|
|
26721
|
+
// TODO json 数据避免传 typedArray
|
|
26722
|
+
} else if (SerializationHelper.checkDataPath(property)) {
|
|
26723
|
+
var referenceObject = engine.findObject(property);
|
|
26724
|
+
return overrideDataPath ? referenceObject : property;
|
|
26725
|
+
} else if (isObject(property) && property.constructor === Object) {
|
|
26726
|
+
var res1;
|
|
26727
|
+
if (type) {
|
|
26728
|
+
res1 = new type();
|
|
26729
|
+
} else {
|
|
26730
|
+
res1 = {};
|
|
26731
|
+
}
|
|
26732
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(Object.keys(property)), _step1; !(_step1 = _iterator1()).done;){
|
|
26733
|
+
var key = _step1.value;
|
|
26734
|
+
res1[key] = SerializationHelper.deserializeProperty(property[key], engine, level + 1, undefined, overrideDataPath);
|
|
26735
|
+
}
|
|
26736
|
+
return res1;
|
|
26737
|
+
} else {
|
|
26738
|
+
return property;
|
|
26739
|
+
}
|
|
26740
|
+
};
|
|
26741
|
+
SerializationHelper.serializeObjectProperty = function serializeObjectProperty(objectProperty, serializedData, level) {
|
|
26742
|
+
if (level > 14) {
|
|
26743
|
+
console.error("The nested object layers of the serialized data exceed the maximum limit.");
|
|
26744
|
+
return;
|
|
26745
|
+
}
|
|
26746
|
+
if (!serializedData) {
|
|
26747
|
+
serializedData = {};
|
|
26748
|
+
}
|
|
26749
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(objectProperty)), _step; !(_step = _iterator()).done;){
|
|
26750
|
+
var key = _step.value;
|
|
26751
|
+
var value = objectProperty[key];
|
|
26752
|
+
if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(objectProperty)) {
|
|
26753
|
+
// TODO json 数据避免传 typedArray
|
|
26754
|
+
serializedData[key] = value;
|
|
26755
|
+
} else if (isArray(value)) {
|
|
26756
|
+
if (!serializedData[key]) {
|
|
26757
|
+
serializedData[key] = [];
|
|
26758
|
+
}
|
|
26759
|
+
SerializationHelper.serializeArrayProperty(value, serializedData[key], level + 1);
|
|
26760
|
+
} else if (EffectsObject.is(value)) {
|
|
26761
|
+
// TODO 处理 EffectsObject 递归序列化
|
|
26762
|
+
serializedData[key] = {
|
|
26763
|
+
id: value.getInstanceId()
|
|
26764
|
+
};
|
|
26765
|
+
} else if (isObject(value)) {
|
|
26766
|
+
if (!serializedData[key]) {
|
|
26767
|
+
serializedData[key] = {};
|
|
26768
|
+
}
|
|
26769
|
+
SerializationHelper.serializeObjectProperty(value, serializedData[key], level + 1);
|
|
26770
|
+
}
|
|
26771
|
+
}
|
|
26772
|
+
};
|
|
26773
|
+
SerializationHelper.serializeArrayProperty = function serializeArrayProperty(arrayProperty, serializedData, level) {
|
|
26774
|
+
if (level > 14) {
|
|
26775
|
+
console.error("The nested object layers of the serialized data exceed the maximum limit.");
|
|
26776
|
+
return;
|
|
26777
|
+
}
|
|
26778
|
+
if (!serializedData) {
|
|
26779
|
+
serializedData = [];
|
|
26780
|
+
}
|
|
26781
|
+
for(var i = 0; i < arrayProperty.length; i++){
|
|
26782
|
+
var value = arrayProperty[i];
|
|
26783
|
+
if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(arrayProperty)) {
|
|
26784
|
+
// TODO json 数据避免传 typedArray
|
|
26785
|
+
serializedData[i] = value;
|
|
26786
|
+
} else if (isArray(value)) {
|
|
26787
|
+
if (!serializedData[i]) {
|
|
26788
|
+
serializedData[i] = [];
|
|
26789
|
+
}
|
|
26790
|
+
SerializationHelper.serializeArrayProperty(value, serializedData[i], level + 1);
|
|
26791
|
+
} else if (EffectsObject.is(value)) {
|
|
26792
|
+
// TODO 处理 EffectsObject 递归序列化
|
|
26793
|
+
serializedData[i] = {
|
|
26794
|
+
id: value.getInstanceId()
|
|
26795
|
+
};
|
|
26796
|
+
} else if (isObject(value)) {
|
|
26797
|
+
if (!serializedData[i]) {
|
|
26798
|
+
serializedData[i] = {};
|
|
26799
|
+
}
|
|
26800
|
+
SerializationHelper.serializeObjectProperty(value, serializedData[i], level + 1);
|
|
26801
|
+
}
|
|
26802
|
+
}
|
|
26803
|
+
};
|
|
26804
|
+
return SerializationHelper;
|
|
26805
|
+
}();
|
|
26806
|
+
|
|
27049
26807
|
/**
|
|
27050
26808
|
* @since 2.0.0
|
|
27051
26809
|
*/ var AssetLoader = /*#__PURE__*/ function() {
|
|
@@ -27053,9 +26811,10 @@ exports.BinaryAsset = __decorate([
|
|
|
27053
26811
|
this.engine = engine;
|
|
27054
26812
|
}
|
|
27055
26813
|
var _proto = AssetLoader.prototype;
|
|
27056
|
-
_proto.loadGUID = function loadGUID(
|
|
27057
|
-
|
|
27058
|
-
|
|
26814
|
+
_proto.loadGUID = function loadGUID(dataPath) {
|
|
26815
|
+
var guid = dataPath.id;
|
|
26816
|
+
if (!dataPath) {
|
|
26817
|
+
return null;
|
|
27059
26818
|
}
|
|
27060
26819
|
var effectsObjectData = this.findData(guid);
|
|
27061
26820
|
var effectsObject;
|
|
@@ -27090,92 +26849,6 @@ exports.BinaryAsset = __decorate([
|
|
|
27090
26849
|
SerializationHelper.deserialize(effectsObjectData, effectsObject);
|
|
27091
26850
|
return effectsObject;
|
|
27092
26851
|
};
|
|
27093
|
-
// 加载本地文件资产
|
|
27094
|
-
_proto.loadGUIDAsync = function loadGUIDAsync(guid) {
|
|
27095
|
-
var _this = this;
|
|
27096
|
-
return _async_to_generator(function() {
|
|
27097
|
-
var effectsObjectData, effectsObject, classConstructor;
|
|
27098
|
-
return __generator(this, function(_state) {
|
|
27099
|
-
switch(_state.label){
|
|
27100
|
-
case 0:
|
|
27101
|
-
if (_this.engine.objectInstance[guid]) {
|
|
27102
|
-
return [
|
|
27103
|
-
2,
|
|
27104
|
-
_this.engine.objectInstance[guid]
|
|
27105
|
-
];
|
|
27106
|
-
}
|
|
27107
|
-
effectsObjectData = _this.findData(guid);
|
|
27108
|
-
if (!!effectsObjectData) return [
|
|
27109
|
-
3,
|
|
27110
|
-
2
|
|
27111
|
-
];
|
|
27112
|
-
if (!_this.engine.database) {
|
|
27113
|
-
console.error("Object data with uuid: " + guid + " not found.");
|
|
27114
|
-
return [
|
|
27115
|
-
2,
|
|
27116
|
-
undefined
|
|
27117
|
-
];
|
|
27118
|
-
}
|
|
27119
|
-
return [
|
|
27120
|
-
4,
|
|
27121
|
-
_this.engine.database.loadGUID(guid)
|
|
27122
|
-
];
|
|
27123
|
-
case 1:
|
|
27124
|
-
effectsObject = _state.sent();
|
|
27125
|
-
if (!effectsObject) {
|
|
27126
|
-
console.error("Disk data with uuid: " + guid + " not found.");
|
|
27127
|
-
return [
|
|
27128
|
-
2,
|
|
27129
|
-
undefined
|
|
27130
|
-
];
|
|
27131
|
-
}
|
|
27132
|
-
_this.engine.addInstance(effectsObject);
|
|
27133
|
-
return [
|
|
27134
|
-
2,
|
|
27135
|
-
effectsObject
|
|
27136
|
-
];
|
|
27137
|
-
case 2:
|
|
27138
|
-
switch(effectsObjectData.dataType){
|
|
27139
|
-
case DataType.Material:
|
|
27140
|
-
effectsObject = Material.create(_this.engine);
|
|
27141
|
-
break;
|
|
27142
|
-
case DataType.Geometry:
|
|
27143
|
-
effectsObject = Geometry.create(_this.engine);
|
|
27144
|
-
break;
|
|
27145
|
-
case DataType.Texture:
|
|
27146
|
-
effectsObject = Texture.create(_this.engine);
|
|
27147
|
-
break;
|
|
27148
|
-
default:
|
|
27149
|
-
{
|
|
27150
|
-
classConstructor = AssetLoader.getClass(effectsObjectData.dataType);
|
|
27151
|
-
if (classConstructor) {
|
|
27152
|
-
effectsObject = new classConstructor(_this.engine);
|
|
27153
|
-
}
|
|
27154
|
-
}
|
|
27155
|
-
}
|
|
27156
|
-
if (!effectsObject) {
|
|
27157
|
-
console.error("Constructor for DataType: " + effectsObjectData.dataType + " not found.");
|
|
27158
|
-
return [
|
|
27159
|
-
2,
|
|
27160
|
-
undefined
|
|
27161
|
-
];
|
|
27162
|
-
}
|
|
27163
|
-
effectsObject.setInstanceId(effectsObjectData.id);
|
|
27164
|
-
_this.engine.addInstance(effectsObject);
|
|
27165
|
-
return [
|
|
27166
|
-
4,
|
|
27167
|
-
SerializationHelper.deserializeAsync(effectsObjectData, effectsObject)
|
|
27168
|
-
];
|
|
27169
|
-
case 3:
|
|
27170
|
-
_state.sent();
|
|
27171
|
-
return [
|
|
27172
|
-
2,
|
|
27173
|
-
effectsObject
|
|
27174
|
-
];
|
|
27175
|
-
}
|
|
27176
|
-
});
|
|
27177
|
-
})();
|
|
27178
|
-
};
|
|
27179
26852
|
_proto.findData = function findData(uuid) {
|
|
27180
26853
|
return this.engine.jsonSceneData[uuid];
|
|
27181
26854
|
};
|
|
@@ -27525,35 +27198,35 @@ function rotationZYXFromQuat(out, quat) {
|
|
|
27525
27198
|
];
|
|
27526
27199
|
}
|
|
27527
27200
|
}
|
|
27528
|
-
var _obj$
|
|
27529
|
-
var particleOriginTranslateMap = (_obj$
|
|
27201
|
+
var _obj$2;
|
|
27202
|
+
var particleOriginTranslateMap = (_obj$2 = {}, _obj$2[ParticleOrigin.PARTICLE_ORIGIN_CENTER] = [
|
|
27530
27203
|
0,
|
|
27531
27204
|
0
|
|
27532
|
-
], _obj$
|
|
27205
|
+
], _obj$2[ParticleOrigin.PARTICLE_ORIGIN_CENTER_BOTTOM] = [
|
|
27533
27206
|
0,
|
|
27534
27207
|
-0.5
|
|
27535
|
-
], _obj$
|
|
27208
|
+
], _obj$2[ParticleOrigin.PARTICLE_ORIGIN_CENTER_TOP] = [
|
|
27536
27209
|
0,
|
|
27537
27210
|
0.5
|
|
27538
|
-
], _obj$
|
|
27211
|
+
], _obj$2[ParticleOrigin.PARTICLE_ORIGIN_LEFT_TOP] = [
|
|
27539
27212
|
-0.5,
|
|
27540
27213
|
0.5
|
|
27541
|
-
], _obj$
|
|
27214
|
+
], _obj$2[ParticleOrigin.PARTICLE_ORIGIN_LEFT_CENTER] = [
|
|
27542
27215
|
-0.5,
|
|
27543
27216
|
0
|
|
27544
|
-
], _obj$
|
|
27217
|
+
], _obj$2[ParticleOrigin.PARTICLE_ORIGIN_LEFT_BOTTOM] = [
|
|
27545
27218
|
-0.5,
|
|
27546
27219
|
-0.5
|
|
27547
|
-
], _obj$
|
|
27220
|
+
], _obj$2[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_CENTER] = [
|
|
27548
27221
|
0.5,
|
|
27549
27222
|
0
|
|
27550
|
-
], _obj$
|
|
27223
|
+
], _obj$2[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_BOTTOM] = [
|
|
27551
27224
|
0.5,
|
|
27552
27225
|
-0.5
|
|
27553
|
-
], _obj$
|
|
27226
|
+
], _obj$2[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_TOP] = [
|
|
27554
27227
|
0.5,
|
|
27555
27228
|
0.5
|
|
27556
|
-
], _obj$
|
|
27229
|
+
], _obj$2);
|
|
27557
27230
|
function getBezierCurveFromHermite(m0, m1, p0, p3) {
|
|
27558
27231
|
var xStart = p0[0];
|
|
27559
27232
|
var yStart = p0[1];
|
|
@@ -27792,28 +27465,6 @@ var refCompositions = new Map();
|
|
|
27792
27465
|
}
|
|
27793
27466
|
}
|
|
27794
27467
|
}
|
|
27795
|
-
// Composition id 转 guid
|
|
27796
|
-
var compositionId = json.compositionId;
|
|
27797
|
-
var compositionIdToGUIDMap = {};
|
|
27798
|
-
for(var _iterator3 = _create_for_of_iterator_helper_loose(json.compositions), _step3; !(_step3 = _iterator3()).done;){
|
|
27799
|
-
var composition = _step3.value;
|
|
27800
|
-
var guid = generateGUID();
|
|
27801
|
-
compositionIdToGUIDMap[composition.id] = guid;
|
|
27802
|
-
if (composition.id === compositionId) {
|
|
27803
|
-
json.compositionId = guid;
|
|
27804
|
-
}
|
|
27805
|
-
composition.id = guid;
|
|
27806
|
-
}
|
|
27807
|
-
// 预合成元素 refId 同步改为生成的合成 guid
|
|
27808
|
-
for(var _iterator4 = _create_for_of_iterator_helper_loose(json.items), _step4; !(_step4 = _iterator4()).done;){
|
|
27809
|
-
var item = _step4.value;
|
|
27810
|
-
if (item.content) {
|
|
27811
|
-
var compositionOptions = item.content.options;
|
|
27812
|
-
if (compositionOptions && compositionOptions.refId !== undefined) {
|
|
27813
|
-
compositionOptions.refId = compositionIdToGUIDMap[compositionOptions.refId];
|
|
27814
|
-
}
|
|
27815
|
-
}
|
|
27816
|
-
}
|
|
27817
27468
|
return json;
|
|
27818
27469
|
}
|
|
27819
27470
|
function version32Migration(json) {
|
|
@@ -27840,21 +27491,68 @@ function version32Migration(json) {
|
|
|
27840
27491
|
itemMap.set(item.id, item);
|
|
27841
27492
|
}
|
|
27842
27493
|
processContent(mainComp);
|
|
27494
|
+
return json;
|
|
27495
|
+
}
|
|
27496
|
+
function version33Migration(json) {
|
|
27843
27497
|
// 老 shape 数据兼容
|
|
27844
|
-
for(var
|
|
27845
|
-
var
|
|
27846
|
-
if (
|
|
27847
|
-
var spriteComponent = componentMap.get(
|
|
27498
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(json.items), _step; !(_step = _iterator()).done;){
|
|
27499
|
+
var item = _step.value;
|
|
27500
|
+
if (item.type === ItemType.sprite) {
|
|
27501
|
+
var spriteComponent = componentMap.get(item.components[0].id);
|
|
27848
27502
|
if (spriteComponent) {
|
|
27849
27503
|
var shape = spriteComponent.renderer.shape;
|
|
27850
27504
|
var shapeData = void 0;
|
|
27851
27505
|
if (Number.isInteger(shape)) {
|
|
27852
27506
|
shapeData = json.shapes[shape];
|
|
27507
|
+
} else {
|
|
27508
|
+
shapeData = shape;
|
|
27853
27509
|
}
|
|
27854
27510
|
spriteComponent.renderer.shape = shapeData;
|
|
27855
27511
|
}
|
|
27856
27512
|
}
|
|
27857
27513
|
}
|
|
27514
|
+
// Composition id 转 guid, Composition 分离 CompositionComponent
|
|
27515
|
+
var compositionId = json.compositionId;
|
|
27516
|
+
var compositionIdToGUIDMap = {};
|
|
27517
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(json.compositions), _step1; !(_step1 = _iterator1()).done;){
|
|
27518
|
+
var composition = _step1.value;
|
|
27519
|
+
var guid = generateGUID();
|
|
27520
|
+
compositionIdToGUIDMap[composition.id] = guid;
|
|
27521
|
+
if (composition.id === compositionId) {
|
|
27522
|
+
json.compositionId = guid;
|
|
27523
|
+
}
|
|
27524
|
+
composition.id = guid;
|
|
27525
|
+
var compositionComponent = {
|
|
27526
|
+
id: generateGUID(),
|
|
27527
|
+
dataType: "CompositionComponent",
|
|
27528
|
+
items: composition.items,
|
|
27529
|
+
timelineAsset: composition.timelineAsset,
|
|
27530
|
+
sceneBindings: composition.sceneBindings,
|
|
27531
|
+
startTime: composition.startTime
|
|
27532
|
+
};
|
|
27533
|
+
//@ts-expect-error
|
|
27534
|
+
composition.timelineAsset = undefined;
|
|
27535
|
+
//@ts-expect-error
|
|
27536
|
+
composition.sceneBindings = undefined;
|
|
27537
|
+
composition.startTime = undefined;
|
|
27538
|
+
//@ts-expect-error
|
|
27539
|
+
composition.components = [
|
|
27540
|
+
{
|
|
27541
|
+
id: compositionComponent.id
|
|
27542
|
+
}
|
|
27543
|
+
];
|
|
27544
|
+
json.components.push(compositionComponent);
|
|
27545
|
+
}
|
|
27546
|
+
// 预合成元素 refId 同步改为生成的合成 guid
|
|
27547
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(json.items), _step2; !(_step2 = _iterator2()).done;){
|
|
27548
|
+
var item1 = _step2.value;
|
|
27549
|
+
if (item1.content) {
|
|
27550
|
+
var compositionOptions = item1.content.options;
|
|
27551
|
+
if (compositionOptions && compositionOptions.refId !== undefined) {
|
|
27552
|
+
compositionOptions.refId = compositionIdToGUIDMap[compositionOptions.refId];
|
|
27553
|
+
}
|
|
27554
|
+
}
|
|
27555
|
+
}
|
|
27858
27556
|
return json;
|
|
27859
27557
|
}
|
|
27860
27558
|
function processContent(composition) {
|
|
@@ -28728,7 +28426,7 @@ function getStandardJSON(json) {
|
|
|
28728
28426
|
if (v0.test(json.version)) {
|
|
28729
28427
|
var _exec;
|
|
28730
28428
|
reverseParticle = ((_exec = /^(\d+)/.exec(json.version)) == null ? void 0 : _exec[0]) === "0";
|
|
28731
|
-
return version32Migration(version31Migration(version30Migration(version21Migration(getStandardJSONFromV0(json)))));
|
|
28429
|
+
return version33Migration(version32Migration(version31Migration(version30Migration(version21Migration(getStandardJSONFromV0(json))))));
|
|
28732
28430
|
}
|
|
28733
28431
|
reverseParticle = false;
|
|
28734
28432
|
var vs = standardVersion.exec(json.version) || [];
|
|
@@ -28753,6 +28451,9 @@ function getStandardJSON(json) {
|
|
|
28753
28451
|
if (minorVersion < 3) {
|
|
28754
28452
|
json = version32Migration(json);
|
|
28755
28453
|
}
|
|
28454
|
+
if (minorVersion < 4) {
|
|
28455
|
+
json = version33Migration(json);
|
|
28456
|
+
}
|
|
28756
28457
|
}
|
|
28757
28458
|
return json;
|
|
28758
28459
|
}
|
|
@@ -29036,6 +28737,40 @@ function getStandardItem(item, opt) {
|
|
|
29036
28737
|
}
|
|
29037
28738
|
}
|
|
29038
28739
|
|
|
28740
|
+
var _obj$1;
|
|
28741
|
+
/**
|
|
28742
|
+
* 机型和渲染等级对应表
|
|
28743
|
+
*
|
|
28744
|
+
* 机型:B-低端机、A-中端机、S-高端机
|
|
28745
|
+
* 渲染等级:B-低、A-中、S-高、A+-中高、B+-全部
|
|
28746
|
+
*
|
|
28747
|
+
* - S(高端机):高、全部、中高
|
|
28748
|
+
* - A(中端机):中、全部、中高
|
|
28749
|
+
* - B(低端机):低、全部
|
|
28750
|
+
* - undefined(全部机型)
|
|
28751
|
+
*/ var renderLevelPassSet = (_obj$1 = {}, _obj$1[RenderLevel.S] = [
|
|
28752
|
+
RenderLevel.S,
|
|
28753
|
+
RenderLevel.BPlus,
|
|
28754
|
+
RenderLevel.APlus
|
|
28755
|
+
], _obj$1[RenderLevel.A] = [
|
|
28756
|
+
RenderLevel.A,
|
|
28757
|
+
RenderLevel.BPlus,
|
|
28758
|
+
RenderLevel.APlus
|
|
28759
|
+
], _obj$1[RenderLevel.B] = [
|
|
28760
|
+
RenderLevel.B,
|
|
28761
|
+
RenderLevel.BPlus
|
|
28762
|
+
], _obj$1);
|
|
28763
|
+
function passRenderLevel(l, renderLevel) {
|
|
28764
|
+
if (!l || !renderLevel) {
|
|
28765
|
+
return true;
|
|
28766
|
+
}
|
|
28767
|
+
var arr = renderLevelPassSet[renderLevel];
|
|
28768
|
+
if (arr) {
|
|
28769
|
+
return arr.includes(l);
|
|
28770
|
+
}
|
|
28771
|
+
return false;
|
|
28772
|
+
}
|
|
28773
|
+
|
|
29039
28774
|
exports.Scene = void 0;
|
|
29040
28775
|
(function(Scene) {
|
|
29041
28776
|
function isJSONObject(scene) {
|
|
@@ -29935,7 +29670,9 @@ function createTextureOptionsBySource(image, sourceFrom, id) {
|
|
|
29935
29670
|
if (_instanceof1(textureOptions, Texture)) {
|
|
29936
29671
|
this.engine.addInstance(textureOptions);
|
|
29937
29672
|
} else {
|
|
29938
|
-
textureOptions = this.engine.
|
|
29673
|
+
textureOptions = this.engine.findObject({
|
|
29674
|
+
id: scene.textureOptions[i].id
|
|
29675
|
+
});
|
|
29939
29676
|
scene.textureOptions[i] = textureOptions;
|
|
29940
29677
|
}
|
|
29941
29678
|
textureOptions.initialize();
|
|
@@ -31582,8 +31319,18 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
|
31582
31319
|
_proto.addInstance = function addInstance(effectsObject) {
|
|
31583
31320
|
this.objectInstance[effectsObject.getInstanceId()] = effectsObject;
|
|
31584
31321
|
};
|
|
31585
|
-
|
|
31586
|
-
|
|
31322
|
+
/**
|
|
31323
|
+
* @ignore
|
|
31324
|
+
*/ _proto.findObject = function findObject(guid) {
|
|
31325
|
+
// 编辑器可能传 Class 对象,这边判断处理一下直接返回原对象。
|
|
31326
|
+
if (!(isObject(guid) && guid.constructor === Object)) {
|
|
31327
|
+
return guid;
|
|
31328
|
+
}
|
|
31329
|
+
if (this.objectInstance[guid.id]) {
|
|
31330
|
+
return this.objectInstance[guid.id];
|
|
31331
|
+
}
|
|
31332
|
+
var result = this.assetLoader.loadGUID(guid);
|
|
31333
|
+
return result;
|
|
31587
31334
|
};
|
|
31588
31335
|
_proto.removeInstance = function removeInstance(id) {
|
|
31589
31336
|
delete this.objectInstance[id];
|
|
@@ -31597,6 +31344,10 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
|
31597
31344
|
}
|
|
31598
31345
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(items), _step1; !(_step1 = _iterator1()).done;){
|
|
31599
31346
|
var vfxItemData = _step1.value;
|
|
31347
|
+
if (!passRenderLevel(vfxItemData.renderLevel, scene.renderLevel)) {
|
|
31348
|
+
vfxItemData.components = [];
|
|
31349
|
+
vfxItemData.type = ItemType.null;
|
|
31350
|
+
}
|
|
31600
31351
|
this.addEffectsObjectData(vfxItemData);
|
|
31601
31352
|
}
|
|
31602
31353
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(materials), _step2; !(_step2 = _iterator2()).done;){
|
|
@@ -31651,45 +31402,20 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
|
31651
31402
|
return _async_to_generator(function() {
|
|
31652
31403
|
var jsonScene, _iterator, _step, itemData, itemType;
|
|
31653
31404
|
return __generator(this, function(_state) {
|
|
31654
|
-
|
|
31655
|
-
|
|
31656
|
-
|
|
31657
|
-
|
|
31658
|
-
|
|
31659
|
-
|
|
31660
|
-
|
|
31661
|
-
|
|
31662
|
-
|
|
31663
|
-
|
|
31664
|
-
itemData = _step.value;
|
|
31665
|
-
itemType = itemData.type;
|
|
31666
|
-
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)) {
|
|
31667
|
-
return [
|
|
31668
|
-
3,
|
|
31669
|
-
3
|
|
31670
|
-
];
|
|
31671
|
-
}
|
|
31672
|
-
if (!_this.database) return [
|
|
31673
|
-
3,
|
|
31674
|
-
3
|
|
31675
|
-
];
|
|
31676
|
-
return [
|
|
31677
|
-
4,
|
|
31678
|
-
_this.assetLoader.loadGUIDAsync(itemData.id)
|
|
31679
|
-
];
|
|
31680
|
-
case 2:
|
|
31681
|
-
_state.sent();
|
|
31682
|
-
_state.label = 3;
|
|
31683
|
-
case 3:
|
|
31684
|
-
return [
|
|
31685
|
-
3,
|
|
31686
|
-
1
|
|
31687
|
-
];
|
|
31688
|
-
case 4:
|
|
31689
|
-
return [
|
|
31690
|
-
2
|
|
31691
|
-
];
|
|
31405
|
+
jsonScene = scene.jsonScene;
|
|
31406
|
+
for(_iterator = _create_for_of_iterator_helper_loose(jsonScene.items); !(_step = _iterator()).done;){
|
|
31407
|
+
itemData = _step.value;
|
|
31408
|
+
itemType = itemData.type;
|
|
31409
|
+
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)) {
|
|
31410
|
+
continue;
|
|
31411
|
+
}
|
|
31412
|
+
if (_this.database) {
|
|
31413
|
+
_this.assetLoader.loadGUID(itemData);
|
|
31414
|
+
}
|
|
31692
31415
|
}
|
|
31416
|
+
return [
|
|
31417
|
+
2
|
|
31418
|
+
];
|
|
31693
31419
|
});
|
|
31694
31420
|
})();
|
|
31695
31421
|
};
|
|
@@ -31937,7 +31663,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem);
|
|
|
31937
31663
|
registerPlugin("particle", ParticleLoader, exports.VFXItem);
|
|
31938
31664
|
registerPlugin("cal", CalculateLoader, exports.VFXItem);
|
|
31939
31665
|
registerPlugin("interact", InteractLoader, exports.VFXItem);
|
|
31940
|
-
var version$1 = "2.4.0-beta.
|
|
31666
|
+
var version$1 = "2.4.0-beta.2";
|
|
31941
31667
|
logger.info("Core version: " + version$1 + ".");
|
|
31942
31668
|
|
|
31943
31669
|
var _obj;
|
|
@@ -32530,6 +32256,17 @@ var _obj3;
|
|
|
32530
32256
|
this.material.side = THREE__namespace.BackSide;
|
|
32531
32257
|
}
|
|
32532
32258
|
}
|
|
32259
|
+
},
|
|
32260
|
+
{
|
|
32261
|
+
key: "colorMask",
|
|
32262
|
+
get: function get() {
|
|
32263
|
+
return this.material.colorWrite;
|
|
32264
|
+
},
|
|
32265
|
+
set: /**
|
|
32266
|
+
* 获取颜色写入开关
|
|
32267
|
+
*/ function set(value) {
|
|
32268
|
+
this.material.colorWrite = value;
|
|
32269
|
+
}
|
|
32533
32270
|
}
|
|
32534
32271
|
]);
|
|
32535
32272
|
return ThreeMaterial;
|
|
@@ -33101,7 +32838,7 @@ var seed = 1;
|
|
|
33101
32838
|
// 预合成元素
|
|
33102
32839
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(this.refContent), _step2; !(_step2 = _iterator2()).done;){
|
|
33103
32840
|
var refContent = _step2.value;
|
|
33104
|
-
for(var _iterator3 = _create_for_of_iterator_helper_loose(refContent.getComponent(CompositionComponent).items), _step3; !(_step3 = _iterator3()).done;){
|
|
32841
|
+
for(var _iterator3 = _create_for_of_iterator_helper_loose(refContent.getComponent(exports.CompositionComponent).items), _step3; !(_step3 = _iterator3()).done;){
|
|
33105
32842
|
var vfxItem1 = _step3.value;
|
|
33106
32843
|
var rendererComponents1 = vfxItem1.getComponents(RendererComponent);
|
|
33107
32844
|
for(var _iterator4 = _create_for_of_iterator_helper_loose(rendererComponents1), _step4; !(_step4 = _iterator4()).done;){
|
|
@@ -33528,7 +33265,7 @@ setMaxSpriteMeshItemCount(8);
|
|
|
33528
33265
|
*/ Mesh.create = function(engine, props) {
|
|
33529
33266
|
return new ThreeMesh(engine, props);
|
|
33530
33267
|
};
|
|
33531
|
-
var version = "2.4.0-beta.
|
|
33268
|
+
var version = "2.4.0-beta.2";
|
|
33532
33269
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
33533
33270
|
|
|
33534
33271
|
exports.AbstractPlugin = AbstractPlugin;
|
|
@@ -33557,7 +33294,6 @@ exports.CameraVFXItemLoader = CameraVFXItemLoader;
|
|
|
33557
33294
|
exports.ColorCurve = ColorCurve;
|
|
33558
33295
|
exports.Component = Component;
|
|
33559
33296
|
exports.Composition = Composition;
|
|
33560
|
-
exports.CompositionComponent = CompositionComponent;
|
|
33561
33297
|
exports.DEFAULT_FONTS = DEFAULT_FONTS;
|
|
33562
33298
|
exports.DEFAULT_FPS = DEFAULT_FPS;
|
|
33563
33299
|
exports.Database = Database;
|
|
@@ -33687,7 +33423,6 @@ exports.effectsClassStore = effectsClassStore;
|
|
|
33687
33423
|
exports.enlargeBuffer = enlargeBuffer;
|
|
33688
33424
|
exports.ensureFixedNumber = ensureFixedNumber;
|
|
33689
33425
|
exports.ensureVec3 = ensureVec3;
|
|
33690
|
-
exports.filterItemsByRenderLevel = filterItemsByRenderLevel;
|
|
33691
33426
|
exports.findPreviousRenderPass = findPreviousRenderPass;
|
|
33692
33427
|
exports.gaussianDownFrag = gaussianDown_frag;
|
|
33693
33428
|
exports.gaussianDownHFrag = gaussianDownHFrag;
|