@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/asset-manager.d.ts +5 -1
- package/dist/index.js +23 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/asset-manager.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as spec from '@galacean/effects-specification';
|
|
2
2
|
import { Downloader } from './downloader';
|
|
3
3
|
import type { Disposable } from './utils';
|
|
4
4
|
import type { Scene } from './scene';
|
|
@@ -112,6 +112,10 @@ export declare class AssetManager implements Disposable {
|
|
|
112
112
|
*/
|
|
113
113
|
constructor(options?: SceneLoadOptions, downloader?: Downloader);
|
|
114
114
|
updateOptions(options?: SceneLoadOptions): void;
|
|
115
|
+
/**
|
|
116
|
+
* 根据用户传入的参数修改场景数据
|
|
117
|
+
*/
|
|
118
|
+
private updateSceneData;
|
|
115
119
|
/**
|
|
116
120
|
* 场景创建,通过 json 创建出场景对象,并进行提前编译等工作
|
|
117
121
|
* @param url - json 的 URL 链接或者 json 对象
|
package/dist/index.js
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.
|
|
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,
|