@galacean/effects-core 1.2.2 → 1.2.3

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/index.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime core for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v1.2.2
6
+ * Version: v1.2.3
7
7
  */
8
8
 
9
9
  /******************************************************************************
@@ -23466,6 +23466,26 @@ var AssetManager = /** @class */ (function () {
23466
23466
  var _a = options.timeout, timeout = _a === void 0 ? 10 : _a;
23467
23467
  this.timeout = timeout;
23468
23468
  };
23469
+ /**
23470
+ * 根据用户传入的参数修改场景数据
23471
+ */
23472
+ AssetManager.prototype.updateSceneData = function (compositions) {
23473
+ var variables = this.options.variables;
23474
+ if (!variables || Object.keys(variables).length <= 0) {
23475
+ return compositions;
23476
+ }
23477
+ compositions.forEach(function (composition) {
23478
+ composition.items.forEach(function (item) {
23479
+ if (item.type === ItemType$1.text) {
23480
+ var textVariable = variables[item.name];
23481
+ if (textVariable) {
23482
+ item.content.options.text = textVariable;
23483
+ }
23484
+ }
23485
+ });
23486
+ });
23487
+ return compositions;
23488
+ };
23469
23489
  /**
23470
23490
  * 场景创建,通过 json 创建出场景对象,并进行提前编译等工作
23471
23491
  * @param url - json 的 URL 链接或者 json 对象
@@ -23557,6 +23577,7 @@ var AssetManager = /** @class */ (function () {
23557
23577
  for (i = 0; i < scene.images.length; i++) {
23558
23578
  scene.textureOptions[i].image = scene.images[i];
23559
23579
  }
23580
+ scene.jsonScene.compositions = this.updateSceneData(scene.jsonScene.compositions);
23560
23581
  _e.label = 5;
23561
23582
  case 5: return [3 /*break*/, 12];
23562
23583
  case 6: return [4 /*yield*/, hookTimeInfo('processJSON', function () { return _this.processJSON(rawJSON); })];
@@ -23576,6 +23597,7 @@ var AssetManager = /** @class */ (function () {
23576
23597
  return [4 /*yield*/, hookTimeInfo('processTextures', function () { return _this.processTextures(loadedImages_1, loadedBins_1, jsonScene_1); })];
23577
23598
  case 10:
23578
23599
  loadedTextures = _e.sent();
23600
+ jsonScene_1.compositions = this.updateSceneData(jsonScene_1.compositions);
23579
23601
  scene = {
23580
23602
  url: url,
23581
23603
  renderLevel: this.options.renderLevel,