@galacean/effects-core 2.0.0-alpha.1 → 2.0.0-alpha.3

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 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.0.0-alpha.1
6
+ * Version: v2.0.0-alpha.3
7
7
  */
8
8
 
9
9
  'use strict';
@@ -7342,275 +7342,6 @@ function generateSerializableMember(type, sourceName) {
7342
7342
  };
7343
7343
  }
7344
7344
 
7345
- /**
7346
- * @since 2.0.0
7347
- * @internal
7348
- */
7349
- var EffectsObject = /** @class */ (function () {
7350
- function EffectsObject(engine) {
7351
- this.engine = engine;
7352
- this.guid = generateGUID();
7353
- this.taggedProperties = {};
7354
- this.engine.addInstance(this);
7355
- }
7356
- EffectsObject.prototype.getInstanceId = function () {
7357
- return this.guid;
7358
- };
7359
- EffectsObject.prototype.setInstanceId = function (guid) {
7360
- this.engine.removeInstance(this.guid);
7361
- this.guid = guid;
7362
- this.engine.addInstance(this);
7363
- };
7364
- EffectsObject.prototype.toData = function () { };
7365
- /**
7366
- * 反序列化函数
7367
- *
7368
- * @param data - 对象的序列化的数据
7369
- */
7370
- EffectsObject.prototype.fromData = function (data) {
7371
- if (data.id) {
7372
- this.setInstanceId(data.id);
7373
- }
7374
- };
7375
- EffectsObject.prototype.dispose = function () { };
7376
- __decorate([
7377
- serialize()
7378
- ], EffectsObject.prototype, "guid", void 0);
7379
- return EffectsObject;
7380
- }());
7381
-
7382
- /**
7383
- * @since 2.0.0
7384
- * @internal
7385
- */
7386
- var Component = /** @class */ (function (_super) {
7387
- __extends(Component, _super);
7388
- function Component() {
7389
- return _super !== null && _super.apply(this, arguments) || this;
7390
- }
7391
- Object.defineProperty(Component.prototype, "transform", {
7392
- /**
7393
- * 附加到的 VFXItem 对象 Transform 组件
7394
- */
7395
- get: function () {
7396
- return this.item.transform;
7397
- },
7398
- enumerable: false,
7399
- configurable: true
7400
- });
7401
- Component.prototype.onAttached = function () { };
7402
- Component.prototype.onDestroy = function () { };
7403
- Component.prototype.fromData = function (data) {
7404
- _super.prototype.fromData.call(this, data);
7405
- if (data.item) {
7406
- this.item = data.item;
7407
- }
7408
- };
7409
- Component.prototype.dispose = function () {
7410
- this.onDestroy();
7411
- if (this.item) {
7412
- removeItem(this.item.components, this);
7413
- }
7414
- };
7415
- return Component;
7416
- }(EffectsObject));
7417
- /**
7418
- * @since 2.0.0
7419
- * @internal
7420
- */
7421
- var Behaviour = /** @class */ (function (_super) {
7422
- __extends(Behaviour, _super);
7423
- function Behaviour() {
7424
- var _this = _super !== null && _super.apply(this, arguments) || this;
7425
- _this._enabled = true;
7426
- return _this;
7427
- }
7428
- Object.defineProperty(Behaviour.prototype, "isActiveAndEnabled", {
7429
- /**
7430
- * 组件是否可以更新,true 更新,false 不更新
7431
- */
7432
- get: function () {
7433
- return this.item.getVisible() && this.enabled;
7434
- },
7435
- enumerable: false,
7436
- configurable: true
7437
- });
7438
- Object.defineProperty(Behaviour.prototype, "enabled", {
7439
- get: function () {
7440
- return this._enabled;
7441
- },
7442
- set: function (value) {
7443
- this._enabled = value;
7444
- if (value) {
7445
- this.onBehaviourEnable();
7446
- }
7447
- },
7448
- enumerable: false,
7449
- configurable: true
7450
- });
7451
- Behaviour.prototype.onBehaviourEnable = function () { };
7452
- Behaviour.prototype.fromData = function (data) {
7453
- _super.prototype.fromData.call(this, data);
7454
- };
7455
- Behaviour.prototype.toData = function () {
7456
- _super.prototype.toData.call(this);
7457
- };
7458
- __decorate([
7459
- serialize()
7460
- ], Behaviour.prototype, "_enabled", void 0);
7461
- return Behaviour;
7462
- }(Component));
7463
- /**
7464
- * @since 2.0.0
7465
- * @internal
7466
- */
7467
- var ItemBehaviour = /** @class */ (function (_super) {
7468
- __extends(ItemBehaviour, _super);
7469
- function ItemBehaviour() {
7470
- var _this = _super !== null && _super.apply(this, arguments) || this;
7471
- _this.started = false;
7472
- return _this;
7473
- }
7474
- // /**
7475
- // * 生命周期函数,初始化后调用,生命周期内只调用一次
7476
- // */
7477
- // awake () {
7478
- // // OVERRIDE
7479
- // }
7480
- /**
7481
- * 在每次设置 enabled 为 true 时触发
7482
- */
7483
- ItemBehaviour.prototype.onEnable = function () { };
7484
- /**
7485
- * 生命周期函数,在第一次 update 前调用,生命周期内只调用一次
7486
- */
7487
- ItemBehaviour.prototype.start = function () {
7488
- // OVERRIDE
7489
- };
7490
- /**
7491
- * 生命周期函数,每帧调用一次
7492
- */
7493
- ItemBehaviour.prototype.update = function (dt) {
7494
- // OVERRIDE
7495
- };
7496
- /**
7497
- * 生命周期函数,每帧调用一次,在 update 之后调用
7498
- */
7499
- ItemBehaviour.prototype.lateUpdate = function (dt) {
7500
- // OVERRIDE
7501
- };
7502
- ItemBehaviour.prototype.onAttached = function () {
7503
- this.item.itemBehaviours.push(this);
7504
- };
7505
- ItemBehaviour.prototype.dispose = function () {
7506
- if (this.item) {
7507
- removeItem(this.item.itemBehaviours, this);
7508
- }
7509
- _super.prototype.dispose.call(this);
7510
- };
7511
- ItemBehaviour.prototype.onBehaviourEnable = function () {
7512
- this.onEnable();
7513
- if (!this.started) {
7514
- this.start();
7515
- this.started = true;
7516
- }
7517
- };
7518
- return ItemBehaviour;
7519
- }(Behaviour));
7520
-
7521
- /**
7522
- * 所有渲染组件的基类
7523
- * @since 2.0.0
7524
- */
7525
- var RendererComponent = /** @class */ (function (_super) {
7526
- __extends(RendererComponent, _super);
7527
- function RendererComponent() {
7528
- var _this = _super !== null && _super.apply(this, arguments) || this;
7529
- _this.started = false;
7530
- _this.materials = [];
7531
- _this._enabled = true;
7532
- return _this;
7533
- }
7534
- Object.defineProperty(RendererComponent.prototype, "priority", {
7535
- get: function () {
7536
- return this._priority;
7537
- },
7538
- set: function (value) {
7539
- this._priority = value;
7540
- },
7541
- enumerable: false,
7542
- configurable: true
7543
- });
7544
- Object.defineProperty(RendererComponent.prototype, "enabled", {
7545
- get: function () {
7546
- return this._enabled;
7547
- },
7548
- set: function (value) {
7549
- this._enabled = value;
7550
- if (value) {
7551
- this.onEnable();
7552
- }
7553
- },
7554
- enumerable: false,
7555
- configurable: true
7556
- });
7557
- Object.defineProperty(RendererComponent.prototype, "isActiveAndEnabled", {
7558
- /**
7559
- * 组件是否可以更新,true 更新,false 不更新
7560
- */
7561
- get: function () {
7562
- return this.item.getVisible() && this.enabled;
7563
- },
7564
- enumerable: false,
7565
- configurable: true
7566
- });
7567
- Object.defineProperty(RendererComponent.prototype, "material", {
7568
- get: function () {
7569
- return this.materials[0];
7570
- },
7571
- set: function (material) {
7572
- if (this.materials.length === 0) {
7573
- this.materials.push(material);
7574
- }
7575
- else {
7576
- this.materials[0] = material;
7577
- }
7578
- },
7579
- enumerable: false,
7580
- configurable: true
7581
- });
7582
- RendererComponent.prototype.onEnable = function () { };
7583
- RendererComponent.prototype.start = function () { };
7584
- RendererComponent.prototype.update = function (dt) { };
7585
- RendererComponent.prototype.lateUpdate = function (dt) { };
7586
- RendererComponent.prototype.render = function (renderer) { };
7587
- RendererComponent.prototype.onAttached = function () {
7588
- this.item.rendererComponents.push(this);
7589
- };
7590
- RendererComponent.prototype.fromData = function (data) {
7591
- _super.prototype.fromData.call(this, data);
7592
- };
7593
- RendererComponent.prototype.toData = function () {
7594
- _super.prototype.toData.call(this);
7595
- };
7596
- RendererComponent.prototype.dispose = function () {
7597
- if (this.item) {
7598
- removeItem(this.item.rendererComponents, this);
7599
- }
7600
- _super.prototype.dispose.call(this);
7601
- };
7602
- __decorate([
7603
- serialize()
7604
- ], RendererComponent.prototype, "materials", void 0);
7605
- __decorate([
7606
- serialize()
7607
- ], RendererComponent.prototype, "_priority", void 0);
7608
- __decorate([
7609
- serialize()
7610
- ], RendererComponent.prototype, "_enabled", void 0);
7611
- return RendererComponent;
7612
- }(Component));
7613
-
7614
7345
  exports.ShaderType = void 0;
