@colijnit/homedecorator 256.1.21 → 256.1.23

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.
@@ -100,6 +100,7 @@ export declare class ModelPreviewComponent implements OnInit, OnDestroy {
100
100
  private _createLightFromProperties;
101
101
  private _setObjectProperties;
102
102
  private _validateObjectStructure;
103
+ private _validateMaterial;
103
104
  static ɵfac: i0.ɵɵFactoryDeclaration<ModelPreviewComponent, never>;
104
105
  static ɵcmp: i0.ɵɵComponentDeclaration<ModelPreviewComponent, "rp-model-preview", never, {}, {}, never, never>;
105
106
  }
@@ -46306,10 +46306,12 @@
46306
46306
  ModelPreviewComponent.prototype.exportSceneAsGLB = function (returnType) {
46307
46307
  var _this = this;
46308
46308
  // add timestamp
46309
+ this.showLoader = true;
46309
46310
  var timestamp = new Date().getTime();
46310
46311
  var exportFileName = this._setModelName(this.glbExportName.nativeElement.value) + '_' + timestamp;
46311
46312
  var gltfExporter = new GLTFExporter.GLTFExporter();
46312
- var scene = this.scenePreview.clone();
46313
+ var scene;
46314
+ scene = this.scenePreview.clone();
46313
46315
  var model = this.scenePreview.getObjectByName(this.modelName).clone();
46314
46316
  while (scene.children.length > 0) {
46315
46317
  scene.remove(scene.children[0]);
@@ -46429,6 +46431,7 @@
46429
46431
  document.body.appendChild(element);
46430
46432
  element.click();
46431
46433
  document.body.removeChild(element);
46434
+ this.showLoader = false;
46432
46435
  return [2 /*return*/];
46433
46436
  });
46434
46437
  });
@@ -46459,11 +46462,13 @@
46459
46462
  _this.data.thirdPartyModelService.parseModelToGLB(file, hash, modelUrl, configurationData, priceData, metaData).then(function (result) {
46460
46463
  _this._dialog.closeAll();
46461
46464
  _this._messageService.emit(MessageType.HideProductCatalog);
46465
+ _this.showLoader = false;
46462
46466
  });
46463
46467
  });
46464
46468
  }
46465
46469
  }).catch(function (error) {
46466
46470
  _this._messageService.emit(MessageType.RenderError, { title: 'Upload error', message: error });
46471
+ _this.showLoader = false;
46467
46472
  });
46468
46473
  return [2 /*return*/];
46469
46474
  });
@@ -46678,6 +46683,7 @@
46678
46683
  }
46679
46684
  };
46680
46685
  ModelPreviewComponent.prototype._validateObjectStructure = function (inputObject) {
46686
+ var _this = this;
46681
46687
  var modelGroup = inputObject;
46682
46688
  var validation = [];
46683
46689
  // Check for a group
@@ -46687,6 +46693,7 @@
46687
46693
  // Does it contain meshes
46688
46694
  var hasVisibleMeshes = false;
46689
46695
  modelGroup.traverse(function (object) {
46696
+ var e_3, _a;
46690
46697
  if (object.isMesh) {
46691
46698
  hasVisibleMeshes = true;
46692
46699
  // basic geometry check
@@ -46697,6 +46704,26 @@
46697
46704
  else if (!object.geometry.attributes.position || object.geometry.attributes.position.count === 0) {
46698
46705
  validation.push('Mesh ' + object.name + ' geometry has no position data.');
46699
46706
  }
46707
+ if (object.material) {
46708
+ if (object.material.length > 1) {
46709
+ try {
46710
+ for (var _b = __values(object.material), _c = _b.next(); !_c.done; _c = _b.next()) {
46711
+ var mat = _c.value;
46712
+ _this._validateMaterial(mat);
46713
+ }
46714
+ }
46715
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
46716
+ finally {
46717
+ try {
46718
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
46719
+ }
46720
+ finally { if (e_3) throw e_3.error; }
46721
+ }
46722
+ }
46723
+ else {
46724
+ _this._validateMaterial(object.material);
46725
+ }
46726
+ }
46700
46727
  // basic mats check
46701
46728
  if (!object.material) {
46702
46729
  validation.push('Mesh ' + object.name + ' has no material');
@@ -46730,6 +46757,13 @@
46730
46757
  }
46731
46758
  return validation;
46732
46759
  };
46760
+ ModelPreviewComponent.prototype._validateMaterial = function (material) {
46761
+ if (material.map && material.map.source && material.map.source.data === null) {
46762
+ material.map.dispose();
46763
+ material.map = null;
46764
+ material.needsUpdate = true;
46765
+ }
46766
+ };
46733
46767
  return ModelPreviewComponent;
46734
46768
  }());
46735
46769
  ModelPreviewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ModelPreviewComponent, deps: [{ token: i1.MAT_DIALOG_DATA }, { token: HomedecoratorSettingsService }, { token: HomedecoratorIconCacheService }, { token: i1__namespace.MatDialogRef }, { token: MessageBusService }, { token: i1__namespace.MatDialog }, { token: HomedecoratorConnectorAdapterService }, { token: HomedecoratorDictionaryService }, { token: FontService }], target: i0__namespace.ɵɵFactoryTarget.Component });
