zakeke-configurator-react 0.0.72 → 0.0.76
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
|
+
import { FocusAttributesEventListener } from '../../../3D/src';
|
|
2
3
|
import { PlatformAttributeSelection } from './integrations/Integration';
|
|
3
4
|
import { Camera, FontFamily, Group, Image, ImageMacroCategory, Item, Product, Template } from './models';
|
|
4
|
-
import { FocusAttributesEventListener } from '../../../3D/src';
|
|
5
5
|
export declare class ZakekeEnvironment {
|
|
6
6
|
private token;
|
|
7
7
|
private platformAttributesSelection;
|
|
@@ -83,7 +83,7 @@ export declare class ZakekeEnvironment {
|
|
|
83
83
|
private createOptionFromSelection;
|
|
84
84
|
private saveDesignBackbone;
|
|
85
85
|
private saveCompositionBackbone;
|
|
86
|
-
saveComposition: () => Promise<
|
|
86
|
+
saveComposition: () => Promise<any>;
|
|
87
87
|
private trigger;
|
|
88
88
|
on: (event: string, callback: any) => void;
|
|
89
89
|
off: (event: string, callback: any) => void;
|
|
@@ -38,6 +38,7 @@ export declare function hsvToRgb(h: any, s: any, v: any): number[];
|
|
|
38
38
|
export declare const iOS: boolean;
|
|
39
39
|
export declare function copy(obj: any): any;
|
|
40
40
|
export declare function compare(_obj1: any, _obj2: any): any;
|
|
41
|
+
export declare function isValidJSON(code: string): boolean;
|
|
41
42
|
export declare function isPlatformCode(code: string): any;
|
|
42
43
|
export declare function matchCodes(code1: string, code2: string): any;
|
|
43
44
|
export declare function getPlatformSettings(): PlatformSettings;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FontFamily, Group,
|
|
2
|
-
import { AppState } from "./state";
|
|
3
|
-
import { Image, ImageMacroCategory, Camera } from "../models";
|
|
1
|
+
import { FontFamily, Group, Item, Product, Template } from "..";
|
|
4
2
|
import { FocusAttributesEventListener } from "../../../../3D/src";
|
|
3
|
+
import { Camera, Image, ImageMacroCategory } from "../models";
|
|
4
|
+
import { AppState } from "./state";
|
|
5
5
|
export interface ProviderValue {
|
|
6
6
|
internalProduct: MPlaza.Model | null;
|
|
7
7
|
internalScene: Zakeke.Scene | null;
|
|
@@ -26,6 +26,7 @@ export interface ProviderValue {
|
|
|
26
26
|
designUpdate: () => void;
|
|
27
27
|
setTemplate: (templateId: number) => void;
|
|
28
28
|
isAreaVisible: (areaId: number) => boolean;
|
|
29
|
+
saveComposition: () => Promise<string>;
|
|
29
30
|
loadComposition: (id: string) => Promise<void>;
|
|
30
31
|
addToCart: (additionalProperties: Record<string, any>) => Promise<void>;
|
|
31
32
|
getPDF: () => Promise<string>;
|
package/dist/index.js
CHANGED
|
@@ -2965,15 +2965,15 @@ class MeshLocationsManager {
|
|
|
2965
2965
|
"use strict";
|
|
2966
2966
|
__webpack_require__.r(__webpack_exports__);
|
|
2967
2967
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MeshDesignManager", function() { return MeshDesignManager; });
|
|
2968
|
-
/* harmony import */ var
|
|
2969
|
-
/* harmony import */ var
|
|
2970
|
-
/* harmony import */ var
|
|
2971
|
-
/* harmony import */ var
|
|
2968
|
+
/* harmony import */ var _Helpers_debounce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Helpers/debounce */ "../../3D/src/Helpers/debounce.ts");
|
|
2969
|
+
/* harmony import */ var _Helpers_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Helpers/utils */ "../../3D/src/Helpers/utils.ts");
|
|
2970
|
+
/* harmony import */ var _NormalMap_ProceduralNormalMap__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../NormalMap/ProceduralNormalMap */ "../../3D/src/Components/NormalMap/ProceduralNormalMap.ts");
|
|
2971
|
+
/* harmony import */ var _ProceduralTextures_ForegroundBackgroundProceduralTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../ProceduralTextures/ForegroundBackgroundProceduralTexture */ "../../3D/src/Components/ProceduralTextures/ForegroundBackgroundProceduralTexture.ts");
|
|
2972
2972
|
/* harmony import */ var _ProceduralTextures_MultiplyProceduralTexture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../ProceduralTextures/MultiplyProceduralTexture */ "../../3D/src/Components/ProceduralTextures/MultiplyProceduralTexture.ts");
|
|
2973
2973
|
/* harmony import */ var _ProceduralTextures_OverlayProceduralTexture__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../ProceduralTextures/OverlayProceduralTexture */ "../../3D/src/Components/ProceduralTextures/OverlayProceduralTexture.ts");
|
|
2974
|
-
/* harmony import */ var
|
|
2975
|
-
/* harmony import */ var
|
|
2976
|
-
/* harmony import */ var
|
|
2974
|
+
/* harmony import */ var _SceneHelper__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../SceneHelper */ "../../3D/src/Components/SceneHelper.ts");
|
|
2975
|
+
/* harmony import */ var _Shadows_InnerShadow__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Shadows/InnerShadow */ "../../3D/src/Components/Shadows/InnerShadow.ts");
|
|
2976
|
+
/* harmony import */ var _Shadows_OuterShadow__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Shadows/OuterShadow */ "../../3D/src/Components/Shadows/OuterShadow.ts");
|
|
2977
2977
|
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2978
2978
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2979
2979
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -3006,7 +3006,7 @@ class MeshDesignManager {
|
|
|
3006
3006
|
// disegnato nulla
|
|
3007
3007
|
this._defaultSize = 1024;
|
|
3008
3008
|
//private readonly _size = Utils.isIPhoneX() ? 512 : 1024;
|
|
3009
|
-
this._size =
|
|
3009
|
+
this._size = _Helpers_utils__WEBPACK_IMPORTED_MODULE_1__["Utils"].isMobile() || _Helpers_utils__WEBPACK_IMPORTED_MODULE_1__["Utils"].isiOS() ? 512 : 1024;
|
|
3010
3010
|
this._baseWidth = this._size;
|
|
3011
3011
|
this._baseHeight = this._size;
|
|
3012
3012
|
this._textureWidth = this._size;
|
|
@@ -3066,7 +3066,7 @@ class MeshDesignManager {
|
|
|
3066
3066
|
this._originalViewMatrixValues = null;
|
|
3067
3067
|
this._grids = [];
|
|
3068
3068
|
this._scene = scene;
|
|
3069
|
-
this._sceneHelper = new
|
|
3069
|
+
this._sceneHelper = new _SceneHelper__WEBPACK_IMPORTED_MODULE_6__["SceneHelper"](scene);
|
|
3070
3070
|
this._zkScene = zkScene;
|
|
3071
3071
|
this._mesh = mesh;
|
|
3072
3072
|
this._subMesh = subMesh;
|
|
@@ -3502,8 +3502,6 @@ class MeshDesignManager {
|
|
|
3502
3502
|
setupNormalmapMaterialAsync() {
|
|
3503
3503
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3504
3504
|
this.disposeNormalmapMaterial();
|
|
3505
|
-
if (!this._mesh.material)
|
|
3506
|
-
return;
|
|
3507
3505
|
this._originalMaterial = this._mesh.material;
|
|
3508
3506
|
let materialId = Zakeke.generateUUID();
|
|
3509
3507
|
let materialName = "normalmapMaterial - " + materialId;
|
|
@@ -3519,7 +3517,7 @@ class MeshDesignManager {
|
|
|
3519
3517
|
this._normalmapMaterial.doNotSerialize = true;
|
|
3520
3518
|
this._normalmapMaterial.metadata = {};
|
|
3521
3519
|
if (this._originalMaterial)
|
|
3522
|
-
this._normalmapMaterial.metadata.originalMaterialID = this.
|
|
3520
|
+
this._normalmapMaterial.metadata.originalMaterialID = this._originalMaterial.id;
|
|
3523
3521
|
else
|
|
3524
3522
|
this._normalmapMaterial.metadata.originalMaterialID = null;
|
|
3525
3523
|
this._normalmapMaterial.metadata.isRealMaterial = false;
|
|
@@ -3682,41 +3680,45 @@ class MeshDesignManager {
|
|
|
3682
3680
|
this._customizer.fitToScreenMargin = 1;
|
|
3683
3681
|
this._customizer.setGrids(this._grids);
|
|
3684
3682
|
this._customizer.setDesign(this._zkDesign);
|
|
3685
|
-
this._customizer.addItemCreatedListener(() => __awaiter(this, void 0, void 0, function* () {
|
|
3686
|
-
yield this.updateDynamicTextureAsync();
|
|
3687
|
-
this.fireRenderingNeededEvent();
|
|
3688
|
-
}));
|
|
3689
|
-
this._customizer.addItemChangedListener(() => __awaiter(this, void 0, void 0, function* () {
|
|
3690
|
-
yield this.updateDynamicTextureAsync();
|
|
3691
|
-
this.fireRenderingNeededEvent();
|
|
3692
|
-
}));
|
|
3693
|
-
this._customizer.addItemRemovedListener(() => __awaiter(this, void 0, void 0, function* () {
|
|
3694
|
-
yield this.updateDynamicTextureAsync();
|
|
3695
|
-
this.fireRenderingNeededEvent();
|
|
3696
|
-
}));
|
|
3697
|
-
this._customizer.addImageLoadedListener(() => __awaiter(this, void 0, void 0, function* () {
|
|
3698
|
-
yield this.updateDynamicTextureAsync();
|
|
3699
|
-
this.fireRenderingNeededEvent();
|
|
3700
|
-
}));
|
|
3701
3683
|
yield new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
3702
3684
|
var _a, _b;
|
|
3703
3685
|
yield ((_a = this._customizer) === null || _a === void 0 ? void 0 : _a.setSide(this._side));
|
|
3704
3686
|
(_b = this._customizer) === null || _b === void 0 ? void 0 : _b.refresh({ boundsToAreas: true }, () => __awaiter(this, void 0, void 0, function* () {
|
|
3705
|
-
if (this.
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3687
|
+
if (this._customizer) {
|
|
3688
|
+
if (this._meshSide) {
|
|
3689
|
+
let valuesJson = this._meshSide.get("matrix");
|
|
3690
|
+
if (valuesJson) {
|
|
3691
|
+
const values = JSON.parse(valuesJson);
|
|
3692
|
+
let matrix = new this._customizer.paper.Matrix(values);
|
|
3693
|
+
if (this._defaultSize !== this._size) {
|
|
3694
|
+
const scale = this._size / this._defaultSize;
|
|
3695
|
+
const scaledMatrix = new this._customizer.paper.Matrix().scale(scale, scale);
|
|
3696
|
+
matrix = matrix.prepend(scaledMatrix);
|
|
3697
|
+
}
|
|
3698
|
+
this._customizer.paper.view.matrix = matrix;
|
|
3699
|
+
this._customizer.paper.view.update();
|
|
3714
3700
|
}
|
|
3715
|
-
this._customizer.paper.view.matrix = matrix;
|
|
3716
|
-
this._customizer.paper.view.update();
|
|
3717
3701
|
}
|
|
3702
|
+
yield this.updateDynamicTextureAsync();
|
|
3703
|
+
// Attach events only after the first rendering
|
|
3704
|
+
// to avoid concurrent updates
|
|
3705
|
+
this._customizer.addItemCreatedListener(() => __awaiter(this, void 0, void 0, function* () {
|
|
3706
|
+
yield this.updateDynamicTextureAsync();
|
|
3707
|
+
this.fireRenderingNeededEvent();
|
|
3708
|
+
}));
|
|
3709
|
+
this._customizer.addItemChangedListener(() => __awaiter(this, void 0, void 0, function* () {
|
|
3710
|
+
yield this.updateDynamicTextureAsync();
|
|
3711
|
+
this.fireRenderingNeededEvent();
|
|
3712
|
+
}));
|
|
3713
|
+
this._customizer.addItemRemovedListener(() => __awaiter(this, void 0, void 0, function* () {
|
|
3714
|
+
yield this.updateDynamicTextureAsync();
|
|
3715
|
+
this.fireRenderingNeededEvent();
|
|
3716
|
+
}));
|
|
3717
|
+
this._customizer.addImageLoadedListener(() => __awaiter(this, void 0, void 0, function* () {
|
|
3718
|
+
yield this.updateDynamicTextureAsync();
|
|
3719
|
+
this.fireRenderingNeededEvent();
|
|
3720
|
+
}));
|
|
3718
3721
|
}
|
|
3719
|
-
yield this.updateDynamicTextureAsync();
|
|
3720
3722
|
resolve();
|
|
3721
3723
|
}));
|
|
3722
3724
|
}));
|
|
@@ -3863,7 +3865,7 @@ class MeshDesignManager {
|
|
|
3863
3865
|
if (material) {
|
|
3864
3866
|
var textures = material.getActiveTextures();
|
|
3865
3867
|
textures.forEach((txt) => __awaiter(this, void 0, void 0, function* () {
|
|
3866
|
-
yield
|
|
3868
|
+
yield _SceneHelper__WEBPACK_IMPORTED_MODULE_6__["SceneHelper"].whenTextureIsReadyAsync(txt);
|
|
3867
3869
|
}));
|
|
3868
3870
|
//let promises: Promise<void>[] = [];
|
|
3869
3871
|
//var textures = material.getActiveTextures();
|
|
@@ -3980,7 +3982,7 @@ class MeshDesignManager {
|
|
|
3980
3982
|
updateDynamicTextureAsync() {
|
|
3981
3983
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3982
3984
|
if (!this._debouncedUpdateDynamicTexture)
|
|
3983
|
-
this._debouncedUpdateDynamicTexture = Object(
|
|
3985
|
+
this._debouncedUpdateDynamicTexture = Object(_Helpers_debounce__WEBPACK_IMPORTED_MODULE_0__["debounce"])(this.updateDynamicTextureInternalAsync, 150);
|
|
3984
3986
|
this._debouncedUpdateDynamicTexture();
|
|
3985
3987
|
});
|
|
3986
3988
|
}
|
|
@@ -4024,7 +4026,7 @@ class MeshDesignManager {
|
|
|
4024
4026
|
let blobTextureURL = URL.createObjectURL(blob);
|
|
4025
4027
|
this._dynamicTexture = new BABYLON.Texture(blobTextureURL, this._scene);
|
|
4026
4028
|
this._dynamicTexture.hasAlpha = true;
|
|
4027
|
-
yield
|
|
4029
|
+
yield _SceneHelper__WEBPACK_IMPORTED_MODULE_6__["SceneHelper"].whenTextureIsReadyAsync(this._dynamicTexture);
|
|
4028
4030
|
if (!isBlank && this._dynamicTexture) {
|
|
4029
4031
|
if (normalmapEnabled)
|
|
4030
4032
|
yield this.updateNormalmapTextureAsync(normalmapConfig);
|
|
@@ -4134,10 +4136,10 @@ class MeshDesignManager {
|
|
|
4134
4136
|
updateOpacityTextureAsync() {
|
|
4135
4137
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4136
4138
|
if (this._dynamicTexture) {
|
|
4137
|
-
yield
|
|
4139
|
+
yield _SceneHelper__WEBPACK_IMPORTED_MODULE_6__["SceneHelper"].whenTextureIsReadyAsync(this._dynamicTexture);
|
|
4138
4140
|
// Genero la maschera di opacità a partire dalla texture dinamic
|
|
4139
4141
|
if (!this._dynamicOpacityTexture) {
|
|
4140
|
-
this._dynamicOpacityTexture = new
|
|
4142
|
+
this._dynamicOpacityTexture = new _ProceduralTextures_ForegroundBackgroundProceduralTexture__WEBPACK_IMPORTED_MODULE_3__["ForegroundBackgroundProceduralTexture"]("dynamicOpacity", this._textureWidth, this._scene, this._dynamicTexture);
|
|
4141
4143
|
this._dynamicOpacityTexture.backColor = new BABYLON.Vector3(0, 0, 0);
|
|
4142
4144
|
this._dynamicOpacityTexture.foreColor = new BABYLON.Vector3(1, 1, 1);
|
|
4143
4145
|
this._dynamicOpacityTexture.refreshRate = 0;
|
|
@@ -4145,7 +4147,7 @@ class MeshDesignManager {
|
|
|
4145
4147
|
}
|
|
4146
4148
|
if (this._dynamicOpacityTexture) {
|
|
4147
4149
|
this._dynamicOpacityTexture.baseTexture = this._dynamicTexture;
|
|
4148
|
-
yield
|
|
4150
|
+
yield _SceneHelper__WEBPACK_IMPORTED_MODULE_6__["SceneHelper"].whenTextureIsReadyAsync(this._dynamicOpacityTexture);
|
|
4149
4151
|
this._dynamicOpacityTexture.render();
|
|
4150
4152
|
}
|
|
4151
4153
|
}
|
|
@@ -4155,8 +4157,8 @@ class MeshDesignManager {
|
|
|
4155
4157
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4156
4158
|
if (!this._originalDiffuseTexture || !this._dynamicTexture)
|
|
4157
4159
|
return;
|
|
4158
|
-
yield
|
|
4159
|
-
yield
|
|
4160
|
+
yield _SceneHelper__WEBPACK_IMPORTED_MODULE_6__["SceneHelper"].whenTextureIsReadyAsync(this._originalDiffuseTexture);
|
|
4161
|
+
yield _SceneHelper__WEBPACK_IMPORTED_MODULE_6__["SceneHelper"].whenTextureIsReadyAsync(this._dynamicTexture);
|
|
4160
4162
|
const baseTexture = blendLevel === 0 ? this._dynamicTexture : this._originalDiffuseTexture;
|
|
4161
4163
|
const blendTexture = blendLevel === 0 ? this._originalDiffuseTexture : this._dynamicTexture;
|
|
4162
4164
|
if (!this._combinedDiffuseTexture) {
|
|
@@ -4169,7 +4171,7 @@ class MeshDesignManager {
|
|
|
4169
4171
|
if (this._combinedDiffuseTexture) {
|
|
4170
4172
|
this._combinedDiffuseTexture.baseTexture = baseTexture;
|
|
4171
4173
|
this._combinedDiffuseTexture.blendTexture = blendTexture;
|
|
4172
|
-
yield
|
|
4174
|
+
yield _SceneHelper__WEBPACK_IMPORTED_MODULE_6__["SceneHelper"].whenTextureIsReadyAsync(this._combinedDiffuseTexture);
|
|
4173
4175
|
this._combinedDiffuseTexture.render();
|
|
4174
4176
|
}
|
|
4175
4177
|
});
|
|
@@ -4178,9 +4180,9 @@ class MeshDesignManager {
|
|
|
4178
4180
|
updateNormalmapTextureAsync(config) {
|
|
4179
4181
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4180
4182
|
if (this._dynamicTexture) {
|
|
4181
|
-
yield
|
|
4183
|
+
yield _SceneHelper__WEBPACK_IMPORTED_MODULE_6__["SceneHelper"].whenTextureIsReadyAsync(this._dynamicTexture);
|
|
4182
4184
|
if (!this._proceduralNormalMap) {
|
|
4183
|
-
this._proceduralNormalMap = new
|
|
4185
|
+
this._proceduralNormalMap = new _NormalMap_ProceduralNormalMap__WEBPACK_IMPORTED_MODULE_2__["ProceduralNormalMap"](this._dynamicTexture, this._textureWidth, config, this._scene);
|
|
4184
4186
|
}
|
|
4185
4187
|
this._normalmapTexture = yield this._proceduralNormalMap.getNormalMapTextureAsync(this._dynamicTexture, config);
|
|
4186
4188
|
if (this._normalmapTexture)
|
|
@@ -4193,6 +4195,7 @@ class MeshDesignManager {
|
|
|
4193
4195
|
// sul materiale. Inoltre, essendo i materiali clonati (per non modificare quelli originari) è necessario controllare
|
|
4194
4196
|
// che le texture siano pronte
|
|
4195
4197
|
setNormalmapTextureAsync(config) {
|
|
4198
|
+
var _a;
|
|
4196
4199
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4197
4200
|
let meshNormalmapTexture = this._normalmapTexture;
|
|
4198
4201
|
let designNormalmapTexture = this._normalmapTexture;
|
|
@@ -4218,8 +4221,12 @@ class MeshDesignManager {
|
|
|
4218
4221
|
this._normalmapMaterial[propName] = meshNormalmapTexture;
|
|
4219
4222
|
else
|
|
4220
4223
|
this.resetMeshNormalmapTexture();
|
|
4221
|
-
if (this._mesh.material !== this._normalmapMaterial)
|
|
4224
|
+
if (this._mesh.material !== this._normalmapMaterial) {
|
|
4222
4225
|
this._mesh.material = this._normalmapMaterial;
|
|
4226
|
+
if (!this._mesh.metadata)
|
|
4227
|
+
this._mesh.metadata = {};
|
|
4228
|
+
this._mesh.metadata.originalNormalmapMaterialID = (_a = this._originalMaterial) === null || _a === void 0 ? void 0 : _a.id;
|
|
4229
|
+
}
|
|
4223
4230
|
}
|
|
4224
4231
|
if (this._dynamicMaterial && designNormalmapTexture) {
|
|
4225
4232
|
designNormalmapTexture.coordinatesIndex = this._coordinatesIndex;
|
|
@@ -4236,8 +4243,8 @@ class MeshDesignManager {
|
|
|
4236
4243
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4237
4244
|
if (!this._originalMeshNormalmapTexture || !this._normalmapTexture)
|
|
4238
4245
|
return;
|
|
4239
|
-
yield
|
|
4240
|
-
yield
|
|
4246
|
+
yield _SceneHelper__WEBPACK_IMPORTED_MODULE_6__["SceneHelper"].whenTextureIsReadyAsync(this._originalMeshNormalmapTexture);
|
|
4247
|
+
yield _SceneHelper__WEBPACK_IMPORTED_MODULE_6__["SceneHelper"].whenTextureIsReadyAsync(this._normalmapTexture);
|
|
4241
4248
|
if (!this._meshCombinedNormalmapTexture) {
|
|
4242
4249
|
this._meshCombinedNormalmapTexture = new _ProceduralTextures_OverlayProceduralTexture__WEBPACK_IMPORTED_MODULE_5__["OverlayProceduralTexture"]("overlayMeshNormal", this._textureWidth, this._scene, this._originalMeshNormalmapTexture, this._normalmapTexture);
|
|
4243
4250
|
this._meshCombinedNormalmapTexture.refreshRate = 0;
|
|
@@ -4245,7 +4252,7 @@ class MeshDesignManager {
|
|
|
4245
4252
|
if (this._meshCombinedNormalmapTexture) {
|
|
4246
4253
|
this._meshCombinedNormalmapTexture.baseTexture = this._originalMeshNormalmapTexture;
|
|
4247
4254
|
this._meshCombinedNormalmapTexture.blendTexture = this._normalmapTexture;
|
|
4248
|
-
yield
|
|
4255
|
+
yield _SceneHelper__WEBPACK_IMPORTED_MODULE_6__["SceneHelper"].whenTextureIsReadyAsync(this._meshCombinedNormalmapTexture);
|
|
4249
4256
|
this._meshCombinedNormalmapTexture.render();
|
|
4250
4257
|
}
|
|
4251
4258
|
});
|
|
@@ -4276,8 +4283,8 @@ class MeshDesignManager {
|
|
|
4276
4283
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4277
4284
|
if (!this._originalDesignNormalmapTexture || !this._normalmapTexture)
|
|
4278
4285
|
return;
|
|
4279
|
-
yield
|
|
4280
|
-
yield
|
|
4286
|
+
yield _SceneHelper__WEBPACK_IMPORTED_MODULE_6__["SceneHelper"].whenTextureIsReadyAsync(this._originalDesignNormalmapTexture);
|
|
4287
|
+
yield _SceneHelper__WEBPACK_IMPORTED_MODULE_6__["SceneHelper"].whenTextureIsReadyAsync(this._normalmapTexture);
|
|
4281
4288
|
if (!this._designCombinedNormalmapTexture) {
|
|
4282
4289
|
this._designCombinedNormalmapTexture = new _ProceduralTextures_OverlayProceduralTexture__WEBPACK_IMPORTED_MODULE_5__["OverlayProceduralTexture"]("overlayDesignNormal", this._textureWidth, this._scene, this._originalDesignNormalmapTexture, this._normalmapTexture);
|
|
4283
4290
|
this._designCombinedNormalmapTexture.refreshRate = 0;
|
|
@@ -4285,7 +4292,7 @@ class MeshDesignManager {
|
|
|
4285
4292
|
if (this._designCombinedNormalmapTexture) {
|
|
4286
4293
|
this._designCombinedNormalmapTexture.baseTexture = this._originalDesignNormalmapTexture;
|
|
4287
4294
|
this._designCombinedNormalmapTexture.blendTexture = this._normalmapTexture;
|
|
4288
|
-
yield
|
|
4295
|
+
yield _SceneHelper__WEBPACK_IMPORTED_MODULE_6__["SceneHelper"].whenTextureIsReadyAsync(this._designCombinedNormalmapTexture);
|
|
4289
4296
|
this._designCombinedNormalmapTexture.render();
|
|
4290
4297
|
}
|
|
4291
4298
|
});
|
|
@@ -4294,9 +4301,9 @@ class MeshDesignManager {
|
|
|
4294
4301
|
updateInnerShadowTextureAsync(config) {
|
|
4295
4302
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4296
4303
|
if (this._dynamicTexture) {
|
|
4297
|
-
yield
|
|
4304
|
+
yield _SceneHelper__WEBPACK_IMPORTED_MODULE_6__["SceneHelper"].whenTextureIsReadyAsync(this._dynamicTexture);
|
|
4298
4305
|
if (!this._innerShadowGenerator) {
|
|
4299
|
-
this._innerShadowGenerator = new
|
|
4306
|
+
this._innerShadowGenerator = new _Shadows_InnerShadow__WEBPACK_IMPORTED_MODULE_7__["InnerShadow"](this._dynamicTexture, this._textureWidth, config, this._scene);
|
|
4300
4307
|
this._innerShadowTexture = yield this._innerShadowGenerator.getInnerShadowTextureAsync(this._dynamicTexture);
|
|
4301
4308
|
this._innerShadowTexture.coordinatesIndex = this._coordinatesIndex;
|
|
4302
4309
|
}
|
|
@@ -4325,8 +4332,8 @@ class MeshDesignManager {
|
|
|
4325
4332
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4326
4333
|
if (!this._originalDesignLightmapTexture || !this._innerShadowTexture)
|
|
4327
4334
|
return;
|
|
4328
|
-
yield
|
|
4329
|
-
yield
|
|
4335
|
+
yield _SceneHelper__WEBPACK_IMPORTED_MODULE_6__["SceneHelper"].whenTextureIsReadyAsync(this._originalDesignLightmapTexture);
|
|
4336
|
+
yield _SceneHelper__WEBPACK_IMPORTED_MODULE_6__["SceneHelper"].whenTextureIsReadyAsync(this._innerShadowTexture);
|
|
4330
4337
|
if (!this._designCombinedLightmapTexture) {
|
|
4331
4338
|
this._designCombinedLightmapTexture = new _ProceduralTextures_MultiplyProceduralTexture__WEBPACK_IMPORTED_MODULE_4__["MultiplyProceduralTexture"]("overlayDesignLightmaps", this._textureWidth, this._scene, this._originalDesignLightmapTexture, this._innerShadowTexture);
|
|
4332
4339
|
this._designCombinedLightmapTexture.refreshRate = 0;
|
|
@@ -4334,7 +4341,7 @@ class MeshDesignManager {
|
|
|
4334
4341
|
if (this._designCombinedLightmapTexture) {
|
|
4335
4342
|
this._designCombinedLightmapTexture.baseTexture = this._originalDesignLightmapTexture;
|
|
4336
4343
|
this._designCombinedLightmapTexture.blendTexture = this._innerShadowTexture;
|
|
4337
|
-
yield
|
|
4344
|
+
yield _SceneHelper__WEBPACK_IMPORTED_MODULE_6__["SceneHelper"].whenTextureIsReadyAsync(this._designCombinedLightmapTexture);
|
|
4338
4345
|
this._designCombinedLightmapTexture.render();
|
|
4339
4346
|
}
|
|
4340
4347
|
});
|
|
@@ -4352,9 +4359,9 @@ class MeshDesignManager {
|
|
|
4352
4359
|
updateOuterShadowTextureAsync(config) {
|
|
4353
4360
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4354
4361
|
if (this._dynamicTexture) {
|
|
4355
|
-
yield
|
|
4362
|
+
yield _SceneHelper__WEBPACK_IMPORTED_MODULE_6__["SceneHelper"].whenTextureIsReadyAsync(this._dynamicTexture);
|
|
4356
4363
|
if (!this._outerShadowGenerator) {
|
|
4357
|
-
this._outerShadowGenerator = new
|
|
4364
|
+
this._outerShadowGenerator = new _Shadows_OuterShadow__WEBPACK_IMPORTED_MODULE_8__["OuterShadow"](this._dynamicTexture, this._textureWidth, config, this._scene);
|
|
4358
4365
|
this._outerShadowTexture = yield this._outerShadowGenerator.getOuterShadowTextureAsync(this._dynamicTexture);
|
|
4359
4366
|
this._outerShadowTexture.coordinatesIndex = this._coordinatesIndex;
|
|
4360
4367
|
}
|
|
@@ -4385,8 +4392,8 @@ class MeshDesignManager {
|
|
|
4385
4392
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4386
4393
|
if (!this._originalMeshLightmapTexture || !this._outerShadowTexture)
|
|
4387
4394
|
return;
|
|
4388
|
-
yield
|
|
4389
|
-
yield
|
|
4395
|
+
yield _SceneHelper__WEBPACK_IMPORTED_MODULE_6__["SceneHelper"].whenTextureIsReadyAsync(this._originalMeshLightmapTexture);
|
|
4396
|
+
yield _SceneHelper__WEBPACK_IMPORTED_MODULE_6__["SceneHelper"].whenTextureIsReadyAsync(this._outerShadowTexture);
|
|
4390
4397
|
if (!this._meshCombinedLightmapTexture) {
|
|
4391
4398
|
this._meshCombinedLightmapTexture = new _ProceduralTextures_MultiplyProceduralTexture__WEBPACK_IMPORTED_MODULE_4__["MultiplyProceduralTexture"]("overlayMeshLightmap", this._textureWidth, this._scene, this._originalMeshLightmapTexture, this._outerShadowTexture);
|
|
4392
4399
|
this._meshCombinedLightmapTexture.refreshRate = 0;
|
|
@@ -4394,7 +4401,7 @@ class MeshDesignManager {
|
|
|
4394
4401
|
if (this._meshCombinedLightmapTexture) {
|
|
4395
4402
|
this._meshCombinedLightmapTexture.baseTexture = this._originalMeshLightmapTexture;
|
|
4396
4403
|
this._meshCombinedLightmapTexture.blendTexture = this._outerShadowTexture;
|
|
4397
|
-
yield
|
|
4404
|
+
yield _SceneHelper__WEBPACK_IMPORTED_MODULE_6__["SceneHelper"].whenTextureIsReadyAsync(this._meshCombinedLightmapTexture);
|
|
4398
4405
|
this._meshCombinedLightmapTexture.render();
|
|
4399
4406
|
}
|
|
4400
4407
|
});
|
|
@@ -12645,18 +12652,16 @@ class ScenePreviewMaker {
|
|
|
12645
12652
|
return this._localEngine;
|
|
12646
12653
|
}
|
|
12647
12654
|
createScenePreviewFileAsync(rootUrl, sourceScene, container) {
|
|
12648
|
-
var _a;
|
|
12649
12655
|
return __awaiter(this, void 0, void 0, function* () {
|
|
12650
12656
|
const serialized = BABYLON.SceneSerializer.Serialize(sourceScene);
|
|
12651
12657
|
const serializedScene = JSON.stringify(serialized);
|
|
12652
12658
|
if (serializedScene) {
|
|
12653
12659
|
const scene = new BABYLON.Scene(this._localEngine);
|
|
12654
|
-
(_a = this._localEngine) === null || _a === void 0 ? void 0 : _a.runRenderLoop(() => scene.render());
|
|
12655
12660
|
if (scene) {
|
|
12656
12661
|
const helper = new _SceneHelper__WEBPACK_IMPORTED_MODULE_1__["SceneHelper"](scene);
|
|
12657
12662
|
yield new Promise((resolve) => {
|
|
12658
12663
|
BABYLON.SceneLoader.Append(rootUrl, "data:" + serializedScene, scene, () => __awaiter(this, void 0, void 0, function* () {
|
|
12659
|
-
var _a, _b;
|
|
12664
|
+
var _a, _b, _c;
|
|
12660
12665
|
yield scene.whenReadyAsync();
|
|
12661
12666
|
if (this._options.camera) {
|
|
12662
12667
|
const arcCamera = scene.activeCamera;
|
|
@@ -12671,14 +12676,11 @@ class ScenePreviewMaker {
|
|
|
12671
12676
|
for (const meshId of this._options.meshesWithCustomizationIds) {
|
|
12672
12677
|
var ourMesh = scene.getMeshByID(meshId);
|
|
12673
12678
|
if (ourMesh) {
|
|
12674
|
-
//
|
|
12675
|
-
if (ourMesh.metadata.
|
|
12676
|
-
ourMesh.
|
|
12677
|
-
continue;
|
|
12679
|
+
// Restore the original material id if it was changed from the mesh design manager
|
|
12680
|
+
if (ourMesh.metadata.originalNormalmapMaterialID) {
|
|
12681
|
+
ourMesh.material = (_a = scene.materials.find(x => x.id === ourMesh.metadata.originalNormalmapMaterialID)) !== null && _a !== void 0 ? _a : null;
|
|
12678
12682
|
}
|
|
12679
|
-
|
|
12680
|
-
ourMesh.isVisible = false;
|
|
12681
|
-
yield _Components_DesignManagers_MeshDesignManager__WEBPACK_IMPORTED_MODULE_0__["MeshDesignManager"].createMeshDesignManagerAsync(scene, this._options.zkScene, ourMesh, ourMesh.subMeshes[0], this._options.zkModel, this._options.zkDesign, true);
|
|
12683
|
+
yield _Components_DesignManagers_MeshDesignManager__WEBPACK_IMPORTED_MODULE_0__["MeshDesignManager"].createMeshDesignManagerAsync(scene, this._options.zkScene, ourMesh, ourMesh.subMeshes && ourMesh.subMeshes.length > 0 ? ourMesh.subMeshes[0] : null, this._options.zkModel, this._options.zkDesign, true);
|
|
12682
12684
|
}
|
|
12683
12685
|
}
|
|
12684
12686
|
// Sleep
|
|
@@ -12689,7 +12691,7 @@ class ScenePreviewMaker {
|
|
|
12689
12691
|
});
|
|
12690
12692
|
scene.render();
|
|
12691
12693
|
}
|
|
12692
|
-
container.previewFile = yield helper.takeContentScreenshotAsync((
|
|
12694
|
+
container.previewFile = yield helper.takeContentScreenshotAsync((_b = this._options.width) !== null && _b !== void 0 ? _b : 1024, (_c = this._options.height) !== null && _c !== void 0 ? _c : 1024);
|
|
12693
12695
|
resolve();
|
|
12694
12696
|
}));
|
|
12695
12697
|
});
|
|
@@ -38755,11 +38757,12 @@ class ZakekeEnvironment {
|
|
|
38755
38757
|
this.saveComposition = () => __awaiter(this, void 0, void 0, function* () {
|
|
38756
38758
|
this.composition.set("name", "Default");
|
|
38757
38759
|
// Save image
|
|
38758
|
-
const data = yield this.viewer.getSceneContentScreenshotAsync(this.previewWidth, this.previewHeight);
|
|
38760
|
+
const data = yield this.viewer.getSceneContentScreenshotAsync(this.previewWidth, this.previewHeight, 0, this.zkCurrentTemplate);
|
|
38759
38761
|
this.composition.set("previewImageData", data);
|
|
38760
38762
|
// Save composition
|
|
38761
38763
|
yield this.saveDesignBackbone();
|
|
38762
38764
|
yield this.saveCompositionBackbone();
|
|
38765
|
+
return this.composition.get('docID');
|
|
38763
38766
|
});
|
|
38764
38767
|
// Events
|
|
38765
38768
|
this.trigger = (event, ...params) => {
|
|
@@ -39900,16 +39903,24 @@ function compare(_obj1, _obj2) {
|
|
|
39900
39903
|
same = false;
|
|
39901
39904
|
if (v != obj2[k])
|
|
39902
39905
|
same = false;
|
|
39903
|
-
|
|
39906
|
+
// Check if are valid json
|
|
39907
|
+
if (typeof v === "object" && typeof obj2[k] === "object") {
|
|
39904
39908
|
same = compare(v, obj2[k]);
|
|
39905
39909
|
}
|
|
39910
|
+
if (isValidJSON(v) || isValidJSON(obj2[k])) {
|
|
39911
|
+
const a = typeof v === "object" ? v : JSON.parse(v);
|
|
39912
|
+
const b = typeof obj2[k] === "object" ? obj2[k] : JSON.parse(obj2[k]);
|
|
39913
|
+
same = compare(a, b);
|
|
39914
|
+
}
|
|
39915
|
+
if (!same)
|
|
39916
|
+
break;
|
|
39906
39917
|
}
|
|
39907
39918
|
return same;
|
|
39908
39919
|
}
|
|
39909
39920
|
function isValidJSON(code) {
|
|
39910
|
-
let json = null;
|
|
39911
39921
|
try {
|
|
39912
|
-
|
|
39922
|
+
JSON.parse(code);
|
|
39923
|
+
return true;
|
|
39913
39924
|
}
|
|
39914
39925
|
catch (ex) {
|
|
39915
39926
|
}
|
|
@@ -40835,6 +40846,7 @@ const createProviderValue = (state, dispatch) => {
|
|
|
40835
40846
|
yield state.environment.addToCart(additionalProperties);
|
|
40836
40847
|
dispatch({ type: 'IS_ADD_TO_CART_LOADING', isLoading: false });
|
|
40837
40848
|
}),
|
|
40849
|
+
saveComposition: state.environment.saveComposition,
|
|
40838
40850
|
loadComposition: state.environment.loadComposition,
|
|
40839
40851
|
// Scene manipulation
|
|
40840
40852
|
getMeshIDbyName: state.environment.getMeshIDbyName.bind(state.environment),
|