7615
7346
  (function (ShaderType) {
7616
7347
  ShaderType[ShaderType["vertex"] = 0] = "vertex";
@@ -8197,6 +7928,43 @@ function loadMipmapImage(pointer, bins) {
8197
7928
  });
8198
7929
  }
8199
7930
 
7931
+ /**
7932
+ * @since 2.0.0
7933
+ * @internal
7934
+ */
7935
+ var EffectsObject = /** @class */ (function () {
7936
+ function EffectsObject(engine) {
7937
+ this.engine = engine;
7938
+ this.guid = generateGUID();
7939
+ this.taggedProperties = {};
7940
+ this.engine.addInstance(this);
7941
+ }
7942
+ EffectsObject.prototype.getInstanceId = function () {
7943
+ return this.guid;
7944
+ };
7945
+ EffectsObject.prototype.setInstanceId = function (guid) {
7946
+ this.engine.removeInstance(this.guid);
7947
+ this.guid = guid;
7948
+ this.engine.addInstance(this);
7949
+ };
7950
+ EffectsObject.prototype.toData = function () { };
7951
+ /**
7952
+ * 反序列化函数
7953
+ *
7954
+ * @param data - 对象的序列化的数据
7955
+ */
7956
+ EffectsObject.prototype.fromData = function (data) {
7957
+ if (data.id) {
7958
+ this.setInstanceId(data.id);
7959
+ }
7960
+ };
7961
+ EffectsObject.prototype.dispose = function () { };
7962
+ __decorate([
7963
+ serialize()
7964
+ ], EffectsObject.prototype, "guid", void 0);
7965
+ return EffectsObject;
7966
+ }());
7967
+
8200
7968
  var seed$9 = 1;
