@galacean/effects-threejs 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 threejs plugin 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';
@@ -23492,6 +23492,26 @@ var AssetManager = /** @class */ (function () {
23492
23492
  var _a = options.timeout, timeout = _a === void 0 ? 10 : _a;
23493
23493
  this.timeout = timeout;
23494
23494
  };
23495
+ /**
23496
+ * 根据用户传入的参数修改场景数据
23497
+ */
23498
+ AssetManager.prototype.updateSceneData = function (compositions) {
23499
+ var variables = this.options.variables;
23500
+ if (!variables || Object.keys(variables).length <= 0) {
23501
+ return compositions;
23502
+ }
23503
+ compositions.forEach(function (composition) {
23504
+ composition.items.forEach(function (item) {
23505
+ if (item.type === ItemType$1.text) {
23506
+ var textVariable = variables[item.name];
23507
+ if (textVariable) {
23508
+ item.content.options.text = textVariable;
23509
+ }
23510
+ }
23511
+ });
23512
+ });
23513
+ return compositions;
23514
+ };
23495
23515
  /**
23496
23516
  * 场景创建,通过 json 创建出场景对象,并进行提前编译等工作
23497
23517
  * @param url - json 的 URL 链接或者 json 对象
@@ -23583,6 +23603,7 @@ var AssetManager = /** @class */ (function () {
23583
23603
  for (i = 0; i < scene.images.length; i++) {
23584
23604
  scene.textureOptions[i].image = scene.images[i];
23585
23605
  }
23606
+ scene.jsonScene.compositions = this.updateSceneData(scene.jsonScene.compositions);
23586
23607
  _e.label = 5;
23587
23608
  case 5: return [3 /*break*/, 12];
23588
23609
  case 6: return [4 /*yield*/, hookTimeInfo('processJSON', function () { return _this.processJSON(rawJSON); })];
@@ -23602,6 +23623,7 @@ var AssetManager = /** @class */ (function () {
23602
23623
  return [4 /*yield*/, hookTimeInfo('processTextures', function () { return _this.processTextures(loadedImages_1, loadedBins_1, jsonScene_1); })];
23603
23624
  case 10:
23604
23625
  loadedTextures = _e.sent();
23626
+ jsonScene_1.compositions = this.updateSceneData(jsonScene_1.compositions);
23605
23627
  scene = {
23606
23628
  url: url,
23607
23629
  renderLevel: this.options.renderLevel,
@@ -26913,7 +26935,7 @@ Geometry.create = function (engine, options) {
26913
26935
  Mesh.create = function (engine, props) {
26914
26936
  return new ThreeMesh(engine, props);
26915
26937
  };
26916
- var version = "1.2.2";
26938
+ var version = "1.2.3";
26917
26939
  logger.info('THREEJS plugin version: ' + version);
26918
26940
 
26919
26941
  exports.AbstractPlugin = AbstractPlugin;