@colijnit/configurator 12.0.6 → 12.0.7
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.
|
@@ -1186,44 +1186,53 @@
|
|
|
1186
1186
|
};
|
|
1187
1187
|
VariationUtils.LoadVariation = function (assetPath, fileName) {
|
|
1188
1188
|
return __awaiter(this, void 0, void 0, function () {
|
|
1189
|
-
var
|
|
1189
|
+
var _this = this;
|
|
1190
1190
|
return __generator(this, function (_a) {
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1191
|
+
return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
1192
|
+
var id, file, settings, err_1, mute;
|
|
1193
|
+
return __generator(this, function (_a) {
|
|
1194
|
+
switch (_a.label) {
|
|
1195
|
+
case 0:
|
|
1196
|
+
if (!fileName) {
|
|
1197
|
+
resolve(null);
|
|
1198
|
+
}
|
|
1199
|
+
if (fileName.indexOf('ione3d') < 0) {
|
|
1200
|
+
fileName = fileName.concat('.ione3d');
|
|
1201
|
+
}
|
|
1202
|
+
id = fileName.substr(0, fileName.lastIndexOf('.ione3d'));
|
|
1203
|
+
_a.label = 1;
|
|
1204
|
+
case 1:
|
|
1205
|
+
_a.trys.push([1, 6, , 7]);
|
|
1206
|
+
if (!assetPath.endsWith('/')) {
|
|
1207
|
+
assetPath += '/';
|
|
1208
|
+
}
|
|
1209
|
+
if (!window.hasOwnProperty('downloadVariation')) {
|
|
1210
|
+
console.error('downloadVariation not defined in window global');
|
|
1211
|
+
reject('downloadVariation not defined in window global');
|
|
1212
|
+
}
|
|
1213
|
+
file = void 0;
|
|
1214
|
+
if (!this.MaterialCache.has(id)) return [3 /*break*/, 2];
|
|
1215
|
+
resolve(this.MaterialCache.get(id));
|
|
1216
|
+
return [3 /*break*/, 5];
|
|
1217
|
+
case 2: return [4 /*yield*/, window.downloadVariation(assetPath.replace('https://cdn1.colijn-it.nl/', '') + "variation/" + fileName)];
|
|
1218
|
+
case 3:
|
|
1219
|
+
file = _a.sent();
|
|
1220
|
+
return [4 /*yield*/, VariationUtils.GetVariationSettingsFromFile(id, file)];
|
|
1221
|
+
case 4:
|
|
1222
|
+
settings = _a.sent();
|
|
1223
|
+
this.MaterialCache.set(id, settings);
|
|
1224
|
+
resolve(settings);
|
|
1225
|
+
_a.label = 5;
|
|
1226
|
+
case 5: return [3 /*break*/, 7];
|
|
1227
|
+
case 6:
|
|
1228
|
+
err_1 = _a.sent();
|
|
1229
|
+
mute = err_1;
|
|
1230
|
+
reject(err_1);
|
|
1231
|
+
return [3 /*break*/, 7];
|
|
1232
|
+
case 7: return [2 /*return*/];
|
|
1233
|
+
}
|
|
1234
|
+
});
|
|
1235
|
+
}); })];
|
|
1227
1236
|
});
|
|
1228
1237
|
});
|
|
1229
1238
|
};
|