@galacean/engine 2.0.0-alpha.15 → 2.0.0-alpha.16
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/browser.js +151 -167
- package/dist/browser.js.map +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +1 -1
- package/dist/bundled.module.js +151 -167
- package/dist/bundled.module.js.map +1 -1
- package/dist/bundled.module.min.js +1 -1
- package/dist/bundled.module.min.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/module.js +1 -1
- package/package.json +5 -5
package/dist/browser.js
CHANGED
|
@@ -5324,74 +5324,69 @@
|
|
|
5324
5324
|
return cloneModes;
|
|
5325
5325
|
};
|
|
5326
5326
|
CloneManager.cloneProperty = function cloneProperty(source, target, k, cloneMode, srcRoot, targetRoot, deepInstanceMap) {
|
|
5327
|
-
|
|
5327
|
+
var sourceProperty = source[k];
|
|
5328
|
+
// Remappable references (Entity/Component) are always remapped, regardless of clone decorator
|
|
5329
|
+
if (_instanceof1$2(sourceProperty, Object) && sourceProperty._remap) {
|
|
5330
|
+
target[k] = sourceProperty._remap(srcRoot, targetRoot);
|
|
5328
5331
|
return;
|
|
5329
5332
|
}
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5333
|
+
if (cloneMode === CloneMode.Ignore) return;
|
|
5334
|
+
// Primitives, undecorated, or @assignmentClone: direct assign
|
|
5335
|
+
if (!_instanceof1$2(sourceProperty, Object) || cloneMode === undefined || cloneMode === CloneMode.Assignment) {
|
|
5336
|
+
target[k] = sourceProperty;
|
|
5337
|
+
return;
|
|
5338
|
+
}
|
|
5339
|
+
// @shallowClone / @deepClone: deep copy complex objects
|
|
5340
|
+
var type = sourceProperty.constructor;
|
|
5341
|
+
switch(type){
|
|
5342
|
+
case Uint8Array:
|
|
5343
|
+
case Uint16Array:
|
|
5344
|
+
case Uint32Array:
|
|
5345
|
+
case Int8Array:
|
|
5346
|
+
case Int16Array:
|
|
5347
|
+
case Int32Array:
|
|
5348
|
+
case Float32Array:
|
|
5349
|
+
case Float64Array:
|
|
5350
|
+
var targetPropertyT = target[k];
|
|
5351
|
+
if (targetPropertyT == null || targetPropertyT.length !== sourceProperty.length) {
|
|
5352
|
+
target[k] = sourceProperty.slice();
|
|
5353
|
+
} else {
|
|
5354
|
+
targetPropertyT.set(sourceProperty);
|
|
5355
|
+
}
|
|
5356
|
+
break;
|
|
5357
|
+
case Array:
|
|
5358
|
+
var targetPropertyA = target[k];
|
|
5359
|
+
var length = sourceProperty.length;
|
|
5360
|
+
if (targetPropertyA == null) {
|
|
5361
|
+
target[k] = targetPropertyA = new Array(length);
|
|
5362
|
+
} else {
|
|
5363
|
+
targetPropertyA.length = length;
|
|
5364
|
+
}
|
|
5365
|
+
for(var i = 0; i < length; i++){
|
|
5366
|
+
CloneManager.cloneProperty(sourceProperty, targetPropertyA, i, cloneMode, srcRoot, targetRoot, deepInstanceMap);
|
|
5367
|
+
}
|
|
5368
|
+
break;
|
|
5369
|
+
default:
|
|
5370
|
+
var targetProperty = target[k];
|
|
5371
|
+
// If the target property is undefined, create new instance and keep reference sharing like the source
|
|
5372
|
+
if (!targetProperty) {
|
|
5373
|
+
targetProperty = deepInstanceMap.get(sourceProperty);
|
|
5368
5374
|
if (!targetProperty) {
|
|
5369
|
-
targetProperty =
|
|
5370
|
-
|
|
5371
|
-
targetProperty = new sourceProperty.constructor();
|
|
5372
|
-
deepInstanceMap.set(sourceProperty, targetProperty);
|
|
5373
|
-
}
|
|
5374
|
-
target[k] = targetProperty;
|
|
5375
|
+
targetProperty = new sourceProperty.constructor();
|
|
5376
|
+
deepInstanceMap.set(sourceProperty, targetProperty);
|
|
5375
5377
|
}
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
}
|
|
5385
|
-
// Custom incremental clone
|
|
5386
|
-
if (sourceProperty._cloneTo) {
|
|
5387
|
-
sourceProperty._cloneTo(targetProperty, srcRoot, targetRoot);
|
|
5388
|
-
}
|
|
5378
|
+
target[k] = targetProperty;
|
|
5379
|
+
}
|
|
5380
|
+
if (sourceProperty.copyFrom) {
|
|
5381
|
+
targetProperty.copyFrom(sourceProperty);
|
|
5382
|
+
} else {
|
|
5383
|
+
var cloneModes = CloneManager.getCloneMode(sourceProperty.constructor);
|
|
5384
|
+
for(var _$k in sourceProperty){
|
|
5385
|
+
CloneManager.cloneProperty(sourceProperty, targetProperty, _$k, cloneModes[_$k], srcRoot, targetRoot, deepInstanceMap);
|
|
5389
5386
|
}
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
// null, undefined, primitive type, function
|
|
5394
|
-
target[k] = sourceProperty;
|
|
5387
|
+
sourceProperty._cloneTo == null ? void 0 : sourceProperty._cloneTo.call(sourceProperty, targetProperty, srcRoot, targetRoot);
|
|
5388
|
+
}
|
|
5389
|
+
break;
|
|
5395
5390
|
}
|
|
5396
5391
|
};
|
|
5397
5392
|
CloneManager.deepCloneObject = function deepCloneObject(source, target, deepInstanceMap) {
|
|
@@ -12338,6 +12333,44 @@
|
|
|
12338
12333
|
return Background;
|
|
12339
12334
|
}();
|
|
12340
12335
|
/** @internal */ Background._premultiplySolidColor = new Color();
|
|
12336
|
+
/**
|
|
12337
|
+
* @internal
|
|
12338
|
+
* Utility functions for remapping Entity/Component references during cloning.
|
|
12339
|
+
*/ var CloneUtils = /*#__PURE__*/ function() {
|
|
12340
|
+
function CloneUtils() {}
|
|
12341
|
+
CloneUtils.remapEntity = function remapEntity(srcRoot, targetRoot, entity) {
|
|
12342
|
+
var path = CloneUtils._tempRemapPath;
|
|
12343
|
+
if (!CloneUtils._getEntityHierarchyPath(srcRoot, entity, path)) return entity;
|
|
12344
|
+
return CloneUtils._getEntityByHierarchyPath(targetRoot, path);
|
|
12345
|
+
};
|
|
12346
|
+
CloneUtils.remapComponent = function remapComponent(srcRoot, targetRoot, component) {
|
|
12347
|
+
var path = CloneUtils._tempRemapPath;
|
|
12348
|
+
var srcEntity = component.entity;
|
|
12349
|
+
if (!CloneUtils._getEntityHierarchyPath(srcRoot, srcEntity, path)) return component;
|
|
12350
|
+
return CloneUtils._getEntityByHierarchyPath(targetRoot, path)._components[srcEntity._components.indexOf(component)];
|
|
12351
|
+
};
|
|
12352
|
+
CloneUtils._getEntityHierarchyPath = function _getEntityHierarchyPath(rootEntity, searchEntity, inversePath) {
|
|
12353
|
+
inversePath.length = 0;
|
|
12354
|
+
while(searchEntity !== rootEntity){
|
|
12355
|
+
var parent = searchEntity.parent;
|
|
12356
|
+
if (!parent) {
|
|
12357
|
+
return false;
|
|
12358
|
+
}
|
|
12359
|
+
inversePath.push(searchEntity.siblingIndex);
|
|
12360
|
+
searchEntity = parent;
|
|
12361
|
+
}
|
|
12362
|
+
return true;
|
|
12363
|
+
};
|
|
12364
|
+
CloneUtils._getEntityByHierarchyPath = function _getEntityByHierarchyPath(rootEntity, inversePath) {
|
|
12365
|
+
var entity = rootEntity;
|
|
12366
|
+
for(var i = inversePath.length - 1; i >= 0; i--){
|
|
12367
|
+
entity = entity.children[inversePath[i]];
|
|
12368
|
+
}
|
|
12369
|
+
return entity;
|
|
12370
|
+
};
|
|
12371
|
+
return CloneUtils;
|
|
12372
|
+
}();
|
|
12373
|
+
CloneUtils._tempRemapPath = [];
|
|
12341
12374
|
var ActiveChangeFlag = /*#__PURE__*/ function(ActiveChangeFlag) {
|
|
12342
12375
|
ActiveChangeFlag[ActiveChangeFlag["None"] = 0] = "None";
|
|
12343
12376
|
ActiveChangeFlag[ActiveChangeFlag["Scene"] = 1] = "Scene";
|
|
@@ -12412,6 +12445,11 @@
|
|
|
12412
12445
|
}
|
|
12413
12446
|
}
|
|
12414
12447
|
};
|
|
12448
|
+
/**
|
|
12449
|
+
* @internal
|
|
12450
|
+
*/ _proto._remap = function _remap(srcRoot, targetRoot) {
|
|
12451
|
+
return CloneUtils.remapComponent(srcRoot, targetRoot, this);
|
|
12452
|
+
};
|
|
12415
12453
|
_proto._addResourceReferCount = function _addResourceReferCount(resource, count) {
|
|
12416
12454
|
this._entity._isTemplate || resource._addReferCount(count);
|
|
12417
12455
|
};
|
|
@@ -12485,9 +12523,6 @@
|
|
|
12485
12523
|
]);
|
|
12486
12524
|
return Component;
|
|
12487
12525
|
}(EngineObject);
|
|
12488
|
-
__decorate$1([
|
|
12489
|
-
ignoreClone
|
|
12490
|
-
], Component.prototype, "_entity", void 0);
|
|
12491
12526
|
__decorate$1([
|
|
12492
12527
|
ignoreClone
|
|
12493
12528
|
], Component.prototype, "_awoken", void 0);
|
|
@@ -12851,7 +12886,7 @@
|
|
|
12851
12886
|
};
|
|
12852
12887
|
/**
|
|
12853
12888
|
* @internal
|
|
12854
|
-
*/ _proto._cloneTo = function _cloneTo(target
|
|
12889
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
12855
12890
|
var position = target._position, rotation = target._rotation, scale = target._scale;
|
|
12856
12891
|
// @ts-ignore
|
|
12857
12892
|
position._onValueChanged = rotation._onValueChanged = scale._onValueChanged = null;
|
|
@@ -13463,9 +13498,6 @@
|
|
|
13463
13498
|
__decorate$1([
|
|
13464
13499
|
ignoreClone
|
|
13465
13500
|
], Transform.prototype, "_isParentDirty", void 0);
|
|
13466
|
-
__decorate$1([
|
|
13467
|
-
ignoreClone
|
|
13468
|
-
], Transform.prototype, "_parentTransformCache", void 0);
|
|
13469
13501
|
__decorate$1([
|
|
13470
13502
|
ignoreClone
|
|
13471
13503
|
], Transform.prototype, "_dirtyFlag", void 0);
|
|
@@ -13924,7 +13956,7 @@
|
|
|
13924
13956
|
};
|
|
13925
13957
|
/**
|
|
13926
13958
|
* @internal
|
|
13927
|
-
*/ _proto._cloneTo = function _cloneTo(target
|
|
13959
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
13928
13960
|
var _this__renderTarget;
|
|
13929
13961
|
(_this__renderTarget = this._renderTarget) == null ? void 0 : _this__renderTarget._addReferCount(1);
|
|
13930
13962
|
};
|
|
@@ -17127,9 +17159,6 @@
|
|
|
17127
17159
|
return ColliderShape;
|
|
17128
17160
|
}();
|
|
17129
17161
|
ColliderShape._idGenerator = 0;
|
|
17130
|
-
__decorate$1([
|
|
17131
|
-
ignoreClone
|
|
17132
|
-
], ColliderShape.prototype, "_collider", void 0);
|
|
17133
17162
|
__decorate$1([
|
|
17134
17163
|
ignoreClone
|
|
17135
17164
|
], ColliderShape.prototype, "_nativeShape", void 0);
|
|
@@ -21511,7 +21540,7 @@
|
|
|
21511
21540
|
};
|
|
21512
21541
|
/**
|
|
21513
21542
|
* @internal
|
|
21514
|
-
*/ _proto._cloneTo = function _cloneTo(target
|
|
21543
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
21515
21544
|
var materials = this._materials;
|
|
21516
21545
|
for(var i = 0, n = materials.length; i < n; i++){
|
|
21517
21546
|
target._setMaterial(i, materials[i]);
|
|
@@ -21766,9 +21795,6 @@
|
|
|
21766
21795
|
__decorate$1([
|
|
21767
21796
|
ignoreClone
|
|
21768
21797
|
], exports.Renderer.prototype, "_bounds", void 0);
|
|
21769
|
-
__decorate$1([
|
|
21770
|
-
ignoreClone
|
|
21771
|
-
], exports.Renderer.prototype, "_transformEntity", void 0);
|
|
21772
21798
|
__decorate$1([
|
|
21773
21799
|
deepClone
|
|
21774
21800
|
], exports.Renderer.prototype, "_shaderData", void 0);
|
|
@@ -21827,8 +21853,8 @@
|
|
|
21827
21853
|
};
|
|
21828
21854
|
/**
|
|
21829
21855
|
* @internal
|
|
21830
|
-
*/ _proto._cloneTo = function _cloneTo(target
|
|
21831
|
-
Renderer.prototype._cloneTo.call(this, target
|
|
21856
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
21857
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
21832
21858
|
target.sprite = this._sprite;
|
|
21833
21859
|
};
|
|
21834
21860
|
/**
|
|
@@ -22138,8 +22164,8 @@
|
|
|
22138
22164
|
};
|
|
22139
22165
|
/**
|
|
22140
22166
|
* @internal
|
|
22141
|
-
*/ _proto._cloneTo = function _cloneTo(target
|
|
22142
|
-
Renderer.prototype._cloneTo.call(this, target
|
|
22167
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
22168
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
22143
22169
|
target.sprite = this._sprite;
|
|
22144
22170
|
target.drawMode = this._drawMode;
|
|
22145
22171
|
};
|
|
@@ -22561,8 +22587,8 @@
|
|
|
22561
22587
|
};
|
|
22562
22588
|
/**
|
|
22563
22589
|
* @internal
|
|
22564
|
-
*/ _proto._cloneTo = function _cloneTo(target
|
|
22565
|
-
Renderer.prototype._cloneTo.call(this, target
|
|
22590
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
22591
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
22566
22592
|
target.font = this._font;
|
|
22567
22593
|
target._subFont = this._subFont;
|
|
22568
22594
|
};
|
|
@@ -24244,8 +24270,8 @@
|
|
|
24244
24270
|
};
|
|
24245
24271
|
/**
|
|
24246
24272
|
* @internal
|
|
24247
|
-
*/ _proto._cloneTo = function _cloneTo(target
|
|
24248
|
-
Renderer.prototype._cloneTo.call(this, target
|
|
24273
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
24274
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
24249
24275
|
target.mesh = this._mesh;
|
|
24250
24276
|
};
|
|
24251
24277
|
/**
|
|
@@ -27100,44 +27126,6 @@
|
|
|
27100
27126
|
]);
|
|
27101
27127
|
PrimitiveMesh._sphereEdgeIdx = 0;
|
|
27102
27128
|
PrimitiveMesh._spherePoleIdx = 0;
|
|
27103
|
-
/**
|
|
27104
|
-
* @internal
|
|
27105
|
-
* Utility functions for remapping Entity/Component references during cloning.
|
|
27106
|
-
*/ var CloneUtils = /*#__PURE__*/ function() {
|
|
27107
|
-
function CloneUtils() {}
|
|
27108
|
-
CloneUtils.remapEntity = function remapEntity(srcRoot, targetRoot, entity) {
|
|
27109
|
-
var paths = CloneUtils._tempRemapPath;
|
|
27110
|
-
var success = CloneUtils._getEntityHierarchyPath(srcRoot, entity, paths);
|
|
27111
|
-
return success ? CloneUtils._getEntityByHierarchyPath(targetRoot, paths) : entity;
|
|
27112
|
-
};
|
|
27113
|
-
CloneUtils.remapComponent = function remapComponent(srcRoot, targetRoot, component) {
|
|
27114
|
-
var _CloneUtils__getEntityByHierarchyPath;
|
|
27115
|
-
var paths = CloneUtils._tempRemapPath;
|
|
27116
|
-
var success = CloneUtils._getEntityHierarchyPath(srcRoot, component.entity, paths);
|
|
27117
|
-
return success ? (_CloneUtils__getEntityByHierarchyPath = CloneUtils._getEntityByHierarchyPath(targetRoot, paths)) == null ? void 0 : _CloneUtils__getEntityByHierarchyPath.getComponent(component.constructor) : component;
|
|
27118
|
-
};
|
|
27119
|
-
CloneUtils._getEntityHierarchyPath = function _getEntityHierarchyPath(rootEntity, searchEntity, inversePath) {
|
|
27120
|
-
inversePath.length = 0;
|
|
27121
|
-
while(searchEntity !== rootEntity){
|
|
27122
|
-
var parent = searchEntity.parent;
|
|
27123
|
-
if (!parent) {
|
|
27124
|
-
return false;
|
|
27125
|
-
}
|
|
27126
|
-
inversePath.push(searchEntity.siblingIndex);
|
|
27127
|
-
searchEntity = parent;
|
|
27128
|
-
}
|
|
27129
|
-
return true;
|
|
27130
|
-
};
|
|
27131
|
-
CloneUtils._getEntityByHierarchyPath = function _getEntityByHierarchyPath(rootEntity, inversePath) {
|
|
27132
|
-
var entity = rootEntity;
|
|
27133
|
-
for(var i = inversePath.length - 1; i >= 0; i--){
|
|
27134
|
-
entity = entity.children[inversePath[i]];
|
|
27135
|
-
}
|
|
27136
|
-
return entity;
|
|
27137
|
-
};
|
|
27138
|
-
return CloneUtils;
|
|
27139
|
-
}();
|
|
27140
|
-
CloneUtils._tempRemapPath = [];
|
|
27141
27129
|
/**
|
|
27142
27130
|
* Skin used for skinned mesh renderer.
|
|
27143
27131
|
*/ var Skin = /*#__PURE__*/ function(EngineObject) {
|
|
@@ -27169,25 +27157,6 @@
|
|
|
27169
27157
|
}
|
|
27170
27158
|
this._updateMark = renderer.engine.time.frameCount;
|
|
27171
27159
|
};
|
|
27172
|
-
/**
|
|
27173
|
-
* @internal
|
|
27174
|
-
*/ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
|
|
27175
|
-
// Clone rootBone
|
|
27176
|
-
var rootBone = this.rootBone;
|
|
27177
|
-
if (rootBone) {
|
|
27178
|
-
target.rootBone = CloneUtils.remapEntity(srcRoot, targetRoot, rootBone);
|
|
27179
|
-
}
|
|
27180
|
-
// Clone bones
|
|
27181
|
-
var bones = this.bones;
|
|
27182
|
-
if (bones.length > 0) {
|
|
27183
|
-
var boneCount = bones.length;
|
|
27184
|
-
var destBones = new Array(boneCount);
|
|
27185
|
-
for(var i = 0; i < boneCount; i++){
|
|
27186
|
-
destBones[i] = CloneUtils.remapEntity(srcRoot, targetRoot, bones[i]);
|
|
27187
|
-
}
|
|
27188
|
-
target.bones = destBones;
|
|
27189
|
-
}
|
|
27190
|
-
};
|
|
27191
27160
|
_create_class$2(Skin, [
|
|
27192
27161
|
{
|
|
27193
27162
|
key: "rootBone",
|
|
@@ -27251,10 +27220,7 @@
|
|
|
27251
27220
|
ignoreClone
|
|
27252
27221
|
], Skin.prototype, "_updatedManager", void 0);
|
|
27253
27222
|
__decorate$1([
|
|
27254
|
-
|
|
27255
|
-
], Skin.prototype, "_rootBone", void 0);
|
|
27256
|
-
__decorate$1([
|
|
27257
|
-
ignoreClone
|
|
27223
|
+
deepClone
|
|
27258
27224
|
], Skin.prototype, "_bones", void 0);
|
|
27259
27225
|
__decorate$1([
|
|
27260
27226
|
ignoreClone
|
|
@@ -27303,8 +27269,8 @@
|
|
|
27303
27269
|
};
|
|
27304
27270
|
/**
|
|
27305
27271
|
* @internal
|
|
27306
|
-
*/ _proto._cloneTo = function _cloneTo(target
|
|
27307
|
-
MeshRenderer.prototype._cloneTo.call(this, target
|
|
27272
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
27273
|
+
MeshRenderer.prototype._cloneTo.call(this, target);
|
|
27308
27274
|
if (this.skin) {
|
|
27309
27275
|
target._applySkin(null, target.skin);
|
|
27310
27276
|
}
|
|
@@ -27840,9 +27806,7 @@
|
|
|
27840
27806
|
for(var k in source){
|
|
27841
27807
|
CloneManager.cloneProperty(source, target, k, cloneModes[k], srcRoot, targetRoot, deepInstanceMap);
|
|
27842
27808
|
}
|
|
27843
|
-
|
|
27844
|
-
source._cloneTo(target, srcRoot, targetRoot);
|
|
27845
|
-
}
|
|
27809
|
+
source._cloneTo == null ? void 0 : source._cloneTo.call(source, target, srcRoot, targetRoot);
|
|
27846
27810
|
};
|
|
27847
27811
|
return ComponentCloner;
|
|
27848
27812
|
}();
|
|
@@ -28026,6 +27990,11 @@
|
|
|
28026
27990
|
};
|
|
28027
27991
|
/**
|
|
28028
27992
|
* @internal
|
|
27993
|
+
*/ _proto._remap = function _remap(srcRoot, targetRoot) {
|
|
27994
|
+
return CloneUtils.remapEntity(srcRoot, targetRoot, this);
|
|
27995
|
+
};
|
|
27996
|
+
/**
|
|
27997
|
+
* @internal
|
|
28029
27998
|
*/ _proto._markAsTemplate = function _markAsTemplate(templateResource) {
|
|
28030
27999
|
this._isTemplate = true;
|
|
28031
28000
|
this._templateResource = templateResource;
|
|
@@ -36001,7 +35970,7 @@
|
|
|
36001
35970
|
};
|
|
36002
35971
|
/**
|
|
36003
35972
|
* @internal
|
|
36004
|
-
*/ _proto._cloneTo = function _cloneTo(target
|
|
35973
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
36005
35974
|
var animatorController = target._animatorController;
|
|
36006
35975
|
if (animatorController) {
|
|
36007
35976
|
target._addResourceReferCount(animatorController, 1);
|
|
@@ -41110,9 +41079,6 @@
|
|
|
41110
41079
|
__decorate$1([
|
|
41111
41080
|
ignoreClone
|
|
41112
41081
|
], ParticleGenerator.prototype, "_subPrimitive", void 0);
|
|
41113
|
-
__decorate$1([
|
|
41114
|
-
ignoreClone
|
|
41115
|
-
], ParticleGenerator.prototype, "_renderer", void 0);
|
|
41116
41082
|
__decorate$1([
|
|
41117
41083
|
ignoreClone
|
|
41118
41084
|
], ParticleGenerator.prototype, "_isPlaying", void 0);
|
|
@@ -41839,7 +41805,7 @@
|
|
|
41839
41805
|
};
|
|
41840
41806
|
/**
|
|
41841
41807
|
* @internal
|
|
41842
|
-
*/ _proto._cloneTo = function _cloneTo(target
|
|
41808
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
41843
41809
|
target.mesh = this._mesh;
|
|
41844
41810
|
};
|
|
41845
41811
|
_create_class$2(MeshShape, [
|
|
@@ -42806,7 +42772,7 @@
|
|
|
42806
42772
|
};
|
|
42807
42773
|
/**
|
|
42808
42774
|
* @internal
|
|
42809
|
-
*/ _proto._cloneTo = function _cloneTo(target
|
|
42775
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
42810
42776
|
var _target__clip;
|
|
42811
42777
|
(_target__clip = target._clip) == null ? void 0 : _target__clip._addReferCount(1);
|
|
42812
42778
|
target._gainNode.gain.setValueAtTime(target._volume, AudioManager.getContext().currentTime);
|
|
@@ -46507,11 +46473,14 @@
|
|
|
46507
46473
|
return resource;
|
|
46508
46474
|
});
|
|
46509
46475
|
} else if (ReflectionParser._isComponentRef(value)) {
|
|
46510
|
-
var
|
|
46511
|
-
return Promise.resolve(
|
|
46476
|
+
var entity = this._resolveEntityByPath(value.entityPath);
|
|
46477
|
+
if (!entity) return Promise.resolve(null);
|
|
46478
|
+
var type = Loader.getClass(value.componentType);
|
|
46479
|
+
if (!type) return Promise.resolve(null);
|
|
46480
|
+
var _entity_getComponents_value_componentIndex;
|
|
46481
|
+
return Promise.resolve((_entity_getComponents_value_componentIndex = entity.getComponents(type, [])[value.componentIndex]) != null ? _entity_getComponents_value_componentIndex : null);
|
|
46512
46482
|
} else if (ReflectionParser._isEntityRef(value)) {
|
|
46513
|
-
|
|
46514
|
-
return Promise.resolve(this._context.entityMap.get(value.entityId));
|
|
46483
|
+
return Promise.resolve(this._resolveEntityByPath(value.entityPath));
|
|
46515
46484
|
} else if (ReflectionParser._isSignalRef(value)) {
|
|
46516
46485
|
return this.parseSignal(value);
|
|
46517
46486
|
} else if (originValue) {
|
|
@@ -46569,6 +46538,16 @@
|
|
|
46569
46538
|
return Promise.resolve(entity);
|
|
46570
46539
|
}
|
|
46571
46540
|
};
|
|
46541
|
+
_proto._resolveEntityByPath = function _resolveEntityByPath(entityPath) {
|
|
46542
|
+
var _this__context = this._context, rootIds = _this__context.rootIds, entityMap = _this__context.entityMap;
|
|
46543
|
+
if (!entityPath.length || entityPath[0] >= rootIds.length) return null;
|
|
46544
|
+
var entity = entityMap.get(rootIds[entityPath[0]]);
|
|
46545
|
+
for(var i = 1; i < entityPath.length; i++){
|
|
46546
|
+
if (!entity || entityPath[i] >= entity.children.length) return null;
|
|
46547
|
+
entity = entity.children[entityPath[i]];
|
|
46548
|
+
}
|
|
46549
|
+
return entity;
|
|
46550
|
+
};
|
|
46572
46551
|
ReflectionParser._isClass = function _isClass(value) {
|
|
46573
46552
|
return value["class"] !== undefined;
|
|
46574
46553
|
};
|
|
@@ -46579,10 +46558,10 @@
|
|
|
46579
46558
|
return value["url"] !== undefined;
|
|
46580
46559
|
};
|
|
46581
46560
|
ReflectionParser._isEntityRef = function _isEntityRef(value) {
|
|
46582
|
-
return value["
|
|
46561
|
+
return Array.isArray(value["entityPath"]) && value["componentType"] === undefined;
|
|
46583
46562
|
};
|
|
46584
46563
|
ReflectionParser._isComponentRef = function _isComponentRef(value) {
|
|
46585
|
-
return value["
|
|
46564
|
+
return Array.isArray(value["entityPath"]) && value["componentType"] !== undefined;
|
|
46586
46565
|
};
|
|
46587
46566
|
ReflectionParser._isSignalRef = function _isSignalRef(value) {
|
|
46588
46567
|
return value["listeners"] !== undefined;
|
|
@@ -46808,6 +46787,13 @@
|
|
|
46808
46787
|
for(var i = 0, l = entities.length; i < l; i++){
|
|
46809
46788
|
entityMap.set(entitiesConfig[i].id, entities[i]);
|
|
46810
46789
|
}
|
|
46790
|
+
// Build rootIds in serialization order (not async completion order)
|
|
46791
|
+
var rootIds = _this.context.rootIds;
|
|
46792
|
+
for(var i1 = 0, l1 = entitiesConfig.length; i1 < l1; i1++){
|
|
46793
|
+
if (!entitiesConfig[i1].parent && !entitiesConfig[i1].strippedId) {
|
|
46794
|
+
rootIds.push(entitiesConfig[i1].id);
|
|
46795
|
+
}
|
|
46796
|
+
}
|
|
46811
46797
|
return entities;
|
|
46812
46798
|
});
|
|
46813
46799
|
};
|
|
@@ -46933,7 +46919,6 @@
|
|
|
46933
46919
|
_proto._parseEntity = function _parseEntity(entityConfig, engine) {
|
|
46934
46920
|
var transform = entityConfig.transform;
|
|
46935
46921
|
var entity = new Entity(engine, entityConfig.name, transform ? Loader.getClass(transform.class) : Transform);
|
|
46936
|
-
if (!entityConfig.parent) this.context.rootIds.push(entityConfig.id);
|
|
46937
46922
|
this._addEntityPlugin(entityConfig.id, entity);
|
|
46938
46923
|
return Promise.resolve(entity);
|
|
46939
46924
|
};
|
|
@@ -46946,7 +46931,6 @@
|
|
|
46946
46931
|
}).then(function(prefabResource) {
|
|
46947
46932
|
var entity = _instanceof1(prefabResource, PrefabResource) ? prefabResource.instantiate() : prefabResource.instantiateSceneRoot();
|
|
46948
46933
|
var instanceContext = new ParserContext(engine, ParserType.Prefab, null);
|
|
46949
|
-
if (!entityConfig.parent) _this.context.rootIds.push(entityConfig.id);
|
|
46950
46934
|
_this._generateInstanceContext(entity, instanceContext, "");
|
|
46951
46935
|
_this._prefabContextMap.set(entity, instanceContext);
|
|
46952
46936
|
var cbArray = _this._prefabPromiseMap.get(entityConfig.id);
|
|
@@ -52926,7 +52910,7 @@
|
|
|
52926
52910
|
], EXT_texture_webp);
|
|
52927
52911
|
|
|
52928
52912
|
//@ts-ignore
|
|
52929
|
-
var version = "2.0.0-alpha.
|
|
52913
|
+
var version = "2.0.0-alpha.16";
|
|
52930
52914
|
console.log("Galacean Engine Version: " + version);
|
|
52931
52915
|
for(var key in CoreObjects){
|
|
52932
52916
|
Loader.registerClass(key, CoreObjects[key]);
|