@galacean/engine-core 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/main.js CHANGED
@@ -353,10 +353,14 @@ function _instanceof(left, right) {
353
353
  if (_instanceof(sourceProperty, Map) || _instanceof(sourceProperty, Set)) return CloneMode.Deep;
354
354
  // Value types with copyFrom (math types like Vector3, Color, etc.)
355
355
  if (sourceProperty.copyFrom) return CloneMode.Deep;
356
- // Plain objects - deep clone (may contain Entity/Component refs)
357
- if (sourceProperty.constructor === Object) return CloneMode.Deep;
358
- // Other class instances (engine resources like Material, Texture) - shared reference
359
- return CloneMode.Assignment;
356
+ // Engine resources (Material, Texture, Mesh, Shader, ...) refCount-managed,
357
+ // shared by reference. Anything outside this contract is treated as a value-like
358
+ // user class and gets a deep clone (so nested Entity/Component refs are remapped).
359
+ if (_instanceof(sourceProperty, ReferResource)) return CloneMode.Assignment;
360
+ // Default: deep clone. Covers plain objects {...} and user-defined value classes
361
+ // (EventHandler, business data containers). Internal Entity/Component refs reach
362
+ // line 109's _remap branch and are correctly rebound to the target tree.
363
+ return CloneMode.Deep;
360
364
  };
361
365
  CloneManager.deepCloneObject = function deepCloneObject(source, target, deepInstanceMap) {
362
366
  for(var k in source){
@@ -31793,6 +31797,13 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
31793
31797
  this._length = 0;
31794
31798
  };
31795
31799
  /**
31800
+ * Samples an animation at a given time.
31801
+ * @param entity - The animated entity
31802
+ * @param time - The time to sample an animation
31803
+ */ _proto.sampleAnimation = function sampleAnimation(entity, time) {
31804
+ this._sampleAnimation(entity, time);
31805
+ };
31806
+ /**
31796
31807
  * @internal
31797
31808
  * Samples an animation at a given time.
31798
31809
  * @param entity - The animated entity
@@ -33214,6 +33225,8 @@ function _type_of(obj) {
33214
33225
  */ var AnimatorStateData = function AnimatorStateData() {
33215
33226
  this.curveLayerOwner = [];
33216
33227
  this.eventHandlers = [];
33228
+ this.state = null;
33229
+ this.clipChangedListener = null;
33217
33230
  };
33218
33231
 
33219
33232
  /**
@@ -33222,7 +33235,7 @@ function _type_of(obj) {
33222
33235
  _inherits(Animator, Component);
33223
33236
  function Animator(entity) {
33224
33237
  var _this;
33225
- _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 = {
33238
+ _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 = {
33226
33239
  layerIndex: -1,
33227
33240
  state: null
33228
33241
  }, _this._controlledRenderers = new Array();
@@ -33426,6 +33439,18 @@ function _type_of(obj) {
33426
33439
  owner.revertDefaultValue();
33427
33440
  }
33428
33441
  }
33442
+ var layersData = this._animatorLayersData;
33443
+ for(var i = 0, n = layersData.length; i < n; i++){
33444
+ var stateDataMap = layersData[i].animatorStateDataMap;
33445
+ for(var stateName in stateDataMap){
33446
+ var stateData = stateDataMap[stateName];
33447
+ if (stateData.clipChangedListener && stateData.state) {
33448
+ stateData.state._updateFlagManager.removeListener(stateData.clipChangedListener);
33449
+ stateData.clipChangedListener = null;
33450
+ stateData.state = null;
33451
+ }
33452
+ }
33453
+ }
33429
33454
  this._animatorLayersData.length = 0;
33430
33455
  this._curveOwnerPool = Object.create(null);
33431
33456
  this._parametersValueMap = Object.create(null);
@@ -33445,6 +33470,7 @@ function _type_of(obj) {
33445
33470
  };
33446
33471
  _proto._onDestroy = function _onDestroy() {
33447
33472
  Component.prototype._onDestroy.call(this);
33473
+ this._reset();
33448
33474
  var controller = this._animatorController;
33449
33475
  if (controller) {
33450
33476
  var _this__controllerUpdateFlag;
@@ -33565,6 +33591,8 @@ function _type_of(obj) {
33565
33591
  };
33566
33592
  clipChangedListener();
33567
33593
  state._updateFlagManager.addListener(clipChangedListener);
33594
+ animatorStateData.state = state;
33595
+ animatorStateData.clipChangedListener = clipChangedListener;
33568
33596
  };
33569
33597
  _proto._clearCrossData = function _clearCrossData(animatorLayerData) {
33570
33598
  animatorLayerData.crossCurveMark++;
@@ -34233,7 +34261,7 @@ function _type_of(obj) {
34233
34261
  };
34234
34262
  _proto._fireAnimationEventsAndCallScripts = function _fireAnimationEventsAndCallScripts(layerIndex, playData, state, lastClipTime, lastPlayState, deltaTime) {
34235
34263
  var eventHandlers = playData.stateData.eventHandlers;
34236
- eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, deltaTime);
34264
+ this.fireEvents && eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, deltaTime);
34237
34265
  if (lastPlayState === AnimatorStatePlayState.UnStarted) {
34238
34266
  state._callOnEnter(this, layerIndex);
34239
34267
  }
@@ -34297,6 +34325,9 @@ Animator._passedTriggerParameterNames = new Array();
34297
34325
  __decorate([
34298
34326
  assignmentClone
34299
34327
  ], Animator.prototype, "speed", void 0);
34328
+ __decorate([
34329
+ assignmentClone
34330
+ ], Animator.prototype, "fireEvents", void 0);
34300
34331
  __decorate([
34301
34332
  assignmentClone
34302
34333
  ], Animator.prototype, "_animatorController", void 0);