@colijnit/configurator 12.0.5 → 12.0.8
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/app/builder.d.ts +2 -0
- package/bundles/colijnit-configurator.umd.js +162 -101
- package/bundles/colijnit-configurator.umd.js.map +1 -1
- package/colijnit-configurator.metadata.json +1 -1
- package/esm2015/app/builder.js +35 -22
- package/esm2015/helper/variation-helper.js +15 -5
- package/esm2015/model/variation-settings.js +1 -1
- package/esm2015/model/variation.js +1 -1
- package/esm2015/utils/variation-utils.js +62 -33
- package/fesm2015/colijnit-configurator.js +109 -57
- package/fesm2015/colijnit-configurator.js.map +1 -1
- package/helper/variation-helper.d.ts +1 -1
- package/model/variation-settings.d.ts +1 -0
- package/model/variation.d.ts +1 -2
- package/package.json +2 -2
- package/utils/variation-utils.d.ts +2 -0
package/app/builder.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare class Builder {
|
|
|
12
12
|
decosReceived: BehaviorSubject<DecoNode[]>;
|
|
13
13
|
answersReceived: BehaviorSubject<Answer[]>;
|
|
14
14
|
modelLoaded: BehaviorSubject<THREE.Object3D>;
|
|
15
|
+
debug: Function;
|
|
15
16
|
private _scene;
|
|
16
17
|
private _instanceId;
|
|
17
18
|
private _sku;
|
|
@@ -62,4 +63,5 @@ export declare class Builder {
|
|
|
62
63
|
private _getAdjustables;
|
|
63
64
|
private _updatePivot;
|
|
64
65
|
private _reset;
|
|
66
|
+
private _log;
|
|
65
67
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three'), require('@colijnit/configuratorapi/build/model/deco-node'), require('@colijnit/configuratorapi/build/service/business-object-factory'), require('@colijnit/configuratorapi/build/model/selection'), require('@colijnit/configuratorapi/build/enum/deco-node-type.enum'), require('axios'), require('@colijnit/configuratorapi/build/enum/deco-node-kind.enum'), require('rxjs'), require('jszip'), require('@colijnit/configuratorapi/build/model/article'), require('@colijnit/configuratorapi/build/configurator'), require('@colijnit/configuratorapi/build/utils/function/not-nill.function'), require('@colijnit/configuratorapi/build/enum/node-type.enum'), require('@colijnit/configuratorapi/build/utils/function/is-nill.function'), require('@angular/core'), require('@angular/common'), require('@angular/animations')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@colijnit/configurator', ['exports', 'three', '@colijnit/configuratorapi/build/model/deco-node', '@colijnit/configuratorapi/build/service/business-object-factory', '@colijnit/configuratorapi/build/model/selection', '@colijnit/configuratorapi/build/enum/deco-node-type.enum', 'axios', '@colijnit/configuratorapi/build/enum/deco-node-kind.enum', 'rxjs', 'jszip', '@colijnit/configuratorapi/build/model/article', '@colijnit/configuratorapi/build/configurator', '@colijnit/configuratorapi/build/utils/function/not-nill.function', '@colijnit/configuratorapi/build/enum/node-type.enum', '@colijnit/configuratorapi/build/utils/function/is-nill.function', '@angular/core', '@angular/common', '@angular/animations'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.colijnit = global.colijnit || {}, global.colijnit.configurator = {}), global.THREE, global.decoNode, global.businessObjectFactory, global.selection, global.decoNodeType_enum, global.axios, global.decoNodeKind_enum, global.rxjs, global.JSZip, global.article, global.configurator, global.notNill_function, global.nodeType_enum, global.isNill_function, global.ng.core, global.ng.common, global.ng.animations));
|
|
5
|
-
})(this, (function (exports, THREE, decoNode, businessObjectFactory, selection, decoNodeType_enum, axios, decoNodeKind_enum, rxjs, JSZip, article, configurator, notNill_function, nodeType_enum, isNill_function, i0, common, animations) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three'), require('@colijnit/configuratorapi/build/model/deco-node'), require('@colijnit/configuratorapi/build/service/business-object-factory'), require('@colijnit/configuratorapi/build/model/selection'), require('@colijnit/configuratorapi/build/enum/deco-node-type.enum'), require('axios'), require('@colijnit/configuratorapi/build/enum/deco-node-kind.enum'), require('rxjs'), require('jszip'), require('three/examples/jsm/loaders/GLTFLoader'), require('@colijnit/configuratorapi/build/model/article'), require('@colijnit/configuratorapi/build/configurator'), require('@colijnit/configuratorapi/build/utils/function/not-nill.function'), require('@colijnit/configuratorapi/build/enum/node-type.enum'), require('@colijnit/configuratorapi/build/utils/function/is-nill.function'), require('@angular/core'), require('@angular/common'), require('@angular/animations')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@colijnit/configurator', ['exports', 'three', '@colijnit/configuratorapi/build/model/deco-node', '@colijnit/configuratorapi/build/service/business-object-factory', '@colijnit/configuratorapi/build/model/selection', '@colijnit/configuratorapi/build/enum/deco-node-type.enum', 'axios', '@colijnit/configuratorapi/build/enum/deco-node-kind.enum', 'rxjs', 'jszip', 'three/examples/jsm/loaders/GLTFLoader', '@colijnit/configuratorapi/build/model/article', '@colijnit/configuratorapi/build/configurator', '@colijnit/configuratorapi/build/utils/function/not-nill.function', '@colijnit/configuratorapi/build/enum/node-type.enum', '@colijnit/configuratorapi/build/utils/function/is-nill.function', '@angular/core', '@angular/common', '@angular/animations'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.colijnit = global.colijnit || {}, global.colijnit.configurator = {}), global.THREE, global.decoNode, global.businessObjectFactory, global.selection, global.decoNodeType_enum, global.axios, global.decoNodeKind_enum, global.rxjs, global.JSZip, global.GLTFLoader, global.article, global.configurator, global.notNill_function, global.nodeType_enum, global.isNill_function, global.ng.core, global.ng.common, global.ng.animations));
|
|
5
|
+
})(this, (function (exports, THREE, decoNode, businessObjectFactory, selection, decoNodeType_enum, axios, decoNodeKind_enum, rxjs, JSZip, GLTFLoader, article, configurator, notNill_function, nodeType_enum, isNill_function, i0, common, animations) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -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
|
};
|
|
@@ -1260,36 +1269,46 @@
|
|
|
1260
1269
|
// }
|
|
1261
1270
|
VariationUtils.GetVariationSettingsFromFile = function (id, compressedFile) {
|
|
1262
1271
|
return __awaiter(this, void 0, void 0, function () {
|
|
1263
|
-
var zipContent, variationSettings, index, indexFile;
|
|
1264
|
-
return __generator(this, function (
|
|
1265
|
-
switch (
|
|
1272
|
+
var zipContent, variationSettings, index, material, _a, indexFile;
|
|
1273
|
+
return __generator(this, function (_b) {
|
|
1274
|
+
switch (_b.label) {
|
|
1266
1275
|
case 0:
|
|
1267
1276
|
if (!compressedFile) {
|
|
1268
1277
|
return [2 /*return*/, null];
|
|
1269
1278
|
}
|
|
1270
1279
|
return [4 /*yield*/, VariationUtils.GetZipContent(compressedFile)];
|
|
1271
1280
|
case 1:
|
|
1272
|
-
zipContent =
|
|
1281
|
+
zipContent = _b.sent();
|
|
1273
1282
|
variationSettings = new VariationSettings();
|
|
1274
1283
|
variationSettings.id = id;
|
|
1275
|
-
if (!zipContent) return [3 /*break*/,
|
|
1276
|
-
if (!zipContent.files['
|
|
1277
|
-
return [4 /*yield*/, zipContent.files['
|
|
1284
|
+
if (!zipContent) return [3 /*break*/, 10];
|
|
1285
|
+
if (!zipContent.files['material.glb']) return [3 /*break*/, 4];
|
|
1286
|
+
return [4 /*yield*/, zipContent.files['material.glb'].async('arraybuffer')];
|
|
1278
1287
|
case 2:
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1288
|
+
material = _b.sent();
|
|
1289
|
+
_a = variationSettings;
|
|
1290
|
+
return [4 /*yield*/, VariationUtils.LoadMaterialFromGlb(material)];
|
|
1282
1291
|
case 3:
|
|
1283
|
-
|
|
1284
|
-
return [
|
|
1292
|
+
_a.material = _b.sent();
|
|
1293
|
+
return [3 /*break*/, 10];
|
|
1285
1294
|
case 4:
|
|
1286
|
-
|
|
1287
|
-
return [
|
|
1288
|
-
case 5:
|
|
1295
|
+
if (!zipContent.files['index.json']) return [3 /*break*/, 6];
|
|
1296
|
+
return [4 /*yield*/, zipContent.files['index.json'].async('string')];
|
|
1297
|
+
case 5:
|
|
1298
|
+
indexFile = _b.sent();
|
|
1299
|
+
index = JSON.parse(indexFile);
|
|
1300
|
+
_b.label = 6;
|
|
1289
1301
|
case 6:
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
case 7:
|
|
1302
|
+
if (!index) return [3 /*break*/, 8];
|
|
1303
|
+
return [4 /*yield*/, VariationUtils.CreateSettingsBasedOnIndex(index, variationSettings, zipContent)];
|
|
1304
|
+
case 7:
|
|
1305
|
+
_b.sent();
|
|
1306
|
+
return [3 /*break*/, 10];
|
|
1307
|
+
case 8: return [4 /*yield*/, VariationUtils.CreateSettingsBasedOnFileName(variationSettings, zipContent)];
|
|
1308
|
+
case 9:
|
|
1309
|
+
_b.sent();
|
|
1310
|
+
_b.label = 10;
|
|
1311
|
+
case 10: return [2 /*return*/, variationSettings];
|
|
1293
1312
|
}
|
|
1294
1313
|
});
|
|
1295
1314
|
});
|
|
@@ -1511,6 +1530,25 @@
|
|
|
1511
1530
|
});
|
|
1512
1531
|
});
|
|
1513
1532
|
};
|
|
1533
|
+
VariationUtils.LoadMaterialFromJson = function (material) {
|
|
1534
|
+
var loader = new THREE__namespace.MaterialLoader();
|
|
1535
|
+
if (material.textures) {
|
|
1536
|
+
var textures = {};
|
|
1537
|
+
for (var i = 0; i < material.textures.length; i++) {
|
|
1538
|
+
textures[material.textures[i].uuid] = material.textures[i];
|
|
1539
|
+
}
|
|
1540
|
+
loader.setTextures(textures);
|
|
1541
|
+
}
|
|
1542
|
+
return loader.parse(material);
|
|
1543
|
+
};
|
|
1544
|
+
VariationUtils.LoadMaterialFromGlb = function (material) {
|
|
1545
|
+
return new Promise(function (resolve) {
|
|
1546
|
+
var loader = new GLTFLoader.GLTFLoader();
|
|
1547
|
+
loader.parse(material, null, function (object) {
|
|
1548
|
+
return resolve(object.scene.children[0].material);
|
|
1549
|
+
});
|
|
1550
|
+
});
|
|
1551
|
+
};
|
|
1514
1552
|
VariationUtils.LoadFileContentFromZip = function (zip, fileName, base64) {
|
|
1515
1553
|
var _this = this;
|
|
1516
1554
|
if (base64 === void 0) { base64 = true; }
|
|
@@ -1685,9 +1723,9 @@
|
|
|
1685
1723
|
variationPromise = [];
|
|
1686
1724
|
_loop_2 = function (j) {
|
|
1687
1725
|
variationPromise.push(this_1.loadTheVariation(variations[j].gameObjectName || parts[i].decoId).then(function (variationSettings) { return __awaiter(_this, void 0, void 0, function () {
|
|
1688
|
-
var newVariation, _a;
|
|
1689
|
-
return __generator(this, function (
|
|
1690
|
-
switch (
|
|
1726
|
+
var newVariation, _a, _b;
|
|
1727
|
+
return __generator(this, function (_c) {
|
|
1728
|
+
switch (_c.label) {
|
|
1691
1729
|
case 0:
|
|
1692
1730
|
newVariation = new Variation();
|
|
1693
1731
|
newVariation.decoId = parseFloat(variations[j].id);
|
|
@@ -1697,9 +1735,15 @@
|
|
|
1697
1735
|
newVariation.supplierArticleNr = variations[j].supplierArticleNr;
|
|
1698
1736
|
newVariation.materialId = variations[j].materialId;
|
|
1699
1737
|
_a = newVariation;
|
|
1700
|
-
return [
|
|
1701
|
-
|
|
1702
|
-
|
|
1738
|
+
if (!variationSettings.material) return [3 /*break*/, 1];
|
|
1739
|
+
_b = variationSettings.material;
|
|
1740
|
+
return [3 /*break*/, 3];
|
|
1741
|
+
case 1: return [4 /*yield*/, AssetUtils.CreateMaterialFromAsset(variationSettings)];
|
|
1742
|
+
case 2:
|
|
1743
|
+
_b = _c.sent();
|
|
1744
|
+
_c.label = 3;
|
|
1745
|
+
case 3:
|
|
1746
|
+
_a.material = _b;
|
|
1703
1747
|
lastKnownVariations.push(newVariation);
|
|
1704
1748
|
return [2 /*return*/];
|
|
1705
1749
|
}
|
|
@@ -1758,7 +1802,7 @@
|
|
|
1758
1802
|
this._variations.push(variations);
|
|
1759
1803
|
}
|
|
1760
1804
|
};
|
|
1761
|
-
VariationHelper.prototype.preloadVariations = function (
|
|
1805
|
+
VariationHelper.prototype.preloadVariations = function (fileNames) {
|
|
1762
1806
|
var _this = this;
|
|
1763
1807
|
fileNames.forEach(function (fileName) {
|
|
1764
1808
|
if (fileName && !_this.get(fileName)) {
|
|
@@ -1859,13 +1903,23 @@
|
|
|
1859
1903
|
if (Array.isArray(mesh.material)) { // multimaterial support
|
|
1860
1904
|
for (var m = 0, mlen = mesh.material.length; m < mlen; m++) {
|
|
1861
1905
|
if (mesh.material[m].name.toLowerCase().indexOf(materialToSearch) !== -1) {
|
|
1862
|
-
|
|
1906
|
+
if (variation.material instanceof THREE__namespace.Material) {
|
|
1907
|
+
mesh.material[m] = variation.material;
|
|
1908
|
+
}
|
|
1909
|
+
else {
|
|
1910
|
+
mesh.material[m] = _this._setMeshMaterialFromVariation(mesh.material[m].name, variation, usePbr);
|
|
1911
|
+
}
|
|
1863
1912
|
}
|
|
1864
1913
|
}
|
|
1865
1914
|
}
|
|
1866
1915
|
else {
|
|
1867
1916
|
if (mesh.material.name.toLowerCase().indexOf(materialToSearch) !== -1) {
|
|
1868
|
-
|
|
1917
|
+
if (variation.material instanceof THREE__namespace.Material) {
|
|
1918
|
+
mesh.material = variation.material;
|
|
1919
|
+
}
|
|
1920
|
+
else {
|
|
1921
|
+
mesh.material = _this._setMeshMaterialFromVariation(mesh.material.name, variation, usePbr);
|
|
1922
|
+
}
|
|
1869
1923
|
}
|
|
1870
1924
|
}
|
|
1871
1925
|
}
|
|
@@ -2312,6 +2366,7 @@
|
|
|
2312
2366
|
return [4 /*yield*/, Promise.all(promises)];
|
|
2313
2367
|
case 5:
|
|
2314
2368
|
_a.sent();
|
|
2369
|
+
this._preloadMaterials();
|
|
2315
2370
|
if (this._answers.length > 0) {
|
|
2316
2371
|
return [2 /*return*/];
|
|
2317
2372
|
}
|
|
@@ -2319,7 +2374,6 @@
|
|
|
2319
2374
|
return [4 /*yield*/, this._build()];
|
|
2320
2375
|
case 6:
|
|
2321
2376
|
build = _a.sent();
|
|
2322
|
-
this._cleanUp();
|
|
2323
2377
|
return [2 /*return*/, build];
|
|
2324
2378
|
case 7: throw 'GLB source not found!';
|
|
2325
2379
|
case 8: return [3 /*break*/, 10];
|
|
@@ -2343,21 +2397,20 @@
|
|
|
2343
2397
|
_a.label = 1;
|
|
2344
2398
|
case 1:
|
|
2345
2399
|
_a.trys.push([1, 6, , 7]);
|
|
2346
|
-
|
|
2400
|
+
this._log('start build');
|
|
2347
2401
|
return [4 /*yield*/, this._downloadAsset(assetUrl, cdnUrl, schema)];
|
|
2348
2402
|
case 2:
|
|
2349
|
-
// console.log(new Date(), 'start build');
|
|
2350
2403
|
_a.sent();
|
|
2351
2404
|
if (!(selections && selections.length > 1 && decos && decos.length > 0 && this._source)) return [3 /*break*/, 4];
|
|
2352
2405
|
this._selections = selections;
|
|
2353
2406
|
this._decos = decos;
|
|
2354
2407
|
this._linkSelectionsAndDecos();
|
|
2355
|
-
this._preloadMaterials(
|
|
2408
|
+
this._preloadMaterials();
|
|
2356
2409
|
return [4 /*yield*/, this._build()];
|
|
2357
2410
|
case 3:
|
|
2358
2411
|
build = _a.sent();
|
|
2359
2412
|
this._cleanUp();
|
|
2360
|
-
|
|
2413
|
+
this._log('finish build');
|
|
2361
2414
|
return [2 /*return*/, build];
|
|
2362
2415
|
case 4: throw 'Unsufficient data provided!';
|
|
2363
2416
|
case 5: return [3 /*break*/, 7];
|
|
@@ -2378,12 +2431,14 @@
|
|
|
2378
2431
|
};
|
|
2379
2432
|
Builder.prototype.selectSelection = function (selection) {
|
|
2380
2433
|
return __awaiter(this, void 0, void 0, function () {
|
|
2434
|
+
var questionsAndAnswers;
|
|
2381
2435
|
return __generator(this, function (_a) {
|
|
2382
2436
|
switch (_a.label) {
|
|
2383
2437
|
case 0: return [4 /*yield*/, this._configuratorService.selectSelection(selection, false)];
|
|
2384
2438
|
case 1:
|
|
2385
|
-
_a.sent();
|
|
2386
|
-
this.
|
|
2439
|
+
questionsAndAnswers = _a.sent();
|
|
2440
|
+
this._answers = questionsAndAnswers.answers;
|
|
2441
|
+
this.answersReceived.next(questionsAndAnswers.answers);
|
|
2387
2442
|
return [2 /*return*/];
|
|
2388
2443
|
}
|
|
2389
2444
|
});
|
|
@@ -2406,16 +2461,17 @@
|
|
|
2406
2461
|
};
|
|
2407
2462
|
Builder.prototype.selectAnswer = function (answer) {
|
|
2408
2463
|
return __awaiter(this, void 0, void 0, function () {
|
|
2409
|
-
var
|
|
2410
|
-
return __generator(this, function (
|
|
2411
|
-
switch (
|
|
2464
|
+
var questionsAndAnswers;
|
|
2465
|
+
return __generator(this, function (_a) {
|
|
2466
|
+
switch (_a.label) {
|
|
2412
2467
|
case 0: return [4 /*yield*/, this._configuratorService.selectAnswer(answer, false)];
|
|
2413
2468
|
case 1:
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2469
|
+
questionsAndAnswers = _a.sent();
|
|
2470
|
+
this._answers = questionsAndAnswers.answers;
|
|
2471
|
+
this.answersReceived.next(questionsAndAnswers.answers);
|
|
2472
|
+
if (questionsAndAnswers.answers.length === 0) {
|
|
2473
|
+
this._build();
|
|
2474
|
+
}
|
|
2419
2475
|
return [2 /*return*/];
|
|
2420
2476
|
}
|
|
2421
2477
|
});
|
|
@@ -2469,8 +2525,8 @@
|
|
|
2469
2525
|
return '';
|
|
2470
2526
|
}
|
|
2471
2527
|
};
|
|
2472
|
-
Builder.prototype._preloadMaterials = function (
|
|
2473
|
-
this._variationHelper.preloadVariations(
|
|
2528
|
+
Builder.prototype._preloadMaterials = function () {
|
|
2529
|
+
this._variationHelper.preloadVariations(__spreadArray([], __read(new Set(this._decos.filter(function (d) { return d.gameObjectName !== undefined; }).map(function (d) { return d.gameObjectName; })))));
|
|
2474
2530
|
};
|
|
2475
2531
|
Builder.prototype._setInstanceId = function (sku, instanceId, goodId) {
|
|
2476
2532
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -2565,7 +2621,7 @@
|
|
|
2565
2621
|
obj.visible = false; // no need to render visualy
|
|
2566
2622
|
this._scene.add(obj);
|
|
2567
2623
|
connected = false;
|
|
2568
|
-
|
|
2624
|
+
this._log('build main model');
|
|
2569
2625
|
for (i = 0, len = adjustables.length; i < len; i++) {
|
|
2570
2626
|
adjustable = this._createAdjustable(obj, adjustables[i]);
|
|
2571
2627
|
if (adjustable) {
|
|
@@ -2583,20 +2639,21 @@
|
|
|
2583
2639
|
console.warn('No connection found for: ', adjustable.name);
|
|
2584
2640
|
}
|
|
2585
2641
|
}
|
|
2586
|
-
|
|
2642
|
+
this._log('place addables');
|
|
2587
2643
|
this._placeAddables(obj);
|
|
2588
|
-
|
|
2644
|
+
this._log('update pivot');
|
|
2589
2645
|
this._updatePivot(obj);
|
|
2590
|
-
|
|
2646
|
+
this._log('load variations');
|
|
2591
2647
|
return [4 /*yield*/, this._loadVariations(obj)];
|
|
2592
2648
|
case 1:
|
|
2593
|
-
// console.log(new Date(), 'load variations');
|
|
2594
2649
|
_a.sent();
|
|
2595
2650
|
// this._variationHelper.clearCache();
|
|
2596
|
-
|
|
2651
|
+
this._log('remove from scene');
|
|
2597
2652
|
this._scene.remove(obj);
|
|
2598
2653
|
ObjectUtils.DisposeObject(this._source);
|
|
2599
|
-
//
|
|
2654
|
+
// this._cleanUp();
|
|
2655
|
+
this._log('ready!');
|
|
2656
|
+
this.modelLoaded.next(obj);
|
|
2600
2657
|
return [2 /*return*/, obj];
|
|
2601
2658
|
case 2: throw 'No adjustables found!';
|
|
2602
2659
|
}
|
|
@@ -2896,24 +2953,22 @@
|
|
|
2896
2953
|
return __awaiter(this, void 0, void 0, function () {
|
|
2897
2954
|
return __generator(this, function (_a) {
|
|
2898
2955
|
switch (_a.label) {
|
|
2899
|
-
case 0:
|
|
2900
|
-
|
|
2901
|
-
|
|
2956
|
+
case 0:
|
|
2957
|
+
this._log('load variation for parts');
|
|
2958
|
+
return [4 /*yield*/, this._variationHelper.loadPart(obj, this._adjustables, true)];
|
|
2902
2959
|
case 1:
|
|
2903
|
-
// console.log(new Date(), 'load variation for parts');
|
|
2904
2960
|
_a.sent();
|
|
2905
|
-
|
|
2961
|
+
this._log('load variation for adjustables');
|
|
2906
2962
|
return [4 /*yield*/, this._variationHelper.loadVariation(obj, this._adjustables, true)];
|
|
2907
2963
|
case 2:
|
|
2908
|
-
// console.log(new Date(), 'load variation for adjustables');
|
|
2909
2964
|
_a.sent();
|
|
2910
|
-
|
|
2965
|
+
this._log('load variation for addables');
|
|
2911
2966
|
return [4 /*yield*/, this._variationHelper.loadVariation(obj, this._addables, true)];
|
|
2912
2967
|
case 3:
|
|
2913
|
-
// console.log(new Date(), 'load variation for addables');
|
|
2914
2968
|
_a.sent();
|
|
2915
|
-
|
|
2969
|
+
this._log('load variation clear cache');
|
|
2916
2970
|
this._variationHelper.clearCache();
|
|
2971
|
+
this._log('load variations done');
|
|
2917
2972
|
return [2 /*return*/];
|
|
2918
2973
|
}
|
|
2919
2974
|
});
|
|
@@ -2942,6 +2997,12 @@
|
|
|
2942
2997
|
this._addables.length = 0;
|
|
2943
2998
|
this._prepareTheSelections();
|
|
2944
2999
|
};
|
|
3000
|
+
Builder.prototype._log = function (message) {
|
|
3001
|
+
if (this.debug) {
|
|
3002
|
+
this.debug(message);
|
|
3003
|
+
console.log(new Date(), message);
|
|
3004
|
+
}
|
|
3005
|
+
};
|
|
2945
3006
|
return Builder;
|
|
2946
3007
|
}());
|
|
2947
3008
|
Builder.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function Builder_Factory() { return new Builder(); }, token: Builder, providedIn: "root" });
|