8201
7969
  /**
8202
7970
  * Texture 抽象类
@@ -9007,54 +8775,286 @@ var SemanticMap = /** @class */ (function () {
9007
8775
  SemanticMap.prototype.hasSemanticValue = function (name) {
9008
8776
  return name in this.semantics;
9009
8777
  };
9010
- SemanticMap.prototype.dispose = function () {
9011
- var _this = this;
9012
- Object.keys(this.semantics).forEach(function (name) {
9013
- delete _this.semantics[name];
9014
- });
8778
+ SemanticMap.prototype.dispose = function () {
8779
+ var _this = this;
8780
+ Object.keys(this.semantics).forEach(function (name) {
8781
+ delete _this.semantics[name];
8782
+ });
8783
+ };
8784
+ return SemanticMap;
8785
+ }());
8786
+
8787
+ var _a$4;
8788
+ var BYTES_TYPE_MAP = (_a$4 = {},
8789
+ _a$4[glContext.FLOAT] = Float32Array.BYTES_PER_ELEMENT,
8790
+ _a$4[glContext.INT] = Int32Array.BYTES_PER_ELEMENT,
8791
+ _a$4[glContext.SHORT] = Int16Array.BYTES_PER_ELEMENT,
8792
+ _a$4[glContext.BYTE] = Int8Array.BYTES_PER_ELEMENT,
8793
+ _a$4);
8794
+ /**
8795
+ * Geometry 抽象类
8796
+ */
8797
+ var Geometry = /** @class */ (function (_super) {
8798
+ __extends(Geometry, _super);
8799
+ function Geometry() {
8800
+ return _super !== null && _super.apply(this, arguments) || this;
8801
+ }
8802
+ /**
8803
+ * 初始化 GPU 资源
8804
+ * @override
8805
+ */
8806
+ Geometry.prototype.initialize = function () {
8807
+ // OVERRIDE
8808
+ };
8809
+ /**
8810
+ * 几何数据刷新
8811
+ */
8812
+ Geometry.prototype.flush = function () {
8813
+ // OVERRIDE
8814
+ };
8815
+ return Geometry;
8816
+ }(EffectsObject));
8817
+ function generateEmptyTypedArray(type) {
8818
+ if (type === glContext.INT) {
8819
+ return new Int32Array(0);
8820
+ }
8821
+ if (type === glContext.SHORT) {
8822
+ return new Int16Array(0);
8823
+ }
8824
+ return new Float32Array(0);
8825
+ }
8826
+
8827
+ /**
8828
+ * @since 2.0.0
8829
+ * @internal
8830
+ */
8831
+ var Component = /** @class */ (function (_super) {
8832
+ __extends(Component, _super);
8833
+ function Component() {
8834
+ return _super !== null && _super.apply(this, arguments) || this;
8835
+ }
8836
+ Object.defineProperty(Component.prototype, "transform", {
8837
+ /**
8838
+ * 附加到的 VFXItem 对象 Transform 组件
8839
+ */
8840
+ get: function () {
8841
+ return this.item.transform;
8842
+ },
8843
+ enumerable: false,
8844
+ configurable: true
8845
+ });
8846
+ Component.prototype.onAttached = function () { };
8847
+ Component.prototype.onDestroy = function () { };
8848
+ Component.prototype.fromData = function (data) {
8849
+ _super.prototype.fromData.call(this, data);
8850
+ if (data.item) {
8851
+ this.item = data.item;
8852
+ }
8853
+ };
8854
+ Component.prototype.dispose = function () {
8855
+ this.onDestroy();
8856
+ if (this.item) {
8857
+ removeItem(this.item.components, this);
8858
+ }
8859
+ };
8860
+ return Component;
8861
+ }(EffectsObject));
8862
+ /**
8863
+ * @since 2.0.0
8864
+ * @internal
8865
+ */
8866
+ var Behaviour = /** @class */ (function (_super) {
8867
+ __extends(Behaviour, _super);
8868
+ function Behaviour() {
8869
+ var _this = _super !== null && _super.apply(this, arguments) || this;
8870
+ _this._enabled = true;
8871
+ return _this;
8872
+ }
8873
+ Object.defineProperty(Behaviour.prototype, "isActiveAndEnabled", {
8874
+ /**
8875
+ * 组件是否可以更新,true 更新,false 不更新
8876
+ */
8877
+ get: function () {
8878
+ return this.item.getVisible() && this.enabled;
8879
+ },
8880
+ enumerable: false,
8881
+ configurable: true
8882
+ });
8883
+ Object.defineProperty(Behaviour.prototype, "enabled", {
8884
+ get: function () {
8885
+ return this._enabled;
8886
+ },
8887
+ set: function (value) {
8888
+ this._enabled = value;
8889
+ if (value) {
8890
+ this.onBehaviourEnable();
8891
+ }
8892
+ },
8893
+ enumerable: false,
8894
+ configurable: true
8895
+ });
8896
+ Behaviour.prototype.onBehaviourEnable = function () { };
8897
+ Behaviour.prototype.fromData = function (data) {
8898
+ _super.prototype.fromData.call(this, data);
8899
+ };
8900
+ Behaviour.prototype.toData = function () {
8901
+ _super.prototype.toData.call(this);
9015
8902
  };
9016
- return SemanticMap;
9017
- }());
9018
-
9019
- var _a$4;
9020
- var BYTES_TYPE_MAP = (_a$4 = {},
9021
- _a$4[glContext.FLOAT] = Float32Array.BYTES_PER_ELEMENT,
9022
- _a$4[glContext.INT] = Int32Array.BYTES_PER_ELEMENT,
9023
- _a$4[glContext.SHORT] = Int16Array.BYTES_PER_ELEMENT,
9024
- _a$4[glContext.BYTE] = Int8Array.BYTES_PER_ELEMENT,
9025
- _a$4);
8903
+ __decorate([
8904
+ serialize()
8905
+ ], Behaviour.prototype, "_enabled", void 0);
8906
+ return Behaviour;
8907
+ }(Component));
9026
8908
  /**
9027
- * Geometry 抽象类
8909
+ * @since 2.0.0
8910
+ * @internal
9028
8911
  */