@@ -47288,7 +47322,7 @@
47288
47322
  this.settingsService = settingsService;
47289
47323
  this._messageService = _messageService;
47290
47324
  this.file = null;
47291
- this.fileMaxSize = 80; // file size in mb
47325
+ this.fileMaxSize = 30; // file size in mb
47292
47326
  this._maxFileSize = this.fileMaxSize * 1024 * 1024; // fileMaxSize to kb
47293
47327
  this._allowedFiles = ['glb', 'obj', 'fbx', '3ds', 'gltf', 'stl'];
47294
47328
  }
@@ -47363,12 +47397,12 @@
47363
47397
  return ModelUploaderComponent;
47364
47398
  }());
47365
47399
  ModelUploaderComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ModelUploaderComponent, deps: [{ token: HomedecoratorSettingsService }, { token: MessageBusService }], target: i0__namespace.ɵɵFactoryTarget.Component });
47366
- ModelUploaderComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ModelUploaderComponent, selector: "rp-model-uploader", viewQueries: [{ propertyName: "fileUploadInput", first: true, predicate: ["fileUpload"], descendants: true }], ngImport: i0__namespace, template: "\n <div class=\"model-upload-container\" (click)=\"fileUpload.click()\">\n <div class=\"header-container\">\n <h3>Upload 3D model</h3>\n <span>\n <mat-icon class=\"homedecorator-material-icons\">add</mat-icon>\n </span>\n </div>\n <div class=\"description\">\n Upload a model\n <span class=\"modelSupport\">Supported formats: glb, obj(textured),<br/>fbx, 3ds, gltf, stl(untextured)</span>\n </div>\n <div *ngIf=\"showUploadError\" class=\"upload-error-container\">\n <span>{{ uploadError }}</span>\n </div>\n <input style=\"display: none;\" type=\"file\" id=\"fileUpload\" class=\"file-input\" (change)=\"onChange($event)\" #fileUpload/>\n </div>\n ", isInline: true, styles: [".model-upload-container{border:1px solid #5b6875;box-sizing:border-box;padding:10px;width:100%;max-width:400px;border-radius:4px;cursor:pointer}.model-upload-container .header-container{display:flex;justify-content:space-between}.model-upload-container .header-container h3{font-weight:bolder;font-size:18px;padding:0;margin:0}.model-upload-container .header-container .description{font-size:12px;margin:0;padding:0}.modelSupport{display:block;font-size:12px;font-style:italic}.upload-error-container{position:relative;padding:.75rem 1.25rem;margin-bottom:1rem;border-radius:.25rem;color:#721c24;background-color:#f8d7da;border-color:#f5c6cb}\n"], components: [{ type: i5__namespace.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
47400
+ ModelUploaderComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ModelUploaderComponent, selector: "rp-model-uploader", viewQueries: [{ propertyName: "fileUploadInput", first: true, predicate: ["fileUpload"], descendants: true }], ngImport: i0__namespace, template: "\n <div class=\"model-upload-container\" (click)=\"fileUpload.click()\">\n <div class=\"header-container\">\n <h3>Upload 3D model</h3>\n <span>\n <mat-icon class=\"homedecorator-material-icons\">add</mat-icon>\n </span>\n </div>\n <div class=\"description\">\n <span class=\"modelSupport\" [textContent]=\"'3D_FILE_UPLOAD_SUPPORTED_FORMATS' | localize\"></span>\n </div>\n <div *ngIf=\"showUploadError\" class=\"upload-error-container\">\n <span [textContent]=\"uploadError\"></span>\n </div>\n <input style=\"display: none;\" type=\"file\" id=\"fileUpload\" class=\"file-input\" (change)=\"onChange($event)\" #fileUpload/>\n </div>\n ", isInline: true, styles: [".model-upload-container{border:1px solid #5b6875;box-sizing:border-box;padding:10px;width:100%;max-width:400px;border-radius:4px;cursor:pointer}.model-upload-container .header-container{display:flex;justify-content:space-between}.model-upload-container .header-container h3{font-weight:bolder;font-size:18px;padding:0;margin:0}.model-upload-container .header-container .description{font-size:12px;margin:0;padding:0}.modelSupport{display:block;font-size:12px;font-style:italic}.upload-error-container{position:relative;padding:.75rem 1.25rem;margin-bottom:1rem;border-radius:.25rem;color:#721c24;background-color:#f8d7da;border-color:#f5c6cb}\n"], components: [{ type: i5__namespace.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "localize": LocalizePipe } });
47367
47401
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ModelUploaderComponent, decorators: [{
47368
47402
  type: i0.Component,
47369
47403
  args: [{
47370
47404
  selector: 'rp-model-uploader',
47371
- template: "\n <div class=\"model-upload-container\" (click)=\"fileUpload.click()\">\n <div class=\"header-container\">\n <h3>Upload 3D model</h3>\n <span>\n <mat-icon class=\"homedecorator-material-icons\">add</mat-icon>\n </span>\n </div>\n <div class=\"description\">\n Upload a model\n <span class=\"modelSupport\">Supported formats: glb, obj(textured),<br/>fbx, 3ds, gltf, stl(untextured)</span>\n </div>\n <div *ngIf=\"showUploadError\" class=\"upload-error-container\">\n <span>{{ uploadError }}</span>\n </div>\n <input style=\"display: none;\" type=\"file\" id=\"fileUpload\" class=\"file-input\" (change)=\"onChange($event)\" #fileUpload/>\n </div>\n ",
47405
+ template: "\n <div class=\"model-upload-container\" (click)=\"fileUpload.click()\">\n <div class=\"header-container\">\n <h3>Upload 3D model</h3>\n <span>\n <mat-icon class=\"homedecorator-material-icons\">add</mat-icon>\n </span>\n </div>\n <div class=\"description\">\n <span class=\"modelSupport\" [textContent]=\"'3D_FILE_UPLOAD_SUPPORTED_FORMATS' | localize\"></span>\n </div>\n <div *ngIf=\"showUploadError\" class=\"upload-error-container\">\n <span [textContent]=\"uploadError\"></span>\n </div>\n <input style=\"display: none;\" type=\"file\" id=\"fileUpload\" class=\"file-input\" (change)=\"onChange($event)\" #fileUpload/>\n </div>\n ",
47372
47406
  styleUrls: ['./model-upload.component.scss']
47373
47407
  }]
47374
47408
  }], ctorParameters: function () { return [{ type: HomedecoratorSettingsService }, { type: MessageBusService }]; }, propDecorators: { fileUploadInput: [{