@galacean/engine-physics-physx 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.
@@ -18205,18 +18205,10 @@ var defaultInterval = 500;
18205
18205
  var _config_type;
18206
18206
  config.type = (_config_type = config.type) != null ? _config_type : getMimeTypeFromUrl(url);
18207
18207
  var realRequest = config.type === "image" ? requestImage : requestRes;
18208
- var lastError;
18209
18208
  var executor = new MultiExecutor(function() {
18210
- return realRequest(url, config).onProgress(setProgress).then(function(res) {
18211
- resolve(res);
18212
- executor.stop();
18213
- }).catch(function(err) {
18214
- return lastError = err;
18215
- });
18209
+ return realRequest(url, config).onProgress(setProgress);
18216
18210
  }, retryCount, retryInterval);
18217
- executor.start(function() {
18218
- reject(lastError);
18219
- });
18211
+ executor.start().onError(reject).onComplete(resolve);
18220
18212
  });
18221
18213
  }
18222
18214
  function requestImage(url, config) {
@@ -18303,23 +18295,33 @@ var MultiExecutor = /*#__PURE__*/ function() {
18303
18295
  this.exec = this.exec.bind(this);
18304
18296
  };
18305
18297
  var _proto = MultiExecutor.prototype;
18306
- _proto.start = function start(done) {
18307
- this.done = done;
18298
+ _proto.start = function start() {
18308
18299
  this.exec();
18300
+ return this;
18309
18301
  };
18310
- _proto.stop = function stop() {
18311
- clearTimeout(this._timeoutId);
18302
+ _proto.onComplete = function onComplete(func) {
18303
+ this._onComplete = func;
18304
+ return this;
18305
+ };
18306
+ _proto.onError = function onError(func) {
18307
+ this._onError = func;
18308
+ return this;
18309
+ };
18310
+ _proto.cancel = function cancel() {
18311
+ engineMiniprogramAdapter$2.window.clearTimeout(this._timeoutId);
18312
18312
  };
18313
18313
  _proto.exec = function exec() {
18314
18314
  var _this = this;
18315
18315
  if (this._currentCount >= this.totalCount) {
18316
- this.done && this.done();
18316
+ this._onError && this._onError(this._error);
18317
18317
  return;
18318
18318
  }
18319
18319
  this._currentCount++;
18320
- this.execFunc(this._currentCount).then(function() {
18321
- //@ts-ignore
18322
- _this._timeoutId = setTimeout(_this.exec, _this.interval);
18320
+ this.execFunc(this._currentCount).then(function(result) {
18321
+ return _this._onComplete && _this._onComplete(result);
18322
+ }).catch(function(e) {
18323
+ _this._error = e;
18324
+ _this._timeoutId = engineMiniprogramAdapter$2.window.setTimeout(_this.exec, _this.interval);
18323
18325
  });
18324
18326
  };
18325
18327
  return MultiExecutor;
@@ -21261,6 +21263,7 @@ var DirtyFlag;
21261
21263
  curKeyframeIndex: 0,
21262
21264
  value: null
21263
21265
  };
21266
+ this.updateMark = 0;
21264
21267
  this.target = target;
21265
21268
  this.type = type;
21266
21269
  this.property = property;
@@ -22701,9 +22704,9 @@ exports.AnimatorLayerBlendingMode = void 0;
22701
22704
  _this = Component.call(this, entity) || this;
22702
22705
  /** Culling mode of this Animator. */ _this.cullingMode = exports.AnimatorCullingMode.None;
22703
22706
  /** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0;
22707
+ _this._updateMark = 0;
22704
22708
  _this._animatorLayersData = [];
22705
22709
  _this._curveOwnerPool = Object.create(null);
22706
- _this._needRevertCurveOwners = [];
22707
22710
  _this._animationEventHandlerPool = new ClassPool(AnimationEventHandler);
22708
22711
  _this._tempAnimatorStateInfo = {
22709
22712
  layerIndex: -1,
@@ -22788,7 +22791,7 @@ exports.AnimatorLayerBlendingMode = void 0;
22788
22791
  return;
22789
22792
  }
22790
22793
  deltaTime *= this.speed;
22791
- this._revertCurveOwners();
22794
+ this._updateMark++;
22792
22795
  for(var i1 = 0, n1 = animatorController.layers.length; i1 < n1; i1++){
22793
22796
  var animatorLayerData = this._getAnimatorLayerData(i1);
22794
22797
  if (animatorLayerData.layerState === LayerState.Standby) {
@@ -22838,7 +22841,6 @@ exports.AnimatorLayerBlendingMode = void 0;
22838
22841
  }
22839
22842
  }
22840
22843
  this._animatorLayersData.length = 0;
22841
- this._needRevertCurveOwners.length = 0;
22842
22844
  this._curveOwnerPool = {};
22843
22845
  this._animationEventHandlerPool.resetPool();
22844
22846
  if (this._controllerUpdateFlag) {
@@ -22889,17 +22891,9 @@ exports.AnimatorLayerBlendingMode = void 0;
22889
22891
  var _curveOwnerPool, _instanceId, _propertyOwners, _property, _layerCurveOwnerPool, _instanceId1, _layerPropertyOwners, _property1;
22890
22892
  var property = curve.property;
22891
22893
  var instanceId = targetEntity.instanceId;
22892
- var needRevert = false;
22893
- if (this.animatorController.layers[layerIndex].blendingMode === exports.AnimatorLayerBlendingMode.Additive && layerIndex > 0) {
22894
- needRevert = true;
22895
- }
22896
22894
  // Get owner
22897
22895
  var propertyOwners = (_curveOwnerPool = curveOwnerPool)[_instanceId = instanceId] || (_curveOwnerPool[_instanceId] = Object.create(null));
22898
22896
  var owner = (_propertyOwners = propertyOwners)[_property = property] || (_propertyOwners[_property] = curve._createCurveOwner(targetEntity));
22899
- //@todo: There is performance waste here, which will be handled together with organizing AnimatorStateData later. The logic is changing from runtime to initialization.
22900
- if (needRevert) {
22901
- this._needRevertCurveOwners.push(owner);
22902
- }
22903
22897
  // Get layer owner
22904
22898
  var layerPropertyOwners = (_layerCurveOwnerPool = layerCurveOwnerPool)[_instanceId1 = instanceId] || (_layerCurveOwnerPool[_instanceId1] = Object.create(null));
22905
22899
  var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[_property1 = property] || (_layerPropertyOwners[_property1] = curve._createCurveLayerOwner(owner));
@@ -23032,6 +23026,7 @@ exports.AnimatorLayerBlendingMode = void 0;
23032
23026
  if (!owner) continue;
23033
23027
  var curve = curveBindings[i].curve;
23034
23028
  if (curve.keys.length) {
23029
+ this._checkRevertOwner(owner, additive);
23035
23030
  var value = owner.evaluateValue(curve, clipTime, additive);
23036
23031
  aniUpdate && owner.applyValue(value, weight, additive);
23037
23032
  finished && layerOwner.saveFinalValue();
@@ -23077,6 +23072,7 @@ exports.AnimatorLayerBlendingMode = void 0;
23077
23072
  if (!owner) continue;
23078
23073
  var srcCurveIndex = layerOwner.crossSrcCurveIndex;
23079
23074
  var destCurveIndex = layerOwner.crossDestCurveIndex;
23075
+ this._checkRevertOwner(owner, additive);
23080
23076
  var value = owner.evaluateCrossFadeValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, additive);
23081
23077
  aniUpdate && owner.applyValue(value, weight, additive);
23082
23078
  finished && layerOwner.saveFinalValue();
@@ -23123,6 +23119,7 @@ exports.AnimatorLayerBlendingMode = void 0;
23123
23119
  var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
23124
23120
  if (!owner) continue;
23125
23121
  var curveIndex = layerOwner.crossDestCurveIndex;
23122
+ this._checkRevertOwner(owner, additive);
23126
23123
  var value = layerOwner.curveOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, additive);
23127
23124
  aniUpdate && owner.applyValue(value, weight, additive);
23128
23125
  finished && layerOwner.saveFinalValue();
@@ -23149,6 +23146,7 @@ exports.AnimatorLayerBlendingMode = void 0;
23149
23146
  var layerOwner = curveLayerOwner[i];
23150
23147
  var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
23151
23148
  if (!owner) continue;
23149
+ this._checkRevertOwner(owner, additive);
23152
23150
  owner.applyValue(layerOwner.finalValue, weight, additive);
23153
23151
  }
23154
23152
  };
@@ -23318,11 +23316,11 @@ exports.AnimatorLayerBlendingMode = void 0;
23318
23316
  }
23319
23317
  }
23320
23318
  };
23321
- _proto._revertCurveOwners = function _revertCurveOwners() {
23322
- var curveOwners = this._needRevertCurveOwners;
23323
- for(var i = 0, n = curveOwners.length; i < n; ++i){
23324
- curveOwners[i].revertDefaultValue();
23319
+ _proto._checkRevertOwner = function _checkRevertOwner(owner, additive) {
23320
+ if (additive && owner.updateMark !== this._updateMark) {
23321
+ owner.revertDefaultValue();
23325
23322
  }
23323
+ owner.updateMark = this._updateMark;
23326
23324
  };
23327
23325
  _create_class$2(Animator, [
23328
23326
  {
@@ -23352,13 +23350,13 @@ __decorate$1([
23352
23350
  ], Animator.prototype, "_controllerUpdateFlag", void 0);
23353
23351
  __decorate$1([
23354
23352
  ignoreClone
23355
- ], Animator.prototype, "_animatorLayersData", void 0);
23353
+ ], Animator.prototype, "_updateMark", void 0);
23356
23354
  __decorate$1([
23357
23355
  ignoreClone
23358
- ], Animator.prototype, "_curveOwnerPool", void 0);
23356
+ ], Animator.prototype, "_animatorLayersData", void 0);
23359
23357
  __decorate$1([
23360
23358
  ignoreClone
23361
- ], Animator.prototype, "_needRevertCurveOwners", void 0);
23359
+ ], Animator.prototype, "_curveOwnerPool", void 0);
23362
23360
  __decorate$1([
23363
23361
  ignoreClone
23364
23362
  ], Animator.prototype, "_animationEventHandlerPool", void 0);
@@ -27503,8 +27501,14 @@ var GLTFLoader = /*#__PURE__*/ function(Loader) {
27503
27501
  }
27504
27502
  });
27505
27503
  GLTFParser.defaultPipeline.parse(context).then(masterPromiseInfo.resolve).catch(function(e) {
27506
- console.error(e);
27507
- masterPromiseInfo.reject("Error loading glTF model from " + url + " .");
27504
+ var msg = "Error loading glTF model from " + url + " .";
27505
+ miniprogram$5.Logger.error(msg);
27506
+ masterPromiseInfo.reject(msg);
27507
+ context.defaultSceneRootPromiseInfo.reject(e);
27508
+ context.texturesPromiseInfo.reject(e);
27509
+ context.materialsPromiseInfo.reject(e);
27510
+ context.meshesPromiseInfo.reject(e);
27511
+ context.animationClipsPromiseInfo.reject(e);
27508
27512
  });
27509
27513
  return context.promiseMap;
27510
27514
  };
@@ -29033,7 +29037,7 @@ exports.MeshLoader = /*#__PURE__*/ function(Loader) {
29033
29037
  decode(data, resourceManager.engine).then(function(mesh) {
29034
29038
  resolve(mesh);
29035
29039
  });
29036
- });
29040
+ }).catch(reject);
29037
29041
  });
