@preference-sl/pref-viewer 2.10.0-beta.26 → 2.10.0-beta.28
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/package.json +1 -1
- package/src/index.js +124 -88
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* style="width:800px; height:600px;">
|
|
23
23
|
* </pref-viewer>
|
|
24
24
|
* ```
|
|
25
|
-
*
|
|
25
|
+
*
|
|
26
26
|
* Load scene a URL:
|
|
27
27
|
* ```html
|
|
28
28
|
* <pref-viewer
|
|
@@ -55,61 +55,61 @@ class PrefViewer extends HTMLElement {
|
|
|
55
55
|
containers: {
|
|
56
56
|
model: {
|
|
57
57
|
name: "model",
|
|
58
|
-
|
|
58
|
+
assetContainer: null,
|
|
59
59
|
show: true,
|
|
60
60
|
storage: null,
|
|
61
61
|
visible: false,
|
|
62
62
|
size: null,
|
|
63
63
|
timeStamp: null,
|
|
64
|
-
changed: false,
|
|
64
|
+
changed: { pending: false, success: false },
|
|
65
65
|
},
|
|
66
66
|
environment: {
|
|
67
67
|
name: "environment",
|
|
68
|
-
|
|
68
|
+
assetContainer: null,
|
|
69
69
|
show: true,
|
|
70
70
|
storage: null,
|
|
71
71
|
visible: false,
|
|
72
72
|
size: null,
|
|
73
73
|
timeStamp: null,
|
|
74
|
-
changed: false,
|
|
74
|
+
changed: { pending: false, success: false },
|
|
75
75
|
},
|
|
76
76
|
materials: {
|
|
77
77
|
name: "materials",
|
|
78
|
-
|
|
78
|
+
assetContainer: null,
|
|
79
79
|
storage: null,
|
|
80
80
|
show: true,
|
|
81
81
|
visible: false,
|
|
82
82
|
size: null,
|
|
83
83
|
timeStamp: null,
|
|
84
|
-
changed: false,
|
|
84
|
+
changed: { pending: false, success: false },
|
|
85
85
|
},
|
|
86
86
|
},
|
|
87
87
|
options: {
|
|
88
88
|
camera: {
|
|
89
89
|
value: null,
|
|
90
90
|
locked: true,
|
|
91
|
-
changed: false,
|
|
91
|
+
changed: { pending: false, success: false },
|
|
92
92
|
},
|
|
93
93
|
materials: {
|
|
94
94
|
innerWall: {
|
|
95
95
|
value: null,
|
|
96
96
|
prefix: "innerWall",
|
|
97
|
-
changed: false,
|
|
97
|
+
changed: { pending: false, success: false },
|
|
98
98
|
},
|
|
99
99
|
outerWall: {
|
|
100
100
|
value: null,
|
|
101
101
|
prefix: "outerWall",
|
|
102
|
-
changed: false,
|
|
102
|
+
changed: { pending: false, success: false },
|
|
103
103
|
},
|
|
104
104
|
innerFloor: {
|
|
105
105
|
value: null,
|
|
106
106
|
prefix: "innerFloor",
|
|
107
|
-
changed: false,
|
|
107
|
+
changed: { pending: false, success: false },
|
|
108
108
|
},
|
|
109
109
|
outerFloor: {
|
|
110
110
|
value: null,
|
|
111
111
|
prefix: "outerFloor",
|
|
112
|
-
changed: false,
|
|
112
|
+
changed: { pending: false, success: false },
|
|
113
113
|
},
|
|
114
114
|
},
|
|
115
115
|
},
|
|
@@ -249,24 +249,24 @@ class PrefViewer extends HTMLElement {
|
|
|
249
249
|
this.loading = false;
|
|
250
250
|
|
|
251
251
|
const toLoadDetail = {
|
|
252
|
-
container_model: !!this.#data.containers.model.changed,
|
|
253
|
-
container_environment: !!this.#data.containers.environment.changed,
|
|
254
|
-
container_materials: !!this.#data.containers.materials.changed,
|
|
255
|
-
options_camera: !!this.#data.options.camera.changed,
|
|
256
|
-
options_innerWallMaterial: !!this.#data.options.materials.innerWall.changed,
|
|
257
|
-
options_outerWallMaterial: !!this.#data.options.materials.outerWall.changed,
|
|
258
|
-
options_innerFloorMaterial: !!this.#data.options.materials.innerFloor.changed,
|
|
259
|
-
options_outerFloorMaterial: !!this.#data.options.materials.outerFloor.changed,
|
|
252
|
+
container_model: !!this.#data.containers.model.changed.pending,
|
|
253
|
+
container_environment: !!this.#data.containers.environment.changed.pending,
|
|
254
|
+
container_materials: !!this.#data.containers.materials.changed.pending,
|
|
255
|
+
options_camera: !!this.#data.options.camera.changed.pending,
|
|
256
|
+
options_innerWallMaterial: !!this.#data.options.materials.innerWall.changed.pending,
|
|
257
|
+
options_outerWallMaterial: !!this.#data.options.materials.outerWall.changed.pending,
|
|
258
|
+
options_innerFloorMaterial: !!this.#data.options.materials.innerFloor.changed.pending,
|
|
259
|
+
options_outerFloorMaterial: !!this.#data.options.materials.outerFloor.changed.pending,
|
|
260
260
|
};
|
|
261
261
|
const loadedDetail = {
|
|
262
|
-
container_model: !!this.#data.containers.model.changed
|
|
263
|
-
container_environment: !!this.#data.containers.environment.changed
|
|
264
|
-
container_materials: !!this.#data.containers.materials.changed
|
|
265
|
-
options_camera: !!this.#data.options.camera.changed
|
|
266
|
-
options_innerWallMaterial: !!this.#data.options.materials.innerWall.changed
|
|
267
|
-
options_outerWallMaterial: !!this.#data.options.materials.outerWall.changed
|
|
268
|
-
options_innerFloorMaterial: !!this.#data.options.materials.innerFloor.changed
|
|
269
|
-
options_outerFloorMaterial: !!this.#data.options.materials.outerFloor.changed
|
|
262
|
+
container_model: !!this.#data.containers.model.changed.success,
|
|
263
|
+
container_environment: !!this.#data.containers.environment.changed.success,
|
|
264
|
+
container_materials: !!this.#data.containers.materials.changed.success,
|
|
265
|
+
options_camera: !!this.#data.options.camera.changed.success,
|
|
266
|
+
options_innerWallMaterial: !!this.#data.options.materials.innerWall.changed.success,
|
|
267
|
+
options_outerWallMaterial: !!this.#data.options.materials.outerWall.changed.success,
|
|
268
|
+
options_innerFloorMaterial: !!this.#data.options.materials.innerFloor.changed.success,
|
|
269
|
+
options_outerFloorMaterial: !!this.#data.options.materials.outerFloor.changed.success,
|
|
270
270
|
};
|
|
271
271
|
|
|
272
272
|
const detail = {
|
|
@@ -301,18 +301,18 @@ class PrefViewer extends HTMLElement {
|
|
|
301
301
|
|
|
302
302
|
#setStatusOptionsLoaded() {
|
|
303
303
|
const toLoadDetail = {
|
|
304
|
-
camera: !!this.#data.options.camera.changed,
|
|
305
|
-
innerWallMaterial: !!this.#data.options.materials.innerWall.changed,
|
|
306
|
-
outerWallMaterial: !!this.#data.options.materials.outerWall.changed,
|
|
307
|
-
innerFloorMaterial: !!this.#data.options.materials.innerFloor.changed,
|
|
308
|
-
outerFloorMaterial: !!this.#data.options.materials.outerFloor.changed,
|
|
304
|
+
camera: !!this.#data.options.camera.changed.pending,
|
|
305
|
+
innerWallMaterial: !!this.#data.options.materials.innerWall.changed.pending,
|
|
306
|
+
outerWallMaterial: !!this.#data.options.materials.outerWall.changed.pending,
|
|
307
|
+
innerFloorMaterial: !!this.#data.options.materials.innerFloor.changed.pending,
|
|
308
|
+
outerFloorMaterial: !!this.#data.options.materials.outerFloor.changed.pending,
|
|
309
309
|
};
|
|
310
310
|
const loadedDetail = {
|
|
311
|
-
camera: !!this.#data.options.camera.changed
|
|
312
|
-
innerWallMaterial: !!this.#data.options.materials.innerWall.changed
|
|
313
|
-
outerWallMaterial: !!this.#data.options.materials.outerWall.changed
|
|
314
|
-
innerFloorMaterial: !!this.#data.options.materials.innerFloor.changed
|
|
315
|
-
outerFloorMaterial: !!this.#data.options.materials.outerFloor.changed
|
|
311
|
+
camera: !!this.#data.options.camera.changed.success,
|
|
312
|
+
innerWallMaterial: !!this.#data.options.materials.innerWall.changed.success,
|
|
313
|
+
outerWallMaterial: !!this.#data.options.materials.outerWall.changed.success,
|
|
314
|
+
innerFloorMaterial: !!this.#data.options.materials.innerFloor.changed.success,
|
|
315
|
+
outerFloorMaterial: !!this.#data.options.materials.outerFloor.changed.success,
|
|
316
316
|
};
|
|
317
317
|
|
|
318
318
|
const detail = {
|
|
@@ -336,10 +336,17 @@ class PrefViewer extends HTMLElement {
|
|
|
336
336
|
if (!options || !options.camera) {
|
|
337
337
|
return false;
|
|
338
338
|
}
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
339
|
+
const prev = this.#data.options.camera.value;
|
|
340
|
+
const changed = options.camera !== prev;
|
|
341
|
+
|
|
342
|
+
this.#data.options.camera.changed.pending = changed;
|
|
343
|
+
this.#data.options.camera.changed.success = false;
|
|
344
|
+
if (changed) {
|
|
345
|
+
this.#data.options.camera.changed.value = prev;
|
|
346
|
+
this.#data.options.camera.changed.locked = this.#data.options.camera.locked;
|
|
347
|
+
this.#data.options.camera.value = options.camera;
|
|
348
|
+
}
|
|
349
|
+
return changed;
|
|
343
350
|
}
|
|
344
351
|
|
|
345
352
|
#checkMaterialsChanged(options) {
|
|
@@ -349,10 +356,18 @@ class PrefViewer extends HTMLElement {
|
|
|
349
356
|
let someChanged = false;
|
|
350
357
|
Object.keys(this.#data.options.materials).forEach((material) => {
|
|
351
358
|
const key = `${material}Material`;
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
359
|
+
const state = this.#data.options.materials[material];
|
|
360
|
+
const prev = state.value;
|
|
361
|
+
const incoming = options[key];
|
|
362
|
+
const changed = !!incoming && incoming !== prev;
|
|
363
|
+
|
|
364
|
+
state.changed.pending = changed;
|
|
365
|
+
state.changed.success = false;
|
|
366
|
+
if (changed) {
|
|
367
|
+
state.changed.value = prev;
|
|
368
|
+
state.value = incoming;
|
|
369
|
+
}
|
|
370
|
+
someChanged = someChanged || changed;
|
|
356
371
|
});
|
|
357
372
|
return someChanged;
|
|
358
373
|
}
|
|
@@ -361,19 +376,19 @@ class PrefViewer extends HTMLElement {
|
|
|
361
376
|
if (success) {
|
|
362
377
|
container.timeStamp = container.changed.timeStamp;
|
|
363
378
|
container.size = container.changed.size;
|
|
364
|
-
container.changed.success =
|
|
365
|
-
} else if (container.changed) {
|
|
366
|
-
container.source = container.changed.source;
|
|
367
|
-
container.changed = false;
|
|
379
|
+
container.changed.success = true;
|
|
368
380
|
} else {
|
|
369
|
-
container.changed = false;
|
|
381
|
+
container.changed.success = false;
|
|
370
382
|
}
|
|
371
383
|
}
|
|
372
384
|
|
|
373
385
|
#resetChangedFlags() {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
386
|
+
const reset = (node) => {
|
|
387
|
+
node.changed = { pending: false, success: false };
|
|
388
|
+
};
|
|
389
|
+
Object.values(this.#data.containers).forEach(reset);
|
|
390
|
+
Object.values(this.#data.options.materials).forEach(reset);
|
|
391
|
+
reset(this.#data.options.camera);
|
|
377
392
|
}
|
|
378
393
|
|
|
379
394
|
// Babylon.js
|
|
@@ -646,7 +661,7 @@ class PrefViewer extends HTMLElement {
|
|
|
646
661
|
try {
|
|
647
662
|
JSON.parse(decoded);
|
|
648
663
|
isJson = true;
|
|
649
|
-
} catch {}
|
|
664
|
+
} catch { }
|
|
650
665
|
extension = isJson ? ".gltf" : ".glb";
|
|
651
666
|
const type = isJson ? "model/gltf+json" : "model/gltf-binary";
|
|
652
667
|
const array = Uint8Array.from(decoded, (c) => c.charCodeAt(0));
|
|
@@ -675,17 +690,17 @@ class PrefViewer extends HTMLElement {
|
|
|
675
690
|
if (!optionMaterial || !optionMaterial.prefix || !optionMaterial.value) {
|
|
676
691
|
return false;
|
|
677
692
|
}
|
|
678
|
-
|
|
693
|
+
|
|
679
694
|
const material = this.#data.containers.materials.assetContainer?.materials.find((mat) => mat.name === optionMaterial.value) || null;
|
|
680
695
|
if (!material) {
|
|
681
696
|
return false;
|
|
682
697
|
}
|
|
683
|
-
|
|
698
|
+
|
|
684
699
|
const containers = [];
|
|
685
|
-
if (this.#data.containers.model.assetContainer && (this.#data.containers.model.changed || this.#data.containers.materials.changed || optionMaterial.changed)) {
|
|
700
|
+
if (this.#data.containers.model.assetContainer && (this.#data.containers.model.changed.pending || this.#data.containers.materials.changed.pending || optionMaterial.changed.pending)) {
|
|
686
701
|
containers.push(this.#data.containers.model.assetContainer);
|
|
687
702
|
}
|
|
688
|
-
if (this.#data.containers.environment.assetContainer && (this.#data.containers.environment.changed || this.#data.containers.materials.changed || optionMaterial.changed)) {
|
|
703
|
+
if (this.#data.containers.environment.assetContainer && (this.#data.containers.environment.changed.pending || this.#data.containers.materials.changed.pending || optionMaterial.changed.pending)) {
|
|
689
704
|
containers.push(this.#data.containers.environment.assetContainer);
|
|
690
705
|
}
|
|
691
706
|
if (containers.length === 0) {
|
|
@@ -704,8 +719,9 @@ class PrefViewer extends HTMLElement {
|
|
|
704
719
|
|
|
705
720
|
if (someSetted) {
|
|
706
721
|
optionMaterial.changed.success = true;
|
|
707
|
-
} else {
|
|
708
|
-
optionMaterial.value = optionMaterial.changed.
|
|
722
|
+
} else if (optionMaterial.changed.pending) {
|
|
723
|
+
optionMaterial.value = optionMaterial.changed.value;
|
|
724
|
+
optionMaterial.changed.success = false;
|
|
709
725
|
}
|
|
710
726
|
|
|
711
727
|
return someSetted;
|
|
@@ -721,27 +737,31 @@ class PrefViewer extends HTMLElement {
|
|
|
721
737
|
}
|
|
722
738
|
|
|
723
739
|
#setOptionsCamera() {
|
|
724
|
-
if (!this.#data.options.camera.value
|
|
740
|
+
if (!this.#data.options.camera.value && !this.#data.options.camera.changed.pending && !this.#data.containers.model.changed.pending && !this.#data.containers.environment.changed.pending) {
|
|
725
741
|
return false;
|
|
726
742
|
}
|
|
727
743
|
|
|
728
744
|
let camera = this.#data.containers.model.assetContainer?.cameras.find((thisCamera) => thisCamera.name === this.#data.options.camera.value) || this.#data.containers.environment.assetContainer?.cameras.find((thisCamera) => thisCamera.name === this.#data.options.camera.value) || null;
|
|
729
745
|
if (!camera) {
|
|
730
|
-
if (this.#data.options.camera.changed
|
|
731
|
-
camera = this.#data.containers.model.assetContainer?.cameras.find((thisCamera) => thisCamera.name === this.#data.options.camera.changed.
|
|
746
|
+
if (this.#data.options.camera.changed.value && this.#data.options.camera.changed.value !== this.#data.options.camera.value) {
|
|
747
|
+
camera = this.#data.containers.model.assetContainer?.cameras.find((thisCamera) => thisCamera.name === this.#data.options.camera.changed.value) || this.#data.containers.environment.assetContainer?.cameras.find((thisCamera) => thisCamera.name === this.#data.options.camera.changed.value) || null;
|
|
732
748
|
}
|
|
733
749
|
if (camera) {
|
|
734
|
-
camera.metadata = { locked: this.#data.options.camera.changed.
|
|
735
|
-
this.#data.options.camera.value = this.#data.options.camera.changed.
|
|
736
|
-
this.#data.options.camera.locked = this.#data.options.camera.changed.
|
|
750
|
+
camera.metadata = { locked: this.#data.options.camera.changed.locked };
|
|
751
|
+
this.#data.options.camera.value = this.#data.options.camera.changed.value;
|
|
752
|
+
this.#data.options.camera.locked = this.#data.options.camera.changed.locked;
|
|
753
|
+
this.#data.options.camera.changed.success = false;
|
|
737
754
|
} else {
|
|
738
755
|
camera = this.#camera;
|
|
739
756
|
this.#data.options.camera.value = null;
|
|
740
757
|
this.#data.options.camera.locked = this.#camera.metadata.locked;
|
|
758
|
+
this.#data.options.camera.changed.success = false;
|
|
741
759
|
}
|
|
742
|
-
this.#data.options.camera.changed.success = false;
|
|
743
760
|
} else {
|
|
744
761
|
camera.metadata = { locked: this.#data.options.camera.locked };
|
|
762
|
+
if (this.#data.options.camera.changed.pending) {
|
|
763
|
+
this.#data.options.camera.changed.success = true;
|
|
764
|
+
}
|
|
745
765
|
}
|
|
746
766
|
if (!this.#data.options.camera.locked && this.#data.options.camera.value !== null) {
|
|
747
767
|
camera.attachControl(this.#canvas, true);
|
|
@@ -766,6 +786,7 @@ class PrefViewer extends HTMLElement {
|
|
|
766
786
|
|
|
767
787
|
#replaceContainer(container, newAssetContainer) {
|
|
768
788
|
if (container.assetContainer) {
|
|
789
|
+
this.#removeContainer(container);
|
|
769
790
|
container.assetContainer.dispose();
|
|
770
791
|
container.assetContainer = null;
|
|
771
792
|
}
|
|
@@ -788,10 +809,10 @@ class PrefViewer extends HTMLElement {
|
|
|
788
809
|
const object = await loadModel(storage.id, storage.table);
|
|
789
810
|
source = object.data;
|
|
790
811
|
if (object.timeStamp === container.timeStamp) {
|
|
791
|
-
container.changed = false;
|
|
812
|
+
container.changed = { pending: false, success: false };
|
|
792
813
|
return false;
|
|
793
814
|
} else {
|
|
794
|
-
|
|
815
|
+
container.changed = { pending: true, size: object.size, success: false, timeStamp: object.timeStamp };
|
|
795
816
|
}
|
|
796
817
|
}
|
|
797
818
|
|
|
@@ -806,12 +827,12 @@ class PrefViewer extends HTMLElement {
|
|
|
806
827
|
file = new File([blob], `${container.name}${extension}`, {
|
|
807
828
|
type: blob.type,
|
|
808
829
|
});
|
|
809
|
-
if (!container.changed) {
|
|
830
|
+
if (!container.changed.pending) {
|
|
810
831
|
if (container.timeStamp === null && container.size === size) {
|
|
811
|
-
container.changed = false;
|
|
832
|
+
container.changed = { pending: false, success: false };
|
|
812
833
|
return false;
|
|
813
834
|
} else {
|
|
814
|
-
|
|
835
|
+
container.changed = { pending: true, size: size, success: false, timeStamp: null };
|
|
815
836
|
}
|
|
816
837
|
}
|
|
817
838
|
} else {
|
|
@@ -819,10 +840,10 @@ class PrefViewer extends HTMLElement {
|
|
|
819
840
|
extension = extMatch ? `.${extMatch[1].toLowerCase()}` : ".gltf";
|
|
820
841
|
const [fileSize, fileTimeStamp] = await this.#getServerFileDataHeader(source);
|
|
821
842
|
if (container.size === fileSize && container.timeStamp === fileTimeStamp) {
|
|
822
|
-
container.changed = false;
|
|
843
|
+
container.changed = { pending: false, success: false };
|
|
823
844
|
return false;
|
|
824
845
|
} else {
|
|
825
|
-
|
|
846
|
+
container.changed = { pending: true, size: fileSize, success: false, timeStamp: fileTimeStamp };
|
|
826
847
|
}
|
|
827
848
|
}
|
|
828
849
|
|
|
@@ -831,7 +852,9 @@ class PrefViewer extends HTMLElement {
|
|
|
831
852
|
pluginExtension: extension,
|
|
832
853
|
pluginOptions: {
|
|
833
854
|
gltf: {
|
|
855
|
+
compileMaterials: true,
|
|
834
856
|
loadAllMaterials: true,
|
|
857
|
+
loadOnlyMaterials: container.name === "materials",
|
|
835
858
|
preprocessUrlAsync: this.#transformUrl,
|
|
836
859
|
},
|
|
837
860
|
},
|
|
@@ -855,16 +878,14 @@ class PrefViewer extends HTMLElement {
|
|
|
855
878
|
const environmentContainer = values[1];
|
|
856
879
|
const materialsContainer = values[2];
|
|
857
880
|
|
|
858
|
-
this.#removeContainer(this.#data.containers.model);
|
|
859
|
-
this.#removeContainer(this.#data.containers.environment);
|
|
860
|
-
this.#removeContainer(this.#data.containers.materials);
|
|
861
|
-
|
|
862
881
|
if (modelContainer.status === "fulfilled" && modelContainer.value) {
|
|
863
882
|
modelContainer.value.lights = [];
|
|
864
883
|
this.#replaceContainer(this.#data.containers.model, modelContainer.value);
|
|
865
884
|
this.#storeChangedFlagsForContainer(this.#data.containers.model, true);
|
|
866
885
|
} else {
|
|
867
|
-
this.#
|
|
886
|
+
if (this.#data.containers.model.assetContainer && this.#data.containers.model.show !== this.#data.containers.model.visible) {
|
|
887
|
+
this.#data.containers.model.show ? this.#addContainer(this.#data.containers.model) : this.#removeContainer(this.#data.containers.model);
|
|
888
|
+
}
|
|
868
889
|
this.#storeChangedFlagsForContainer(this.#data.containers.model, false);
|
|
869
890
|
}
|
|
870
891
|
|
|
@@ -872,7 +893,9 @@ class PrefViewer extends HTMLElement {
|
|
|
872
893
|
this.#replaceContainer(this.#data.containers.environment, environmentContainer.value);
|
|
873
894
|
this.#storeChangedFlagsForContainer(this.#data.containers.environment, true);
|
|
874
895
|
} else {
|
|
875
|
-
this.#
|
|
896
|
+
if (this.#data.containers.environment.assetContainer && this.#data.containers.environment.show !== this.#data.containers.environment.visible) {
|
|
897
|
+
this.#data.containers.environment.show ? this.#addContainer(this.#data.containers.environment) : this.#removeContainer(this.#data.containers.environment);
|
|
898
|
+
}
|
|
876
899
|
this.#storeChangedFlagsForContainer(this.#data.containers.environment, false);
|
|
877
900
|
}
|
|
878
901
|
|
|
@@ -880,10 +903,10 @@ class PrefViewer extends HTMLElement {
|
|
|
880
903
|
this.#replaceContainer(this.#data.containers.materials, materialsContainer.value);
|
|
881
904
|
this.#storeChangedFlagsForContainer(this.#data.containers.materials, true);
|
|
882
905
|
} else {
|
|
883
|
-
this.#addContainer(this.#data.containers.materials);
|
|
884
906
|
this.#storeChangedFlagsForContainer(this.#data.containers.materials, false);
|
|
885
907
|
}
|
|
886
908
|
|
|
909
|
+
await this.#scene.whenReadyAsync();
|
|
887
910
|
this.#setOptionsMaterials();
|
|
888
911
|
this.#setOptionsCamera();
|
|
889
912
|
this.#setVisibilityOfWallAndFloorInModel();
|
|
@@ -917,17 +940,24 @@ class PrefViewer extends HTMLElement {
|
|
|
917
940
|
|
|
918
941
|
// Containers
|
|
919
942
|
const loadModel = !!config.model?.storage;
|
|
920
|
-
|
|
943
|
+
// CHANGED: marcar pending, no boolean
|
|
944
|
+
this.#data.containers.model.changed.pending = loadModel;
|
|
945
|
+
this.#data.containers.model.changed.success = false;
|
|
946
|
+
this.#data.containers.model.changed.storage = this.#data.containers.model.storage;
|
|
921
947
|
this.#data.containers.model.storage = loadModel ? config.model.storage : this.#data.containers.model.storage;
|
|
922
948
|
this.#data.containers.model.show = config.model?.visible !== undefined ? config.model.visible : this.#data.containers.model.show;
|
|
923
949
|
|
|
924
950
|
const loadEnvironment = !!config.scene?.storage;
|
|
925
|
-
this.#data.containers.environment.changed = loadEnvironment
|
|
951
|
+
this.#data.containers.environment.changed.pending = loadEnvironment;
|
|
952
|
+
this.#data.containers.environment.changed.success = false;
|
|
953
|
+
this.#data.containers.environment.changed.storage = this.#data.containers.environment.storage;
|
|
926
954
|
this.#data.containers.environment.storage = loadEnvironment ? config.scene.storage : this.#data.containers.environment.storage;
|
|
927
955
|
this.#data.containers.environment.show = config.scene?.visible !== undefined ? config.scene.visible : this.#data.containers.environment.show;
|
|
928
956
|
|
|
929
957
|
const loadMaterials = !!config.materials?.storage;
|
|
930
|
-
this.#data.containers.materials.changed = loadMaterials
|
|
958
|
+
this.#data.containers.materials.changed.pending = loadMaterials;
|
|
959
|
+
this.#data.containers.materials.changed.success = false;
|
|
960
|
+
this.#data.containers.materials.changed.storage = this.#data.containers.materials.storage;
|
|
931
961
|
this.#data.containers.materials.storage = loadMaterials ? config.materials.storage : this.#data.containers.materials.storage;
|
|
932
962
|
|
|
933
963
|
// Options
|
|
@@ -965,7 +995,9 @@ class PrefViewer extends HTMLElement {
|
|
|
965
995
|
return false;
|
|
966
996
|
}
|
|
967
997
|
const loadModel = !!model.storage;
|
|
968
|
-
this.#data.containers.model.changed = loadModel
|
|
998
|
+
this.#data.containers.model.changed.pending = loadModel;
|
|
999
|
+
this.#data.containers.model.changed.success = false;
|
|
1000
|
+
this.#data.containers.model.changed.storage = this.#data.containers.model.storage;
|
|
969
1001
|
this.#data.containers.model.storage = loadModel ? model.storage : this.#data.containers.model.storage;
|
|
970
1002
|
this.#data.containers.model.show = model.visible !== undefined ? model.visible : this.#data.containers.model.show;
|
|
971
1003
|
this.initialized && this.#loadContainers(loadModel, false, false);
|
|
@@ -977,7 +1009,9 @@ class PrefViewer extends HTMLElement {
|
|
|
977
1009
|
return false;
|
|
978
1010
|
}
|
|
979
1011
|
const loadEnvironment = !!scene.storage;
|
|
980
|
-
this.#data.containers.environment.changed = loadEnvironment
|
|
1012
|
+
this.#data.containers.environment.changed.pending = loadEnvironment;
|
|
1013
|
+
this.#data.containers.environment.changed.success = false;
|
|
1014
|
+
this.#data.containers.environment.changed.storage = this.#data.containers.environment.storage;
|
|
981
1015
|
this.#data.containers.environment.storage = loadEnvironment ? scene.storage : this.#data.containers.environment.storage;
|
|
982
1016
|
this.#data.containers.environment.show = scene.visible !== undefined ? scene.visible : this.#data.containers.environment.show;
|
|
983
1017
|
this.initialized && this.#loadContainers(false, loadEnvironment, false);
|
|
@@ -989,7 +1023,9 @@ class PrefViewer extends HTMLElement {
|
|
|
989
1023
|
return false;
|
|
990
1024
|
}
|
|
991
1025
|
const loadMaterials = !!materials.storage;
|
|
992
|
-
this.#data.containers.materials.changed = loadMaterials
|
|
1026
|
+
this.#data.containers.materials.changed.pending = loadMaterials;
|
|
1027
|
+
this.#data.containers.materials.changed.success = false;
|
|
1028
|
+
this.#data.containers.materials.changed.storage = this.#data.containers.materials.storage;
|
|
993
1029
|
this.#data.containers.materials.storage = loadMaterials ? materials.storage : this.#data.containers.materials.storage;
|
|
994
1030
|
this.initialized && this.#loadContainers(false, false, loadMaterials);
|
|
995
1031
|
}
|