@galacean/effects-threejs 2.0.0-alpha.15 → 2.0.0-alpha.17

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 threejs plugin for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.0.0-alpha.15
6
+ * Version: v2.0.0-alpha.17
7
7
  */
8
8
 
9
9
  'use strict';
@@ -474,7 +474,6 @@ function isSimulatorCellPhone() {
474
474
  }
475
475
  function isAlipayMiniApp() {
476
476
  var _my;
477
- // @ts-expect-error
478
477
  return typeof my !== "undefined" && ((_my = my) == null ? void 0 : _my.renderTarget) === "web";
479
478
  }
480
479
 
@@ -730,8 +729,8 @@ function noop() {}
730
729
  *
731
730
  * @static
732
731
  * @function isString
733
- * @param {object} obj - 要判断的对象
734
- * @return {boolean}
732
+ * @param obj - 要判断的对象
733
+ * @return
735
734
  */ function isString(obj) {
736
735
  return typeof obj === "string";
737
736
  }
@@ -740,8 +739,8 @@ function noop() {}
740
739
  *
741
740
  * @static
742
741
  * @function isArray
743
- * @param {object} obj - 要判断的对象
744
- * @return {boolean}
742
+ * @param obj - 要判断的对象
743
+ * @return
745
744
  */ var isArray = Array.isArray || function(obj) {
746
745
  return Object.prototype.toString.call(obj) === "[object Array]";
747
746
  };
@@ -750,8 +749,8 @@ function noop() {}
750
749
  *
751
750
  * @static
752
751
  * @function isFunction
753
- * @param {object} obj - 要判断的对象
754
- * @return {boolean}
752
+ * @param obj - 要判断的对象
753
+ * @return
755
754
  */ function isFunction(obj) {
756
755
  return Object.prototype.toString.call(obj) === "[object Function]";
757
756
  }
@@ -760,8 +759,8 @@ function noop() {}
760
759
  *
761
760
  * @static
762
761
  * @function isObject
763
- * @param {object} obj - 要判断的对象
764
- * @return {boolean}
762
+ * @param obj - 要判断的对象
763
+ * @return
765
764
  */ function isObject(obj) {
766
765
  return Object.prototype.toString.call(obj) === "[object Object]";
767
766
  }
@@ -770,25 +769,12 @@ function isCanvas(canvas) {
770
769
  // 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
771
770
  return typeof canvas === "object" && canvas !== null && ((_canvas_tagName = canvas.tagName) == null ? void 0 : _canvas_tagName.toUpperCase()) === "CANVAS";
772
771
  }
773
- function deepClone(obj) {
774
- if (isArray(obj)) {
775
- return obj.map(deepClone);
776
- } else if (obj && typeof obj === "object") {
777
- if (ArrayBuffer.isView(obj)) {
778
- return obj.slice();
779
- }
780
- var ret = {};
781
- var kas = Object.keys(obj);
782
- for(var i = 0; i < kas.length; i++){
783
- var key = kas[i];
784
- ret[key] = deepClone(obj[key]);
785
- }
786
- return ret;
787
- }
788
- return obj;
789
- }
790
- // TODO: 改名
791
- function random(min, max) {
772
+ /**
773
+ * 生成一个位于 min 和 max 之间的随机数
774
+ * @param min
775
+ * @param max
776
+ * @returns
777
+ */ function randomInRange(min, max) {
792
778
  return min + Math.random() * (max - min);
793
779
  }
794
780
  function throwDestroyedError() {
@@ -4119,7 +4105,7 @@ var CameraClipMode;
4119
4105
  * 蒙版形状切分
4120
4106
  */ ValueType[ValueType["SHAPE_SPLITS"] = 11] = "SHAPE_SPLITS";
4121
4107
  /**
4122
- *直线路径
4108
+ * 直线路径
4123
4109
  */ ValueType[ValueType["LINEAR_PATH"] = 12] = "LINEAR_PATH";
4124
4110
  /**
4125
4111
  * 多色
@@ -4295,7 +4281,7 @@ var TextAlignment;
4295
4281
  (function(TextAlignment) {
4296
4282
  /**
4297
4283
  * text alignment starts from(x,y) to right direction
4298
- * 从(x,y)开始第一个字符,向右边延伸
4284
+ * 从 (x,y) 开始第一个字符,向右边延伸
4299
4285
  */ TextAlignment[TextAlignment["left"] = 0] = "left";
4300
4286
  /**
4301
4287
  * (x,y) is middle position of text, where (left + right)/2 =(x,y)
@@ -4303,7 +4289,7 @@ var TextAlignment;
4303
4289
  */ TextAlignment[TextAlignment["middle"] = 1] = "middle";
4304
4290
  /**
4305
4291
  * text alignment ends with(x,y) from left direction
4306
- * 从(x,y)结束最后一个字符,向左边延伸
4292
+ * 从 (x,y) 结束最后一个字符,向左边延伸
4307
4293
  */ TextAlignment[TextAlignment["right"] = 2] = "right";
4308
4294
  })(TextAlignment || (TextAlignment = {}));