9029
- var Geometry = /** @class */ (function (_super) {
9030
- __extends(Geometry, _super);
9031
- function Geometry() {
9032
- return _super !== null && _super.apply(this, arguments) || this;
8912
+ var ItemBehaviour = /** @class */ (function (_super) {
8913
+ __extends(ItemBehaviour, _super);
8914
+ function ItemBehaviour() {
8915
+ var _this = _super !== null && _super.apply(this, arguments) || this;
8916
+ _this.started = false;
8917
+ return _this;
9033
8918
  }
8919
+ // /**
8920
+ // * 生命周期函数,初始化后调用,生命周期内只调用一次
8921
+ // */
8922
+ // awake () {
8923
+ // // OVERRIDE
8924
+ // }
9034
8925
  /**
9035
- * 初始化 GPU 资源
9036
- * @override
8926
+ * 在每次设置 enabled 为 true 时触发
9037
8927
  */
9038
- Geometry.prototype.initialize = function () {
8928
+ ItemBehaviour.prototype.onEnable = function () { };
8929
+ /**
8930
+ * 生命周期函数,在第一次 update 前调用,生命周期内只调用一次
8931
+ */
8932
+ ItemBehaviour.prototype.start = function () {
9039
8933
  // OVERRIDE
9040
8934
  };
9041
8935
  /**
9042
- * 几何数据刷新
8936
+ * 生命周期函数,每帧调用一次
9043
8937
  */
9044
- Geometry.prototype.flush = function () {
8938
+ ItemBehaviour.prototype.update = function (dt) {
9045
8939
  // OVERRIDE
9046
8940
  };
9047
- return Geometry;
9048
- }(EffectsObject));
9049
- function generateEmptyTypedArray(type) {
9050
- if (type === glContext.INT) {
9051
- return new Int32Array(0);
9052
- }
9053
- if (type === glContext.SHORT) {
9054
- return new Int16Array(0);
8941
+ /**
8942
+ * 生命周期函数,每帧调用一次,在 update 之后调用
8943
+ */
8944
+ ItemBehaviour.prototype.lateUpdate = function (dt) {
8945
+ // OVERRIDE
8946
+ };
8947
+ ItemBehaviour.prototype.onAttached = function () {
8948
+ this.item.itemBehaviours.push(this);
8949
+ };
8950
+ ItemBehaviour.prototype.dispose = function () {
8951
+ if (this.item) {
8952
+ removeItem(this.item.itemBehaviours, this);
8953
+ }
8954
+ _super.prototype.dispose.call(this);
8955
+ };
8956
+ ItemBehaviour.prototype.onBehaviourEnable = function () {
8957
+ this.onEnable();
8958
+ if (!this.started) {
8959
+ this.start();
8960
+ this.started = true;
8961
+ }
8962
+ };
8963
+ return ItemBehaviour;
8964
+ }(Behaviour));
8965
+
8966
+ /**
8967
+ * 所有渲染组件的基类
8968
+ * @since 2.0.0
8969
+ */
8970
+ var RendererComponent = /** @class */ (function (_super) {
8971
+ __extends(RendererComponent, _super);
8972
+ function RendererComponent() {
8973
+ var _this = _super !== null && _super.apply(this, arguments) || this;
8974
+ _this.started = false;
8975
+ _this.materials = [];
8976
+ _this._enabled = true;
8977
+ return _this;
9055
8978
  }
9056
- return new Float32Array(0);
9057
- }
8979
+ Object.defineProperty(RendererComponent.prototype, "priority", {
8980
+ get: function () {
8981
+ return this._priority;
8982
+ },
8983
+ set: function (value) {
8984
+ this._priority = value;
8985
+ },
8986
+ enumerable: false,
8987
+ configurable: true
8988
+ });
8989
+ Object.defineProperty(RendererComponent.prototype, "enabled", {
8990
+ get: function () {
8991
+ return this._enabled;
8992
+ },
8993
+ set: function (value) {
8994
+ this._enabled = value;
8995
+ if (value) {
8996
+ this.onEnable();
8997
+ }
8998
+ },
8999
+ enumerable: false,
9000
+ configurable: true
9001
+ });
9002
+ Object.defineProperty(RendererComponent.prototype, "isActiveAndEnabled", {
9003
+ /**
9004
+ * 组件是否可以更新,true 更新,false 不更新
9005
+ */
9006
+ get: function () {
9007
+ return this.item.getVisible() && this.enabled;
9008
+ },
9009
+ enumerable: false,
9010
+ configurable: true
9011
+ });
9012
+ Object.defineProperty(RendererComponent.prototype, "material", {
9013
+ get: function () {
9014
+ return this.materials[0];
9015
+ },
9016
+ set: function (material) {
9017
+ if (this.materials.length === 0) {
9018
+ this.materials.push(material);
9019
+ }
9020
+ else {
9021
+ this.materials[0] = material;
9022
+ }
9023
+ },
9024
+ enumerable: false,
9025
+ configurable: true
9026
+ });
9027
+ RendererComponent.prototype.onEnable = function () { };
9028
+ RendererComponent.prototype.start = function () { };
9029
+ RendererComponent.prototype.update = function (dt) { };
9030
+ RendererComponent.prototype.lateUpdate = function (dt) { };
9031
+ RendererComponent.prototype.render = function (renderer) { };
9032
+ RendererComponent.prototype.onAttached = function () {
9033
+ this.item.rendererComponents.push(this);
9034
+ };
9035
+ RendererComponent.prototype.fromData = function (data) {
9036
+ _super.prototype.fromData.call(this, data);
9037
+ };
9038
+ RendererComponent.prototype.toData = function () {
9039
+ _super.prototype.toData.call(this);
9040
+ };
9041
+ RendererComponent.prototype.dispose = function () {
9042
+ if (this.item) {
9043
+ removeItem(this.item.rendererComponents, this);
9044
+ }
9045
+ _super.prototype.dispose.call(this);
9046
+ };
9047
+ __decorate([
9048
+ serialize()
9049
+ ], RendererComponent.prototype, "materials", void 0);
9050
+ __decorate([
9051
+ serialize()
9052
+ ], RendererComponent.prototype, "_priority", void 0);
9053
+ __decorate([
9054
+ serialize()
9055
+ ], RendererComponent.prototype, "_enabled", void 0);
9056
+ return RendererComponent;
9057
+ }(Component));
9058
9058
 
9059
9059
  var seed$7 = 1;
9060
9060
  /**
@@ -11291,7 +11291,7 @@ var SerializationHelper = /** @class */ (function () {
11291
11291
  };
11292
11292
  SerializationHelper.deserializeProperty = function (property, engine, level) {
11293
11293
  var e_11, _a, e_12, _b;
11294
- if (level > 10) {
11294
+ if (level > 14) {
11295
11295
  console.error('序列化数据的内嵌对象层数大于上限');
11296
11296
  return;
11297
11297
  }
@@ -11352,7 +11352,7 @@ var SerializationHelper = /** @class */ (function () {
11352
11352
  return __generator(this, function (_j) {
11353
11353
  switch (_j.label) {
11354
11354
  case 0:
11355
- if (level > 10) {
11355
+ if (level > 14) {
11356
11356
  console.error('序列化数据的内嵌对象层数大于上限');
11357
11357
  return [2 /*return*/];
11358
11358
  }
@@ -11443,7 +11443,7 @@ var SerializationHelper = /** @class */ (function () {
11443
11443
  };
11444
11444
  SerializationHelper.serializeObjectProperty = function (objectProperty, serializedData, level) {
11445
11445
  var e_15, _a;
11446
- if (level > 10) {
11446
+ if (level > 14) {
11447
11447
  console.error('序列化数据的内嵌对象层数大于上限');
11448
11448
  return;
11449
11449
  }
@@ -11488,7 +11488,7 @@ var SerializationHelper = /** @class */ (function () {
11488
11488
  }
11489
11489
  };
11490
11490
  SerializationHelper.serializeArrayProperty = function (arrayProperty, serializedData, level) {
11491
- if (level > 10) {
11491
+ if (level > 14) {
11492
11492
  console.error('序列化数据的内嵌对象层数大于上限');
11493
11493
  return;
11494
11494
  }
@@ -11654,24 +11654,24 @@ var Database = /** @class */ (function () {
11654
11654
  }());
11655
11655
  exports.DataType = void 0;
11656
11656
  (function (DataType) {
11657
- DataType[DataType["VFXItemData"] = 0] = "VFXItemData";
11658
- DataType[DataType["EffectComponent"] = 1] = "EffectComponent";
11659
- DataType[DataType["Material"] = 2] = "Material";
11660
- DataType[DataType["Shader"] = 3] = "Shader";
11661
- DataType[DataType["SpriteComponent"] = 4] = "SpriteComponent";
11662
- DataType[DataType["ParticleSystem"] = 5] = "ParticleSystem";
11663
- DataType[DataType["InteractComponent"] = 6] = "InteractComponent";
11664
- DataType[DataType["CameraController"] = 7] = "CameraController";
11665
- DataType[DataType["Geometry"] = 8] = "Geometry";
11666
- DataType[DataType["Texture"] = 9] = "Texture";
11667
- DataType[DataType["TextComponent"] = 10] = "TextComponent";
11657
+ DataType["VFXItemData"] = "VFXItemData";
11658
+ DataType["EffectComponent"] = "EffectComponent";
11659
+ DataType["Material"] = "Material";
11660
+ DataType["Shader"] = "Shader";
11661
+ DataType["SpriteComponent"] = "SpriteComponent";
11662
+ DataType["ParticleSystem"] = "ParticleSystem";
11663
+ DataType["InteractComponent"] = "InteractComponent";
11664
+ DataType["CameraController"] = "CameraController";
11665
+ DataType["Geometry"] = "Geometry";
11666
+ DataType["Texture"] = "Texture";
11667
+ DataType["TextComponent"] = "TextComponent";
11668
11668
  // FIXME: 先完成ECS的场景转换,后面移到spec中
11669
- DataType[DataType["MeshComponent"] = 10000] = "MeshComponent";
11670
- DataType[DataType["SkyboxComponent"] = 10001] = "SkyboxComponent";
11671
- DataType[DataType["LightComponent"] = 10002] = "LightComponent";
11672
- DataType[DataType["CameraComponent"] = 10003] = "CameraComponent";
11673
- DataType[DataType["ModelPluginComponent"] = 10004] = "ModelPluginComponent";
11674
- DataType[DataType["TreeComponent"] = 10005] = "TreeComponent";
11669
+ DataType["MeshComponent"] = "MeshComponent";
11670
+ DataType["SkyboxComponent"] = "SkyboxComponent";
11671
+ DataType["LightComponent"] = "LightComponent";
11672
+ DataType["CameraComponent"] = "CameraComponent";
11673
+ DataType["ModelPluginComponent"] = "ModelPluginComponent";
11674
+ DataType["TreeComponent"] = "TreeComponent";
11675
11675
  })(exports.DataType || (exports.DataType = {}));
11676
11676
 
11677
11677
  /**
@@ -13938,15 +13938,25 @@ var PlayableOutput = /** @class */ (function () {
13938
13938
  };
13939
13939
  return PlayableOutput;
13940
13940
  }());
13941
+ var PlayableAsset = /** @class */ (function () {
13942
+ function PlayableAsset() {
13943
+ }
13944
+ PlayableAsset.prototype.fromData = function (data) {
13945
+ };
13946
+ return PlayableAsset;
13947
+ }());
13941
13948
 
13942
13949
  /**
13943
13950
  * @since 2.0.0
13944
13951
  * @internal
13945
13952
  */
13946
- var Track = /** @class */ (function () {
13953
+ var Track = /** @class */ (function (_super) {
13954
+ __extends(Track, _super);
13947
13955
  function Track() {
13948
- this.clips = [];
13949
- this.clipSeed = 0;
13956
+ var _this = _super !== null && _super.apply(this, arguments) || this;
13957
+ _this.clips = [];
13958
+ _this.clipSeed = 0;
13959
+ return _this;
13950
13960
  }
13951
13961
  Track.prototype.createOutput = function () {
13952
13962
  var output = new PlayableOutput();
@@ -13958,7 +13968,7 @@ var Track = /** @class */ (function () {
13958
13968
  Track.prototype.createMixerPlayable = function () {
13959
13969
  return new Playable();
13960
13970
  };
13961
- Track.prototype.createPlayebleTree = function () {
13971
+ Track.prototype.createPlayable = function () {
13962
13972
  var e_1, _a;
13963
13973
  var defaultMixPlayable = this.createMixerPlayable();
13964
13974
  try {
@@ -14010,7 +14020,7 @@ var Track = /** @class */ (function () {
14010
14020
  this.clips.push(clip);
14011
14021
  };
14012
14022
  return Track;
14013
- }());
14023
+ }(PlayableAsset));
14014
14024
  /**
14015
14025
  * @since 2.0.0
14016
14026
  * @internal
@@ -14066,12 +14076,12 @@ var tempPos = new Vector3();
14066
14076
  * @since 2.0.0
14067
14077
  * @internal
14068
14078
  */
14069
- var AnimationClipPlayable = /** @class */ (function (_super) {
14070
- __extends(AnimationClipPlayable, _super);
14071
- function AnimationClipPlayable() {
14079
+ var TransformAnimationPlayable = /** @class */ (function (_super) {
14080
+ __extends(TransformAnimationPlayable, _super);
14081
+ function TransformAnimationPlayable() {
14072
14082
  return _super !== null && _super.apply(this, arguments) || this;
14073
14083
  }
14074
- AnimationClipPlayable.prototype.processFrame = function (dt) {
14084
+ TransformAnimationPlayable.prototype.processFrame = function (dt) {
14075
14085
  if (this.bindingItem.composition) {
14076
14086
  this.sampleAnimation();
14077
14087
  }
@@ -14079,7 +14089,7 @@ var AnimationClipPlayable = /** @class */ (function (_super) {
14079
14089
  /**
14080
14090
  * 应用时间轴K帧数据到对象
14081
14091
  */
14082
- AnimationClipPlayable.prototype.sampleAnimation = function () {
14092
+ TransformAnimationPlayable.prototype.sampleAnimation = function () {
14083
14093
  var _this = this;
14084
14094
  var duration = this.bindingItem.duration;
14085
14095
  var life = this.time / duration;
@@ -14124,7 +14134,7 @@ var AnimationClipPlayable = /** @class */ (function (_super) {
14124
14134
  // this.animationStream.setCurveValue('transform', 'position.z', pos.z);
14125
14135
  }
14126
14136
  };
14127
- AnimationClipPlayable.prototype.fromData = function (data) {
14137
+ TransformAnimationPlayable.prototype.fromData = function (data) {
14128
14138
  var _a;
14129
14139
  var scale = this.bindingItem.transform.scale;
14130
14140
  this.originalTransform = {
@@ -14195,30 +14205,45 @@ var AnimationClipPlayable = /** @class */ (function (_super) {
14195
14205
  this.velocity = this.direction.clone();
14196
14206
  this.velocity.multiply(this.startSpeed);
14197
14207
  };
14198
- return AnimationClipPlayable;
14208
+ return TransformAnimationPlayable;
14199
14209
  }(AnimationPlayable));
14210
+ var TransformAnimationPlayableAsset = /** @class */ (function (_super) {
14211
+ __extends(TransformAnimationPlayableAsset, _super);
14212
+ function TransformAnimationPlayableAsset() {
14213
+ return _super !== null && _super.apply(this, arguments) || this;
14214
+ }
14215
+ TransformAnimationPlayableAsset.prototype.createPlayable = function () {
14216
+ var transformAnimationPlayable = new TransformAnimationPlayable();
14217
+ transformAnimationPlayable.fromData(this.transformAnimationData);
14218
+ return transformAnimationPlayable;
14219
+ };
14220
+ TransformAnimationPlayableAsset.prototype.fromData = function (data) {
14221
+ this.transformAnimationData = data;
14222
+ };
14223
+ return TransformAnimationPlayableAsset;
14224
+ }(PlayableAsset));
14200
14225
  /**
14201
14226
  * @since 2.0.0
14202
14227
  * @internal
14203
14228
  */
14204
- var ActivationClipPlayable = /** @class */ (function (_super) {
14205
- __extends(ActivationClipPlayable, _super);
14206
- function ActivationClipPlayable() {
14229
+ var ActivationPlayable = /** @class */ (function (_super) {
14230
+ __extends(ActivationPlayable, _super);
14231
+ function ActivationPlayable() {
14207
14232
  return _super !== null && _super.apply(this, arguments) || this;
14208
14233
  }
14209
- ActivationClipPlayable.prototype.onGraphStart = function () {
14234
+ ActivationPlayable.prototype.onGraphStart = function () {
14210
14235
  this.bindingItem.transform.setValid(false);
14211
14236
  this.hideRendererComponents();
14212
14237
  };
14213
- ActivationClipPlayable.prototype.onPlayablePlay = function () {
14238
+ ActivationPlayable.prototype.onPlayablePlay = function () {
14214
14239
  this.bindingItem.transform.setValid(true);
14215
14240
  this.showRendererComponents();
14216
14241
  };
14217
- ActivationClipPlayable.prototype.onPlayableDestroy = function () {
14242
+ ActivationPlayable.prototype.onPlayableDestroy = function () {
14218
14243
  this.bindingItem.transform.setValid(false);
14219
14244
  this.hideRendererComponents();
14220
14245
  };
14221
- ActivationClipPlayable.prototype.hideRendererComponents = function () {
14246
+ ActivationPlayable.prototype.hideRendererComponents = function () {
14222
14247
  var e_1, _a;
14223
14248
  try {
14224
14249
  for (var _b = __values$1(this.bindingItem.rendererComponents), _c = _b.next(); !_c.done; _c = _b.next()) {
@@ -14236,7 +14261,7 @@ var ActivationClipPlayable = /** @class */ (function (_super) {
14236
14261
  finally { if (e_1) throw e_1.error; }
14237
14262
  }
14238
14263
  };
14239
- ActivationClipPlayable.prototype.showRendererComponents = function () {
14264
+ ActivationPlayable.prototype.showRendererComponents = function () {
14240
14265
  var e_2, _a;
14241
14266
  try {
14242
14267
  for (var _b = __values$1(this.bindingItem.rendererComponents), _c = _b.next(); !_c.done; _c = _b.next()) {
@@ -14254,7 +14279,7 @@ var ActivationClipPlayable = /** @class */ (function (_super) {
14254
14279
  finally { if (e_2) throw e_2.error; }
14255
14280
  }
14256
14281
  };
14257
- return ActivationClipPlayable;
14282
+ return ActivationPlayable;
14258
14283
  }(Playable));
14259
14284
 
14260
14285
  /**
@@ -14509,7 +14534,7 @@ var TimelineComponent = /** @class */ (function (_super) {
14509
14534
  try {
14510
14535
  for (var _b = __values$1(this.tracks), _c = _b.next(); !_c.done; _c = _b.next()) {
14511
14536
  var track = _c.value;
14512
- var trackMixPlayable = track.createPlayebleTree();
14537
+ var trackMixPlayable = track.createPlayable();
14513
14538
  var trackOutput = track.createOutput();
14514
14539
  graph.addOutput(trackOutput);
14515
14540
  trackOutput.setSourcePlayeble(trackMixPlayable);
@@ -14524,6 +14549,7 @@ var TimelineComponent = /** @class */ (function (_super) {
14524
14549
  }
14525
14550
  };
14526
14551
  TimelineComponent.prototype.fromData = function (data) {
14552
+ var e_13, _a, e_14, _b;
14527
14553
  _super.prototype.fromData.call(this, data);
14528
14554
  this.options = {
14529
14555
  start: this.item.start,
@@ -14534,7 +14560,47 @@ var TimelineComponent = /** @class */ (function (_super) {
14534
14560
  this.id = this.item.id;
14535
14561
  this.name = this.item.name;
14536
14562
  var activationTrack = this.createTrack(Track, 'ActivationTrack');
14537
- activationTrack.createClip(ActivationClipPlayable, 'ActivationTimelineClip');
14563
+ activationTrack.createClip(ActivationPlayable, 'ActivationTimelineClip');
14564
+ //@ts-expect-error
14565
+ if (data.tracks) {
14566
+ //@ts-expect-error
14567
+ var tracks = data.tracks;
14568
+ try {
14569
+ for (var tracks_1 = __values$1(tracks), tracks_1_1 = tracks_1.next(); !tracks_1_1.done; tracks_1_1 = tracks_1.next()) {
14570
+ var track = tracks_1_1.value;
14571
+ var newTrack = this.createTrack(Track);
14572
+ try {
14573
+ for (var _c = (e_14 = void 0, __values$1(track.clips)), _d = _c.next(); !_d.done; _d = _c.next()) {
14574
+ var clipAsset = _d.value;
14575
+ switch (clipAsset.dataType) {
14576
+ case 'TransformAnimationPlayableAsset':
14577
+ newTrack.name = 'AnimationTrack';
14578
+ newTrack.createClip(TransformAnimationPlayable, 'AnimationTimelineClip').playable.fromData(clipAsset.animationClip);
14579
+ break;
14580
+ case 'SpriteColorAnimationPlayableAsset':
14581
+ newTrack.name = 'SpriteColorTrack';
14582
+ newTrack.createClip(SpriteColorPlayable, 'SpriteColorClip').playable.fromData(clipAsset.animationClip);
14583
+ break;
14584
+ }
14585
+ }
14586
+ }
14587
+ catch (e_14_1) { e_14 = { error: e_14_1 }; }
14588
+ finally {
14589
+ try {
14590
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
14591
+ }
14592
+ finally { if (e_14) throw e_14.error; }
14593
+ }
14594
+ }
14595
+ }
14596
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
14597
+ finally {
14598
+ try {
14599
+ if (tracks_1_1 && !tracks_1_1.done && (_a = tracks_1.return)) _a.call(tracks_1);
14600
+ }
14601
+ finally { if (e_13) throw e_13.error; }
14602
+ }
14603
+ }
14538
14604
  };
14539
14605
  TimelineComponent.prototype.toData = function () {
14540
14606
  _super.prototype.toData.call(this);
@@ -14948,9 +15014,6 @@ var SpriteComponent = /** @class */ (function (_super) {
14948
15014
  this.material.setVector4('_Color', new Vector4().setFromArray(startColor));
14949
15015
  this.material.setVector4('_TexOffset', new Vector4().setFromArray([0, 0, 1, 1]));
14950
15016
  this.setItem();
14951
- // 添加K帧动画
14952
- var colorTrack = this.item.getComponent(TimelineComponent).createTrack(Track, 'SpriteColorTrack');
14953
- colorTrack.createClip(SpriteColorPlayable, 'SpriteColorClip').playable.fromData({ colorOverLifetime: data.colorOverLifetime, startColor: data.options.startColor });
14954
15017
  };
14955
15018
  SpriteComponent.prototype.toData = function () {
14956
15019
  _super.prototype.toData.call(this);
@@ -20607,10 +20670,6 @@ var VFXItem = /** @class */ (function (_super) {
20607
20670
  }
20608
20671
  var timelineComponent = this.getComponent(TimelineComponent);
20609
20672
  timelineComponent.fromData(data.content);
20610
- if (this.type !== ItemType$1.particle) {
20611
- var track = timelineComponent.createTrack(Track, 'AnimationTrack');
20612
- track.createClip(AnimationClipPlayable, 'AnimationTimelineClip').playable.fromData(data.content);
20613
- }
20614
20673
  if (duration <= 0) {
20615
20674
  throw Error("Item duration can't be less than 0, see ".concat(HELP_LINK['Item duration can\'t be less than 0']));
20616
20675
  }
@@ -22822,6 +22881,49 @@ function version3Migration(scene) {
22822
22881
  if (item.endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY$1 || item.endBehavior === END_BEHAVIOR_PAUSE$1) {
22823
22882
  item.endBehavior = END_BEHAVIOR_FREEZE$1;
22824
22883
  }
22884
+ // 动画数据转化 TODO: 动画数据移到 TimelineComponentData
22885
+ //@ts-expect-error
22886
+ item.content.tracks = [];
22887
+ //@ts-expect-error
22888
+ var tracks = item.content.tracks;
22889
+ if (item.type !== ItemType$1.particle) {
22890
+ tracks.push({
22891
+ clips: [
22892
+ {
22893
+ dataType: 'TransformAnimationPlayableAsset',
22894
+ animationClip: {
22895
+ //@ts-expect-error
22896
+ sizeOverLifetime: item.content.sizeOverLifetime,
22897
+ //@ts-expect-error
22898
+ rotationOverLifetime: item.content.rotationOverLifetime,
22899
+ //@ts-expect-error
22900
+ positionOverLifetime: item.content.positionOverLifetime,
22901
+ },
22902
+ },
22903
+ ],
22904
+ });
22905
+ }
22906
+ if (item.type === ItemType$1.sprite) {
22907
+ tracks.push({
22908
+ clips: [
22909
+ {
22910
+ dataType: 'SpriteColorAnimationPlayableAsset',
22911
+ animationClip: {
22912
+ //@ts-expect-error
22913
+ colorOverLifetime: item.content.colorOverLifetime,
22914
+ //@ts-expect-error
22915
+ startColor: item.content.options.startColor,
22916
+ },
22917
+ },
22918
+ ],
22919
+ });
22920
+ }
22921
+ // gizmo 的 target id 转换为新的 item guid
22922
+ //@ts-expect-error
22923
+ if (item.content.options.target) {
22924
+ //@ts-expect-error
22925
+ item.content.options.target = itemGuidMap[item.content.options.target];
22926
+ }
22825
22927
  // item 的 content 转为 component data 加入 JSONScene.components
22826
22928
  var uuid = v4().replace(/-/g, '');
22827
22929
  if (item.type === ItemType$1.sprite) {
@@ -25886,8 +25988,7 @@ registerPlugin('interact', InteractLoader, VFXItem, true);
25886
25988
  // registerFilters(filters);
25887
25989
 
25888
25990
  exports.AbstractPlugin = AbstractPlugin;
25889
- exports.ActivationClipPlayable = ActivationClipPlayable;
25890
- exports.AnimationClipPlayable = AnimationClipPlayable;
25991
+ exports.ActivationPlayable = ActivationPlayable;
25891
25992
  exports.AssetLoader = AssetLoader;
25892
25993
  exports.AssetManager = AssetManager;
25893
25994
  exports.BYTES_TYPE_MAP = BYTES_TYPE_MAP;
@@ -25986,6 +26087,8 @@ exports.TimelineClip = TimelineClip;
25986
26087
  exports.TimelineComponent = TimelineComponent;
25987
26088
  exports.Track = Track;
25988
26089
  exports.Transform = Transform;
26090
+ exports.TransformAnimationPlayable = TransformAnimationPlayable;
26091
+ exports.TransformAnimationPlayableAsset = TransformAnimationPlayableAsset;
25989
26092
  exports.VFXItem = VFXItem;
25990
26093
  exports.ValueGetter = ValueGetter;
25991
26094
  exports.addByOrder = addByOrder;