29038
29042
  };
29039
29043
  return MeshLoader;
@@ -29051,14 +29055,14 @@ exports.EditorTextureLoader = /*#__PURE__*/ function(Loader) {
29051
29055
  var _proto = EditorTextureLoader.prototype;
29052
29056
  _proto.load = function load(item, resourceManager) {
29053
29057
  var _this = this;
29054
- return new miniprogram$5.AssetPromise(function(resolve) {
29058
+ return new miniprogram$5.AssetPromise(function(resolve, reject) {
29055
29059
  _this.request(item.url, {
29056
29060
  type: "arraybuffer"
29057
29061
  }).then(function(data) {
29058
29062
  decode(data, resourceManager.engine).then(function(texture) {
29059
29063
  resolve(texture);
29060
29064
  });
29061
- });
29065
+ }).catch(reject);
29062
29066
  });
29063
29067
  };
29064
29068
  return EditorTextureLoader;
@@ -36253,7 +36257,7 @@ function _interopNamespace(e) {
36253
36257
  }
36254
36258
  var CoreObjects__namespace = /*#__PURE__*/ _interopNamespace(CoreObjects);
36255
36259
  //@ts-ignore
36256
- var version = "0.9.18";
36260
+ var version = "0.9.20";
36257
36261
  console.log("Galacean engine version: " + version);
36258
36262
  for(var key in CoreObjects__namespace){
36259
36263
  CoreObjects.Loader.registerClass(key, CoreObjects__namespace[key]);