@galacean/engine-loader 2.0.0-alpha.46 → 2.0.0-alpha.48
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/README.md +3 -1
- package/dist/main.js +37 -32
- package/dist/main.js.map +1 -1
- package/dist/module.js +37 -32
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/HDRDecoder.d.ts +2 -0
package/README.md
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
A subpackage of `@galacean/engine`.
|
|
1
|
+
A subpackage of `@galacean/engine`.
|
|
2
|
+
|
|
3
|
+
Hierarchy loading creates all ordinary and instance-added components before resolving component properties and calls. References use the template component order plus additions; removals run afterward, so deleting a component does not shift a selector before its reference is resolved. Scene and Prefab loading share this lifecycle.
|
package/dist/main.js
CHANGED
|
@@ -1080,6 +1080,7 @@ var ReflectionParser = /*#__PURE__*/ function() {
|
|
|
1080
1080
|
};
|
|
1081
1081
|
};
|
|
1082
1082
|
/**
|
|
1083
|
+
* @internal
|
|
1083
1084
|
* Convert RGBE pixel data to R16G16B16A16 half-float.
|
|
1084
1085
|
*/ HDRDecoder._rgbeToHalfFloat = function _rgbeToHalfFloat(rgbe, width, height) {
|
|
1085
1086
|
var floatView = this._floatView;
|
|
@@ -1103,6 +1104,7 @@ var ReflectionParser = /*#__PURE__*/ function() {
|
|
|
1103
1104
|
return result;
|
|
1104
1105
|
};
|
|
1105
1106
|
/**
|
|
1107
|
+
* @internal
|
|
1106
1108
|
* Decode RLE-compressed RGBE scanlines into raw RGBE pixel data.
|
|
1107
1109
|
*/ HDRDecoder._readPixels = function _readPixels(buffer, width, height) {
|
|
1108
1110
|
var byteLength = buffer.byteLength;
|
|
@@ -1451,16 +1453,31 @@ function _instanceof(left, right) {
|
|
|
1451
1453
|
var refs = this.data.refs;
|
|
1452
1454
|
for(var i = 0, n = entities.length; i < n; i++){
|
|
1453
1455
|
var entityConfig = entities[i];
|
|
1454
|
-
if (HierarchyParser._isPrefabInstanceEntity(entityConfig)) continue;
|
|
1455
1456
|
var entity = entityInstances[i];
|
|
1457
|
+
if (HierarchyParser._isPrefabInstanceEntity(entityConfig)) {
|
|
1458
|
+
var _entityConfig_instance_overrides;
|
|
1459
|
+
var additions = (_entityConfig_instance_overrides = entityConfig.instance.overrides) == null ? void 0 : _entityConfig_instance_overrides.addedComponents;
|
|
1460
|
+
var _additions_length;
|
|
1461
|
+
for(var j = 0, m = (_additions_length = additions == null ? void 0 : additions.length) != null ? _additions_length : 0; j < m; j++){
|
|
1462
|
+
var added = additions[j];
|
|
1463
|
+
var target = HierarchyParser._resolveEntity(entity, added.target);
|
|
1464
|
+
var config = allComponents[added.component];
|
|
1465
|
+
var instance = HierarchyParser._addComponentFromConfig(target, config, refs);
|
|
1466
|
+
pendingComponents.push({
|
|
1467
|
+
instance: instance,
|
|
1468
|
+
config: config
|
|
1469
|
+
});
|
|
1470
|
+
}
|
|
1471
|
+
continue;
|
|
1472
|
+
}
|
|
1456
1473
|
var componentIndices = entityConfig.components;
|
|
1457
1474
|
if (!componentIndices) continue;
|
|
1458
|
-
for(var
|
|
1459
|
-
var
|
|
1460
|
-
var
|
|
1475
|
+
for(var j1 = 0, m1 = componentIndices.length; j1 < m1; j1++){
|
|
1476
|
+
var config1 = allComponents[componentIndices[j1]];
|
|
1477
|
+
var instance1 = HierarchyParser._addComponentFromConfig(entity, config1, refs);
|
|
1461
1478
|
pendingComponents.push({
|
|
1462
|
-
instance:
|
|
1463
|
-
config:
|
|
1479
|
+
instance: instance1,
|
|
1480
|
+
config: config1
|
|
1464
1481
|
});
|
|
1465
1482
|
}
|
|
1466
1483
|
}
|
|
@@ -1495,7 +1512,6 @@ function _instanceof(left, right) {
|
|
|
1495
1512
|
return Promise.all(promises);
|
|
1496
1513
|
};
|
|
1497
1514
|
_proto._applyOverrides = function _applyOverrides(rootEntity, overrides, promises) {
|
|
1498
|
-
var refs = this.data.refs;
|
|
1499
1515
|
var reflectionParser = this._reflectionParser;
|
|
1500
1516
|
// entityProps — entity-level property overrides
|
|
1501
1517
|
if (overrides.entityProps) {
|
|
@@ -1513,50 +1529,39 @@ function _instanceof(left, right) {
|
|
|
1513
1529
|
promises.push(reflectionParser.parseMutationBlock(target, override1));
|
|
1514
1530
|
}
|
|
1515
1531
|
}
|
|
1516
|
-
// addedComponents — attach top-level components[index] to a prefab entity and parse props
|
|
1517
|
-
if (overrides.addedComponents) {
|
|
1518
|
-
var allComponents = this.data.components;
|
|
1519
|
-
for(var j2 = 0, m2 = overrides.addedComponents.length; j2 < m2; j2++){
|
|
1520
|
-
var added = overrides.addedComponents[j2];
|
|
1521
|
-
var entity1 = HierarchyParser._resolveEntity(rootEntity, added.target);
|
|
1522
|
-
var config = allComponents[added.component];
|
|
1523
|
-
var component = HierarchyParser._addComponentFromConfig(entity1, config, refs);
|
|
1524
|
-
promises.push(reflectionParser.parseMutationBlock(component, config));
|
|
1525
|
-
}
|
|
1526
|
-
}
|
|
1527
1532
|
// addedEntities — attach already-created top-level entityInstances[index] as a child
|
|
1528
1533
|
if (overrides.addedEntities) {
|
|
1529
1534
|
var entityInstances = this.context.entityInstances;
|
|
1530
|
-
for(var
|
|
1531
|
-
var
|
|
1532
|
-
var parent = HierarchyParser._resolveEntity(rootEntity,
|
|
1533
|
-
parent.addChild(entityInstances[
|
|
1535
|
+
for(var j2 = 0, m2 = overrides.addedEntities.length; j2 < m2; j2++){
|
|
1536
|
+
var added = overrides.addedEntities[j2];
|
|
1537
|
+
var parent = HierarchyParser._resolveEntity(rootEntity, added.parent);
|
|
1538
|
+
parent.addChild(entityInstances[added.entity]);
|
|
1534
1539
|
}
|
|
1535
1540
|
}
|
|
1536
1541
|
// removedEntities — pre-resolve all targets then destroy (destroy shifts sibling indices)
|
|
1537
1542
|
if (overrides.removedEntities) {
|
|
1538
1543
|
var removed = overrides.removedEntities;
|
|
1539
1544
|
var targets = new Array(removed.length);
|
|
1540
|
-
for(var
|
|
1541
|
-
targets[
|
|
1545
|
+
for(var j3 = 0, m3 = removed.length; j3 < m3; j3++){
|
|
1546
|
+
targets[j3] = HierarchyParser._resolveEntity(rootEntity, removed[j3]);
|
|
1542
1547
|
}
|
|
1543
|
-
for(var
|
|
1544
|
-
targets[
|
|
1548
|
+
for(var j4 = 0, m4 = targets.length; j4 < m4; j4++){
|
|
1549
|
+
targets[j4].destroy();
|
|
1545
1550
|
}
|
|
1546
1551
|
}
|
|
1547
1552
|
// removedComponents — pre-resolve all targets then destroy (destroy shifts component indices)
|
|
1548
1553
|
if (overrides.removedComponents) {
|
|
1549
1554
|
var targets1 = [];
|
|
1550
|
-
for(var
|
|
1551
|
-
var override2 = overrides.removedComponents[
|
|
1552
|
-
var
|
|
1555
|
+
for(var j5 = 0, m5 = overrides.removedComponents.length; j5 < m5; j5++){
|
|
1556
|
+
var override2 = overrides.removedComponents[j5];
|
|
1557
|
+
var entity1 = HierarchyParser._resolveEntity(rootEntity, override2.path);
|
|
1553
1558
|
var selectors = override2.selectors;
|
|
1554
1559
|
for(var k = 0, p = selectors.length; k < p; k++){
|
|
1555
|
-
targets1.push(HierarchyParser._resolveComponent(
|
|
1560
|
+
targets1.push(HierarchyParser._resolveComponent(entity1, selectors[k]));
|
|
1556
1561
|
}
|
|
1557
1562
|
}
|
|
1558
|
-
for(var
|
|
1559
|
-
targets1[
|
|
1563
|
+
for(var j6 = 0, m6 = targets1.length; j6 < m6; j6++){
|
|
1564
|
+
targets1[j6].destroy();
|
|
1560
1565
|
}
|
|
1561
1566
|
}
|
|
1562
1567
|
};
|