@galacean/engine-loader 1.5.14 → 1.5.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/main.js CHANGED
@@ -1075,6 +1075,25 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
1075
1075
  /** start parse the scene or prefab or others */ _proto.start = function start() {
1076
1076
  this._parseEntities().then(this._organizeEntities).then(this._parseComponents).then(this._parseAddedComponents).then(this._parseComponentsPropsAndMethods).then(this._parsePrefabModification).then(this._parsePrefabRemovedEntities).then(this._parsePrefabRemovedComponents).then(this._clearAndResolve).then(this._resolve).catch(this._reject);
1077
1077
  };
1078
+ _proto._applyEntityData = function _applyEntityData(entity, entityConfig) {
1079
+ if (entityConfig === void 0) entityConfig = {};
1080
+ var _entityConfig_isActive;
1081
+ entity.isActive = (_entityConfig_isActive = entityConfig.isActive) != null ? _entityConfig_isActive : entity.isActive;
1082
+ var _entityConfig_name;
1083
+ entity.name = (_entityConfig_name = entityConfig.name) != null ? _entityConfig_name : entity.name;
1084
+ var transform = entity.transform;
1085
+ var transformConfig = entityConfig.transform;
1086
+ if (transformConfig) {
1087
+ this._reflectionParser.parsePropsAndMethods(transform, transformConfig);
1088
+ } else {
1089
+ var position = entityConfig.position, rotation = entityConfig.rotation, scale = entityConfig.scale;
1090
+ if (position) transform.position.copyFrom(position);
1091
+ if (rotation) transform.rotation.copyFrom(rotation);
1092
+ if (scale) transform.scale.copyFrom(scale);
1093
+ }
1094
+ if (entityConfig.layer) entity.layer = entityConfig.layer;
1095
+ return entity;
1096
+ };
1078
1097
  _proto._parseEntities = function _parseEntities() {
1079
1098
  var _this = this;
1080
1099
  var entitiesConfig = this.data.entities;
@@ -1285,25 +1304,6 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
1285
1304
  this._addComponentPlugin(componentId, component);
1286
1305
  }
1287
1306
  };
1288
- _proto._applyEntityData = function _applyEntityData(entity, entityConfig) {
1289
- if (entityConfig === void 0) entityConfig = {};
1290
- var _entityConfig_isActive;
1291
- entity.isActive = (_entityConfig_isActive = entityConfig.isActive) != null ? _entityConfig_isActive : entity.isActive;
1292
- var _entityConfig_name;
1293
- entity.name = (_entityConfig_name = entityConfig.name) != null ? _entityConfig_name : entity.name;
1294
- var transform = entity.transform;
1295
- var transformConfig = entityConfig.transform;
1296
- if (transformConfig) {
1297
- this._reflectionParser.parsePropsAndMethods(transform, transformConfig);
1298
- } else {
1299
- var position = entityConfig.position, rotation = entityConfig.rotation, scale = entityConfig.scale;
1300
- if (position) transform.position.copyFrom(position);
1301
- if (rotation) transform.rotation.copyFrom(rotation);
1302
- if (scale) transform.scale.copyFrom(scale);
1303
- }
1304
- if (entityConfig.layer) entity.layer = entityConfig.layer;
1305
- return entity;
1306
- };
1307
1307
  _proto._generateInstanceContext = function _generateInstanceContext(entity, context, path) {
1308
1308
  var entityMap = context.entityMap, components = context.components;
1309
1309
  var componentsMap = {};
@@ -5390,6 +5390,13 @@ var PrefabParser = /*#__PURE__*/ function(HierarchyParser) {
5390
5390
  return _this;
5391
5391
  }
5392
5392
  var _proto = PrefabParser.prototype;
5393
+ _proto._applyEntityData = function _applyEntityData(entity, entityConfig) {
5394
+ if (entityConfig === void 0) entityConfig = {};
5395
+ HierarchyParser.prototype._applyEntityData.call(this, entity, entityConfig);
5396
+ // @ts-ignore
5397
+ entity._markAsTemplate(this.context.resource);
5398
+ return entity;
5399
+ };
5393
5400
  _proto._handleRootEntity = function _handleRootEntity(id) {
5394
5401
  this.prefabResource._root = this.context.entityMap.get(id);
5395
5402
  };