@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/dist/module.js CHANGED
@@ -1076,6 +1076,7 @@ var ReflectionParser = /*#__PURE__*/ function() {
1076
1076
  };
1077
1077
  };
1078
1078
  /**
1079
+ * @internal
1079
1080
  * Convert RGBE pixel data to R16G16B16A16 half-float.
1080
1081
  */ HDRDecoder._rgbeToHalfFloat = function _rgbeToHalfFloat(rgbe, width, height) {
1081
1082
  var floatView = this._floatView;
@@ -1099,6 +1100,7 @@ var ReflectionParser = /*#__PURE__*/ function() {
1099
1100
  return result;
1100
1101
  };
1101
1102
  /**
1103
+ * @internal
1102
1104
  * Decode RLE-compressed RGBE scanlines into raw RGBE pixel data.
1103
1105
  */ HDRDecoder._readPixels = function _readPixels(buffer, width, height) {
1104
1106
  var byteLength = buffer.byteLength;
@@ -1447,16 +1449,31 @@ function _instanceof(left, right) {
1447
1449
  var refs = this.data.refs;
1448
1450
  for(var i = 0, n = entities.length; i < n; i++){
1449
1451
  var entityConfig = entities[i];
1450
- if (HierarchyParser._isPrefabInstanceEntity(entityConfig)) continue;
1451
1452
  var entity = entityInstances[i];
1453
+ if (HierarchyParser._isPrefabInstanceEntity(entityConfig)) {
1454
+ var _entityConfig_instance_overrides;
1455
+ var additions = (_entityConfig_instance_overrides = entityConfig.instance.overrides) == null ? void 0 : _entityConfig_instance_overrides.addedComponents;
1456
+ var _additions_length;
1457
+ for(var j = 0, m = (_additions_length = additions == null ? void 0 : additions.length) != null ? _additions_length : 0; j < m; j++){
1458
+ var added = additions[j];
1459
+ var target = HierarchyParser._resolveEntity(entity, added.target);
1460
+ var config = allComponents[added.component];
1461
+ var instance = HierarchyParser._addComponentFromConfig(target, config, refs);
1462
+ pendingComponents.push({
1463
+ instance: instance,
1464
+ config: config
1465
+ });
1466
+ }
1467
+ continue;
1468
+ }
1452
1469
  var componentIndices = entityConfig.components;
1453
1470
  if (!componentIndices) continue;
1454
- for(var j = 0, m = componentIndices.length; j < m; j++){
1455
- var config = allComponents[componentIndices[j]];
1456
- var instance = HierarchyParser._addComponentFromConfig(entity, config, refs);
1471
+ for(var j1 = 0, m1 = componentIndices.length; j1 < m1; j1++){
1472
+ var config1 = allComponents[componentIndices[j1]];
1473
+ var instance1 = HierarchyParser._addComponentFromConfig(entity, config1, refs);
1457
1474
  pendingComponents.push({
1458
- instance: instance,
1459
- config: config
1475
+ instance: instance1,
1476
+ config: config1
1460
1477
  });
1461
1478
  }
1462
1479
  }
@@ -1491,7 +1508,6 @@ function _instanceof(left, right) {
1491
1508
  return Promise.all(promises);
1492
1509
  };
1493
1510
  _proto._applyOverrides = function _applyOverrides(rootEntity, overrides, promises) {
1494
- var refs = this.data.refs;
1495
1511
  var reflectionParser = this._reflectionParser;
1496
1512
  // entityProps — entity-level property overrides
1497
1513
  if (overrides.entityProps) {
@@ -1509,50 +1525,39 @@ function _instanceof(left, right) {
1509
1525
  promises.push(reflectionParser.parseMutationBlock(target, override1));
1510
1526
  }
1511
1527
  }
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
1528
  // addedEntities — attach already-created top-level entityInstances[index] as a child
1524
1529
  if (overrides.addedEntities) {
1525
1530
  var entityInstances = this.context.entityInstances;
1526
- for(var j3 = 0, m3 = overrides.addedEntities.length; j3 < m3; j3++){
1527
- var added1 = overrides.addedEntities[j3];
1528
- var parent = HierarchyParser._resolveEntity(rootEntity, added1.parent);
1529
- parent.addChild(entityInstances[added1.entity]);
1531
+ for(var j2 = 0, m2 = overrides.addedEntities.length; j2 < m2; j2++){
1532
+ var added = overrides.addedEntities[j2];
1533
+ var parent = HierarchyParser._resolveEntity(rootEntity, added.parent);
1534
+ parent.addChild(entityInstances[added.entity]);
1530
1535
  }
1531
1536
  }
1532
1537
  // removedEntities — pre-resolve all targets then destroy (destroy shifts sibling indices)
1533
1538
  if (overrides.removedEntities) {
1534
1539
  var removed = overrides.removedEntities;
1535
1540
  var targets = new Array(removed.length);
1536
- for(var j4 = 0, m4 = removed.length; j4 < m4; j4++){
1537
- targets[j4] = HierarchyParser._resolveEntity(rootEntity, removed[j4]);
1541
+ for(var j3 = 0, m3 = removed.length; j3 < m3; j3++){
1542
+ targets[j3] = HierarchyParser._resolveEntity(rootEntity, removed[j3]);
1538
1543
  }
1539
- for(var j5 = 0, m5 = targets.length; j5 < m5; j5++){
1540
- targets[j5].destroy();
1544
+ for(var j4 = 0, m4 = targets.length; j4 < m4; j4++){
1545
+ targets[j4].destroy();
1541
1546
  }
1542
1547
  }
1543
1548
  // removedComponents — pre-resolve all targets then destroy (destroy shifts component indices)
1544
1549
  if (overrides.removedComponents) {
1545
1550
  var targets1 = [];
1546
- for(var j6 = 0, m6 = overrides.removedComponents.length; j6 < m6; j6++){
1547
- var override2 = overrides.removedComponents[j6];
1548
- var entity2 = HierarchyParser._resolveEntity(rootEntity, override2.path);
1551
+ for(var j5 = 0, m5 = overrides.removedComponents.length; j5 < m5; j5++){
1552
+ var override2 = overrides.removedComponents[j5];
1553
+ var entity1 = HierarchyParser._resolveEntity(rootEntity, override2.path);
1549
1554
  var selectors = override2.selectors;
1550
1555
  for(var k = 0, p = selectors.length; k < p; k++){
1551
- targets1.push(HierarchyParser._resolveComponent(entity2, selectors[k]));
1556
+ targets1.push(HierarchyParser._resolveComponent(entity1, selectors[k]));
1552
1557
  }
1553
1558
  }
1554
- for(var j7 = 0, m7 = targets1.length; j7 < m7; j7++){
1555
- targets1[j7].destroy();
1559
+ for(var j6 = 0, m6 = targets1.length; j6 < m6; j6++){
1560
+ targets1[j6].destroy();
1556
1561
  }
1557
1562
  }
1558
1563
  };