4309
4295
  /**
@@ -4353,6 +4339,7 @@ var DataType;
4353
4339
  DataType["TimelineAsset"] = "TimelineAsset";
4354
4340
  DataType["TransformPlayableAsset"] = "TransformPlayableAsset";
4355
4341
  DataType["SpriteColorPlayableAsset"] = "SpriteColorPlayableAsset";
4342
+ DataType["BinaryAsset"] = "BinaryAsset";
4356
4343
  // FIXME: 先完成ECS的场景转换,后面移到spec中
4357
4344
  DataType["MeshComponent"] = "MeshComponent";
4358
4345
  DataType["SkyboxComponent"] = "SkyboxComponent";
@@ -4361,6 +4348,7 @@ var DataType;
4361
4348
  DataType["ModelPluginComponent"] = "ModelPluginComponent";
4362
4349
  DataType["TreeComponent"] = "TreeComponent";
4363
4350
  DataType["AnimationComponent"] = "AnimationComponent";
4351
+ DataType["SpineComponent"] = "SpineComponent";
4364
4352
  // Non-EffectObject
4365
4353
  DataType["TimelineClip"] = "TimelineClip";
4366
4354
  })(DataType || (DataType = {}));
@@ -4448,11 +4436,11 @@ var VertexBufferSemantic;
4448
4436
  VertexBufferSemantic["TangentBS3"] = "TANGENT_BS3";
4449
4437
  })(VertexBufferSemantic || (VertexBufferSemantic = {}));
4450
4438
 
4451
- var BuiltinObjectGUID = function BuiltinObjectGUID() {
4439
+ var BuiltinObjectGUID = {
4440
+ WhiteTexture: "whitetexture00000000000000000000",
4441
+ PBRShader: "pbr00000000000000000000000000000",
4442
+ UnlitShader: "unlit000000000000000000000000000"
4452
4443
  };
4453
- BuiltinObjectGUID.WhiteTexture = "whitetexture00000000000000000000";
4454
- BuiltinObjectGUID.PBRShader = "pbr00000000000000000000000000000";
4455
- BuiltinObjectGUID.UnlitShader = "unlit000000000000000000000000000";
4456
4444
 
4457
4445
  var index$1 = /*#__PURE__*/Object.freeze({
4458
4446
  __proto__: null,
@@ -4508,15 +4496,20 @@ var index$1 = /*#__PURE__*/Object.freeze({
4508
4496
  BuiltinObjectGUID: BuiltinObjectGUID
4509
4497
  });
4510
4498
 
4511
- var effectsClassStore = {};
4512
4499
  var decoratorInitialStore = {};
4513
4500
  var mergedStore = {};
4514
- function getDirectStore(target) {
4515
- var classKey = target.constructor.name;
4516
- if (!decoratorInitialStore[classKey]) {
4517
- decoratorInitialStore[classKey] = {};
4518
- }
4519
- return decoratorInitialStore[classKey];
4501
+ var effectsClassStore = {};
4502
+ function effectsClass(className) {
4503
+ return function(target, context) {
4504
+ if (effectsClassStore[className]) {
4505
+ console.warn("Class " + className + " 重复注册");
4506
+ }
4507
+ // TODO: three修改json dataType, 这边重复注册直接 return
4508
+ effectsClassStore[className] = target;
4509
+ };
4510
+ }
4511
+ function serialize(type, sourceName) {
4512
+ return generateSerializableMember(type, sourceName); // value member
4520
4513
  }
4521
4514
  function getMergedStore(target) {
4522
4515
  var classKey = target.constructor.name;
@@ -4541,18 +4534,6 @@ function getMergedStore(target) {
4541
4534
  }
4542
4535
  return store;
4543
4536
  }
4544
- function serialize(type, sourceName) {
4545
- return generateSerializableMember(type, sourceName); // value member
4546
- }
4547
- function effectsClass(className) {
4548
- return function(target, context) {
4549
- if (effectsClassStore[className]) {
4550
- console.warn("Class " + className + " 重复注册");
4551
- }
4552
- //TODO: three修改json dataType, 这边重复注册直接 return
4553
- effectsClassStore[className] = target;
4554
- };
4555
- }
4556
4537
  function generateSerializableMember(type, sourceName) {
4557
4538
  return function(target, propertyKey) {
4558
4539
  var classStore = getDirectStore(target);
@@ -4564,6 +4545,13 @@ function generateSerializableMember(type, sourceName) {
4564
4545
  }
4565
4546
  };
4566
4547
  }
4548
+ function getDirectStore(target) {
4549
+ var classKey = target.constructor.name;
4550
+ if (!decoratorInitialStore[classKey]) {
4551
+ decoratorInitialStore[classKey] = {};
4552
+ }
4553
+ return decoratorInitialStore[classKey];
4554
+ }
4567
4555
 
4568
4556
  /**
4569
4557
  * @since 2.0.0
@@ -4595,6 +4583,9 @@ function generateSerializableMember(type, sourceName) {
4595
4583
  }
4596
4584
  };
4597
4585
  _proto.dispose = function dispose() {};
4586
+ EffectsObject.is = function is(obj) {
4587
+ return _instanceof1(obj, EffectsObject) && "guid" in obj;
4588
+ };
4598
4589
  return EffectsObject;
4599
4590
  }();
4600
4591
  __decorate([
@@ -4747,6 +4738,7 @@ __decorate([
4747
4738
  _this = Component.apply(this, arguments) || this;
4748
4739
  _this.started = false;
4749
4740
  _this.materials = [];
4741
+ _this._priority = 0;
4750
4742
  _this._enabled = true;
4751
4743
  return _this;
4752
4744
  }
@@ -10003,7 +9995,7 @@ var RandomValue = /*#__PURE__*/ function(ValueGetter) {
10003
9995
  this.max = props[1];
10004
9996
  };
10005
9997
  _proto.getValue = function getValue(time) {
10006
- return random(this.min, this.max);
9998
+ return randomInRange(this.min, this.max);
10007
9999
  };
10008
10000
  _proto.toUniform = function toUniform() {
10009
10001
  return new Float32Array([
@@ -13713,13 +13705,16 @@ var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
13713
13705
  }
13714
13706
  var _proto = SpriteColorPlayable.prototype;
13715
13707
  _proto.processFrame = function processFrame(context) {
13716
- var boundItem = context.output.getUserData();
13708
+ var boundObject = context.output.getUserData();
13709
+ if (!_instanceof1(boundObject, exports.VFXItem)) {
13710
+ return;
13711
+ }
13717
13712
  if (!this.spriteMaterial) {
13718
- this.spriteMaterial = boundItem.getComponent(exports.SpriteComponent).material;
13713
+ this.spriteMaterial = boundObject.getComponent(exports.SpriteComponent).material;
13719
13714
  }
13720
13715
  var colorInc = vecFill(tempColor, 1);
13721
13716
  var colorChanged;
13722
- var life = this.time / boundItem.duration;
13717
+ var life = this.time / boundObject.duration;
13723
13718
  var opacityOverLifetime = this.opacityOverLifetime;
13724
13719
  var colorOverLifetime = this.colorOverLifetime;
13725
13720
  if (colorOverLifetime) {
@@ -13849,7 +13844,6 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
13849
13844
  renderer.drawGeometry(geo, material);
13850
13845
  };
13851
13846
  _proto.start = function start() {
13852
- this.priority = this.item.listIndex;
13853
13847
  this.item.getHitTestParams = this.getHitTestParams;
13854
13848
  };
13855
13849
  _proto.update = function update(dt) {
@@ -14737,7 +14731,7 @@ var Cone = /*#__PURE__*/ function() {
14737
14731
  // dir + [0,0,1]
14738
14732
  dir.z += 1;
14739
14733
  return {
14740
- position: position.multiply(random(0, 1)),
14734
+ position: position.multiply(randomInRange(0, 1)),
14741
14735
  direction: dir.normalize()
14742
14736
  };
14743
14737
  };
@@ -14745,7 +14739,7 @@ var Cone = /*#__PURE__*/ function() {
14745
14739
  }();
14746
14740
  function getArcAngle(arc, arcMode, opt) {
14747
14741
  if (arcMode === ShapeArcMode.RANDOM) {
14748
- arc = random(0, arc);
14742
+ arc = randomInRange(0, arc);
14749
14743
  } else if (arcMode === ShapeArcMode.UNIDIRECTIONAL_CYCLE) {
14750
14744
  var d = opt.index % (opt.total + 1);
14751
14745
  arc = arc / opt.total * d;
@@ -14785,8 +14779,8 @@ var Rectangle = /*#__PURE__*/ function() {
14785
14779
  }
14786
14780
  var _proto = Rectangle.prototype;
14787
14781
  _proto.generate = function generate(opt) {
14788
- var x = random(-this._d, this._d);
14789
- var y = random(-this._h, this._h);
14782
+ var x = randomInRange(-this._d, this._d);
14783
+ var y = randomInRange(-this._h, this._h);
14790
14784
  return {
14791
14785
  direction: new Vector3(0, 0, 1),
14792
14786
  position: new Vector3(x, y, 0)
@@ -14836,7 +14830,7 @@ var Edge = /*#__PURE__*/ function() {
14836
14830
  }
14837
14831
  var _proto = Edge.prototype;
14838
14832
  _proto.generate = function generate(options) {
14839
- var x = this.arcMode === ShapeArcMode.UNIFORM_BURST ? options.burstIndex % options.burstCount / (options.burstCount - 1) : random(0, 1);
14833
+ var x = this.arcMode === ShapeArcMode.UNIFORM_BURST ? options.burstIndex % options.burstCount / (options.burstCount - 1) : randomInRange(0, 1);
14840
14834
  return {
14841
14835
  direction: new Vector3(0, 1, 0),
14842
14836
  position: new Vector3(this._d * (x - 0.5), 0, 0)
@@ -14857,7 +14851,7 @@ var Donut = /*#__PURE__*/ function() {
14857
14851
  _proto.generate = function generate(opt) {
14858
14852
  var dradius = this.donutRadius;
14859
14853
  var center = this.radius - dradius;
14860
- var angle = random(0, Math.PI * 2);
14854
+ var angle = randomInRange(0, Math.PI * 2);
14861
14855
  var arc = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
14862
14856
  var rot = tempMat4$2.setFromRotationZ(arc);
14863
14857
  var direction = new Vector3(Math.cos(angle), Math.sin(angle), 0);
@@ -14880,7 +14874,7 @@ var Sphere = /*#__PURE__*/ function() {
14880
14874
  }
14881
14875
  var _proto = Sphere.prototype;
14882
14876
  _proto.getHorizontalAngle = function getHorizontalAngle() {
14883
- return random(-90, 90);
14877
+ return randomInRange(-90, 90);
14884
14878
  };
14885
14879
  _proto.generate = function generate(opt) {
14886
14880
  var rz = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
@@ -14903,7 +14897,7 @@ var Hemisphere = /*#__PURE__*/ function(Sphere) {
14903
14897
  }
14904
14898
  var _proto = Hemisphere.prototype;
14905
14899
  _proto.getHorizontalAngle = function getHorizontalAngle() {
14906
- return random(0, 90);
14900
+ return randomInRange(0, 90);
14907
14901
  };
14908
14902
  return Hemisphere;
14909
14903
  }(Sphere);
@@ -16253,7 +16247,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16253
16247
  }
16254
16248
  var _proto = ParticleSystemRenderer.prototype;
16255
16249
  _proto.start = function start() {
16256
- this._priority = this.item.listIndex;
16250
+ this._priority = this.item.renderOrder;
16257
16251
  this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);
16258
16252
  for(var _iterator = _create_for_of_iterator_helper_loose(this.meshes), _step; !(_step = _iterator()).done;){
16259
16253
  var mesh = _step.value;
@@ -16941,11 +16935,9 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
16941
16935
  this.props = props;
16942
16936
  this.destroyed = false;
16943
16937
  var cachePrefix = "";
16944
- var options = props.options;
16945
- var positionOverLifetime = props.positionOverLifetime;
16946
- var shape = props.shape;
16947
- var gravityModifier = positionOverLifetime.gravityOverLifetime;
16948
- var gravity = ensureVec3(positionOverLifetime.gravity);
16938
+ var options = props.options, _props_positionOverLifetime = props.positionOverLifetime, positionOverLifetime = _props_positionOverLifetime === void 0 ? {} : _props_positionOverLifetime, shape = props.shape;
16939
+ var gravityModifier = positionOverLifetime == null ? void 0 : positionOverLifetime.gravityOverLifetime;
16940
+ var gravity = ensureVec3(positionOverLifetime == null ? void 0 : positionOverLifetime.gravity);
16949
16941
  var _textureSheetAnimation = props.textureSheetAnimation;
16950
16942
  var textureSheetAnimation = _textureSheetAnimation ? {
16951
16943
  animationDelay: createValueGetter(_textureSheetAnimation.animationDelay || 0),
@@ -16956,7 +16948,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
16956
16948
  row: _textureSheetAnimation.row,
16957
16949
  total: _textureSheetAnimation.total || _textureSheetAnimation.col * _textureSheetAnimation.row
16958
16950
  } : undefined;
16959
- var startTurbulence = !!(shape && shape.turbulenceX || shape.turbulenceY || shape.turbulenceZ);
16951
+ var startTurbulence = !!(shape && shape.turbulenceX || (shape == null ? void 0 : shape.turbulenceY) || (shape == null ? void 0 : shape.turbulenceZ));
16960
16952
  var turbulence;
16961
16953
  if (startTurbulence) {
16962
16954
  var _shape_turbulenceX, _shape_turbulenceY, _shape_turbulenceZ;
@@ -16989,7 +16981,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
16989
16981
  }
16990
16982
  }
16991
16983
  var forceTarget;
16992
- if (positionOverLifetime.forceTarget) {
16984
+ if (positionOverLifetime == null ? void 0 : positionOverLifetime.forceTarget) {
16993
16985
  forceTarget = {
16994
16986
  target: positionOverLifetime.target || [
16995
16987
  0,
@@ -17303,13 +17295,13 @@ function randomArrItem(arr, keepArr) {
17303
17295
  }
17304
17296
  var _proto = ParticleBehaviourPlayable.prototype;
17305
17297
  _proto.start = function start(context) {
17306
- var binding = context.output.getUserData();
17307
- if (this.particleSystem) {
17298
+ var boundObject = context.output.getUserData();
17299
+ if (this.particleSystem || !_instanceof1(boundObject, exports.VFXItem)) {
17308
17300
  return;
17309
17301
  }
17310
- this.particleSystem = binding.getComponent(exports.ParticleSystem);
17302
+ this.particleSystem = boundObject.getComponent(exports.ParticleSystem);
17311
17303
  if (this.particleSystem) {
17312
- this.particleSystem.name = binding.name;
17304
+ this.particleSystem.name = boundObject.name;
17313
17305
  this.particleSystem.start();
17314
17306
  this.particleSystem.initEmitterTransform();
17315
17307
  }
@@ -18467,10 +18459,13 @@ var tempPos = new Vector3();
18467
18459
  };
18468
18460
  _proto.processFrame = function processFrame(context) {
18469
18461
  if (!this.binding) {
18470
- this.binding = context.output.getUserData();
18471
- this.start();
18462
+ var boundObject = context.output.getUserData();
18463
+ if (_instanceof1(boundObject, exports.VFXItem)) {
18464
+ this.binding = boundObject;
18465
+ this.start();
18466
+ }
18472
18467
  }
18473
- if (this.binding.composition) {
18468
+ if (this.binding && this.binding.composition) {
18474
18469
  this.sampleAnimation();
18475
18470
  }
18476
18471
  };
@@ -18679,14 +18674,40 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
18679
18674
  }
18680
18675
  var _proto = AnimationClipPlayable.prototype;
18681
18676
  _proto.processFrame = function processFrame(context) {
18682
- var boundItem = context.output.getUserData();
18683
- if (boundItem.composition) {
18684
- this.clip.sampleAnimation(boundItem, this.time);
18677
+ var boundObject = context.output.getUserData();
18678
+ if (!_instanceof1(boundObject, exports.VFXItem)) {
18679
+ return;
18680
+ }
18681
+ if (boundObject.composition) {
18682
+ this.clip.sampleAnimation(boundObject, this.time);
18685
18683
  }
18686
18684
  };
18687
18685
  return AnimationClipPlayable;
18688
18686
  }(Playable);
18689
18687
 
18688
+ /**
18689
+ * @since 2.0.0
18690
+ * @internal
18691
+ */ var TimelineClip = /*#__PURE__*/ function() {
18692
+ function TimelineClip() {
18693
+ this.start = 0;
18694
+ this.duration = 0;
18695
+ }
18696
+ var _proto = TimelineClip.prototype;
18697
+ _proto.toLocalTime = function toLocalTime(time) {
18698
+ var localTime = time - this.start;
18699
+ var duration = this.duration;
18700
+ if (localTime - duration > 0.001) {
18701
+ if (this.endBehaviour === ItemEndBehavior.loop) {
18702
+ localTime = localTime % duration;
18703
+ } else if (this.endBehaviour === ItemEndBehavior.freeze) {
18704
+ localTime = Math.min(duration, localTime);
18705
+ }
18706
+ }
18707
+ return localTime;
18708
+ };
18709
+ return TimelineClip;
18710
+ }();
18690
18711
  exports.TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
18691
18712
  _inherits(TrackAsset, PlayableAsset);
18692
18713
  function TrackAsset() {
@@ -18748,7 +18769,7 @@ exports.TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
18748
18769
  this.children.push(child);
18749
18770
  };
18750
18771
  _proto.createClip = function createClip(classConstructor, name) {
18751
- var newClip = new exports.TimelineClip();
18772
+ var newClip = new TimelineClip();
18752
18773
  newClip.asset = new classConstructor(this.engine);
18753
18774
  newClip.name = name ? name : "TimelineClip" + newClip.id;
18754
18775
  this.addClip(newClip);
@@ -18775,7 +18796,7 @@ exports.TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
18775
18796
  return TrackAsset;
18776
18797
  }(PlayableAsset);
18777
18798
  __decorate([
18778
- serialize("TimelineClip")
18799
+ serialize(TimelineClip)
18779
18800
  ], exports.TrackAsset.prototype, "clips", void 0);
18780
18801
  __decorate([
18781
18802
  serialize()
@@ -18788,29 +18809,6 @@ exports.TrackType = void 0;
18788
18809
  TrackType[TrackType["MasterTrack"] = 0] = "MasterTrack";
18789
18810
  TrackType[TrackType["ObjectTrack"] = 1] = "ObjectTrack";
18790
18811
  })(exports.TrackType || (exports.TrackType = {}));
18791
- exports.TimelineClip = /*#__PURE__*/ function() {
18792
- function TimelineClip() {
18793
- this.start = 0;
18794
- this.duration = 0;
18795
- }
18796
- var _proto = TimelineClip.prototype;
18797
- _proto.toLocalTime = function toLocalTime(time) {
18798
- var localTime = time - this.start;
18799
- var duration = this.duration;
18800
- if (localTime - duration > 0.001) {
18801
- if (this.endBehaviour === ItemEndBehavior.loop) {
18802
- localTime = localTime % duration;
18803
- } else if (this.endBehaviour === ItemEndBehavior.freeze) {
18804
- localTime = Math.min(duration, localTime);
18805
- }
18806
- }
18807
- return localTime;
18808
- };
18809
- return TimelineClip;
18810
- }();
18811
- exports.TimelineClip = __decorate([
18812
- effectsClass("TimelineClip")
18813
- ], exports.TimelineClip);
18814
18812
  var RuntimeClip = /*#__PURE__*/ function() {
18815
18813
  function RuntimeClip(clip, clipPlayable, parentMixer, track) {
18816
18814
  this.clip = clip;
@@ -18897,10 +18895,6 @@ exports.ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
18897
18895
  particleClip.endBehaviour = boundItem.endBehavior;
18898
18896
  }
18899
18897
  };
18900
- _proto.fromData = function fromData(data) {
18901
- TrackAsset1.prototype.fromData.call(this, data);
18902
- this.data = data;
18903
- };
18904
18898
  return ObjectBindingTrack;
18905
18899
  }(exports.TrackAsset);
18906
18900
  exports.ObjectBindingTrack = __decorate([
@@ -18925,13 +18919,11 @@ var ActivationMixerPlayable = /*#__PURE__*/ function(Playable) {
18925
18919
  }
18926
18920
  var _proto = ActivationMixerPlayable.prototype;
18927
18921
  _proto.processFrame = function processFrame(context) {
18928
- if (!this.bindingItem) {
18929
- this.bindingItem = context.output.getUserData();
18930
- }
18931
- if (!this.bindingItem) {
18922
+ var boundObject = context.output.getUserData();
18923
+ if (!_instanceof1(boundObject, exports.VFXItem)) {
18932
18924
  return;
18933
18925
  }
18934
- var bindingItem = this.bindingItem;
18926
+ var boundItem = boundObject;
18935
18927
  var hasInput = false;
18936
18928
  for(var i = 0; i < this.getInputCount(); i++){
18937
18929
  if (this.getInputWeight(i) > 0) {
@@ -18940,11 +18932,11 @@ var ActivationMixerPlayable = /*#__PURE__*/ function(Playable) {
18940
18932
  }
18941
18933
  }
18942
18934
  if (hasInput) {
18943
- bindingItem.transform.setValid(true);
18944
- this.showRendererComponents(bindingItem);
18935
+ boundItem.transform.setValid(true);
18936
+ this.showRendererComponents(boundItem);
18945
18937
  } else {
18946
- bindingItem.transform.setValid(false);
18947
- this.hideRendererComponents(bindingItem);
18938
+ boundItem.transform.setValid(false);
18939
+ this.hideRendererComponents(boundItem);
18948
18940
  }
18949
18941
  };
18950
18942
  _proto.hideRendererComponents = function hideRendererComponents(item) {
@@ -19142,7 +19134,6 @@ function compareTracks(a, b) {
19142
19134
  this.startTime = startTime;
19143
19135
  this.resolveBindings();
19144
19136
  this.timelinePlayable = this.timelineAsset.createPlayable(this.graph);
19145
- this.timelinePlayable.play();
19146
19137
  // 重播不销毁元素
19147
19138
  if (this.item.endBehavior !== ItemEndBehavior.destroy) {
19148
19139
  this.setReusable(true);
@@ -19371,7 +19362,9 @@ var SubCompositionClipPlayable = /*#__PURE__*/ function(Playable) {
19371
19362
  var _proto = SubCompositionClipPlayable.prototype;
19372
19363
  _proto.processFrame = function processFrame(context) {
19373
19364
  var boundObject = context.output.getUserData();
19374
- boundObject.time = this.getTime();
19365
+ if (_instanceof1(boundObject, CompositionComponent)) {
19366
+ boundObject.time = this.getTime();
19367
+ }
19375
19368
  };
19376
19369
  return SubCompositionClipPlayable;
19377
19370
  }(Playable);
@@ -19559,7 +19552,6 @@ var CanvasPool = /*#__PURE__*/ function() {
19559
19552
  return this.elements.shift();
19560
19553
  }
19561
19554
  if (getConfig(TEMPLATE_USE_OFFSCREEN_CANVAS)) {
19562
- // @ts-expect-error
19563
19555
  return window._createOffscreenCanvas(10, 10);
19564
19556
  } else {
19565
19557
  // in hongmeng system, create too many canvas will case render error
@@ -20128,6 +20120,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
20128
20120
  /**
20129
20121
  * 元素动画的速度
20130
20122
  */ _this.speed = 1;
20123
+ _this.listIndex = 0;
20131
20124
  _this.name = "VFXItem";
20132
20125
  _this.transform.name = _this.name;
20133
20126
  _this.transform.engine = engine;
@@ -20398,7 +20391,6 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
20398
20391
  this.parentId = parentId;
20399
20392
  this.duration = duration;
20400
20393
  this.endBehavior = endBehavior;
20401
- this.listIndex = listIndex;
20402
20394
  //@ts-expect-error
20403
20395
  this.oldId = data.oldId;
20404
20396
  if (!data.content) {
@@ -20409,18 +20401,12 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
20409
20401
  if (duration <= 0) {
20410
20402
  throw Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"]);
20411
20403
  }
20412
- if (data.components) {
20413
- for(var _iterator = _create_for_of_iterator_helper_loose(data.components), _step; !(_step = _iterator()).done;){
20414
- var component = _step.value;
20415
- var newComponent = component;
20416
- this.components.push(newComponent);
20417
- if (_instanceof1(newComponent, RendererComponent)) {
20418
- this.rendererComponents.push(newComponent);
20419
- } else if (_instanceof1(newComponent, ItemBehaviour)) {
20420
- this.itemBehaviours.push(newComponent);
20421
- }
20422
- }
20404
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
20405
+ var component = _step.value;
20406
+ component.onAttached();
20423
20407
  }
20408
+ // renderOrder 在 component 初始化后设置。确保能拿到 rendererComponent。
20409
+ this.renderOrder = listIndex;
20424
20410
  };
20425
20411
  _proto.toData = function toData() {
20426
20412
  var _this_parent;
@@ -20530,10 +20516,30 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
20530
20516
  var _this_composition_reusable;
20531
20517
  return (_this_composition_reusable = (_this_composition = this.composition) == null ? void 0 : _this_composition.reusable) != null ? _this_composition_reusable : false;
20532
20518
  }
20519
+ },
20520
+ {
20521
+ key: "renderOrder",
20522
+ get: /**
20523
+ * 元素在合成中的索引
20524
+ */ function get() {
20525
+ return this.listIndex;
20526
+ },
20527
+ set: function set(value) {
20528
+ if (this.listIndex !== value) {
20529
+ this.listIndex = value;
20530
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.rendererComponents), _step; !(_step = _iterator()).done;){
20531
+ var rendererComponent = _step.value;
20532
+ rendererComponent.priority = value;
20533
+ }
20534
+ }
20535
+ }
20533
20536
  }
20534
20537
  ]);
20535
20538
  return VFXItem;
20536
20539
  }(EffectsObject);
20540
+ __decorate([
20541
+ serialize()
20542
+ ], exports.VFXItem.prototype, "components", void 0);
20537
20543
  exports.VFXItem = __decorate([
20538
20544
  effectsClass(DataType.VFXItemData)
20539
20545
  ], exports.VFXItem);
@@ -20763,22 +20769,22 @@ var SerializationHelper = /*#__PURE__*/ function() {
20763
20769
  if (value === undefined) {
20764
20770
  value = effectsObject[key];
20765
20771
  }
20766
- if (_instanceof1(value, EffectsObject)) {
20767
- this.collectSerializableObject(value, res);
20768
- } else if (_instanceof1(value, Array)) {
20772
+ if (EffectsObject.is(value)) {
20773
+ SerializationHelper.collectSerializableObject(value, res);
20774
+ } else if (isArray(value)) {
20769
20775
  for(var _iterator1 = _create_for_of_iterator_helper_loose(value), _step1; !(_step1 = _iterator1()).done;){
20770
20776
  var arrayValue = _step1.value;
20771
- if (_instanceof1(arrayValue, EffectsObject)) {
20772
- this.collectSerializableObject(arrayValue, res);
20777
+ if (EffectsObject.is(arrayValue)) {
20778
+ SerializationHelper.collectSerializableObject(arrayValue, res);
20773
20779
  }
20774
20780
  }
20775
- } else if (_instanceof1(value, Object)) {
20781
+ } else if (isObject(value)) {
20776
20782
  // 非 EffectsObject 对象只递归一层
20777
20783
  for(var _iterator2 = _create_for_of_iterator_helper_loose(Object.keys(value)), _step2; !(_step2 = _iterator2()).done;){
20778
20784
  var objectKey = _step2.value;
20779
20785
  var objectValue = value[objectKey];
20780
- if (_instanceof1(objectValue, EffectsObject)) {
20781
- this.collectSerializableObject(objectValue, res);
20786
+ if (EffectsObject.is(objectValue)) {
20787
+ SerializationHelper.collectSerializableObject(objectValue, res);
20782
20788
  }
20783
20789
  }
20784
20790
  }
@@ -20815,17 +20821,17 @@ var SerializationHelper = /*#__PURE__*/ function() {
20815
20821
  if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(value)) {
20816
20822
  // TODO json 数据避免传 typedArray
20817
20823
  serializedData[key] = value;
20818
- } else if (_instanceof1(value, Array)) {
20824
+ } else if (isArray(value)) {
20819
20825
  if (!serializedData[key]) {
20820
20826
  serializedData[key] = [];
20821
20827
  }
20822
20828
  SerializationHelper.serializeArrayProperty(value, serializedData[key], 0);
20823
- } else if (_instanceof1(value, EffectsObject)) {
20829
+ } else if (EffectsObject.is(value)) {
20824
20830
  // TODO 处理 EffectsObject 递归序列化
20825
20831
  serializedData[key] = {
20826
20832
  id: value.getInstanceId()
20827
20833
  };
20828
- } else if (_instanceof1(value, Object)) {
20834
+ } else if (isObject(value)) {
20829
20835
  if (!serializedData[key]) {
20830
20836
  serializedData[key] = {};
20831
20837
  }
@@ -20839,17 +20845,17 @@ var SerializationHelper = /*#__PURE__*/ function() {
20839
20845
  if (typeof value1 === "number" || typeof value1 === "string" || typeof value1 === "boolean" || SerializationHelper.checkTypedArray(value1)) {
20840
20846
  // TODO json 数据避免传 typedArray
20841
20847
  serializedData[key1] = value1;
20842
- } else if (_instanceof1(value1, Array)) {
20848
+ } else if (isArray(value1)) {
20843
20849
  if (!serializedData[key1]) {
20844
20850
  serializedData[key1] = [];
20845
20851
  }
20846
20852
  SerializationHelper.serializeArrayProperty(value1, serializedData[key1], 0);
20847
- } else if (_instanceof1(value1, EffectsObject)) {
20853
+ } else if (EffectsObject.is(value1)) {
20848
20854
  // TODO 处理 EffectsObject 递归序列化
20849
20855
  serializedData[key1] = {
20850
20856
  id: value1.getInstanceId()
20851
20857
  };
20852
- } else if (_instanceof1(value1, Object)) {
20858
+ } else if (isObject(value1)) {
20853
20859
  if (!serializedData[key1]) {
20854
20860
  serializedData[key1] = {};
20855
20861
  }
@@ -20962,13 +20968,13 @@ var SerializationHelper = /*#__PURE__*/ function() {
20962
20968
  SerializationHelper.checkTypedArray = function checkTypedArray(obj) {
20963
20969
  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);
20964
20970
  };
20971
+ // check value is { id: 7e69662e964e4892ae8933f24562395b }
20965
20972
  SerializationHelper.checkDataPath = function checkDataPath(value) {
20966
- // check value is { id: 7e69662e964e4892ae8933f24562395b }
20967
- return _instanceof1(value, Object) && Object.keys(value).length === 1 && value.id && value.id.length === 32;
20973
+ return !!(isObject(value) && Object.keys(value).length === 1 && "id" in value && isString(value.id) && value.id.length === 32);
20968
20974
  };
20969
20975
  // TODO 测试函数,2.0 上线后移除
20970
20976
  SerializationHelper.checkGLTFNode = function checkGLTFNode(value) {
20971
- return _instanceof1(value, Object) && value.nodeIndex !== undefined && value.isJoint !== undefined;
20977
+ return isObject(value) && value.nodeIndex !== undefined && value.isJoint !== undefined;
20972
20978
  };
20973
20979
  SerializationHelper.checkImageSource = function checkImageSource(value) {
20974
20980
  return isCanvas(value) || _instanceof1(value, HTMLImageElement);
@@ -20978,9 +20984,8 @@ var SerializationHelper = /*#__PURE__*/ function() {
20978
20984
  console.error("序列化数据的内嵌对象层数大于上限");
20979
20985
  return;
20980
20986
  }
20981
- if (typeof property === "number" || typeof property === "string" || typeof property === "boolean") {
20982
- return property;
20983
- } else if (_instanceof1(property, Array)) {
20987
+ // 加载并链接 DataPath 字段表示的 EffectsObject 引用。Class 对象 copy [key, value] 会丢失对象信息,因此只递归数组对象和普通 js Object 结构对象。
20988
+ if (isArray(property)) {
20984
20989
  var res = [];
20985
20990
  for(var _iterator = _create_for_of_iterator_helper_loose(property), _step; !(_step = _iterator()).done;){
20986
20991
  var value = _step.value;
@@ -20990,27 +20995,25 @@ var SerializationHelper = /*#__PURE__*/ function() {
20990
20995
  // TODO json 数据避免传 typedArray
20991
20996
  } else if (SerializationHelper.checkDataPath(property)) {
20992
20997
  return engine.assetLoader.loadGUID(property.id);
20993
- } else if (_instanceof1(property, EffectsObject) || SerializationHelper.checkImageSource(property) || SerializationHelper.checkTypedArray(property) || SerializationHelper.checkGLTFNode(property)) {
20994
- return property;
20995
- } else if (_instanceof1(property, Object)) {
20998
+ } else if (isObject(property) && property.constructor === Object) {
20996
20999
  var res1;
20997
21000
  if (type) {
20998
- var classConstructor = effectsClassStore[type];
20999
- res1 = new classConstructor();
21001
+ res1 = new type();
21000
21002
  } else {
21001
21003
  res1 = {};
21002
21004
  }
21003
21005
  for(var _iterator1 = _create_for_of_iterator_helper_loose(Object.keys(property)), _step1; !(_step1 = _iterator1()).done;){
21004
21006
  var key = _step1.value;
21005
- // @ts-expect-error
21006
21007
  res1[key] = SerializationHelper.deserializeProperty(property[key], engine, level + 1);
21007
21008
  }
21008
21009
  return res1;
21010
+ } else {
21011
+ return property;
21009
21012
  }
21010
21013
  };
21011
21014
  SerializationHelper.deserializePropertyAsync = function deserializePropertyAsync(property, engine, level, type) {
21012
21015
  return _async_to_generator(function() {
21013
- var res, _iterator, _step, value, _, res1, res2, classConstructor, _iterator1, _step1, key;
21016
+ var res, _iterator, _step, value, _, res1, res2, _iterator1, _step1, key;
21014
21017
  return __generator(this, function(_state) {
21015
21018
  switch(_state.label){
21016
21019
  case 0:
@@ -21020,26 +21023,17 @@ var SerializationHelper = /*#__PURE__*/ function() {
21020
21023
  2
21021
21024
  ];
21022
21025
  }
21023
- if (!(typeof property === "number" || typeof property === "string" || typeof property === "boolean")) return [
21026
+ if (!isArray(property)) return [
21024
21027
  3,
21025
- 1
21026
- ];
21027
- return [
21028
- 2,
21029
- property
21030
- ];
21031
- case 1:
21032
- if (!_instanceof1(property, Array)) return [
21033
- 3,
21034
- 6
21028
+ 5
21035
21029
  ];
21036
21030
  res = [];
21037
21031
  _iterator = _create_for_of_iterator_helper_loose(property);
21038
- _state.label = 2;
21039
- case 2:
21032
+ _state.label = 1;
21033
+ case 1:
21040
21034
  if (!!(_step = _iterator()).done) return [
21041
21035
  3,
21042
- 5
21036
+ 4
21043
21037
  ];
21044
21038
  value = _step.value;
21045
21039
  _ = res.push;
@@ -21047,61 +21041,58 @@ var SerializationHelper = /*#__PURE__*/ function() {
21047
21041
  4,
21048
21042
  SerializationHelper.deserializePropertyAsync(value, engine, level + 1, type)
21049
21043
  ];
21050
- case 3:
21044
+ case 2:
21051
21045
  _.apply(res, [
21052
21046
  _state.sent()
21053
21047
  ]);
21054
- _state.label = 4;
21055
- case 4:
21048
+ _state.label = 3;
21049
+ case 3:
21056
21050
  return [
21057
21051
  3,
21058
- 2
21052
+ 1
21059
21053
  ];
21060
- case 5:
21054
+ case 4:
21061
21055
  return [
21062
21056
  2,
21063
21057
  res
21064
21058
  ];
21065
- case 6:
21059
+ case 5:
21066
21060
  if (!SerializationHelper.checkDataPath(property)) return [
21067
21061
  3,
21068
- 8
21062
+ 7
21069
21063
  ];
21070
21064
  return [
21071
21065
  4,
21072
21066
  engine.assetLoader.loadGUIDAsync(property.id)
21073
21067
  ];
21074
- case 7:
21068
+ case 6:
21075
21069
  res1 = _state.sent();
21076
21070
  return [
21077
21071
  2,
21078
21072
  res1
21079
21073
  ];
21080
- case 8:
21081
- if (_instanceof1(property, EffectsObject) || SerializationHelper.checkImageSource(property) || SerializationHelper.checkTypedArray(property) || SerializationHelper.checkGLTFNode(property)) {
21082
- return [
21083
- 2,
21084
- property
21085
- ];
21086
- } else if (_instanceof1(property, Object)) {
21074
+ case 7:
21075
+ if (isObject(property) && property.constructor === Object) {
21087
21076
  if (type) {
21088
- classConstructor = effectsClassStore[type];
21089
- res2 = new classConstructor();
21077
+ res2 = new type();
21090
21078
  } else {
21091
21079
  res2 = {};
21092
21080
  }
21093
21081
  for(_iterator1 = _create_for_of_iterator_helper_loose(Object.keys(property)); !(_step1 = _iterator1()).done;){
21094
21082
  key = _step1.value;
21095
- // @ts-expect-error
21096
21083
  res2[key] = SerializationHelper.deserializeProperty(property[key], engine, level + 1);
21097
21084
  }
21098
21085
  return [
21099
21086
  2,
21100
21087
  res2
21101
21088
  ];
21089
+ } else {
21090
+ return [
21091
+ 2,
21092
+ property
21093
+ ];
21102
21094
  }
21103
- _state.label = 9;
21104
- case 9:
21095
+ case 8:
21105
21096
  return [
21106
21097
  2
21107
21098
  ];
@@ -21123,17 +21114,17 @@ var SerializationHelper = /*#__PURE__*/ function() {
21123
21114
  if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(objectProperty)) {
21124
21115
  // TODO json 数据避免传 typedArray
21125
21116
  serializedData[key] = value;
21126
- } else if (_instanceof1(value, Array)) {
21117
+ } else if (isArray(value)) {
21127
21118
  if (!serializedData[key]) {
21128
21119
  serializedData[key] = [];
21129
21120
  }
21130
21121
  SerializationHelper.serializeArrayProperty(value, serializedData[key], level + 1);
21131
- } else if (_instanceof1(value, EffectsObject)) {
21122
+ } else if (EffectsObject.is(value)) {
21132
21123
  // TODO 处理 EffectsObject 递归序列化
21133
21124
  serializedData[key] = {
21134
21125
  id: value.getInstanceId()
21135
21126
  };
21136
- } else if (_instanceof1(value, Object)) {
21127
+ } else if (isObject(value)) {
21137
21128
  if (!serializedData[key]) {
21138
21129
  serializedData[key] = {};
21139
21130
  }
@@ -21154,17 +21145,17 @@ var SerializationHelper = /*#__PURE__*/ function() {
21154
21145
  if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(arrayProperty)) {
21155
21146
  // TODO json 数据避免传 typedArray
21156
21147
  serializedData[i] = value;
21157
- } else if (_instanceof1(value, Array)) {
21148
+ } else if (isArray(value)) {
21158
21149
  if (!serializedData[i]) {
21159
21150
  serializedData[i] = [];
21160
21151
  }
21161
- this.serializeArrayProperty(value, serializedData[i], level + 1);
21162
- } else if (_instanceof1(value, EffectsObject)) {
21152
+ SerializationHelper.serializeArrayProperty(value, serializedData[i], level + 1);
21153
+ } else if (EffectsObject.is(value)) {
21163
21154
  // TODO 处理 EffectsObject 递归序列化
21164
21155
  serializedData[i] = {
21165
21156
  id: value.getInstanceId()
21166
21157
  };
21167
- } else if (_instanceof1(value, Object)) {
21158
+ } else if (isObject(value)) {
21168
21159
  if (!serializedData[i]) {
21169
21160
  serializedData[i] = {};
21170
21161
  }
@@ -22204,8 +22195,6 @@ function getStandardCameraContent(model) {
22204
22195
  // 生成时间轴数据
22205
22196
  convertTimelineAsset(compositionData, guidToItemMap, result);
22206
22197
  };
22207
- var // 更正 spine 数据中的 images 属性
22208
- _json_spines;
22209
22198
  var // 兼容老版本数据中不存在textures的情况
22210
22199
  _result;
22211
22200
  var result = _extends({}, json, {
@@ -22215,7 +22204,8 @@ function getStandardCameraContent(model) {
22215
22204
  materials: [],
22216
22205
  shaders: [],
22217
22206
  geometries: [],
22218
- animations: []
22207
+ animations: [],
22208
+ miscs: []
22219
22209
  });
22220
22210
  // image数据添加 guid
22221
22211
  for(var _iterator = _create_for_of_iterator_helper_loose(result.images), _step; !(_step = _iterator()).done;){
@@ -22245,17 +22235,10 @@ function getStandardCameraContent(model) {
22245
22235
  });
22246
22236
  }
22247
22237
  }
22248
- (_json_spines = json.spines) == null ? void 0 : _json_spines.forEach(function(spine) {
22249
- for(var i = 0; i < spine.images.length; i++){
22250
- var _json_textures_spine_images_i;
22251
- //@ts-expect-error
22252
- var textureId = (_json_textures_spine_images_i = json.textures[spine.images[i]]) == null ? void 0 : _json_textures_spine_images_i.id;
22253
- //@ts-expect-error
22254
- spine.images[i] = {
22255
- id: textureId
22256
- };
22257
- }
22258
- });
22238
+ // 处理老版本数据中 bins 没有 id 的情况
22239
+ if (json.bins) {
22240
+ convertBinaryAsset(json.bins, result);
22241
+ }
22259
22242
  var itemOldIdToGuidMap = {};
22260
22243
  var guidToItemMap = {};
22261
22244
  // 更正Composition.endBehavior
@@ -22419,6 +22402,10 @@ function getStandardCameraContent(model) {
22419
22402
  //@ts-expect-error
22420
22403
  item.type = "orientation-transformer";
22421
22404
  }
22405
+ // Spine 元素转为 guid 索引
22406
+ if (item.type === ItemType.spine && json.spines && json.spines.length !== 0) {
22407
+ convertSpineData(json.spines[item.content.options.spine], item.content, result);
22408
+ }
22422
22409
  // item 的 content 转为 component data 加入 JSONScene.components
22423
22410
  if (item.type === ItemType.sprite || item.type === ItemType.particle || item.type === ItemType.mesh || item.type === ItemType.skybox || item.type === ItemType.light || item.type === "camera" || item.type === ItemType.tree || item.type === ItemType.interact || item.type === ItemType.camera || item.type === ItemType.text || item.type === ItemType.spine || item.type === "editor-gizmo" || item.type === "orientation-transformer") {
22424
22411
  item.components = [];
@@ -22666,22 +22653,54 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22666
22653
  id: timelineAssetData.id
22667
22654
  };
22668
22655
  composition.sceneBindings = sceneBindings;
22669
- if (!jsonScene.animations) {
22670
- jsonScene.animations = [];
22671
- }
22672
- // @ts-expect-error
22673
- jsonScene.animations.push(timelineAssetData);
22656
+ jsonScene.miscs.push(timelineAssetData);
22674
22657
  for(var _iterator2 = _create_for_of_iterator_helper_loose(trackDatas), _step2; !(_step2 = _iterator2()).done;){
22675
22658
  var trackData1 = _step2.value;
22676
22659
  //@ts-expect-error
22677
- jsonScene.animations.push(trackData1);
22660
+ jsonScene.miscs.push(trackData1);
22678
22661
  }
22679
22662
  for(var _iterator3 = _create_for_of_iterator_helper_loose(playableAssetDatas), _step3; !(_step3 = _iterator3()).done;){
22680
22663
  var playableAsset = _step3.value;
22681
22664
  //@ts-expect-error
22682
- jsonScene.animations.push(playableAsset);
22665
+ jsonScene.miscs.push(playableAsset);
22683
22666
  }
22684
22667
  }
22668
+ function convertBinaryAsset(bins, jsonScene) {
22669
+ //@ts-expect-error
22670
+ jsonScene.bins = bins.map(function(bin) {
22671
+ return {
22672
+ url: bin.url,
22673
+ "dataType": "BinaryAsset",
22674
+ id: generateGUID()
22675
+ };
22676
+ });
22677
+ }
22678
+ function convertSpineData(resource, content, jsonScene) {
22679
+ //@ts-expect-error
22680
+ content.resource = {
22681
+ "atlas": {
22682
+ "bins": {
22683
+ //@ts-expect-error
22684
+ "id": jsonScene.bins[resource.atlas[1][0]].id
22685
+ },
22686
+ "source": resource.atlas[1].slice(1)
22687
+ },
22688
+ "skeleton": {
22689
+ "bins": {
22690
+ //@ts-expect-error
22691
+ "id": jsonScene.bins[resource.skeleton[1][0]].id
22692
+ },
22693
+ "source": resource.skeleton[1].slice(1)
22694
+ },
22695
+ "skeletonType": resource.skeletonType,
22696
+ "images": resource.images.map(function(i) {
22697
+ return {
22698
+ //@ts-expect-error
22699
+ id: jsonScene.textures[i].id
22700
+ };
22701
+ })
22702
+ };
22703
+ }
22685
22704
 
22686
22705
  var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
22687
22706
  var standardVersion = /^(\d+)\.(\d+)$/;
@@ -22995,7 +23014,17 @@ function getStandardItem(item, opt) {
22995
23014
  }
22996
23015
 
22997
23016
  var _obj$1;
22998
- var renderLevelPassSet = (_obj$1 = {}, _obj$1[RenderLevel.S] = [
23017
+ /**
23018
+ * 机型和渲染等级对应表
23019
+ *
23020
+ * 机型:B-低端机、A-中端机、S-高端机
23021
+ * 渲染等级:B-低、A-中、S-高、A+-中高、B+-全部
23022
+ *
23023
+ * - S(高端机):高、全部、中高
23024
+ * - A(中端机):中、全部、中高
23025
+ * - B(低端机):低、全部
23026
+ * - undefined(全部机型)
23027
+ */ var renderLevelPassSet = (_obj$1 = {}, _obj$1[RenderLevel.S] = [
22999
23028
  RenderLevel.S,
23000
23029
  RenderLevel.BPlus,
23001
23030
  RenderLevel.APlus
@@ -23417,7 +23446,7 @@ var seed$1 = 1;
23417
23446
  return [
23418
23447
  4,
23419
23448
  new Promise(function(resolve) {
23420
- shaderLibrary.compileAllShaders(function() {
23449
+ shaderLibrary == null ? void 0 : shaderLibrary.compileAllShaders(function() {
23421
23450
  resolve(null);
23422
23451
  });
23423
23452
  })
@@ -24399,7 +24428,7 @@ var listOrder = 0;
24399
24428
  scene.textures = undefined;
24400
24429
  scene.consumed = true;
24401
24430
  }
24402
- var _this_compositionSourceManager = this.compositionSourceManager, sourceContent = _this_compositionSourceManager.sourceContent, pluginSystem = _this_compositionSourceManager.pluginSystem, imgUsage = _this_compositionSourceManager.imgUsage, totalTime = _this_compositionSourceManager.totalTime, renderLevel = _this_compositionSourceManager.renderLevel, refCompositionProps = _this_compositionSourceManager.refCompositionProps;
24431
+ var _this_compositionSourceManager = this.compositionSourceManager, sourceContent = _this_compositionSourceManager.sourceContent, pluginSystem = _this_compositionSourceManager.pluginSystem, imgUsage = _this_compositionSourceManager.imgUsage, totalTime = _this_compositionSourceManager.totalTime, refCompositionProps = _this_compositionSourceManager.refCompositionProps;
24403
24432
  assertExist(sourceContent);
24404
24433
  this.renderer = renderer;
24405
24434
  this.refCompositionProps = refCompositionProps;
@@ -24425,7 +24454,6 @@ var listOrder = 0;
24425
24454
  };
24426
24455
  this.reusable = reusable;
24427
24456
  this.speed = speed;
24428
- this.renderLevel = renderLevel;
24429
24457
  this.autoRefTex = !this.keepResource && imageUsage && this.rootItem.endBehavior !== ItemEndBehavior.loop;
24430
24458
  this.name = sourceContent.name;
24431
24459
  this.pluginSystem = pluginSystem;
@@ -25232,7 +25260,7 @@ var listOrder = 0;
25232
25260
  };
25233
25261
  _proto.addPackageDatas = function addPackageDatas(scene) {
25234
25262
  var jsonScene = scene.jsonScene, _scene_textureOptions = scene.textureOptions, textureOptions = _scene_textureOptions === void 0 ? [] : _scene_textureOptions;
25235
- var _jsonScene_items = jsonScene.items, items = _jsonScene_items === void 0 ? [] : _jsonScene_items, _jsonScene_materials = jsonScene.materials, materials = _jsonScene_materials === void 0 ? [] : _jsonScene_materials, _jsonScene_shaders = jsonScene.shaders, shaders = _jsonScene_shaders === void 0 ? [] : _jsonScene_shaders, _jsonScene_geometries = jsonScene.geometries, geometries = _jsonScene_geometries === void 0 ? [] : _jsonScene_geometries, _jsonScene_components = jsonScene.components, components = _jsonScene_components === void 0 ? [] : _jsonScene_components, _jsonScene_animations = jsonScene.animations, animations = _jsonScene_animations === void 0 ? [] : _jsonScene_animations, _jsonScene_bins = jsonScene.bins, bins = _jsonScene_bins === void 0 ? [] : _jsonScene_bins;
25263
+ var _jsonScene_items = jsonScene.items, items = _jsonScene_items === void 0 ? [] : _jsonScene_items, _jsonScene_materials = jsonScene.materials, materials = _jsonScene_materials === void 0 ? [] : _jsonScene_materials, _jsonScene_shaders = jsonScene.shaders, shaders = _jsonScene_shaders === void 0 ? [] : _jsonScene_shaders, _jsonScene_geometries = jsonScene.geometries, geometries = _jsonScene_geometries === void 0 ? [] : _jsonScene_geometries, _jsonScene_components = jsonScene.components, components = _jsonScene_components === void 0 ? [] : _jsonScene_components, _jsonScene_animations = jsonScene.animations, animations = _jsonScene_animations === void 0 ? [] : _jsonScene_animations, _jsonScene_bins = jsonScene.bins, bins = _jsonScene_bins === void 0 ? [] : _jsonScene_bins, _jsonScene_miscs = jsonScene.miscs, miscs = _jsonScene_miscs === void 0 ? [] : _jsonScene_miscs;
25236
25264
  for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
25237
25265
  var vfxItemData = _step.value;
25238
25266
  this.addEffectsObjectData(vfxItemData);
@@ -25257,6 +25285,10 @@ var listOrder = 0;
25257
25285
  var animationData = _step5.value;
25258
25286
  this.addEffectsObjectData(animationData);
25259
25287
  }
25288
+ for(var _iterator6 = _create_for_of_iterator_helper_loose(miscs), _step6; !(_step6 = _iterator6()).done;){
25289
+ var miscData = _step6.value;
25290
+ this.addEffectsObjectData(miscData);
25291
+ }
25260
25292
  for(var i = 0; i < bins.length; i++){
25261
25293
  var binaryData = bins[i];
25262
25294
  var binaryBuffer = scene.bins[i];
@@ -25268,8 +25300,8 @@ var listOrder = 0;
25268
25300
  this.addEffectsObjectData(binaryData);
25269
25301
  }
25270
25302
  }
25271
- for(var _iterator6 = _create_for_of_iterator_helper_loose(textureOptions), _step6; !(_step6 = _iterator6()).done;){
25272
- var textureData = _step6.value;
25303
+ for(var _iterator7 = _create_for_of_iterator_helper_loose(textureOptions), _step7; !(_step7 = _iterator7()).done;){
25304
+ var textureData = _step7.value;
25273
25305
  this.addEffectsObjectData(textureData);
25274
25306
  }
25275
25307
  };
@@ -26637,6 +26669,14 @@ var seed = 1;
26637
26669
  */ _proto.dispose = function dispose() {
26638
26670
  this.texture.dispose();
26639
26671
  };
26672
+ /**
26673
+ * 通过图层设置创建贴图
26674
+ * @param data - 图层设置
26675
+ */ _proto.fromData = function fromData(data) {
26676
+ Texture.prototype.fromData.call(this, data);
26677
+ this.texture = this.createTextureByType(data);
26678
+ this.texture.needsUpdate = true;
26679
+ };
26640
26680
  _proto.createTextureByType = function createTextureByType(options) {
26641
26681
  var assembleOptions = this.assembleOptions(options);
26642
26682
  // TODO renderer.getMaxAnisotropy() 查询最大各向异性
@@ -27157,7 +27197,7 @@ setMaxSpriteMeshItemCount(8);
27157
27197
  */ Mesh.create = function(engine, props) {
27158
27198
  return new ThreeMesh(engine, props);
27159
27199
  };
27160
- var version = "2.0.0-alpha.15";
27200
+ var version = "2.0.0-alpha.17";
27161
27201
  logger.info("THREEJS plugin version: " + version);
27162
27202
 
27163
27203
  exports.AbstractPlugin = AbstractPlugin;
@@ -27250,7 +27290,9 @@ exports.SpriteLoader = SpriteLoader;
27250
27290
  exports.StaticValue = StaticValue;
27251
27291
  exports.TEMPLATE_USE_OFFSCREEN_CANVAS = TEMPLATE_USE_OFFSCREEN_CANVAS;
27252
27292
  exports.TEXTURE_UNIFORM_MAP = TEXTURE_UNIFORM_MAP;
27293
+ exports.TextLayout = TextLayout;
27253
27294
  exports.TextLoader = TextLoader;
27295
+ exports.TextStyle = TextStyle;
27254
27296
  exports.Texture = Texture;
27255
27297
  exports.TextureFactory = TextureFactory;
27256
27298
  exports.ThreeComposition = ThreeComposition;
@@ -27259,6 +27301,7 @@ exports.ThreeEngine = ThreeEngine;
27259
27301
  exports.ThreeMaterial = ThreeMaterial;
27260
27302
  exports.ThreeTexture = ThreeTexture;
27261
27303
  exports.Ticker = Ticker;
27304
+ exports.TimelineClip = TimelineClip;
27262
27305
  exports.TimelinePlayable = TimelinePlayable;
27263
27306
  exports.TrackSortWrapper = TrackSortWrapper;
27264
27307
  exports.Transform = Transform;
@@ -27287,7 +27330,6 @@ exports.createShape = createShape;
27287
27330
  exports.createVFXItem = createVFXItem;
27288
27331
  exports.createValueGetter = createValueGetter;
27289
27332
  exports.decimalEqual = decimalEqual;
27290
- exports.deepClone = deepClone;
27291
27333
  exports.defaultGlobalVolume = defaultGlobalVolume;
27292
27334
  exports.defaultPlugins = defaultPlugins;
27293
27335
  exports.deserializeMipmapTexture = deserializeMipmapTexture;
@@ -27374,7 +27416,7 @@ exports.particleUniformTypeMap = particleUniformTypeMap;
27374
27416
  exports.particleVert = particleVert;
27375
27417
  exports.pluginLoaderMap = pluginLoaderMap;
27376
27418
  exports.pointOnLine = pointOnLine;
27377
- exports.random = random;
27419
+ exports.randomInRange = randomInRange;
27378
27420
  exports.registerPlugin = registerPlugin;
27379
27421
  exports.removeItem = removeItem;
27380
27422
  exports.rotateVec2 = rotateVec2;