@galacean/effects-core 2.0.0-alpha.25 → 2.0.0-alpha.26
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/decorators.d.ts +1 -1
- package/dist/index.js +89 -73
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +89 -73
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/decorators.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import type { Constructor } from './utils';
|
|
|
2
2
|
export declare const effectsClassStore: Record<string, any>;
|
|
3
3
|
export declare function effectsClass(className: string): (target: Object, context?: unknown) => void;
|
|
4
4
|
export declare function serialize(type?: Constructor, sourceName?: string): (target: Object, propertyKey: string | symbol) => void;
|
|
5
|
-
export declare function getMergedStore(target: Object): Record<string, any
|
|
5
|
+
export declare function getMergedStore(target: Object): Record<string, any> | undefined;
|
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.0.0-alpha.
|
|
6
|
+
* Version: v2.0.0-alpha.26
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -4493,8 +4493,8 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
4493
4493
|
BuiltinObjectGUID: BuiltinObjectGUID
|
|
4494
4494
|
});
|
|
4495
4495
|
|
|
4496
|
-
var decoratorInitialStore =
|
|
4497
|
-
var mergedStore =
|
|
4496
|
+
var decoratorInitialStore = new Map();
|
|
4497
|
+
var mergedStore = new Map();
|
|
4498
4498
|
var effectsClassStore = {};
|
|
4499
4499
|
function effectsClass(className) {
|
|
4500
4500
|
return function(target, context) {
|
|
@@ -4509,22 +4509,22 @@ function serialize(type, sourceName) {
|
|
|
4509
4509
|
return generateSerializableMember(type, sourceName); // value member
|
|
4510
4510
|
}
|
|
4511
4511
|
function getMergedStore(target) {
|
|
4512
|
-
var classKey = target.constructor
|
|
4513
|
-
if (mergedStore
|
|
4514
|
-
return mergedStore
|
|
4512
|
+
var classKey = target.constructor;
|
|
4513
|
+
if (mergedStore.get(classKey)) {
|
|
4514
|
+
return mergedStore.get(classKey);
|
|
4515
4515
|
}
|
|
4516
|
-
|
|
4517
|
-
|
|
4516
|
+
var store = {};
|
|
4517
|
+
mergedStore.set(classKey, store);
|
|
4518
4518
|
var currentTarget = target;
|
|
4519
4519
|
var currentKey = classKey;
|
|
4520
4520
|
while(currentKey){
|
|
4521
|
-
var initialStore = decoratorInitialStore
|
|
4521
|
+
var initialStore = decoratorInitialStore.get(currentKey);
|
|
4522
4522
|
for(var property in initialStore){
|
|
4523
4523
|
store[property] = initialStore[property];
|
|
4524
4524
|
}
|
|
4525
4525
|
var parent = Object.getPrototypeOf(currentTarget);
|
|
4526
|
-
currentKey = Object.getPrototypeOf(parent).constructor
|
|
4527
|
-
if (currentKey ===
|
|
4526
|
+
currentKey = Object.getPrototypeOf(parent).constructor;
|
|
4527
|
+
if (currentKey === Object) {
|
|
4528
4528
|
break;
|
|
4529
4529
|
}
|
|
4530
4530
|
currentTarget = parent;
|
|
@@ -4534,6 +4534,9 @@ function getMergedStore(target) {
|
|
|
4534
4534
|
function generateSerializableMember(type, sourceName) {
|
|
4535
4535
|
return function(target, propertyKey) {
|
|
4536
4536
|
var classStore = getDirectStore(target);
|
|
4537
|
+
if (!classStore) {
|
|
4538
|
+
return;
|
|
4539
|
+
}
|
|
4537
4540
|
if (!classStore[propertyKey]) {
|
|
4538
4541
|
classStore[propertyKey] = {
|
|
4539
4542
|
type: type,
|
|
@@ -4543,11 +4546,11 @@ function generateSerializableMember(type, sourceName) {
|
|
|
4543
4546
|
};
|
|
4544
4547
|
}
|
|
4545
4548
|
function getDirectStore(target) {
|
|
4546
|
-
var classKey = target.constructor
|
|
4547
|
-
if (!decoratorInitialStore
|
|
4548
|
-
decoratorInitialStore
|
|
4549
|
+
var classKey = target.constructor;
|
|
4550
|
+
if (!decoratorInitialStore.get(classKey)) {
|
|
4551
|
+
decoratorInitialStore.set(classKey, {});
|
|
4549
4552
|
}
|
|
4550
|
-
return decoratorInitialStore
|
|
4553
|
+
return decoratorInitialStore.get(classKey);
|
|
4551
4554
|
}
|
|
4552
4555
|
|
|
4553
4556
|
/**
|
|
@@ -19669,7 +19672,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
19669
19672
|
_proto.updateWithOptions = function updateWithOptions(options) {
|
|
19670
19673
|
this.textStyle = new TextStyle(options);
|
|
19671
19674
|
this.textLayout = new TextLayout(options);
|
|
19672
|
-
this.text = options.text;
|
|
19675
|
+
this.text = options.text.toString();
|
|
19673
19676
|
this.lineCount = this.getLineCount(options.text, true);
|
|
19674
19677
|
};
|
|
19675
19678
|
_proto.getLineCount = function getLineCount(text, init) {
|
|
@@ -19740,7 +19743,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
19740
19743
|
if (this.text === value) {
|
|
19741
19744
|
return;
|
|
19742
19745
|
}
|
|
19743
|
-
this.text = value;
|
|
19746
|
+
this.text = value.toString();
|
|
19744
19747
|
this.lineCount = this.getLineCount(value, false);
|
|
19745
19748
|
this.isDirty = true;
|
|
19746
19749
|
};
|
|
@@ -20849,29 +20852,31 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20849
20852
|
effectsObject.toData();
|
|
20850
20853
|
res[effectsObject.getInstanceId()] = effectsObject;
|
|
20851
20854
|
var serializedProperties = getMergedStore(effectsObject);
|
|
20852
|
-
|
|
20853
|
-
var
|
|
20854
|
-
|
|
20855
|
-
|
|
20856
|
-
|
|
20857
|
-
value
|
|
20858
|
-
|
|
20859
|
-
if (EffectsObject.is(value)) {
|
|
20860
|
-
SerializationHelper.collectSerializableObject(value, res);
|
|
20861
|
-
} else if (isArray(value)) {
|
|
20862
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(value), _step1; !(_step1 = _iterator1()).done;){
|
|
20863
|
-
var arrayValue = _step1.value;
|
|
20864
|
-
if (EffectsObject.is(arrayValue)) {
|
|
20865
|
-
SerializationHelper.collectSerializableObject(arrayValue, res);
|
|
20866
|
-
}
|
|
20855
|
+
if (serializedProperties) {
|
|
20856
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(serializedProperties)), _step; !(_step = _iterator()).done;){
|
|
20857
|
+
var key = _step.value;
|
|
20858
|
+
// TODO 待移除,序列化属性通过 effectsObject 对象直接获取
|
|
20859
|
+
var value = effectsObject.taggedProperties[key];
|
|
20860
|
+
if (value === undefined) {
|
|
20861
|
+
value = effectsObject[key];
|
|
20867
20862
|
}
|
|
20868
|
-
|
|
20869
|
-
|
|
20870
|
-
|
|
20871
|
-
var
|
|
20872
|
-
|
|
20873
|
-
|
|
20874
|
-
|
|
20863
|
+
if (EffectsObject.is(value)) {
|
|
20864
|
+
SerializationHelper.collectSerializableObject(value, res);
|
|
20865
|
+
} else if (isArray(value)) {
|
|
20866
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(value), _step1; !(_step1 = _iterator1()).done;){
|
|
20867
|
+
var arrayValue = _step1.value;
|
|
20868
|
+
if (EffectsObject.is(arrayValue)) {
|
|
20869
|
+
SerializationHelper.collectSerializableObject(arrayValue, res);
|
|
20870
|
+
}
|
|
20871
|
+
}
|
|
20872
|
+
} else if (isObject(value)) {
|
|
20873
|
+
// 非 EffectsObject 对象只递归一层
|
|
20874
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(Object.keys(value)), _step2; !(_step2 = _iterator2()).done;){
|
|
20875
|
+
var objectKey = _step2.value;
|
|
20876
|
+
var objectValue = value[objectKey];
|
|
20877
|
+
if (EffectsObject.is(objectValue)) {
|
|
20878
|
+
SerializationHelper.collectSerializableObject(objectValue, res);
|
|
20879
|
+
}
|
|
20875
20880
|
}
|
|
20876
20881
|
}
|
|
20877
20882
|
}
|
|
@@ -20902,27 +20907,29 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20902
20907
|
serializedData = {};
|
|
20903
20908
|
}
|
|
20904
20909
|
var serializedProperties = getMergedStore(effectsObject);
|
|
20905
|
-
|
|
20906
|
-
var
|
|
20907
|
-
|
|
20908
|
-
|
|
20909
|
-
|
|
20910
|
-
|
|
20911
|
-
|
|
20912
|
-
if (
|
|
20913
|
-
serializedData[key]
|
|
20914
|
-
|
|
20915
|
-
|
|
20916
|
-
|
|
20917
|
-
|
|
20918
|
-
|
|
20919
|
-
|
|
20920
|
-
|
|
20921
|
-
|
|
20922
|
-
if (
|
|
20923
|
-
serializedData[key]
|
|
20910
|
+
if (serializedProperties) {
|
|
20911
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(serializedProperties)), _step; !(_step = _iterator()).done;){
|
|
20912
|
+
var key = _step.value;
|
|
20913
|
+
var value = effectsObject[key];
|
|
20914
|
+
if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(value)) {
|
|
20915
|
+
// TODO json 数据避免传 typedArray
|
|
20916
|
+
serializedData[key] = value;
|
|
20917
|
+
} else if (isArray(value)) {
|
|
20918
|
+
if (!serializedData[key]) {
|
|
20919
|
+
serializedData[key] = [];
|
|
20920
|
+
}
|
|
20921
|
+
SerializationHelper.serializeArrayProperty(value, serializedData[key], 0);
|
|
20922
|
+
} else if (EffectsObject.is(value)) {
|
|
20923
|
+
// TODO 处理 EffectsObject 递归序列化
|
|
20924
|
+
serializedData[key] = {
|
|
20925
|
+
id: value.getInstanceId()
|
|
20926
|
+
};
|
|
20927
|
+
} else if (isObject(value)) {
|
|
20928
|
+
if (!serializedData[key]) {
|
|
20929
|
+
serializedData[key] = {};
|
|
20930
|
+
}
|
|
20931
|
+
SerializationHelper.serializeObjectProperty(value, serializedData[key], 0);
|
|
20924
20932
|
}
|
|
20925
|
-
SerializationHelper.serializeObjectProperty(value, serializedData[key], 0);
|
|
20926
20933
|
}
|
|
20927
20934
|
}
|
|
20928
20935
|
// TODO 待移除 tagggedProperties 为没有装饰器的临时方案
|
|
@@ -20957,22 +20964,24 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20957
20964
|
var engine = effectsObject.engine;
|
|
20958
20965
|
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(serializedData)), _step; !(_step = _iterator()).done;){
|
|
20959
20966
|
var key = _step.value;
|
|
20960
|
-
if (serializedProperties[key]) {
|
|
20967
|
+
if (serializedProperties && serializedProperties[key]) {
|
|
20961
20968
|
continue;
|
|
20962
20969
|
}
|
|
20963
20970
|
var value = serializedData[key];
|
|
20964
20971
|
taggedProperties[key] = SerializationHelper.deserializeProperty(value, engine, 0);
|
|
20965
20972
|
}
|
|
20966
|
-
|
|
20967
|
-
var
|
|
20968
|
-
|
|
20969
|
-
|
|
20970
|
-
|
|
20973
|
+
if (serializedProperties) {
|
|
20974
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(Object.keys(serializedProperties)), _step1; !(_step1 = _iterator1()).done;){
|
|
20975
|
+
var key1 = _step1.value;
|
|
20976
|
+
var value1 = serializedData[key1];
|
|
20977
|
+
if (value1 === undefined) {
|
|
20978
|
+
continue;
|
|
20979
|
+
}
|
|
20980
|
+
var propertyType = serializedProperties[key1].type;
|
|
20981
|
+
// FIXME: taggedProperties 为 readonly,这里存在强制赋值
|
|
20982
|
+
// @ts-expect-error
|
|
20983
|
+
effectsObject[key1] = SerializationHelper.deserializeProperty(value1, engine, 0, propertyType);
|
|
20971
20984
|
}
|
|
20972
|
-
var propertyType = serializedProperties[key1].type;
|
|
20973
|
-
// FIXME: taggedProperties 为 readonly,这里存在强制赋值
|
|
20974
|
-
// @ts-expect-error
|
|
20975
|
-
effectsObject[key1] = SerializationHelper.deserializeProperty(value1, engine, 0, propertyType);
|
|
20976
20985
|
}
|
|
20977
20986
|
effectsObject.fromData(taggedProperties);
|
|
20978
20987
|
};
|
|
@@ -20993,7 +21002,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20993
21002
|
4
|
|
20994
21003
|
];
|
|
20995
21004
|
key = _step.value;
|
|
20996
|
-
if (serializedProperties[key]) {
|
|
21005
|
+
if (serializedProperties && serializedProperties[key]) {
|
|
20997
21006
|
return [
|
|
20998
21007
|
3,
|
|
20999
21008
|
3
|
|
@@ -21013,6 +21022,10 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
21013
21022
|
1
|
|
21014
21023
|
];
|
|
21015
21024
|
case 4:
|
|
21025
|
+
if (!serializedProperties) return [
|
|
21026
|
+
3,
|
|
21027
|
+
8
|
|
21028
|
+
];
|
|
21016
21029
|
_iterator1 = _create_for_of_iterator_helper_loose(Object.keys(serializedProperties));
|
|
21017
21030
|
_state.label = 5;
|
|
21018
21031
|
case 5:
|
|
@@ -24132,11 +24145,13 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24132
24145
|
* 获取归一化坐标和 3D 世界坐标的换算比例
|
|
24133
24146
|
* @param z - 当前的位置 z
|
|
24134
24147
|
*/ _proto.getInverseVPRatio = function getInverseVPRatio(z) {
|
|
24135
|
-
var pos = new Vector3(
|
|
24148
|
+
var pos = new Vector3(this.position.x, this.position.y, z);
|
|
24136
24149
|
var mat = this.getViewProjectionMatrix();
|
|
24137
24150
|
var inverseVP = this.getInverseViewProjectionMatrix();
|
|
24138
24151
|
var _mat_projectPoint = mat.projectPoint(pos), nz = _mat_projectPoint.z;
|
|
24139
|
-
|
|
24152
|
+
var _inverseVP_projectPoint = inverseVP.projectPoint(new Vector3(1, 1, nz)), xMax = _inverseVP_projectPoint.x, yMax = _inverseVP_projectPoint.y;
|
|
24153
|
+
var _inverseVP_projectPoint1 = inverseVP.projectPoint(new Vector3(-1, -1, nz)), xMin = _inverseVP_projectPoint1.x, yMin = _inverseVP_projectPoint1.y;
|
|
24154
|
+
return new Vector3((xMax - xMin) / 2, (yMax - yMin) / 2, 0);
|
|
24140
24155
|
};
|
|
24141
24156
|
/**
|
|
24142
24157
|
* 设置相机的旋转四元数
|
|
@@ -24789,6 +24804,7 @@ var listOrder = 0;
|
|
|
24789
24804
|
// this.extraCamera?.getComponent(TimelineComponent)?.update(deltaTime);
|
|
24790
24805
|
this.updateCamera();
|
|
24791
24806
|
if (this.shouldDispose()) {
|
|
24807
|
+
this.onEnd == null ? void 0 : this.onEnd.call(this, this);
|
|
24792
24808
|
this.dispose();
|
|
24793
24809
|
} else {
|
|
24794
24810
|
if (!skipRender) {
|
|
@@ -25715,7 +25731,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
25715
25731
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
25716
25732
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
25717
25733
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
25718
|
-
var version = "2.0.0-alpha.
|
|
25734
|
+
var version = "2.0.0-alpha.26";
|
|
25719
25735
|
logger.info("Core version: " + version + ".");
|
|
25720
25736
|
|
|
25721
25737
|
exports.AbstractPlugin = AbstractPlugin;
|