@galacean/effects-core 2.4.6 → 2.4.8
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/composition.d.ts +1 -2
- package/dist/index.js +56 -90
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -90
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/text/text-item.d.ts +3 -2
- package/dist/scene.d.ts +2 -1
- package/package.json +1 -1
package/dist/composition.d.ts
CHANGED
|
@@ -357,7 +357,6 @@ export declare class Composition extends EventEmitter<CompositionEvent<Compositi
|
|
|
357
357
|
*/
|
|
358
358
|
update(deltaTime: number): void;
|
|
359
359
|
private shouldDispose;
|
|
360
|
-
private getUpdateTime;
|
|
361
360
|
private callAwake;
|
|
362
361
|
/**
|
|
363
362
|
* 更新视频数据到纹理
|
|
@@ -377,7 +376,7 @@ export declare class Composition extends EventEmitter<CompositionEvent<Compositi
|
|
|
377
376
|
/**
|
|
378
377
|
* 更新主合成组件
|
|
379
378
|
*/
|
|
380
|
-
private
|
|
379
|
+
private updateCompositionTime;
|
|
381
380
|
/**
|
|
382
381
|
* 通过名称获取元素
|
|
383
382
|
* @param name - 元素名称
|
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: v2.4.
|
|
6
|
+
* Version: v2.4.8
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -20139,7 +20139,7 @@ var RuntimeClip = /*#__PURE__*/ function() {
|
|
|
20139
20139
|
this.playable.play();
|
|
20140
20140
|
}
|
|
20141
20141
|
this.parentMixer.setClipWeight(this.playable, weight);
|
|
20142
|
-
var clipTime =
|
|
20142
|
+
var clipTime = clip.toLocalTime(localTime);
|
|
20143
20143
|
this.playable.setTime(clipTime);
|
|
20144
20144
|
// 判断动画是否结束
|
|
20145
20145
|
if (ended) {
|
|
@@ -21139,13 +21139,12 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
21139
21139
|
_this._textures = [];
|
|
21140
21140
|
var _props_reusable = props.reusable, reusable = _props_reusable === void 0 ? false : _props_reusable, _props_speed = props.speed, speed = _props_speed === void 0 ? 1 : _props_speed, _props_baseRenderOrder = props.baseRenderOrder, baseRenderOrder = _props_baseRenderOrder === void 0 ? 0 : _props_baseRenderOrder, renderer = props.renderer, event = props.event, width = props.width, height = props.height, handleItemMessage = props.handleItemMessage;
|
|
21141
21141
|
_this.renderer = renderer;
|
|
21142
|
-
_this._textures = scene.
|
|
21142
|
+
_this._textures = scene.textures;
|
|
21143
21143
|
var _scene_jsonScene_renderSettings_postProcessingEnabled;
|
|
21144
21144
|
_this.postProcessingEnabled = (_scene_jsonScene_renderSettings_postProcessingEnabled = (_scene_jsonScene_renderSettings = scene.jsonScene.renderSettings) == null ? void 0 : _scene_jsonScene_renderSettings.postProcessingEnabled) != null ? _scene_jsonScene_renderSettings_postProcessingEnabled : false;
|
|
21145
21145
|
_this.getEngine().renderLevel = scene.renderLevel;
|
|
21146
21146
|
if (reusable) {
|
|
21147
21147
|
_this.keepResource = true;
|
|
21148
|
-
scene.textures = undefined;
|
|
21149
21148
|
scene.consumed = true;
|
|
21150
21149
|
}
|
|
21151
21150
|
var sourceContent = scene.jsonScene.compositions[0];
|
|
@@ -21329,11 +21328,12 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
21329
21328
|
* 前进合成到指定时间
|
|
21330
21329
|
* @param time - 相对0时刻的时间
|
|
21331
21330
|
*/ _proto.forwardTime = function forwardTime(time) {
|
|
21332
|
-
var deltaTime = time * 1000 - this.
|
|
21331
|
+
var deltaTime = time * 1000 - this.time * 1000;
|
|
21333
21332
|
var reverse = deltaTime < 0;
|
|
21334
21333
|
var step = 15;
|
|
21335
21334
|
var t = Math.abs(deltaTime);
|
|
21336
21335
|
var ss = reverse ? -step : step;
|
|
21336
|
+
// FIXME Update 中可能会修改合成时间,这边需要优化更新逻辑
|
|
21337
21337
|
for(t; t > step; t -= step){
|
|
21338
21338
|
this.update(ss);
|
|
21339
21339
|
}
|
|
@@ -21373,13 +21373,14 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
21373
21373
|
this.callAwake(this.rootItem);
|
|
21374
21374
|
this.rootItem.beginPlay();
|
|
21375
21375
|
}
|
|
21376
|
-
var
|
|
21377
|
-
this.
|
|
21376
|
+
var previousCompositionTime = this.time;
|
|
21377
|
+
this.updateCompositionTime(deltaTime * this.speed / 1000);
|
|
21378
|
+
var deltaTimeInMs = (this.time - previousCompositionTime) * 1000;
|
|
21378
21379
|
this.updateVideo();
|
|
21379
21380
|
// 更新 model-tree-plugin
|
|
21380
|
-
this.updatePluginLoaders(
|
|
21381
|
-
this.sceneTicking.update.tick(
|
|
21382
|
-
this.sceneTicking.lateUpdate.tick(
|
|
21381
|
+
this.updatePluginLoaders(deltaTimeInMs);
|
|
21382
|
+
this.sceneTicking.update.tick(deltaTimeInMs);
|
|
21383
|
+
this.sceneTicking.lateUpdate.tick(deltaTimeInMs);
|
|
21383
21384
|
this.updateCamera();
|
|
21384
21385
|
this.prepareRender();
|
|
21385
21386
|
if (this.isEnded && !this.isEndCalled) {
|
|
@@ -21395,14 +21396,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
21395
21396
|
_proto.shouldDispose = function shouldDispose() {
|
|
21396
21397
|
return this.isEnded && this.rootItem.endBehavior === EndBehavior.destroy && !this.reusable;
|
|
21397
21398
|
};
|
|
21398
|
-
_proto.getUpdateTime = function getUpdateTime(t) {
|
|
21399
|
-
var startTimeInMs = this.startTime * 1000;
|
|
21400
|
-
var now = this.rootComposition.time * 1000;
|
|
21401
|
-
if (t < 0 && now + t < startTimeInMs) {
|
|
21402
|
-
return startTimeInMs - now;
|
|
21403
|
-
}
|
|
21404
|
-
return t;
|
|
21405
|
-
};
|
|
21406
21399
|
_proto.callAwake = function callAwake(item) {
|
|
21407
21400
|
for(var _iterator = _create_for_of_iterator_helper_loose(item.components), _step; !(_step = _iterator()).done;){
|
|
21408
21401
|
var component = _step.value;
|
|
@@ -21447,14 +21440,18 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
21447
21440
|
};
|
|
21448
21441
|
/**
|
|
21449
21442
|
* 更新主合成组件
|
|
21450
|
-
*/ _proto.
|
|
21443
|
+
*/ _proto.updateCompositionTime = function updateCompositionTime(deltaTime) {
|
|
21451
21444
|
if (this.rootComposition.state === PlayState.Paused || !this.rootComposition.isActiveAndEnabled) {
|
|
21452
21445
|
return;
|
|
21453
21446
|
}
|
|
21454
|
-
|
|
21455
|
-
var
|
|
21447
|
+
// 相对于合成开始时间的时间
|
|
21448
|
+
var localTime = this.time + deltaTime - this.startTime;
|
|
21449
|
+
if (deltaTime < 0 && localTime < 0) {
|
|
21450
|
+
localTime = 0;
|
|
21451
|
+
}
|
|
21456
21452
|
var duration = this.rootItem.duration;
|
|
21457
21453
|
var endBehavior = this.rootItem.endBehavior;
|
|
21454
|
+
var isEnded = false;
|
|
21458
21455
|
if (localTime - duration > 0.001) {
|
|
21459
21456
|
isEnded = true;
|
|
21460
21457
|
switch(endBehavior){
|
|
@@ -21479,7 +21476,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
21479
21476
|
}
|
|
21480
21477
|
}
|
|
21481
21478
|
}
|
|
21482
|
-
this.rootComposition.time = localTime;
|
|
21479
|
+
this.rootComposition.time = localTime + this.startTime;
|
|
21483
21480
|
// end state changed, handle onEnd flags
|
|
21484
21481
|
if (this.isEnded !== isEnded) {
|
|
21485
21482
|
if (isEnded) {
|
|
@@ -26262,8 +26259,9 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
26262
26259
|
this.isDirty = true;
|
|
26263
26260
|
};
|
|
26264
26261
|
/**
|
|
26265
|
-
*
|
|
26266
|
-
* @param value
|
|
26262
|
+
* 设置字体样式
|
|
26263
|
+
* @param value 设置字体样式
|
|
26264
|
+
* @default "normal"
|
|
26267
26265
|
* @returns
|
|
26268
26266
|
*/ _proto.setFontStyle = function setFontStyle(value) {
|
|
26269
26267
|
if (this.textStyle.fontStyle === value) {
|
|
@@ -27414,7 +27412,6 @@ function getStandardInteractContent(ui) {
|
|
|
27414
27412
|
var currentMaskComponent;
|
|
27415
27413
|
var componentMap = new Map();
|
|
27416
27414
|
var itemMap = new Map();
|
|
27417
|
-
var refCompositions = new Map();
|
|
27418
27415
|
/**
|
|
27419
27416
|
* 3.1 版本数据适配
|
|
27420
27417
|
* - 富文本插件名称的适配
|
|
@@ -27462,27 +27459,20 @@ var refCompositions = new Map();
|
|
|
27462
27459
|
function version32Migration(json) {
|
|
27463
27460
|
componentMap.clear();
|
|
27464
27461
|
itemMap.clear();
|
|
27465
|
-
refCompositions.clear();
|
|
27466
27462
|
var compositions = json.compositions, items = json.items, components = json.components;
|
|
27467
27463
|
// 处理旧蒙版数据
|
|
27468
|
-
var mainComp = compositions[0];
|
|
27469
27464
|
for(var _iterator = _create_for_of_iterator_helper_loose(components), _step; !(_step = _iterator()).done;){
|
|
27470
27465
|
var component = _step.value;
|
|
27471
27466
|
componentMap.set(component.id, component);
|
|
27472
27467
|
}
|
|
27473
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(
|
|
27474
|
-
var
|
|
27475
|
-
if (comp.id === json.compositionId) {
|
|
27476
|
-
mainComp = comp;
|
|
27477
|
-
} else {
|
|
27478
|
-
refCompositions.set(comp.id, comp);
|
|
27479
|
-
}
|
|
27480
|
-
}
|
|
27481
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(items), _step2; !(_step2 = _iterator2()).done;){
|
|
27482
|
-
var item = _step2.value;
|
|
27468
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(items), _step1; !(_step1 = _iterator1()).done;){
|
|
27469
|
+
var item = _step1.value;
|
|
27483
27470
|
itemMap.set(item.id, item);
|
|
27484
27471
|
}
|
|
27485
|
-
|
|
27472
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(compositions), _step2; !(_step2 = _iterator2()).done;){
|
|
27473
|
+
var comp = _step2.value;
|
|
27474
|
+
processContent(comp);
|
|
27475
|
+
}
|
|
27486
27476
|
return json;
|
|
27487
27477
|
}
|
|
27488
27478
|
function version33Migration(json) {
|
|
@@ -27567,12 +27557,6 @@ function processContent(composition) {
|
|
|
27567
27557
|
processMask(component);
|
|
27568
27558
|
}
|
|
27569
27559
|
}
|
|
27570
|
-
// 处理预合成的渲染顺序
|
|
27571
|
-
if (itemProps.type === ItemType.composition) {
|
|
27572
|
-
var refId = itemProps.content.options.refId;
|
|
27573
|
-
var comp = refCompositions.get(refId);
|
|
27574
|
-
comp && processContent(comp);
|
|
27575
|
-
}
|
|
27576
27560
|
}
|
|
27577
27561
|
}
|
|
27578
27562
|
function processMask(renderContent) {
|
|
@@ -28961,7 +28945,7 @@ var seed = 1;
|
|
|
28961
28945
|
});
|
|
28962
28946
|
});
|
|
28963
28947
|
loadResourcePromise = /*#__PURE__*/ _async_to_generator(function() {
|
|
28964
|
-
var scene, link,
|
|
28948
|
+
var scene, link, _ref, jsonScene, pluginSystem, _jsonScene_bins, bins, images, fonts, _ref1, loadedBins, loadedImages, loadedTextures, totalTime;
|
|
28965
28949
|
return __generator(this, function(_state) {
|
|
28966
28950
|
switch(_state.label){
|
|
28967
28951
|
case 0:
|
|
@@ -28992,37 +28976,23 @@ var seed = 1;
|
|
|
28992
28976
|
case 3:
|
|
28993
28977
|
if (!exports.Scene.isJSONObject(rawJSON)) return [
|
|
28994
28978
|
3,
|
|
28995
|
-
|
|
28979
|
+
4
|
|
28996
28980
|
];
|
|
28997
|
-
// 已经加载过的 可能需要更新数据模板
|
|
28998
28981
|
scene = _extends({}, rawJSON);
|
|
28999
|
-
jsonScene = scene.jsonScene, pluginSystem = scene.pluginSystem, loadedImages = scene.images;
|
|
29000
|
-
images = jsonScene.images;
|
|
29001
|
-
_this.assignImagesToAssets(images, loadedImages);
|
|
29002
|
-
return [
|
|
29003
|
-
4,
|
|
29004
|
-
Promise.all([
|
|
29005
|
-
hookTimeInfo("plugin:processAssets", function() {
|
|
29006
|
-
return _this.processPluginAssets(jsonScene, pluginSystem, options);
|
|
29007
|
-
})
|
|
29008
|
-
])
|
|
29009
|
-
];
|
|
29010
|
-
case 4:
|
|
29011
|
-
_state.sent();
|
|
29012
28982
|
return [
|
|
29013
28983
|
3,
|
|
29014
|
-
|
|
28984
|
+
9
|
|
29015
28985
|
];
|
|
29016
|
-
case
|
|
28986
|
+
case 4:
|
|
29017
28987
|
return [
|
|
29018
28988
|
4,
|
|
29019
28989
|
hookTimeInfo("processJSON", function() {
|
|
29020
28990
|
return _this.processJSON(rawJSON);
|
|
29021
28991
|
})
|
|
29022
28992
|
];
|
|
29023
|
-
case
|
|
29024
|
-
_ref = _state.sent(),
|
|
29025
|
-
_jsonScene_bins =
|
|
28993
|
+
case 5:
|
|
28994
|
+
_ref = _state.sent(), jsonScene = _ref.jsonScene, pluginSystem = _ref.pluginSystem;
|
|
28995
|
+
_jsonScene_bins = jsonScene.bins, bins = _jsonScene_bins === void 0 ? [] : _jsonScene_bins, images = jsonScene.images, fonts = jsonScene.fonts;
|
|
29026
28996
|
return [
|
|
29027
28997
|
4,
|
|
29028
28998
|
Promise.all([
|
|
@@ -29030,48 +29000,50 @@ var seed = 1;
|
|
|
29030
29000
|
return _this.processBins(bins);
|
|
29031
29001
|
}),
|
|
29032
29002
|
hookTimeInfo("processImages", function() {
|
|
29033
|
-
return _this.processImages(
|
|
29003
|
+
return _this.processImages(images, compressedTexture);
|
|
29034
29004
|
}),
|
|
29035
29005
|
hookTimeInfo("plugin:processAssets", function() {
|
|
29036
|
-
return _this.processPluginAssets(
|
|
29006
|
+
return _this.processPluginAssets(jsonScene, pluginSystem, options);
|
|
29037
29007
|
}),
|
|
29038
29008
|
hookTimeInfo("processFontURL", function() {
|
|
29039
29009
|
return _this.processFontURL(fonts);
|
|
29040
29010
|
})
|
|
29041
29011
|
])
|
|
29042
29012
|
];
|
|
29043
|
-
case
|
|
29044
|
-
_ref1 = _state.sent(), loadedBins = _ref1[0],
|
|
29013
|
+
case 6:
|
|
29014
|
+
_ref1 = _state.sent(), loadedBins = _ref1[0], loadedImages = _ref1[1];
|
|
29045
29015
|
return [
|
|
29046
29016
|
4,
|
|
29047
29017
|
hookTimeInfo("processTextures", function() {
|
|
29048
|
-
return _this.processTextures(
|
|
29018
|
+
return _this.processTextures(loadedImages, loadedBins, jsonScene);
|
|
29049
29019
|
})
|
|
29050
29020
|
];
|
|
29051
|
-
case
|
|
29021
|
+
case 7:
|
|
29052
29022
|
loadedTextures = _state.sent();
|
|
29053
29023
|
scene = {
|
|
29054
29024
|
timeInfos: timeInfos,
|
|
29055
29025
|
url: url,
|
|
29056
29026
|
renderLevel: _this.options.renderLevel,
|
|
29057
29027
|
storage: {},
|
|
29058
|
-
pluginSystem:
|
|
29059
|
-
jsonScene:
|
|
29028
|
+
pluginSystem: pluginSystem,
|
|
29029
|
+
jsonScene: jsonScene,
|
|
29060
29030
|
bins: loadedBins,
|
|
29061
|
-
|
|
29062
|
-
|
|
29031
|
+
textureOptions: loadedTextures,
|
|
29032
|
+
textures: [],
|
|
29033
|
+
images: loadedImages,
|
|
29034
|
+
assets: _this.assets
|
|
29063
29035
|
};
|
|
29064
29036
|
// 触发插件系统 pluginSystem 的回调 prepareResource
|
|
29065
29037
|
return [
|
|
29066
29038
|
4,
|
|
29067
29039
|
hookTimeInfo("plugin:prepareResource", function() {
|
|
29068
|
-
return
|
|
29040
|
+
return pluginSystem.loadResources(scene, _this.options);
|
|
29069
29041
|
})
|
|
29070
29042
|
];
|
|
29071
|
-
case
|
|
29043
|
+
case 8:
|
|
29072
29044
|
_state.sent();
|
|
29073
|
-
_state.label =
|
|
29074
|
-
case
|
|
29045
|
+
_state.label = 9;
|
|
29046
|
+
case 9:
|
|
29075
29047
|
totalTime = performance.now() - startTime;
|
|
29076
29048
|
logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfoMessages.join(" ") + ", url: " + assetUrl + ".");
|
|
29077
29049
|
window.clearTimeout(loadTimer);
|
|
@@ -29666,16 +29638,10 @@ function createTextureOptionsBySource(image, sourceFrom, id) {
|
|
|
29666
29638
|
};
|
|
29667
29639
|
_proto.initializeTexture = function initializeTexture(scene) {
|
|
29668
29640
|
for(var i = 0; i < scene.textureOptions.length; i++){
|
|
29669
|
-
|
|
29670
|
-
|
|
29671
|
-
|
|
29672
|
-
|
|
29673
|
-
textureOptions = this.engine.findObject({
|
|
29674
|
-
id: scene.textureOptions[i].id
|
|
29675
|
-
});
|
|
29676
|
-
scene.textureOptions[i] = textureOptions;
|
|
29677
|
-
}
|
|
29678
|
-
textureOptions.initialize();
|
|
29641
|
+
scene.textures[i] = this.engine.findObject({
|
|
29642
|
+
id: scene.textureOptions[i].id
|
|
29643
|
+
});
|
|
29644
|
+
scene.textures[i].initialize();
|
|
29679
29645
|
}
|
|
29680
29646
|
};
|
|
29681
29647
|
_proto.prepareAssets = function prepareAssets(scene, assets) {
|
|
@@ -31660,7 +31626,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem);
|
|
|
31660
31626
|
registerPlugin("particle", ParticleLoader, exports.VFXItem);
|
|
31661
31627
|
registerPlugin("cal", CalculateLoader, exports.VFXItem);
|
|
31662
31628
|
registerPlugin("interact", InteractLoader, exports.VFXItem);
|
|
31663
|
-
var version = "2.4.
|
|
31629
|
+
var version = "2.4.8";
|
|
31664
31630
|
logger.info("Core version: " + version + ".");
|
|
31665
31631
|
|
|
31666
31632
|
exports.AbstractPlugin = AbstractPlugin;
|