@galacean/effects 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.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime player 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
  'use strict';
@@ -23470,6 +23470,26 @@ var AssetManager = /** @class */ (function () {
23470
23470
  var _a = options.timeout, timeout = _a === void 0 ? 10 : _a;
23471
23471
  this.timeout = timeout;
23472
23472
  };
23473
+ /**
23474
+ * 根据用户传入的参数修改场景数据
23475
+ */
23476
+ AssetManager.prototype.updateSceneData = function (compositions) {
23477
+ var variables = this.options.variables;
23478
+ if (!variables || Object.keys(variables).length <= 0) {
23479
+ return compositions;
23480
+ }
23481
+ compositions.forEach(function (composition) {
23482
+ composition.items.forEach(function (item) {
23483
+ if (item.type === ItemType$1.text) {
23484
+ var textVariable = variables[item.name];
23485
+ if (textVariable) {
23486
+ item.content.options.text = textVariable;
23487
+ }
23488
+ }
23489
+ });
23490
+ });
23491
+ return compositions;
23492
+ };
23473
23493
  /**
23474
23494
  * 场景创建,通过 json 创建出场景对象,并进行提前编译等工作
23475
23495
  * @param url - json 的 URL 链接或者 json 对象
@@ -23561,6 +23581,7 @@ var AssetManager = /** @class */ (function () {
23561
23581
  for (i = 0; i < scene.images.length; i++) {
23562
23582
  scene.textureOptions[i].image = scene.images[i];
23563
23583
  }
23584
+ scene.jsonScene.compositions = this.updateSceneData(scene.jsonScene.compositions);
23564
23585
  _e.label = 5;
23565
23586
  case 5: return [3 /*break*/, 12];
23566
23587
  case 6: return [4 /*yield*/, hookTimeInfo('processJSON', function () { return _this.processJSON(rawJSON); })];
@@ -23580,6 +23601,7 @@ var AssetManager = /** @class */ (function () {
23580
23601
  return [4 /*yield*/, hookTimeInfo('processTextures', function () { return _this.processTextures(loadedImages_1, loadedBins_1, jsonScene_1); })];
23581
23602
  case 10:
23582
23603
  loadedTextures = _e.sent();
23604
+ jsonScene_1.compositions = this.updateSceneData(jsonScene_1.compositions);
23583
23605
  scene = {
23584
23606
  url: url,
23585
23607
  renderLevel: this.options.renderLevel,
@@ -30424,7 +30446,7 @@ Renderer.create = function (canvas, framework, renderOptions) {
30424
30446
  Engine.create = function (gl) {
30425
30447
  return new GLEngine(gl);
30426
30448
  };
30427
- var version = "1.2.2";
30449
+ var version = "1.2.3";
30428
30450
  logger.info('player version: ' + version);
30429
30451
 
30430
30452
  exports.AbstractPlugin = AbstractPlugin;