@galacean/engine 0.9.18 → 0.9.20

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
@@ -22946,18 +22946,10 @@
22946
22946
  var _config_type;
22947
22947
  config.type = (_config_type = config.type) != null ? _config_type : getMimeTypeFromUrl(url);
22948
22948
  var realRequest = config.type === "image" ? requestImage : requestRes;
22949
- var lastError;
22950
22949
  var executor = new MultiExecutor(function() {
22951
- return realRequest(url, config).onProgress(setProgress).then(function(res) {
22952
- resolve(res);
22953
- executor.stop();
22954
- }).catch(function(err) {
22955
- return lastError = err;
22956
- });
22950
+ return realRequest(url, config).onProgress(setProgress);
22957
22951
  }, retryCount, retryInterval);
22958
- executor.start(function() {
22959
- reject(lastError);
22960
- });
22952
+ executor.start().onError(reject).onComplete(resolve);
22961
22953
  });
22962
22954
  }
22963
22955
  function requestImage(url, config) {
@@ -23044,23 +23036,33 @@
23044
23036
  this.exec = this.exec.bind(this);
23045
23037
  };
23046
23038
  var _proto = MultiExecutor.prototype;
23047
- _proto.start = function start(done) {
23048
- this.done = done;
23039
+ _proto.start = function start() {
23049
23040
  this.exec();
23041
+ return this;
23050
23042
  };
23051
- _proto.stop = function stop() {
23052
- clearTimeout(this._timeoutId);
23043
+ _proto.onComplete = function onComplete(func) {
23044
+ this._onComplete = func;
23045
+ return this;
23046
+ };
23047
+ _proto.onError = function onError(func) {
23048
+ this._onError = func;
23049
+ return this;
23050
+ };
23051
+ _proto.cancel = function cancel() {
23052
+ window.clearTimeout(this._timeoutId);
23053
23053
  };
23054
23054
  _proto.exec = function exec() {
23055
23055
  var _this = this;
23056
23056
  if (this._currentCount >= this.totalCount) {
23057
- this.done && this.done();
23057
+ this._onError && this._onError(this._error);
23058
23058
  return;
23059
23059
  }
23060
23060
  this._currentCount++;
23061
- this.execFunc(this._currentCount).then(function() {
23062
- //@ts-ignore
23063
- _this._timeoutId = setTimeout(_this.exec, _this.interval);
23061
+ this.execFunc(this._currentCount).then(function(result) {
23062
+ return _this._onComplete && _this._onComplete(result);
23063
+ }).catch(function(e) {
23064
+ _this._error = e;
23065
+ _this._timeoutId = window.setTimeout(_this.exec, _this.interval);
23064
23066
  });
23065
23067
  };
23066
23068
  return MultiExecutor;
@@ -26002,6 +26004,7 @@
26002
26004
  curKeyframeIndex: 0,
26003
26005
  value: null
26004
26006
  };
26007
+ this.updateMark = 0;
26005
26008
  this.target = target;
26006
26009
  this.type = type;
26007
26010
  this.property = property;
@@ -27442,9 +27445,9 @@
27442
27445
  _this = Component.call(this, entity) || this;
27443
27446
  /** Culling mode of this Animator. */ _this.cullingMode = exports.AnimatorCullingMode.None;
27444
27447
  /** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0;
27448
+ _this._updateMark = 0;
27445
27449
  _this._animatorLayersData = [];
27446
27450
  _this._curveOwnerPool = Object.create(null);
27447
- _this._needRevertCurveOwners = [];
27448
27451
  _this._animationEventHandlerPool = new ClassPool(AnimationEventHandler);
27449
27452
  _this._tempAnimatorStateInfo = {
27450
27453
  layerIndex: -1,
@@ -27529,7 +27532,7 @@
27529
27532
  return;
27530
27533
  }
27531
27534
  deltaTime *= this.speed;
27532
- this._revertCurveOwners();
27535
+ this._updateMark++;
27533
27536
  for(var i1 = 0, n1 = animatorController.layers.length; i1 < n1; i1++){
27534
27537
  var animatorLayerData = this._getAnimatorLayerData(i1);
27535
27538
  if (animatorLayerData.layerState === LayerState.Standby) {
@@ -27579,7 +27582,6 @@
27579
27582
  }
27580
27583
  }
27581
27584
  this._animatorLayersData.length = 0;
27582
- this._needRevertCurveOwners.length = 0;
27583
27585
  this._curveOwnerPool = {};
27584
27586
  this._animationEventHandlerPool.resetPool();
27585
27587
  if (this._controllerUpdateFlag) {
@@ -27630,17 +27632,9 @@
27630
27632
  var _curveOwnerPool, _instanceId, _propertyOwners, _property, _layerCurveOwnerPool, _instanceId1, _layerPropertyOwners, _property1;
27631
27633
  var property = curve.property;
27632
27634
  var instanceId = targetEntity.instanceId;
27633
- var needRevert = false;
27634
- if (this.animatorController.layers[layerIndex].blendingMode === exports.AnimatorLayerBlendingMode.Additive && layerIndex > 0) {
27635
- needRevert = true;
27636
- }
27637
27635
  // Get owner
27638
27636
  var propertyOwners = (_curveOwnerPool = curveOwnerPool)[_instanceId = instanceId] || (_curveOwnerPool[_instanceId] = Object.create(null));
27639
27637
  var owner = (_propertyOwners = propertyOwners)[_property = property] || (_propertyOwners[_property] = curve._createCurveOwner(targetEntity));
27640
- //@todo: There is performance waste here, which will be handled together with organizing AnimatorStateData later. The logic is changing from runtime to initialization.
27641
- if (needRevert) {
27642
- this._needRevertCurveOwners.push(owner);
27643
- }
27644
27638
  // Get layer owner
27645
27639
  var layerPropertyOwners = (_layerCurveOwnerPool = layerCurveOwnerPool)[_instanceId1 = instanceId] || (_layerCurveOwnerPool[_instanceId1] = Object.create(null));
27646
27640
  var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[_property1 = property] || (_layerPropertyOwners[_property1] = curve._createCurveLayerOwner(owner));
@@ -27773,6 +27767,7 @@
27773
27767
  if (!owner) continue;
27774
27768
  var curve = curveBindings[i].curve;
27775
27769
  if (curve.keys.length) {
27770
+ this._checkRevertOwner(owner, additive);
27776
27771
  var value = owner.evaluateValue(curve, clipTime, additive);
27777
27772
  aniUpdate && owner.applyValue(value, weight, additive);
27778
27773
  finished && layerOwner.saveFinalValue();
@@ -27818,6 +27813,7 @@
27818
27813
  if (!owner) continue;
27819
27814
  var srcCurveIndex = layerOwner.crossSrcCurveIndex;
27820
27815
  var destCurveIndex = layerOwner.crossDestCurveIndex;
27816
+ this._checkRevertOwner(owner, additive);
27821
27817
  var value = owner.evaluateCrossFadeValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, additive);
27822
27818
  aniUpdate && owner.applyValue(value, weight, additive);
27823
27819
  finished && layerOwner.saveFinalValue();
@@ -27864,6 +27860,7 @@
27864
27860
  var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
27865
27861
  if (!owner) continue;
27866
27862
  var curveIndex = layerOwner.crossDestCurveIndex;
27863
+ this._checkRevertOwner(owner, additive);
27867
27864
  var value = layerOwner.curveOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, additive);
27868
27865
  aniUpdate && owner.applyValue(value, weight, additive);
27869
27866
  finished && layerOwner.saveFinalValue();
@@ -27890,6 +27887,7 @@
27890
27887
  var layerOwner = curveLayerOwner[i];
27891
27888
  var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
27892
27889
  if (!owner) continue;
27890
+ this._checkRevertOwner(owner, additive);
27893
27891
  owner.applyValue(layerOwner.finalValue, weight, additive);
27894
27892
  }
27895
27893
  };
@@ -28059,11 +28057,11 @@
28059
28057
  }
28060
28058
  }
28061
28059
  };
28062
- _proto._revertCurveOwners = function _revertCurveOwners() {
28063
- var curveOwners = this._needRevertCurveOwners;
28064
- for(var i = 0, n = curveOwners.length; i < n; ++i){
28065
- curveOwners[i].revertDefaultValue();
28060
+ _proto._checkRevertOwner = function _checkRevertOwner(owner, additive) {
28061
+ if (additive && owner.updateMark !== this._updateMark) {
28062
+ owner.revertDefaultValue();
28066
28063
  }
28064
+ owner.updateMark = this._updateMark;
28067
28065
  };
28068
28066
  _create_class$3(Animator, [
28069
28067
  {
@@ -28093,13 +28091,13 @@
28093
28091
  ], Animator.prototype, "_controllerUpdateFlag", void 0);
28094
28092
  __decorate$1([
28095
28093
  ignoreClone
28096
- ], Animator.prototype, "_animatorLayersData", void 0);
28094
+ ], Animator.prototype, "_updateMark", void 0);
28097
28095
  __decorate$1([
28098
28096
  ignoreClone
28099
- ], Animator.prototype, "_curveOwnerPool", void 0);
28097
+ ], Animator.prototype, "_animatorLayersData", void 0);
28100
28098
  __decorate$1([
28101
28099
  ignoreClone
28102
- ], Animator.prototype, "_needRevertCurveOwners", void 0);
28100
+ ], Animator.prototype, "_curveOwnerPool", void 0);
28103
28101
  __decorate$1([
28104
28102
  ignoreClone
28105
28103
  ], Animator.prototype, "_animationEventHandlerPool", void 0);
@@ -34401,8 +34399,14 @@
34401
34399
  }
34402
34400
  });
34403
34401
  GLTFParser.defaultPipeline.parse(context).then(masterPromiseInfo.resolve).catch(function(e) {
34404
- console.error(e);
34405
- masterPromiseInfo.reject("Error loading glTF model from " + url + " .");
34402
+ var msg = "Error loading glTF model from " + url + " .";
34403
+ Logger.error(msg);
34404
+ masterPromiseInfo.reject(msg);
34405
+ context.defaultSceneRootPromiseInfo.reject(e);
34406
+ context.texturesPromiseInfo.reject(e);
34407
+ context.materialsPromiseInfo.reject(e);
34408
+ context.meshesPromiseInfo.reject(e);
34409
+ context.animationClipsPromiseInfo.reject(e);
34406
34410
  });
34407
34411
  return context.promiseMap;
34408
34412
  };
@@ -35931,7 +35935,7 @@
35931
35935
  decode(data, resourceManager.engine).then(function(mesh) {
35932
35936
  resolve(mesh);
35933
35937
  });
35934
- });
35938
+ }).catch(reject);
35935
35939
  });
35936
35940
  };
35937
35941
  return MeshLoader;
@@ -35949,14 +35953,14 @@
35949
35953
  var _proto = EditorTextureLoader.prototype;
35950
35954
  _proto.load = function load(item, resourceManager) {
35951
35955
  var _this = this;
35952
- return new AssetPromise(function(resolve) {
35956
+ return new AssetPromise(function(resolve, reject) {
35953
35957
  _this.request(item.url, {
35954
35958
  type: "arraybuffer"
35955
35959
  }).then(function(data) {
35956
35960
  decode(data, resourceManager.engine).then(function(texture) {
35957
35961
  resolve(texture);
35958
35962
  });
35959
- });
35963
+ }).catch(reject);
35960
35964
  });
35961
35965
  };
35962
35966
  return EditorTextureLoader;
@@ -36386,7 +36390,7 @@
36386
36390
  }));
36387
36391
 
36388
36392
  //@ts-ignore
36389
- var version = "0.9.18";
36393
+ var version = "0.9.20";
36390
36394
  console.log("Galacean engine version: " + version);
36391
36395
  for(var key in CoreObjects){
36392
36396
  Loader.registerClass(key, CoreObjects[key]);