@galacean/engine 0.0.0-experimental-2.0-game.14 → 0.0.0-experimental-2.0-game.15

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/browser.js CHANGED
@@ -5457,10 +5457,14 @@
5457
5457
  if (_instanceof1$2(sourceProperty, Map) || _instanceof1$2(sourceProperty, Set)) return CloneMode.Deep;
5458
5458
  // Value types with copyFrom (math types like Vector3, Color, etc.)
5459
5459
  if (sourceProperty.copyFrom) return CloneMode.Deep;
5460
- // Plain objects - deep clone (may contain Entity/Component refs)
5461
- if (sourceProperty.constructor === Object) return CloneMode.Deep;
5462
- // Other class instances (engine resources like Material, Texture) - shared reference
5463
- return CloneMode.Assignment;
5460
+ // Engine resources (Material, Texture, Mesh, Shader, ...) refCount-managed,
5461
+ // shared by reference. Anything outside this contract is treated as a value-like
5462
+ // user class and gets a deep clone (so nested Entity/Component refs are remapped).
5463
+ if (_instanceof1$2(sourceProperty, ReferResource)) return CloneMode.Assignment;
5464
+ // Default: deep clone. Covers plain objects {...} and user-defined value classes
5465
+ // (EventHandler, business data containers). Internal Entity/Component refs reach
5466
+ // line 109's _remap branch and are correctly rebound to the target tree.
5467
+ return CloneMode.Deep;
5464
5468
  };
5465
5469
  CloneManager.deepCloneObject = function deepCloneObject(source, target, deepInstanceMap) {
5466
5470
  for(var k in source){
@@ -36469,6 +36473,13 @@
36469
36473
  this._length = 0;
36470
36474
  };
36471
36475
  /**
36476
+ * Samples an animation at a given time.
36477
+ * @param entity - The animated entity
36478
+ * @param time - The time to sample an animation
36479
+ */ _proto.sampleAnimation = function sampleAnimation(entity, time) {
36480
+ this._sampleAnimation(entity, time);
36481
+ };
36482
+ /**
36472
36483
  * @internal
36473
36484
  * Samples an animation at a given time.
36474
36485
  * @param entity - The animated entity
@@ -37860,6 +37871,8 @@
37860
37871
  */ var AnimatorStateData = function AnimatorStateData() {
37861
37872
  this.curveLayerOwner = [];
37862
37873
  this.eventHandlers = [];
37874
+ this.state = null;
37875
+ this.clipChangedListener = null;
37863
37876
  };
37864
37877
  /**
37865
37878
  * The controller of the animation system.
@@ -37867,7 +37880,7 @@
37867
37880
  _inherits$2(Animator, Component);
37868
37881
  function Animator(entity) {
37869
37882
  var _this;
37870
- _this = Component.call(this, entity) || this, /** Culling mode of this Animator. */ _this.cullingMode = AnimatorCullingMode.None, /** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0, /** @internal */ _this._playFrameCount = -1, /** @internal */ _this._onUpdateIndex = -1, _this._updateMark = 0, _this._animatorLayersData = new Array(), _this._curveOwnerPool = Object.create(null), _this._animationEventHandlerPool = new ClearableObjectPool(AnimationEventHandler), _this._parametersValueMap = Object.create(null), _this._tempAnimatorStateInfo = {
37883
+ _this = Component.call(this, entity) || this, /** Culling mode of this Animator. */ _this.cullingMode = AnimatorCullingMode.None, /** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0, /** Whether the Animator sends AnimationEvent callbacks. */ _this.fireEvents = true, /** @internal */ _this._playFrameCount = -1, /** @internal */ _this._onUpdateIndex = -1, _this._updateMark = 0, _this._animatorLayersData = new Array(), _this._curveOwnerPool = Object.create(null), _this._animationEventHandlerPool = new ClearableObjectPool(AnimationEventHandler), _this._parametersValueMap = Object.create(null), _this._tempAnimatorStateInfo = {
37871
37884
  layerIndex: -1,
37872
37885
  state: null
37873
37886
  }, _this._controlledRenderers = new Array();
@@ -38071,6 +38084,18 @@
38071
38084
  owner.revertDefaultValue();
38072
38085
  }
38073
38086
  }
38087
+ var layersData = this._animatorLayersData;
38088
+ for(var i = 0, n = layersData.length; i < n; i++){
38089
+ var stateDataMap = layersData[i].animatorStateDataMap;
38090
+ for(var stateName in stateDataMap){
38091
+ var stateData = stateDataMap[stateName];
38092
+ if (stateData.clipChangedListener && stateData.state) {
38093
+ stateData.state._updateFlagManager.removeListener(stateData.clipChangedListener);
38094
+ stateData.clipChangedListener = null;
38095
+ stateData.state = null;
38096
+ }
38097
+ }
38098
+ }
38074
38099
  this._animatorLayersData.length = 0;
38075
38100
  this._curveOwnerPool = Object.create(null);
38076
38101
  this._parametersValueMap = Object.create(null);
@@ -38090,6 +38115,7 @@
38090
38115
  };
38091
38116
  _proto._onDestroy = function _onDestroy() {
38092
38117
  Component.prototype._onDestroy.call(this);
38118
+ this._reset();
38093
38119
  var controller = this._animatorController;
38094
38120
  if (controller) {
38095
38121
  var _this__controllerUpdateFlag;
@@ -38210,6 +38236,8 @@
38210
38236
  };
38211
38237
  clipChangedListener();
38212
38238
  state._updateFlagManager.addListener(clipChangedListener);
38239
+ animatorStateData.state = state;
38240
+ animatorStateData.clipChangedListener = clipChangedListener;
38213
38241
  };
38214
38242
  _proto._clearCrossData = function _clearCrossData(animatorLayerData) {
38215
38243
  animatorLayerData.crossCurveMark++;
@@ -38874,7 +38902,7 @@
38874
38902
  };
38875
38903
  _proto._fireAnimationEventsAndCallScripts = function _fireAnimationEventsAndCallScripts(layerIndex, playData, state, lastClipTime, lastPlayState, deltaTime) {
38876
38904
  var eventHandlers = playData.stateData.eventHandlers;
38877
- eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, deltaTime);
38905
+ this.fireEvents && eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, deltaTime);
38878
38906
  if (lastPlayState === AnimatorStatePlayState.UnStarted) {
38879
38907
  state._callOnEnter(this, layerIndex);
38880
38908
  }
@@ -38938,6 +38966,9 @@
38938
38966
  __decorate$1([
38939
38967
  assignmentClone
38940
38968
  ], Animator.prototype, "speed", void 0);
38969
+ __decorate$1([
38970
+ assignmentClone
38971
+ ], Animator.prototype, "fireEvents", void 0);
38941
38972
  __decorate$1([
38942
38973
  assignmentClone
38943
38974
  ], Animator.prototype, "_animatorController", void 0);
@@ -56421,7 +56452,7 @@
56421
56452
  ], EXT_texture_webp);
56422
56453
 
56423
56454
  //@ts-ignore
56424
- var version = "0.0.0-experimental-2.0-game.14";
56455
+ var version = "0.0.0-experimental-2.0-game.15";
56425
56456
  console.log("Galacean Engine Version: " + version);
56426
56457
  for(var key in CoreObjects){
56427
56458
  Loader.registerClass(key, CoreObjects[key]);