@galacean/engine-loader 1.4.4 → 1.4.5
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
|
@@ -1103,6 +1103,7 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
|
1103
1103
|
this._organizeEntities = this._organizeEntities.bind(this);
|
|
1104
1104
|
this._parseComponents = this._parseComponents.bind(this);
|
|
1105
1105
|
this._parsePrefabModification = this._parsePrefabModification.bind(this);
|
|
1106
|
+
this._parseAddedComponents = this._parseAddedComponents.bind(this);
|
|
1106
1107
|
this._parsePrefabRemovedEntities = this._parsePrefabRemovedEntities.bind(this);
|
|
1107
1108
|
this._parsePrefabRemovedComponents = this._parsePrefabRemovedComponents.bind(this);
|
|
1108
1109
|
this._clearAndResolve = this._clearAndResolve.bind(this);
|
|
@@ -1114,7 +1115,7 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
|
1114
1115
|
}
|
|
1115
1116
|
var _proto = HierarchyParser.prototype;
|
|
1116
1117
|
/** start parse the scene or prefab or others */ _proto.start = function start() {
|
|
1117
|
-
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);
|
|
1118
|
+
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);
|
|
1118
1119
|
};
|
|
1119
1120
|
_proto._parseEntities = function _parseEntities() {
|
|
1120
1121
|
var _this = this;
|
|
@@ -1142,21 +1143,11 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
|
1142
1143
|
var promises = [];
|
|
1143
1144
|
for(var i = 0, l = entitiesConfig.length; i < l; i++){
|
|
1144
1145
|
var entityConfig = entitiesConfig[i];
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
var componentConfig = entityConfig.components[i1];
|
|
1148
|
-
var key = !componentConfig.refId ? componentConfig.class : componentConfig.refId;
|
|
1149
|
-
var component = entity.addComponent(engineCore.Loader.getClass(key));
|
|
1150
|
-
this.context.addComponent(componentConfig.id, component);
|
|
1151
|
-
var promise = this._reflectionParser.parsePropsAndMethods(component, componentConfig);
|
|
1152
|
-
promises.push(promise);
|
|
1146
|
+
if (entityConfig.strippedId) {
|
|
1147
|
+
continue;
|
|
1153
1148
|
}
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
var waitingList = _step.value;
|
|
1157
|
-
waitingList.forEach(function(resolve) {
|
|
1158
|
-
return resolve(null);
|
|
1159
|
-
});
|
|
1149
|
+
var entity = entityMap.get(entityConfig.id);
|
|
1150
|
+
this._addComponents(entity, entityConfig.components, promises);
|
|
1160
1151
|
}
|
|
1161
1152
|
return Promise.all(promises);
|
|
1162
1153
|
};
|
|
@@ -1191,6 +1182,25 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
|
1191
1182
|
for(var i = 0, l = entitiesConfig.length; i < l; i++)_loop(i);
|
|
1192
1183
|
return Promise.all(promises);
|
|
1193
1184
|
};
|
|
1185
|
+
_proto._parseAddedComponents = function _parseAddedComponents() {
|
|
1186
|
+
var entityMap = this.context.entityMap;
|
|
1187
|
+
var entityConfigMap = this.context.entityConfigMap;
|
|
1188
|
+
var strippedIds = this.context.strippedIds;
|
|
1189
|
+
var promises = [];
|
|
1190
|
+
for(var i = 0, n = strippedIds.length; i < n; i++){
|
|
1191
|
+
var entityConfig = entityConfigMap.get(strippedIds[i]);
|
|
1192
|
+
var prefabContext = this._prefabContextMap.get(entityMap.get(entityConfig.prefabInstanceId));
|
|
1193
|
+
var entity = prefabContext.entityMap.get(entityConfig.prefabSource.entityId);
|
|
1194
|
+
this._addComponents(entity, entityConfig.components, promises);
|
|
1195
|
+
}
|
|
1196
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.context.componentWaitingMap.values()), _step; !(_step = _iterator()).done;){
|
|
1197
|
+
var waitingList = _step.value;
|
|
1198
|
+
waitingList.forEach(function(resolve) {
|
|
1199
|
+
return resolve(null);
|
|
1200
|
+
});
|
|
1201
|
+
}
|
|
1202
|
+
return Promise.all(promises);
|
|
1203
|
+
};
|
|
1194
1204
|
_proto._parsePrefabRemovedEntities = function _parsePrefabRemovedEntities() {
|
|
1195
1205
|
var _loop = function(i, l) {
|
|
1196
1206
|
var entityConfig = entitiesConfig[i];
|
|
@@ -1320,6 +1330,17 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
|
1320
1330
|
}
|
|
1321
1331
|
}
|
|
1322
1332
|
};
|
|
1333
|
+
_proto._addComponents = function _addComponents(entity, components, promises) {
|
|
1334
|
+
for(var i = 0, n = components.length; i < n; i++){
|
|
1335
|
+
var componentConfig = components[i];
|
|
1336
|
+
var key = !componentConfig.refId ? componentConfig.class : componentConfig.refId;
|
|
1337
|
+
var component = entity.addComponent(engineCore.Loader.getClass(key));
|
|
1338
|
+
this.context.addComponent(componentConfig.id, component);
|
|
1339
|
+
var promise = this._reflectionParser.parsePropsAndMethods(component, componentConfig);
|
|
1340
|
+
promises.push(promise);
|
|
1341
|
+
}
|
|
1342
|
+
return promises;
|
|
1343
|
+
};
|
|
1323
1344
|
_proto._applyEntityData = function _applyEntityData(entity, entityConfig) {
|
|
1324
1345
|
if (entityConfig === void 0) entityConfig = {};
|
|
1325
1346
|
var _entityConfig_isActive;
|