@galacean/engine-spine 4.2.3 → 4.2.5

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.
@@ -5017,19 +5017,18 @@ function _async_to_generator(fn) {
5017
5017
  }
5018
5018
 
5019
5019
  var AssetManagerBase = /*#__PURE__*/ function() {
5020
- function AssetManagerBase(textureLoader, pathPrefix, downloader) {
5020
+ function AssetManagerBase(textureLoader, pathPrefix, downloader, cache) {
5021
5021
  if (pathPrefix === void 0) pathPrefix = "";
5022
5022
  if (downloader === void 0) downloader = new Downloader();
5023
+ if (cache === void 0) cache = new AssetCache();
5023
5024
  this.pathPrefix = "";
5024
- this.assets = {};
5025
- this.assetsRefCount = {};
5026
- this.assetsLoaded = {};
5027
5025
  this.errors = {};
5028
5026
  this.toLoad = 0;
5029
5027
  this.loaded = 0;
5030
5028
  this.textureLoader = textureLoader;
5031
5029
  this.pathPrefix = pathPrefix;
5032
5030
  this.downloader = downloader;
5031
+ this.cache = cache;
5033
5032
  }
5034
5033
  var _proto = AssetManagerBase.prototype;
5035
5034
  _proto.start = function start(path) {
@@ -5039,8 +5038,8 @@ var AssetManagerBase = /*#__PURE__*/ function() {
5039
5038
  _proto.success = function success(callback, path, asset) {
5040
5039
  this.toLoad--;
5041
5040
  this.loaded++;
5042
- this.assets[path] = asset;
5043
- this.assetsRefCount[path] = (this.assetsRefCount[path] || 0) + 1;
5041
+ this.cache.assets[path] = asset;
5042
+ this.cache.assetsRefCount[path] = (this.cache.assetsRefCount[path] || 0) + 1;
5044
5043
  if (callback) callback(path, asset);
5045
5044
  };
5046
5045
  _proto.error = function error(callback, path, message) {
@@ -5073,7 +5072,7 @@ var AssetManagerBase = /*#__PURE__*/ function() {
5073
5072
  if (error === void 0) error = function() {};
5074
5073
  path = this.start(path);
5075
5074
  if (this.reuseAssets(path, success, error)) return;
5076
- this.assetsLoaded[path] = new Promise(function(resolve, reject) {
5075
+ this.cache.assetsLoaded[path] = new Promise(function(resolve, reject) {
5077
5076
  _this.downloader.downloadBinary(path, function(data) {
5078
5077
  _this.success(success, path, data);
5079
5078
  resolve(data);
@@ -5101,7 +5100,7 @@ var AssetManagerBase = /*#__PURE__*/ function() {
5101
5100
  if (error === void 0) error = function() {};
5102
5101
  path = this.start(path);
5103
5102
  if (this.reuseAssets(path, success, error)) return;
5104
- this.assetsLoaded[path] = new Promise(function(resolve, reject) {
5103
+ this.cache.assetsLoaded[path] = new Promise(function(resolve, reject) {
5105
5104
  _this.downloader.downloadJson(path, function(data) {
5106
5105
  _this.success(success, path, data);
5107
5106
  resolve(data);
@@ -5116,11 +5115,15 @@ var AssetManagerBase = /*#__PURE__*/ function() {
5116
5115
  var _this = this;
5117
5116
  if (success === void 0) success = function() {};
5118
5117
  if (error === void 0) error = function() {};
5119
- var loadedStatus = this.assetsLoaded[path];
5118
+ var loadedStatus = this.cache.assetsLoaded[path];
5120
5119
  var alreadyExistsOrLoading = loadedStatus !== undefined;
5121
5120
  if (alreadyExistsOrLoading) {
5122
- loadedStatus.then(function(data) {
5123
- return _this.success(success, path, data);
5121
+ this.cache.assetsLoaded[path] = loadedStatus.then(function(data) {
5122
+ // necessary when user preloads an image into the cache.
5123
+ // texture loader is not avaiable in the cache, so we transform in GLTexture at first use
5124
+ data = _instanceof1(data, engineMiniprogramAdapter.Image) || _instanceof1(data, ImageBitmap) ? _this.textureLoader(data) : data;
5125
+ _this.success(success, path, data);
5126
+ return data;
5124
5127
  }).catch(function(errorMsg) {
5125
5128
  return _this.error(error, path, errorMsg);
5126
5129
  });
@@ -5133,7 +5136,7 @@ var AssetManagerBase = /*#__PURE__*/ function() {
5133
5136
  if (error === void 0) error = function() {};
5134
5137
  path = this.start(path);
5135
5138
  if (this.reuseAssets(path, success, error)) return;
5136
- this.assetsLoaded[path] = new Promise(function(resolve, reject) {
5139
+ this.cache.assetsLoaded[path] = new Promise(function(resolve, reject) {
5137
5140
  var isBrowser = !!(typeof engineMiniprogramAdapter.window !== 'undefined' && typeof engineMiniprogramAdapter.navigator !== 'undefined' && engineMiniprogramAdapter.window.document);
5138
5141
  var isWebWorker = !isBrowser; // && typeof importScripts !== 'undefined';
5139
5142
  if (isWebWorker) {
@@ -5182,7 +5185,7 @@ var AssetManagerBase = /*#__PURE__*/ function() {
5182
5185
  var parent = index >= 0 ? path.substring(0, index + 1) : "";
5183
5186
  path = this.start(path);
5184
5187
  if (this.reuseAssets(path, success, error)) return;
5185
- this.assetsLoaded[path] = new Promise(function(resolve, reject) {
5188
+ this.cache.assetsLoaded[path] = new Promise(function(resolve, reject) {
5186
5189
  _this.downloader.downloadText(path, function(atlasText) {
5187
5190
  try {
5188
5191
  var _loop = function() {
@@ -5197,7 +5200,7 @@ var AssetManagerBase = /*#__PURE__*/ function() {
5197
5200
  }
5198
5201
  }, function(imagePath, message) {
5199
5202
  if (!abort) {
5200
- var errorMsg = "Couldn't load texture atlas " + path + " page image: " + imagePath;
5203
+ var errorMsg = "Couldn't load texture " + path + " page image: " + imagePath;
5201
5204
  _this.error(error, path, errorMsg);
5202
5205
  reject(errorMsg);
5203
5206
  }
@@ -5225,7 +5228,7 @@ var AssetManagerBase = /*#__PURE__*/ function() {
5225
5228
  if (error === void 0) error = function() {};
5226
5229
  path = this.start(path);
5227
5230
  if (this.reuseAssets(path, success, error)) return;
5228
- this.assetsLoaded[path] = new Promise(function(resolve, reject) {
5231
+ this.cache.assetsLoaded[path] = new Promise(function(resolve, reject) {
5229
5232
  _this.downloader.downloadText(path, function(atlasText) {
5230
5233
  try {
5231
5234
  var atlas = new TextureAtlas(atlasText);
@@ -5334,33 +5337,36 @@ var AssetManagerBase = /*#__PURE__*/ function() {
5334
5337
  });
5335
5338
  }).call(this);
5336
5339
  };
5340
+ _proto.setCache = function setCache(cache) {
5341
+ this.cache = cache;
5342
+ };
5337
5343
  _proto.get = function get(path) {
5338
- return this.assets[this.pathPrefix + path];
5344
+ return this.cache.assets[this.pathPrefix + path];
5339
5345
  };
5340
5346
  _proto.require = function require(path) {
5341
5347
  path = this.pathPrefix + path;
5342
- var asset = this.assets[path];
5348
+ var asset = this.cache.assets[path];
5343
5349
  if (asset) return asset;
5344
5350
  var error = this.errors[path];
5345
5351
  throw Error("Asset not found: " + path + (error ? "\n" + error : ""));
5346
5352
  };
5347
5353
  _proto.remove = function remove(path) {
5348
5354
  path = this.pathPrefix + path;
5349
- var asset = this.assets[path];
5355
+ var asset = this.cache.assets[path];
5350
5356
  if (asset.dispose) asset.dispose();
5351
- delete this.assets[path];
5352
- delete this.assetsRefCount[path];
5353
- delete this.assetsLoaded[path];
5357
+ delete this.cache.assets[path];
5358
+ delete this.cache.assetsRefCount[path];
5359
+ delete this.cache.assetsLoaded[path];
5354
5360
  return asset;
5355
5361
  };
5356
5362
  _proto.removeAll = function removeAll() {
5357
- for(var path in this.assets){
5358
- var asset = this.assets[path];
5363
+ for(var path in this.cache.assets){
5364
+ var asset = this.cache.assets[path];
5359
5365
  if (asset.dispose) asset.dispose();
5360
5366
  }
5361
- this.assets = {};
5362
- this.assetsLoaded = {};
5363
- this.assetsRefCount = {};
5367
+ this.cache.assets = {};
5368
+ this.cache.assetsLoaded = {};
5369
+ this.cache.assetsRefCount = {};
5364
5370
  };
5365
5371
  _proto.isLoadingComplete = function isLoadingComplete() {
5366
5372
  return this.toLoad == 0;
@@ -5376,7 +5382,7 @@ var AssetManagerBase = /*#__PURE__*/ function() {
5376
5382
  };
5377
5383
  // dispose asset only if it's not used by others
5378
5384
  _proto.disposeAsset = function disposeAsset(path) {
5379
- if (--this.assetsRefCount[path] === 0) {
5385
+ if (--this.cache.assetsRefCount[path] === 0) {
5380
5386
  this.remove(path);
5381
5387
  }
5382
5388
  };
@@ -5388,6 +5394,44 @@ var AssetManagerBase = /*#__PURE__*/ function() {
5388
5394
  };
5389
5395
  return AssetManagerBase;
5390
5396
  }();
5397
+ var AssetCache = /*#__PURE__*/ function() {
5398
+ function AssetCache() {
5399
+ this.assets = {};
5400
+ this.assetsRefCount = {};
5401
+ this.assetsLoaded = {};
5402
+ }
5403
+ var _proto = AssetCache.prototype;
5404
+ _proto.addAsset = function addAsset(path, asset) {
5405
+ return _async_to_generator(function() {
5406
+ var _;
5407
+ return __generator(this, function(_state) {
5408
+ switch(_state.label){
5409
+ case 0:
5410
+ this.assetsLoaded[path] = Promise.resolve(asset);
5411
+ _ = this.assets;
5412
+ return [
5413
+ 4,
5414
+ asset
5415
+ ];
5416
+ case 1:
5417
+ _[path] = _state.sent();
5418
+ return [
5419
+ 2
5420
+ ];
5421
+ }
5422
+ });
5423
+ }).call(this);
5424
+ };
5425
+ AssetCache.getCache = function getCache(id) {
5426
+ var cache = AssetCache.AVAILABLE_CACHES.get(id);
5427
+ if (cache) return cache;
5428
+ var newCache = new AssetCache();
5429
+ AssetCache.AVAILABLE_CACHES.set(id, newCache);
5430
+ return newCache;
5431
+ };
5432
+ return AssetCache;
5433
+ }();
5434
+ AssetCache.AVAILABLE_CACHES = new Map();
5391
5435
  var Downloader = /*#__PURE__*/ function() {
5392
5436
  function Downloader() {
5393
5437
  this.callbacks = {};
@@ -11364,6 +11408,7 @@ SpineMaterial._spineFS = "\n #include <common>\n uniform sampler2D materia
11364
11408
  */ _this.defaultConfig = new SpineAnimationDefaultConfig(), /** @internal */ _this._subPrimitives = [], /** @internal */ _this._vertices = new Float32Array(), /** @internal */ _this._indices = new Uint16Array(), /** @internal */ _this._needResizeBuffer = false, /** @internal */ _this._vertexCount = 0, /** @internal */ _this._localBounds = new miniprogram.BoundingBox(new miniprogram.Vector3(Infinity, Infinity, Infinity), new miniprogram.Vector3(-Infinity, -Infinity, -Infinity));
11365
11409
  var primitive = new miniprogram.Primitive(_this._engine);
11366
11410
  _this._primitive = primitive;
11411
+ _this._primitive._addReferCount(1);
11367
11412
  primitive.addVertexElement(SpineAnimationRenderer._positionVertexElement);
11368
11413
  primitive.addVertexElement(SpineAnimationRenderer._lightColorVertexElement);
11369
11414
  primitive.addVertexElement(SpineAnimationRenderer._uvVertexElement);
@@ -11449,8 +11494,12 @@ SpineMaterial._spineFS = "\n #include <common>\n uniform sampler2D materia
11449
11494
  */ _proto._onDestroy = function _onDestroy() {
11450
11495
  this._clearMaterialCache();
11451
11496
  this._subPrimitives.length = 0;
11452
- this._primitive && this._primitive.destroy();
11453
- this._primitive = null;
11497
+ var primitive = this._primitive;
11498
+ if (primitive) {
11499
+ primitive._addReferCount(-1);
11500
+ primitive.destroy();
11501
+ this._primitive = null;
11502
+ }
11454
11503
  this._resource = null;
11455
11504
  this._skeleton = null;
11456
11505
  this._state = null;
@@ -12011,7 +12060,7 @@ for(var key in RendererObject){
12011
12060
  for(var key1 in LoaderObject){
12012
12061
  miniprogram.Loader.registerClass(key1, LoaderObject[key1]);
12013
12062
  }
12014
- var version = "4.2.3";
12063
+ var version = "4.2.5";
12015
12064
  console.log("Galacean spine version: " + version);
12016
12065
 
12017
12066
  exports.AlphaTimeline = AlphaTimeline;
@@ -12019,6 +12068,7 @@ exports.Animation = Animation;
12019
12068
  exports.AnimationState = AnimationState;
12020
12069
  exports.AnimationStateAdapter = AnimationStateAdapter;
12021
12070
  exports.AnimationStateData = AnimationStateData;
12071
+ exports.AssetCache = AssetCache;
12022
12072
  exports.AssetManagerBase = AssetManagerBase;
12023
12073
  exports.AtlasAttachmentLoader = AtlasAttachmentLoader;
12024
12074
  exports.Attachment = Attachment;
package/dist/module.js CHANGED
@@ -5012,19 +5012,18 @@ function _async_to_generator(fn) {
5012
5012
  }
5013
5013
 
5014
5014
  var AssetManagerBase = /*#__PURE__*/ function() {
5015
- function AssetManagerBase(textureLoader, pathPrefix, downloader) {
5015
+ function AssetManagerBase(textureLoader, pathPrefix, downloader, cache) {
5016
5016
  if (pathPrefix === void 0) pathPrefix = "";
5017
5017
  if (downloader === void 0) downloader = new Downloader();
5018
+ if (cache === void 0) cache = new AssetCache();
5018
5019
  this.pathPrefix = "";
5019
- this.assets = {};
5020
- this.assetsRefCount = {};
5021
- this.assetsLoaded = {};
5022
5020
  this.errors = {};
5023
5021
  this.toLoad = 0;
5024
5022
  this.loaded = 0;
5025
5023
  this.textureLoader = textureLoader;
5026
5024
  this.pathPrefix = pathPrefix;
5027
5025
  this.downloader = downloader;
5026
+ this.cache = cache;
5028
5027
  }
5029
5028
  var _proto = AssetManagerBase.prototype;
5030
5029
  _proto.start = function start(path) {
@@ -5034,8 +5033,8 @@ var AssetManagerBase = /*#__PURE__*/ function() {
5034
5033
  _proto.success = function success(callback, path, asset) {
5035
5034
  this.toLoad--;
5036
5035
  this.loaded++;
5037
- this.assets[path] = asset;
5038
- this.assetsRefCount[path] = (this.assetsRefCount[path] || 0) + 1;
5036
+ this.cache.assets[path] = asset;
5037
+ this.cache.assetsRefCount[path] = (this.cache.assetsRefCount[path] || 0) + 1;
5039
5038
  if (callback) callback(path, asset);
5040
5039
  };
5041
5040
  _proto.error = function error(callback, path, message) {
@@ -5068,7 +5067,7 @@ var AssetManagerBase = /*#__PURE__*/ function() {
5068
5067
  if (error === void 0) error = function() {};
5069
5068
  path = this.start(path);
5070
5069
  if (this.reuseAssets(path, success, error)) return;
5071
- this.assetsLoaded[path] = new Promise(function(resolve, reject) {
5070
+ this.cache.assetsLoaded[path] = new Promise(function(resolve, reject) {
5072
5071
  _this.downloader.downloadBinary(path, function(data) {
5073
5072
  _this.success(success, path, data);
5074
5073
  resolve(data);
@@ -5096,7 +5095,7 @@ var AssetManagerBase = /*#__PURE__*/ function() {
5096
5095
  if (error === void 0) error = function() {};
5097
5096
  path = this.start(path);
5098
5097
  if (this.reuseAssets(path, success, error)) return;
5099
- this.assetsLoaded[path] = new Promise(function(resolve, reject) {
5098
+ this.cache.assetsLoaded[path] = new Promise(function(resolve, reject) {
5100
5099
  _this.downloader.downloadJson(path, function(data) {
5101
5100
  _this.success(success, path, data);
5102
5101
  resolve(data);
@@ -5111,11 +5110,15 @@ var AssetManagerBase = /*#__PURE__*/ function() {
5111
5110
  var _this = this;
5112
5111
  if (success === void 0) success = function() {};
5113
5112
  if (error === void 0) error = function() {};
5114
- var loadedStatus = this.assetsLoaded[path];
5113
+ var loadedStatus = this.cache.assetsLoaded[path];
5115
5114
  var alreadyExistsOrLoading = loadedStatus !== undefined;
5116
5115
  if (alreadyExistsOrLoading) {
5117
- loadedStatus.then(function(data) {
5118
- return _this.success(success, path, data);
5116
+ this.cache.assetsLoaded[path] = loadedStatus.then(function(data) {
5117
+ // necessary when user preloads an image into the cache.
5118
+ // texture loader is not avaiable in the cache, so we transform in GLTexture at first use
5119
+ data = _instanceof1(data, Image) || _instanceof1(data, ImageBitmap) ? _this.textureLoader(data) : data;
5120
+ _this.success(success, path, data);
5121
+ return data;
5119
5122
  }).catch(function(errorMsg) {
5120
5123
  return _this.error(error, path, errorMsg);
5121
5124
  });
@@ -5128,7 +5131,7 @@ var AssetManagerBase = /*#__PURE__*/ function() {
5128
5131
  if (error === void 0) error = function() {};
5129
5132
  path = this.start(path);
5130
5133
  if (this.reuseAssets(path, success, error)) return;
5131
- this.assetsLoaded[path] = new Promise(function(resolve, reject) {
5134
+ this.cache.assetsLoaded[path] = new Promise(function(resolve, reject) {
5132
5135
  var isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document);
5133
5136
  var isWebWorker = !isBrowser; // && typeof importScripts !== 'undefined';
5134
5137
  if (isWebWorker) {
@@ -5177,7 +5180,7 @@ var AssetManagerBase = /*#__PURE__*/ function() {
5177
5180
  var parent = index >= 0 ? path.substring(0, index + 1) : "";
5178
5181
  path = this.start(path);
5179
5182
  if (this.reuseAssets(path, success, error)) return;
5180
- this.assetsLoaded[path] = new Promise(function(resolve, reject) {
5183
+ this.cache.assetsLoaded[path] = new Promise(function(resolve, reject) {
5181
5184
  _this.downloader.downloadText(path, function(atlasText) {
5182
5185
  try {
5183
5186
  var _loop = function() {
@@ -5192,7 +5195,7 @@ var AssetManagerBase = /*#__PURE__*/ function() {
5192
5195
  }
5193
5196
  }, function(imagePath, message) {
5194
5197
  if (!abort) {
5195
- var errorMsg = "Couldn't load texture atlas " + path + " page image: " + imagePath;
5198
+ var errorMsg = "Couldn't load texture " + path + " page image: " + imagePath;
5196
5199
  _this.error(error, path, errorMsg);
5197
5200
  reject(errorMsg);
5198
5201
  }
@@ -5220,7 +5223,7 @@ var AssetManagerBase = /*#__PURE__*/ function() {
5220
5223
  if (error === void 0) error = function() {};
5221
5224
  path = this.start(path);
5222
5225
  if (this.reuseAssets(path, success, error)) return;
5223
- this.assetsLoaded[path] = new Promise(function(resolve, reject) {
5226
+ this.cache.assetsLoaded[path] = new Promise(function(resolve, reject) {
5224
5227
  _this.downloader.downloadText(path, function(atlasText) {
5225
5228
  try {
5226
5229
  var atlas = new TextureAtlas(atlasText);
@@ -5329,33 +5332,36 @@ var AssetManagerBase = /*#__PURE__*/ function() {
5329
5332
  });
5330
5333
  }).call(this);
5331
5334
  };
5335
+ _proto.setCache = function setCache(cache) {
5336
+ this.cache = cache;
5337
+ };
5332
5338
  _proto.get = function get(path) {
5333
- return this.assets[this.pathPrefix + path];
5339
+ return this.cache.assets[this.pathPrefix + path];
5334
5340
  };
5335
5341
  _proto.require = function require(path) {
5336
5342
  path = this.pathPrefix + path;
5337
- var asset = this.assets[path];
5343
+ var asset = this.cache.assets[path];
5338
5344
  if (asset) return asset;
5339
5345
  var error = this.errors[path];
5340
5346
  throw Error("Asset not found: " + path + (error ? "\n" + error : ""));
5341
5347
  };
5342
5348
  _proto.remove = function remove(path) {
5343
5349
  path = this.pathPrefix + path;
5344
- var asset = this.assets[path];
5350
+ var asset = this.cache.assets[path];
5345
5351
  if (asset.dispose) asset.dispose();
5346
- delete this.assets[path];
5347
- delete this.assetsRefCount[path];
5348
- delete this.assetsLoaded[path];
5352
+ delete this.cache.assets[path];
5353
+ delete this.cache.assetsRefCount[path];
5354
+ delete this.cache.assetsLoaded[path];
5349
5355
  return asset;
5350
5356
  };
5351
5357
  _proto.removeAll = function removeAll() {
5352
- for(var path in this.assets){
5353
- var asset = this.assets[path];
5358
+ for(var path in this.cache.assets){
5359
+ var asset = this.cache.assets[path];
5354
5360
  if (asset.dispose) asset.dispose();
5355
5361
  }
5356
- this.assets = {};
5357
- this.assetsLoaded = {};
5358
- this.assetsRefCount = {};
5362
+ this.cache.assets = {};
5363
+ this.cache.assetsLoaded = {};
5364
+ this.cache.assetsRefCount = {};
5359
5365
  };
5360
5366
  _proto.isLoadingComplete = function isLoadingComplete() {
5361
5367
  return this.toLoad == 0;
@@ -5371,7 +5377,7 @@ var AssetManagerBase = /*#__PURE__*/ function() {
5371
5377
  };
5372
5378
  // dispose asset only if it's not used by others
5373
5379
  _proto.disposeAsset = function disposeAsset(path) {
5374
- if (--this.assetsRefCount[path] === 0) {
5380
+ if (--this.cache.assetsRefCount[path] === 0) {
5375
5381
  this.remove(path);
5376
5382
  }
5377
5383
  };
@@ -5383,6 +5389,44 @@ var AssetManagerBase = /*#__PURE__*/ function() {
5383
5389
  };
5384
5390
  return AssetManagerBase;
5385
5391
  }();
5392
+ var AssetCache = /*#__PURE__*/ function() {
5393
+ function AssetCache() {
5394
+ this.assets = {};
5395
+ this.assetsRefCount = {};
5396
+ this.assetsLoaded = {};
5397
+ }
5398
+ var _proto = AssetCache.prototype;
5399
+ _proto.addAsset = function addAsset(path, asset) {
5400
+ return _async_to_generator(function() {
5401
+ var _;
5402
+ return __generator(this, function(_state) {
5403
+ switch(_state.label){
5404
+ case 0:
5405
+ this.assetsLoaded[path] = Promise.resolve(asset);
5406
+ _ = this.assets;
5407
+ return [
5408
+ 4,
5409
+ asset
5410
+ ];
5411
+ case 1:
5412
+ _[path] = _state.sent();
5413
+ return [
5414
+ 2
5415
+ ];
5416
+ }
5417
+ });
5418
+ }).call(this);
5419
+ };
5420
+ AssetCache.getCache = function getCache(id) {
5421
+ var cache = AssetCache.AVAILABLE_CACHES.get(id);
5422
+ if (cache) return cache;
5423
+ var newCache = new AssetCache();
5424
+ AssetCache.AVAILABLE_CACHES.set(id, newCache);
5425
+ return newCache;
5426
+ };
5427
+ return AssetCache;
5428
+ }();
5429
+ AssetCache.AVAILABLE_CACHES = new Map();
5386
5430
  var Downloader = /*#__PURE__*/ function() {
5387
5431
  function Downloader() {
5388
5432
  this.callbacks = {};
@@ -11359,6 +11403,7 @@ SpineMaterial._spineFS = "\n #include <common>\n uniform sampler2D materia
11359
11403
  */ _this.defaultConfig = new SpineAnimationDefaultConfig(), /** @internal */ _this._subPrimitives = [], /** @internal */ _this._vertices = new Float32Array(), /** @internal */ _this._indices = new Uint16Array(), /** @internal */ _this._needResizeBuffer = false, /** @internal */ _this._vertexCount = 0, /** @internal */ _this._localBounds = new BoundingBox(new Vector3(Infinity, Infinity, Infinity), new Vector3(-Infinity, -Infinity, -Infinity));
11360
11404
  var primitive = new Primitive(_this._engine);
11361
11405
  _this._primitive = primitive;
11406
+ _this._primitive._addReferCount(1);
11362
11407
  primitive.addVertexElement(SpineAnimationRenderer._positionVertexElement);
11363
11408
  primitive.addVertexElement(SpineAnimationRenderer._lightColorVertexElement);
11364
11409
  primitive.addVertexElement(SpineAnimationRenderer._uvVertexElement);
@@ -11444,8 +11489,12 @@ SpineMaterial._spineFS = "\n #include <common>\n uniform sampler2D materia
11444
11489
  */ _proto._onDestroy = function _onDestroy() {
11445
11490
  this._clearMaterialCache();
11446
11491
  this._subPrimitives.length = 0;
11447
- this._primitive && this._primitive.destroy();
11448
- this._primitive = null;
11492
+ var primitive = this._primitive;
11493
+ if (primitive) {
11494
+ primitive._addReferCount(-1);
11495
+ primitive.destroy();
11496
+ this._primitive = null;
11497
+ }
11449
11498
  this._resource = null;
11450
11499
  this._skeleton = null;
11451
11500
  this._state = null;
@@ -12006,8 +12055,8 @@ for(var key in RendererObject){
12006
12055
  for(var key1 in LoaderObject){
12007
12056
  Loader.registerClass(key1, LoaderObject[key1]);
12008
12057
  }
12009
- var version = "4.2.3";
12058
+ var version = "4.2.5";
12010
12059
  console.log("Galacean spine version: " + version);
12011
12060
 
12012
- export { AlphaTimeline, Animation, AnimationState, AnimationStateAdapter, AnimationStateData, AssetManagerBase, AtlasAttachmentLoader, Attachment, AttachmentTimeline, BinaryInput, BlendMode, Bone, BoneData, BoundingBoxAttachment, CURRENT, ClippingAttachment, Color, ConstraintData, CurveTimeline, CurveTimeline1, CurveTimeline2, DebugUtils, DeformTimeline, Downloader, DrawOrderTimeline, Event, EventData, EventQueue, EventTimeline, EventType, FIRST, FakeTexture, HOLD_FIRST, HOLD_MIX, HOLD_SUBSEQUENT, IkConstraint, IkConstraintData, IkConstraintTimeline, Inherit, InheritTimeline, IntSet, Interpolation, LoaderUtils, MathUtils, MeshAttachment, MixBlend, MixDirection, PathAttachment, PathConstraint, PathConstraintData, PathConstraintMixTimeline, PathConstraintPositionTimeline, PathConstraintSpacingTimeline, Physics, PhysicsConstraintDampingTimeline, PhysicsConstraintGravityTimeline, PhysicsConstraintInertiaTimeline, PhysicsConstraintMassTimeline, PhysicsConstraintMixTimeline, PhysicsConstraintResetTimeline, PhysicsConstraintStrengthTimeline, PhysicsConstraintTimeline, PhysicsConstraintWindTimeline, PointAttachment, Pool, PositionMode, Pow, PowOut, RGB2Timeline, RGBA2Timeline, RGBATimeline, RGBTimeline, RegionAttachment, RotateMode, RotateTimeline, SETUP, SUBSEQUENT, ScaleTimeline, ScaleXTimeline, ScaleYTimeline, SequenceTimeline, ShearTimeline, ShearXTimeline, ShearYTimeline, Skeleton, SkeletonBinary, SkeletonBounds, SkeletonClipping, SkeletonData, SkeletonJson, Skin, SkinEntry, Slot, SlotData, SpacingMode, SpineAnimationRenderer, SpineMaterial, SpineResource, StringSet, Texture, TextureAtlas, TextureAtlasPage, TextureAtlasRegion, TextureFilter, TextureRegion, TextureWrap, TimeKeeper, Timeline, TrackEntry, TransformConstraint, TransformConstraintData, TransformConstraintTimeline, TranslateTimeline, TranslateXTimeline, TranslateYTimeline, Triangulator, Utils, Vector2, VertexAttachment, WindowedMean, version };
12061
+ export { AlphaTimeline, Animation, AnimationState, AnimationStateAdapter, AnimationStateData, AssetCache, AssetManagerBase, AtlasAttachmentLoader, Attachment, AttachmentTimeline, BinaryInput, BlendMode, Bone, BoneData, BoundingBoxAttachment, CURRENT, ClippingAttachment, Color, ConstraintData, CurveTimeline, CurveTimeline1, CurveTimeline2, DebugUtils, DeformTimeline, Downloader, DrawOrderTimeline, Event, EventData, EventQueue, EventTimeline, EventType, FIRST, FakeTexture, HOLD_FIRST, HOLD_MIX, HOLD_SUBSEQUENT, IkConstraint, IkConstraintData, IkConstraintTimeline, Inherit, InheritTimeline, IntSet, Interpolation, LoaderUtils, MathUtils, MeshAttachment, MixBlend, MixDirection, PathAttachment, PathConstraint, PathConstraintData, PathConstraintMixTimeline, PathConstraintPositionTimeline, PathConstraintSpacingTimeline, Physics, PhysicsConstraintDampingTimeline, PhysicsConstraintGravityTimeline, PhysicsConstraintInertiaTimeline, PhysicsConstraintMassTimeline, PhysicsConstraintMixTimeline, PhysicsConstraintResetTimeline, PhysicsConstraintStrengthTimeline, PhysicsConstraintTimeline, PhysicsConstraintWindTimeline, PointAttachment, Pool, PositionMode, Pow, PowOut, RGB2Timeline, RGBA2Timeline, RGBATimeline, RGBTimeline, RegionAttachment, RotateMode, RotateTimeline, SETUP, SUBSEQUENT, ScaleTimeline, ScaleXTimeline, ScaleYTimeline, SequenceTimeline, ShearTimeline, ShearXTimeline, ShearYTimeline, Skeleton, SkeletonBinary, SkeletonBounds, SkeletonClipping, SkeletonData, SkeletonJson, Skin, SkinEntry, Slot, SlotData, SpacingMode, SpineAnimationRenderer, SpineMaterial, SpineResource, StringSet, Texture, TextureAtlas, TextureAtlasPage, TextureAtlasRegion, TextureFilter, TextureRegion, TextureWrap, TimeKeeper, Timeline, TrackEntry, TransformConstraint, TransformConstraintData, TransformConstraintTimeline, TranslateTimeline, TranslateXTimeline, TranslateYTimeline, Triangulator, Utils, Vector2, VertexAttachment, WindowedMean, version };
12013
12062
  //# sourceMappingURL=module.js.map