@galacean/engine-loader 1.4.4 → 1.4.6
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
|
@@ -1099,6 +1099,7 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
|
1099
1099
|
this._organizeEntities = this._organizeEntities.bind(this);
|
|
1100
1100
|
this._parseComponents = this._parseComponents.bind(this);
|
|
1101
1101
|
this._parsePrefabModification = this._parsePrefabModification.bind(this);
|
|
1102
|
+
this._parseAddedComponents = this._parseAddedComponents.bind(this);
|
|
1102
1103
|
this._parsePrefabRemovedEntities = this._parsePrefabRemovedEntities.bind(this);
|
|
1103
1104
|
this._parsePrefabRemovedComponents = this._parsePrefabRemovedComponents.bind(this);
|
|
1104
1105
|
this._clearAndResolve = this._clearAndResolve.bind(this);
|
|
@@ -1110,7 +1111,7 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
|
1110
1111
|
}
|
|
1111
1112
|
var _proto = HierarchyParser.prototype;
|
|
1112
1113
|
/** start parse the scene or prefab or others */ _proto.start = function start() {
|
|
1113
|
-
this._parseEntities().then(this._organizeEntities).then(this._parseComponents).then(this._parsePrefabModification).then(this._parsePrefabRemovedEntities).then(this._parsePrefabRemovedComponents).then(this._clearAndResolve).then(this._resolve).catch(this._reject);
|
|
1114
|
+
this._parseEntities().then(this._organizeEntities).then(this._parseComponents).then(this._parsePrefabModification).then(this._parseAddedComponents).then(this._parsePrefabRemovedEntities).then(this._parsePrefabRemovedComponents).then(this._clearAndResolve).then(this._resolve).catch(this._reject);
|
|
1114
1115
|
};
|
|
1115
1116
|
_proto._parseEntities = function _parseEntities() {
|
|
1116
1117
|
var _this = this;
|
|
@@ -1138,21 +1139,11 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
|
1138
1139
|
var promises = [];
|
|
1139
1140
|
for(var i = 0, l = entitiesConfig.length; i < l; i++){
|
|
1140
1141
|
var entityConfig = entitiesConfig[i];
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
var componentConfig = entityConfig.components[i1];
|
|
1144
|
-
var key = !componentConfig.refId ? componentConfig.class : componentConfig.refId;
|
|
1145
|
-
var component = entity.addComponent(Loader.getClass(key));
|
|
1146
|
-
this.context.addComponent(componentConfig.id, component);
|
|
1147
|
-
var promise = this._reflectionParser.parsePropsAndMethods(component, componentConfig);
|
|
1148
|
-
promises.push(promise);
|
|
1142
|
+
if (entityConfig.strippedId) {
|
|
1143
|
+
continue;
|
|
1149
1144
|
}
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
var waitingList = _step.value;
|
|
1153
|
-
waitingList.forEach(function(resolve) {
|
|
1154
|
-
return resolve(null);
|
|
1155
|
-
});
|
|
1145
|
+
var entity = entityMap.get(entityConfig.id);
|
|
1146
|
+
this._addComponents(entity, entityConfig.components, promises);
|
|
1156
1147
|
}
|
|
1157
1148
|
return Promise.all(promises);
|
|
1158
1149
|
};
|
|
@@ -1187,6 +1178,25 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
|
1187
1178
|
for(var i = 0, l = entitiesConfig.length; i < l; i++)_loop(i);
|
|
1188
1179
|
return Promise.all(promises);
|
|
1189
1180
|
};
|
|
1181
|
+
_proto._parseAddedComponents = function _parseAddedComponents() {
|
|
1182
|
+
var entityMap = this.context.entityMap;
|
|
1183
|
+
var entityConfigMap = this.context.entityConfigMap;
|
|
1184
|
+
var strippedIds = this.context.strippedIds;
|
|
1185
|
+
var promises = [];
|
|
1186
|
+
for(var i = 0, n = strippedIds.length; i < n; i++){
|
|
1187
|
+
var entityConfig = entityConfigMap.get(strippedIds[i]);
|
|
1188
|
+
var prefabContext = this._prefabContextMap.get(entityMap.get(entityConfig.prefabInstanceId));
|
|
1189
|
+
var entity = prefabContext.entityMap.get(entityConfig.prefabSource.entityId);
|
|
1190
|
+
this._addComponents(entity, entityConfig.components, promises);
|
|
1191
|
+
}
|
|
1192
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.context.componentWaitingMap.values()), _step; !(_step = _iterator()).done;){
|
|
1193
|
+
var waitingList = _step.value;
|
|
1194
|
+
waitingList.forEach(function(resolve) {
|
|
1195
|
+
return resolve(null);
|
|
1196
|
+
});
|
|
1197
|
+
}
|
|
1198
|
+
return Promise.all(promises);
|
|
1199
|
+
};
|
|
1190
1200
|
_proto._parsePrefabRemovedEntities = function _parsePrefabRemovedEntities() {
|
|
1191
1201
|
var _loop = function(i, l) {
|
|
1192
1202
|
var entityConfig = entitiesConfig[i];
|
|
@@ -1316,6 +1326,17 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
|
1316
1326
|
}
|
|
1317
1327
|
}
|
|
1318
1328
|
};
|
|
1329
|
+
_proto._addComponents = function _addComponents(entity, components, promises) {
|
|
1330
|
+
for(var i = 0, n = components.length; i < n; i++){
|
|
1331
|
+
var componentConfig = components[i];
|
|
1332
|
+
var key = !componentConfig.refId ? componentConfig.class : componentConfig.refId;
|
|
1333
|
+
var component = entity.addComponent(Loader.getClass(key));
|
|
1334
|
+
this.context.addComponent(componentConfig.id, component);
|
|
1335
|
+
var promise = this._reflectionParser.parsePropsAndMethods(component, componentConfig);
|
|
1336
|
+
promises.push(promise);
|
|
1337
|
+
}
|
|
1338
|
+
return promises;
|
|
1339
|
+
};
|
|
1319
1340
|
_proto._applyEntityData = function _applyEntityData(entity, entityConfig) {
|
|
1320
1341
|
if (entityConfig === void 0) entityConfig = {};
|
|
1321
1342
|
var _entityConfig_isActive;
|