@galacean/engine-loader 2.0.0-alpha.46 → 2.0.0-alpha.47
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 +35 -32
- package/dist/main.js.map +1 -1
- package/dist/module.js +35 -32
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
package/dist/module.js
CHANGED
|
@@ -1447,16 +1447,31 @@ function _instanceof(left, right) {
|
|
|
1447
1447
|
var refs = this.data.refs;
|
|
1448
1448
|
for(var i = 0, n = entities.length; i < n; i++){
|
|
1449
1449
|
var entityConfig = entities[i];
|
|
1450
|
-
if (HierarchyParser._isPrefabInstanceEntity(entityConfig)) continue;
|
|
1451
1450
|
var entity = entityInstances[i];
|
|
1451
|
+
if (HierarchyParser._isPrefabInstanceEntity(entityConfig)) {
|
|
1452
|
+
var _entityConfig_instance_overrides;
|
|
1453
|
+
var additions = (_entityConfig_instance_overrides = entityConfig.instance.overrides) == null ? void 0 : _entityConfig_instance_overrides.addedComponents;
|
|
1454
|
+
var _additions_length;
|
|
1455
|
+
for(var j = 0, m = (_additions_length = additions == null ? void 0 : additions.length) != null ? _additions_length : 0; j < m; j++){
|
|
1456
|
+
var added = additions[j];
|
|
1457
|
+
var target = HierarchyParser._resolveEntity(entity, added.target);
|
|
1458
|
+
var config = allComponents[added.component];
|
|
1459
|
+
var instance = HierarchyParser._addComponentFromConfig(target, config, refs);
|
|
1460
|
+
pendingComponents.push({
|
|
1461
|
+
instance: instance,
|
|
1462
|
+
config: config
|
|
1463
|
+
});
|
|
1464
|
+
}
|
|
1465
|
+
continue;
|
|
1466
|
+
}
|
|
1452
1467
|
var componentIndices = entityConfig.components;
|
|
1453
1468
|
if (!componentIndices) continue;
|
|
1454
|
-
for(var
|
|
1455
|
-
var
|
|
1456
|
-
var
|
|
1469
|
+
for(var j1 = 0, m1 = componentIndices.length; j1 < m1; j1++){
|
|
1470
|
+
var config1 = allComponents[componentIndices[j1]];
|
|
1471
|
+
var instance1 = HierarchyParser._addComponentFromConfig(entity, config1, refs);
|
|
1457
1472
|
pendingComponents.push({
|
|
1458
|
-
instance:
|
|
1459
|
-
config:
|
|
1473
|
+
instance: instance1,
|
|
1474
|
+
config: config1
|
|
1460
1475
|
});
|
|
1461
1476
|
}
|
|
1462
1477
|
}
|
|
@@ -1491,7 +1506,6 @@ function _instanceof(left, right) {
|
|
|
1491
1506
|
return Promise.all(promises);
|
|
1492
1507
|
};
|
|
1493
1508
|
_proto._applyOverrides = function _applyOverrides(rootEntity, overrides, promises) {
|
|
1494
|
-
var refs = this.data.refs;
|
|
1495
1509
|
var reflectionParser = this._reflectionParser;
|
|
1496
1510
|
// entityProps — entity-level property overrides
|
|
1497
1511
|
if (overrides.entityProps) {
|
|
@@ -1509,50 +1523,39 @@ function _instanceof(left, right) {
|
|
|
1509
1523
|
promises.push(reflectionParser.parseMutationBlock(target, override1));
|
|
1510
1524
|
}
|
|
1511
1525
|
}
|
|
1512
|
-
// addedComponents — attach top-level components[index] to a prefab entity and parse props
|
|
1513
|
-
if (overrides.addedComponents) {
|
|
1514
|
-
var allComponents = this.data.components;
|
|
1515
|
-
for(var j2 = 0, m2 = overrides.addedComponents.length; j2 < m2; j2++){
|
|
1516
|
-
var added = overrides.addedComponents[j2];
|
|
1517
|
-
var entity1 = HierarchyParser._resolveEntity(rootEntity, added.target);
|
|
1518
|
-
var config = allComponents[added.component];
|
|
1519
|
-
var component = HierarchyParser._addComponentFromConfig(entity1, config, refs);
|
|
1520
|
-
promises.push(reflectionParser.parseMutationBlock(component, config));
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
1526
|
// addedEntities — attach already-created top-level entityInstances[index] as a child
|
|
1524
1527
|
if (overrides.addedEntities) {
|
|
1525
1528
|
var entityInstances = this.context.entityInstances;
|
|
1526
|
-
for(var
|
|
1527
|
-
var
|
|
1528
|
-
var parent = HierarchyParser._resolveEntity(rootEntity,
|
|
1529
|
-
parent.addChild(entityInstances[
|
|
1529
|
+
for(var j2 = 0, m2 = overrides.addedEntities.length; j2 < m2; j2++){
|
|
1530
|
+
var added = overrides.addedEntities[j2];
|
|
1531
|
+
var parent = HierarchyParser._resolveEntity(rootEntity, added.parent);
|
|
1532
|
+
parent.addChild(entityInstances[added.entity]);
|
|
1530
1533
|
}
|
|
1531
1534
|
}
|
|
1532
1535
|
// removedEntities — pre-resolve all targets then destroy (destroy shifts sibling indices)
|
|
1533
1536
|
if (overrides.removedEntities) {
|
|
1534
1537
|
var removed = overrides.removedEntities;
|
|
1535
1538
|
var targets = new Array(removed.length);
|
|
1536
|
-
for(var
|
|
1537
|
-
targets[
|
|
1539
|
+
for(var j3 = 0, m3 = removed.length; j3 < m3; j3++){
|
|
1540
|
+
targets[j3] = HierarchyParser._resolveEntity(rootEntity, removed[j3]);
|
|
1538
1541
|
}
|
|
1539
|
-
for(var
|
|
1540
|
-
targets[
|
|
1542
|
+
for(var j4 = 0, m4 = targets.length; j4 < m4; j4++){
|
|
1543
|
+
targets[j4].destroy();
|
|
1541
1544
|
}
|
|
1542
1545
|
}
|
|
1543
1546
|
// removedComponents — pre-resolve all targets then destroy (destroy shifts component indices)
|
|
1544
1547
|
if (overrides.removedComponents) {
|
|
1545
1548
|
var targets1 = [];
|
|
1546
|
-
for(var
|
|
1547
|
-
var override2 = overrides.removedComponents[
|
|
1548
|
-
var
|
|
1549
|
+
for(var j5 = 0, m5 = overrides.removedComponents.length; j5 < m5; j5++){
|
|
1550
|
+
var override2 = overrides.removedComponents[j5];
|
|
1551
|
+
var entity1 = HierarchyParser._resolveEntity(rootEntity, override2.path);
|
|
1549
1552
|
var selectors = override2.selectors;
|
|
1550
1553
|
for(var k = 0, p = selectors.length; k < p; k++){
|
|
1551
|
-
targets1.push(HierarchyParser._resolveComponent(
|
|
1554
|
+
targets1.push(HierarchyParser._resolveComponent(entity1, selectors[k]));
|
|
1552
1555
|
}
|
|
1553
1556
|
}
|
|
1554
|
-
for(var
|
|
1555
|
-
targets1[
|
|
1557
|
+
for(var j6 = 0, m6 = targets1.length; j6 < m6; j6++){
|
|
1558
|
+
targets1[j6].destroy();
|
|
1556
1559
|
}
|
|
1557
1560
|
}
|
|
1558
1561
|
};
|