redhotmagma-visualization 1.43.4 → 1.44.0

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.
@@ -528,119 +528,32 @@ var Three3DScene = exports.Three3DScene = /*#__PURE__*/function (_Three3D) {
528
528
  });
529
529
  }
530
530
  }, {
531
- key: "applyCustomizations",
531
+ key: "applyMaterialParams",
532
532
  value: function () {
533
- var _applyCustomizations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(model, item, imageLoader) {
533
+ var _applyMaterialParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(model, materialOptions, imageLoader) {
534
534
  var _this4 = this;
535
- var options,
536
- _options$saveAndResto,
537
- saveAndRestore,
538
- params,
539
- material,
540
- _params,
541
- _args3 = arguments;
535
+ var params;
542
536
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
543
537
  while (1) switch (_context3.prev = _context3.next) {
544
538
  case 0:
545
- options = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : {};
546
- _options$saveAndResto = options.saveAndRestore, saveAndRestore = _options$saveAndResto === void 0 ? true : _options$saveAndResto;
547
- params = item.params;
548
- if (params) {
549
- Object.keys(params).forEach(function (p) {
550
- // skip not allowed props
551
- if (allowedObjectProps.indexOf(p) === -1) {
552
- return;
553
- }
554
- // restore original value first
555
- if (params[p] === UNSET) {
556
- if (model.originalValues && model.originalValues[p]) {
557
- model[p].copy(model.originalValues[p]);
558
- }
559
- return;
560
- }
561
- // store original value for later restoration
562
- if (!model.originalValues) {
563
- model.originalValues = {};
564
- }
565
- if (!model.originalValues[p]) {
566
- model.originalValues[p] = model[p] ? model[p].clone() : model[p];
567
- }
568
- // apply the param values
569
- switch (p) {
570
- case "scale":
571
- {
572
- var _params$p = params[p],
573
- _params$p$x = _params$p.x,
574
- x = _params$p$x === void 0 ? 1 : _params$p$x,
575
- _params$p$y = _params$p.y,
576
- y = _params$p$y === void 0 ? 1 : _params$p$y,
577
- _params$p$z = _params$p.z,
578
- z = _params$p$z === void 0 ? 1 : _params$p$z;
579
- model[p].set(x, y, z);
580
- break;
581
- }
582
- case "rotation":
583
- case "position":
584
- {
585
- var _params$p2 = params[p],
586
- _params$p2$x = _params$p2.x,
587
- _x4 = _params$p2$x === void 0 ? 0 : _params$p2$x,
588
- _params$p2$y = _params$p2.y,
589
- _y = _params$p2$y === void 0 ? 0 : _params$p2$y,
590
- _params$p2$z = _params$p2.z,
591
- _z = _params$p2$z === void 0 ? 0 : _params$p2$z;
592
- model[p].set(_x4, _y, _z);
593
- break;
594
- }
595
- }
596
- });
597
- }
598
-
599
- // store & restore original material and textures before applying new param values
600
- saveAndRestore && Object.values(getMaterials(model)).map(function (mat) {
601
- if (!mat.original) {
602
- mat.original = mat.clone();
603
- Object.values(mat).filter(function (value) {
604
- return value && value.isTexture;
605
- }).forEach(function (texture) {
606
- if (!texture.original) {
607
- texture.original = texture.clone();
608
- }
609
- });
610
- } else {
611
- mat.copy(mat.original);
612
- Object.keys(mat).forEach(function (key) {
613
- var value = mat[key];
614
- if (value && value.original) {
615
- value.copy(value.original);
616
- }
617
- });
618
- mat.needsUpdate = true;
619
- }
620
- });
621
-
622
- // set new material params if provided
623
- // the material object should be located under item.params.material
624
- // item.material is only for backward compatibility
625
- material = params && params.material || item.material;
626
- if (!material) {
627
- _context3.next = 12;
539
+ if (!materialOptions) {
540
+ _context3.next = 6;
628
541
  break;
629
542
  }
630
- _params = material.params;
631
- _context3.t0 = _params;
543
+ params = materialOptions.params;
544
+ _context3.t0 = params;
632
545
  if (!_context3.t0) {
633
- _context3.next = 12;
546
+ _context3.next = 6;
634
547
  break;
635
548
  }
636
- _context3.next = 12;
549
+ _context3.next = 6;
637
550
  return Promise.all(getAllMaterials(model).map( /*#__PURE__*/function () {
638
551
  var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(material) {
639
552
  var materialName, materialNames;
640
553
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
641
554
  while (1) switch (_context2.prev = _context2.next) {
642
555
  case 0:
643
- materialName = _params.materialName, materialNames = _params.materialNames; // check materialNames list if provided
556
+ materialName = params.materialName, materialNames = params.materialNames; // check materialNames list if provided
644
557
  if (!(materialNames instanceof Array && materialNames.indexOf(material.name) === -1)) {
645
558
  _context2.next = 3;
646
559
  break;
@@ -654,13 +567,13 @@ var Three3DScene = exports.Three3DScene = /*#__PURE__*/function (_Three3D) {
654
567
  return _context2.abrupt("return");
655
568
  case 5:
656
569
  _context2.next = 7;
657
- return Promise.all(Object.keys(_params).map( /*#__PURE__*/function () {
570
+ return Promise.all(Object.keys(params).map( /*#__PURE__*/function () {
658
571
  var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(p) {
659
572
  var texture, value;
660
573
  return _regeneratorRuntime().wrap(function _callee$(_context) {
661
574
  while (1) switch (_context.prev = _context.next) {
662
575
  case 0:
663
- if (!(_params[p] === UNSET)) {
576
+ if (!(params[p] === UNSET)) {
664
577
  _context.next = 2;
665
578
  break;
666
579
  }
@@ -671,14 +584,14 @@ var Three3DScene = exports.Three3DScene = /*#__PURE__*/function (_Three3D) {
671
584
  break;
672
585
  case 5:
673
586
  texture = material[p] || material.map && material.map.clone() || new _three.Texture();
674
- _context.t1 = findImageBySrc(_this4.sceneContainer, "".concat(_this4._modelBasePath).concat(_params[p]));
587
+ _context.t1 = findImageBySrc(_this4.sceneContainer, "".concat(_this4._modelBasePath).concat(params[p]));
675
588
  if (_context.t1) {
676
589
  _context.next = 11;
677
590
  break;
678
591
  }
679
592
  _context.next = 10;
680
593
  return new Promise(function (resolve, reject) {
681
- return imageLoader.load(_params[p], resolve, undefined, reject);
594
+ return imageLoader.load(params[p], resolve, undefined, reject);
682
595
  });
683
596
  case 10:
684
597
  _context.t1 = _context.sent;
@@ -688,13 +601,13 @@ var Three3DScene = exports.Three3DScene = /*#__PURE__*/function (_Three3D) {
688
601
  material[p] = texture;
689
602
  return _context.abrupt("break", 20);
690
603
  case 15:
691
- value = parseFloat(_params[p]);
604
+ value = parseFloat(params[p]);
692
605
  if (!isNaN(value)) {
693
606
  material[p] = value;
694
607
  }
695
608
  return _context.abrupt("break", 20);
696
609
  case 18:
697
- material[p] = new _three.Color(_params[p]);
610
+ material[p] = new _three.Color(params[p]);
698
611
  return _context.abrupt("break", 20);
699
612
  case 20:
700
613
  case "end":
@@ -702,7 +615,7 @@ var Three3DScene = exports.Three3DScene = /*#__PURE__*/function (_Three3D) {
702
615
  }
703
616
  }, _callee);
704
617
  }));
705
- return function (_x6) {
618
+ return function (_x5) {
706
619
  return _ref7.apply(this, arguments);
707
620
  };
708
621
  }()));
@@ -715,17 +628,138 @@ var Three3DScene = exports.Three3DScene = /*#__PURE__*/function (_Three3D) {
715
628
  }
716
629
  }, _callee2);
717
630
  }));
718
- return function (_x5) {
631
+ return function (_x4) {
719
632
  return _ref6.apply(this, arguments);
720
633
  };
721
634
  }()));
722
- case 12:
635
+ case 6:
723
636
  case "end":
724
637
  return _context3.stop();
725
638
  }
726
639
  }, _callee3);
727
640
  }));
728
- function applyCustomizations(_x, _x2, _x3) {
641
+ function applyMaterialParams(_x, _x2, _x3) {
642
+ return _applyMaterialParams.apply(this, arguments);
643
+ }
644
+ return applyMaterialParams;
645
+ }()
646
+ }, {
647
+ key: "applyCustomizations",
648
+ value: function () {
649
+ var _applyCustomizations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(model, item, imageLoader) {
650
+ var _this5 = this;
651
+ var options,
652
+ _options$saveAndResto,
653
+ saveAndRestore,
654
+ params,
655
+ materials,
656
+ material,
657
+ allMaterials,
658
+ _args4 = arguments;
659
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
660
+ while (1) switch (_context4.prev = _context4.next) {
661
+ case 0:
662
+ options = _args4.length > 3 && _args4[3] !== undefined ? _args4[3] : {};
663
+ _options$saveAndResto = options.saveAndRestore, saveAndRestore = _options$saveAndResto === void 0 ? true : _options$saveAndResto;
664
+ params = item.params;
665
+ if (params) {
666
+ Object.keys(params).forEach(function (p) {
667
+ // skip not allowed props
668
+ if (allowedObjectProps.indexOf(p) === -1) {
669
+ return;
670
+ }
671
+ // restore original value first
672
+ if (params[p] === UNSET) {
673
+ if (model.originalValues && model.originalValues[p]) {
674
+ model[p].copy(model.originalValues[p]);
675
+ }
676
+ return;
677
+ }
678
+ // store original value for later restoration
679
+ if (!model.originalValues) {
680
+ model.originalValues = {};
681
+ }
682
+ if (!model.originalValues[p]) {
683
+ model.originalValues[p] = model[p] ? model[p].clone() : model[p];
684
+ }
685
+ // apply the param values
686
+ switch (p) {
687
+ case "scale":
688
+ {
689
+ var _params$p = params[p],
690
+ _params$p$x = _params$p.x,
691
+ x = _params$p$x === void 0 ? 1 : _params$p$x,
692
+ _params$p$y = _params$p.y,
693
+ y = _params$p$y === void 0 ? 1 : _params$p$y,
694
+ _params$p$z = _params$p.z,
695
+ z = _params$p$z === void 0 ? 1 : _params$p$z;
696
+ model[p].set(x, y, z);
697
+ break;
698
+ }
699
+ case "rotation":
700
+ case "position":
701
+ {
702
+ var _params$p2 = params[p],
703
+ _params$p2$x = _params$p2.x,
704
+ _x9 = _params$p2$x === void 0 ? 0 : _params$p2$x,
705
+ _params$p2$y = _params$p2.y,
706
+ _y = _params$p2$y === void 0 ? 0 : _params$p2$y,
707
+ _params$p2$z = _params$p2.z,
708
+ _z = _params$p2$z === void 0 ? 0 : _params$p2$z;
709
+ model[p].set(_x9, _y, _z);
710
+ break;
711
+ }
712
+ }
713
+ });
714
+ }
715
+
716
+ // store & restore original material and textures before applying new param values
717
+ saveAndRestore && Object.values(getMaterials(model)).map(function (mat) {
718
+ if (!mat.original) {
719
+ mat.original = mat.clone();
720
+ Object.values(mat).filter(function (value) {
721
+ return value && value.isTexture;
722
+ }).forEach(function (texture) {
723
+ if (!texture.original) {
724
+ texture.original = texture.clone();
725
+ }
726
+ });
727
+ } else {
728
+ mat.copy(mat.original);
729
+ Object.keys(mat).forEach(function (key) {
730
+ var value = mat[key];
731
+ if (value && value.original) {
732
+ value.copy(value.original);
733
+ }
734
+ });
735
+ mat.needsUpdate = true;
736
+ }
737
+ });
738
+
739
+ // set new material params if provided
740
+ // the material object should be located under item.params.material
741
+ // item.material is only for backward compatibility
742
+ materials = (params === null || params === void 0 ? void 0 : params.materials) || [];
743
+ material = (params === null || params === void 0 ? void 0 : params.material) || item.material;
744
+ allMaterials = [].concat(_toConsumableArray(materials), [material]).filter(function (v) {
745
+ return v;
746
+ });
747
+ _context4.t0 = allMaterials.length;
748
+ if (!_context4.t0) {
749
+ _context4.next = 12;
750
+ break;
751
+ }
752
+ _context4.next = 12;
753
+ return Promise.all(allMaterials.map(function (material) {
754
+ return _this5.applyMaterialParams(model, material, imageLoader);
755
+ }));
756
+ case 12:
757
+ case "end":
758
+ return _context4.stop();
759
+ }
760
+ }, _callee4);
761
+ }));
762
+ function applyCustomizations(_x6, _x7, _x8) {
729
763
  return _applyCustomizations.apply(this, arguments);
730
764
  }
731
765
  return applyCustomizations;
@@ -733,7 +767,7 @@ var Three3DScene = exports.Three3DScene = /*#__PURE__*/function (_Three3D) {
733
767
  }, {
734
768
  key: "loadSceneContainer",
735
769
  value: function loadSceneContainer(item) {
736
- var _this5 = this;
770
+ var _this6 = this;
737
771
  var path;
738
772
  var itemType = _typeof(item);
739
773
  if ("string" === itemType) {
@@ -752,32 +786,32 @@ var Three3DScene = exports.Three3DScene = /*#__PURE__*/function (_Three3D) {
752
786
  var imageLoader = this.createImageLoader(loaderOptions);
753
787
  return new Promise(function (resolve, reject) {
754
788
  modelLoader.load(modelFileName, /*#__PURE__*/function () {
755
- var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(gltf) {
789
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(gltf) {
756
790
  var model;
757
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
758
- while (1) switch (_context4.prev = _context4.next) {
791
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
792
+ while (1) switch (_context5.prev = _context5.next) {
759
793
  case 0:
760
794
  model = gltf.scene;
761
795
  model.userData.path = path;
762
796
  if (undefined !== item.index) {
763
797
  model.userData.index = item.index;
764
798
  }
765
- _this5.fixImportedScene(model);
799
+ _this6.fixImportedScene(model);
766
800
  if (!("object" === itemType)) {
767
- _context4.next = 7;
801
+ _context5.next = 7;
768
802
  break;
769
803
  }
770
- _context4.next = 7;
771
- return _this5.applyCustomizations(model, item, imageLoader);
804
+ _context5.next = 7;
805
+ return _this6.applyCustomizations(model, item, imageLoader);
772
806
  case 7:
773
807
  resolve(gltf);
774
808
  case 8:
775
809
  case "end":
776
- return _context4.stop();
810
+ return _context5.stop();
777
811
  }
778
- }, _callee4);
812
+ }, _callee5);
779
813
  }));
780
- return function (_x7) {
814
+ return function (_x10) {
781
815
  return _ref8.apply(this, arguments);
782
816
  };
783
817
  }(), undefined, reject);
@@ -813,10 +847,10 @@ var Three3DScene = exports.Three3DScene = /*#__PURE__*/function (_Three3D) {
813
847
  }, {
814
848
  key: "initCustomizableMaterialsIfNeeded",
815
849
  value: function () {
816
- var _initCustomizableMaterialsIfNeeded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
850
+ var _initCustomizableMaterialsIfNeeded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
817
851
  var materials;
818
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
819
- while (1) switch (_context5.prev = _context5.next) {
852
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
853
+ while (1) switch (_context6.prev = _context6.next) {
820
854
  case 0:
821
855
  // reset customizable materials to always find the right one in the loaded scene
822
856
  this._customizableMaterialKeys.length = 0;
@@ -826,13 +860,13 @@ var Three3DScene = exports.Three3DScene = /*#__PURE__*/function (_Three3D) {
826
860
  this.guessCustomizableMaterialNameIfNotSet(materials);
827
861
  this.findCustomizableMaterials(materials);
828
862
  }
829
- _context5.next = 6;
863
+ _context6.next = 6;
830
864
  return this.dispatchMaterialUpdateEvent();
831
865
  case 6:
832
866
  case "end":
833
- return _context5.stop();
867
+ return _context6.stop();
834
868
  }
835
- }, _callee5, this);
869
+ }, _callee6, this);
836
870
  }));
837
871
  function initCustomizableMaterialsIfNeeded() {
838
872
  return _initCustomizableMaterialsIfNeeded.apply(this, arguments);
@@ -856,56 +890,56 @@ var Three3DScene = exports.Three3DScene = /*#__PURE__*/function (_Three3D) {
856
890
  }, {
857
891
  key: "loadSceneSync",
858
892
  value: function () {
859
- var _loadSceneSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(resourceList) {
893
+ var _loadSceneSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(resourceList) {
860
894
  var result;
861
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
862
- while (1) switch (_context6.prev = _context6.next) {
895
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
896
+ while (1) switch (_context7.prev = _context7.next) {
863
897
  case 0:
864
- _context6.prev = 0;
865
- _context6.next = 3;
898
+ _context7.prev = 0;
899
+ _context7.next = 3;
866
900
  return this._loadScenePromise;
867
901
  case 3:
868
- _context6.next = 7;
902
+ _context7.next = 7;
869
903
  break;
870
904
  case 5:
871
- _context6.prev = 5;
872
- _context6.t0 = _context6["catch"](0);
905
+ _context7.prev = 5;
906
+ _context7.t0 = _context7["catch"](0);
873
907
  case 7:
874
- _context6.prev = 7;
908
+ _context7.prev = 7;
875
909
  this._loadScenePromise = this.loadScene(resourceList);
876
- _context6.next = 11;
910
+ _context7.next = 11;
877
911
  return this._loadScenePromise;
878
912
  case 11:
879
- result = _context6.sent;
880
- _context6.next = 17;
913
+ result = _context7.sent;
914
+ _context7.next = 17;
881
915
  break;
882
916
  case 14:
883
- _context6.prev = 14;
884
- _context6.t1 = _context6["catch"](7);
917
+ _context7.prev = 14;
918
+ _context7.t1 = _context7["catch"](7);
885
919
  // remove promise if it is failed
886
920
  delete this._loadScenePromise;
887
921
  case 17:
888
- _context6.prev = 17;
889
- _context6.next = 20;
922
+ _context7.prev = 17;
923
+ _context7.next = 20;
890
924
  return this.envMapPromise;
891
925
  case 20:
892
- _context6.next = 24;
926
+ _context7.next = 24;
893
927
  break;
894
928
  case 22:
895
- _context6.prev = 22;
896
- _context6.t2 = _context6["catch"](17);
929
+ _context7.prev = 22;
930
+ _context7.t2 = _context7["catch"](17);
897
931
  case 24:
898
932
  if (!this.isAnimating()) {
899
933
  this.render();
900
934
  }
901
- return _context6.abrupt("return", result);
935
+ return _context7.abrupt("return", result);
902
936
  case 26:
903
937
  case "end":
904
- return _context6.stop();
938
+ return _context7.stop();
905
939
  }
906
- }, _callee6, this, [[0, 5], [7, 14], [17, 22]]);
940
+ }, _callee7, this, [[0, 5], [7, 14], [17, 22]]);
907
941
  }));
908
- function loadSceneSync(_x8) {
942
+ function loadSceneSync(_x11) {
909
943
  return _loadSceneSync.apply(this, arguments);
910
944
  }
911
945
  return loadSceneSync;
@@ -913,11 +947,11 @@ var Three3DScene = exports.Three3DScene = /*#__PURE__*/function (_Three3D) {
913
947
  }, {
914
948
  key: "loadScene",
915
949
  value: function () {
916
- var _loadScene = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(resourceList) {
917
- var _this6 = this;
950
+ var _loadScene = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(resourceList) {
951
+ var _this7 = this;
918
952
  var sceneContainer, _diffResourceLists, toBeRemoved, toBeAdded, toBeUpdated, toBeApplied, shouldResetScene, toBeDisposed, triggerLoadEvent, sceneParts, imageLoader, mixer, animations;
919
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
920
- while (1) switch (_context7.prev = _context7.next) {
953
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
954
+ while (1) switch (_context8.prev = _context8.next) {
921
955
  case 0:
922
956
  sceneContainer = this.sceneContainer;
923
957
  this.stopAnimation();
@@ -942,12 +976,12 @@ var Three3DScene = exports.Three3DScene = /*#__PURE__*/function (_Three3D) {
942
976
  });
943
977
  triggerLoadEvent = !!(toBeAdded.length || toBeUpdated.length || toBeApplied.length);
944
978
  triggerLoadEvent && this.onLoadStart();
945
- _context7.next = 13;
979
+ _context8.next = 13;
946
980
  return Promise.all(toBeAdded.map(function (item) {
947
- return _this6.loadSceneContainer(item);
981
+ return _this7.loadSceneContainer(item);
948
982
  }));
949
983
  case 13:
950
- sceneParts = _context7.sent;
984
+ sceneParts = _context8.sent;
951
985
  sceneParts.forEach(function (_ref10) {
952
986
  var scene = _ref10.scene,
953
987
  animations = _ref10.animations;
@@ -955,10 +989,10 @@ var Three3DScene = exports.Three3DScene = /*#__PURE__*/function (_Three3D) {
955
989
 
956
990
  // collect animations
957
991
  if (animations.length) {
958
- var _this6$animations;
959
- (_this6$animations = _this6.animations).push.apply(_this6$animations, _toConsumableArray(animations.filter(function (_ref11) {
992
+ var _this7$animations;
993
+ (_this7$animations = _this7.animations).push.apply(_this7$animations, _toConsumableArray(animations.filter(function (_ref11) {
960
994
  var name = _ref11.name;
961
- return !_this6.animations.find(function (_ref12) {
995
+ return !_this7.animations.find(function (_ref12) {
962
996
  var existingName = _ref12.name;
963
997
  return name !== existingName;
964
998
  });
@@ -966,7 +1000,7 @@ var Three3DScene = exports.Three3DScene = /*#__PURE__*/function (_Three3D) {
966
1000
  }
967
1001
  });
968
1002
  sceneContainer.updateWorldMatrix(true, true);
969
- _context7.next = 18;
1003
+ _context8.next = 18;
970
1004
  return Promise.all(toBeUpdated.map(function (item) {
971
1005
  var itemSrc = getSrc(item);
972
1006
  var object = findObjectWith(sceneContainer, function (_ref13) {
@@ -974,28 +1008,30 @@ var Three3DScene = exports.Three3DScene = /*#__PURE__*/function (_Three3D) {
974
1008
  return userData.path === itemSrc && userData.index === item.index;
975
1009
  });
976
1010
  var path = getSrc(item);
977
- var _this6$parseModelPath = _this6.parseModelPath(path),
978
- resourcePath = _this6$parseModelPath.resourcePath;
1011
+ var _this7$parseModelPath = _this7.parseModelPath(path),
1012
+ resourcePath = _this7$parseModelPath.resourcePath;
979
1013
  var loaderOptions = {
980
- basePath: _this6._modelBasePath,
1014
+ basePath: _this7._modelBasePath,
981
1015
  resourcePath: resourcePath
982
1016
  };
983
- var imageLoader = _this6.createImageLoader(loaderOptions);
984
- return object && _this6.applyCustomizations(object, item, imageLoader);
1017
+ var imageLoader = _this7.createImageLoader(loaderOptions);
1018
+ return object && _this7.applyCustomizations(object, item, imageLoader);
985
1019
  }));
986
1020
  case 18:
987
1021
  // apply global or targeted param values
988
1022
  imageLoader = this.createImageLoader({
989
1023
  basePath: this._modelBasePath
990
1024
  });
991
- _context7.next = 21;
1025
+ _context8.next = 21;
992
1026
  return Promise.all(toBeApplied.map(function (_ref14) {
993
1027
  var optionParams = _ref14.params,
994
1028
  files = _ref14.files;
995
1029
  // find model based on objectName
996
1030
  var objectName = optionParams.objectName,
997
1031
  _optionParams$materia = optionParams.material,
998
- material = _optionParams$materia === void 0 ? {} : _optionParams$materia;
1032
+ material = _optionParams$materia === void 0 ? {} : _optionParams$materia,
1033
+ _optionParams$materia2 = optionParams.materials,
1034
+ materials = _optionParams$materia2 === void 0 ? [] : _optionParams$materia2;
999
1035
  var objects = objectName ? findAllObjectsWith(sceneContainer, function (_ref15) {
1000
1036
  var name = _ref15.name;
1001
1037
  return name === objectName;
@@ -1005,17 +1041,22 @@ var Three3DScene = exports.Three3DScene = /*#__PURE__*/function (_Three3D) {
1005
1041
  params: _objectSpread(_objectSpread({}, optionParams), {}, {
1006
1042
  material: _objectSpread(_objectSpread({}, material), {}, {
1007
1043
  params: params && mapObjectValues(params, files)
1044
+ }),
1045
+ materials: materials.map(function (material) {
1046
+ return _objectSpread(_objectSpread({}, material), {}, {
1047
+ params: material.params && mapObjectValues(material.params, files)
1048
+ });
1008
1049
  })
1009
1050
  })
1010
1051
  };
1011
1052
  return Promise.all(objects.map(function (object) {
1012
- return _this6.applyCustomizations(object, item, imageLoader, {
1053
+ return _this7.applyCustomizations(object, item, imageLoader, {
1013
1054
  saveAndRestore: false
1014
1055
  });
1015
1056
  }));
1016
1057
  }));
1017
1058
  case 21:
1018
- _context7.next = 23;
1059
+ _context8.next = 23;
1019
1060
  return this.initCustomizableMaterialsIfNeeded();
1020
1061
  case 23:
1021
1062
  this.setupGround();
@@ -1034,11 +1075,11 @@ var Three3DScene = exports.Three3DScene = /*#__PURE__*/function (_Three3D) {
1034
1075
  }
1035
1076
  case 29:
1036
1077
  case "end":
1037
- return _context7.stop();
1078
+ return _context8.stop();
1038
1079
  }
1039
- }, _callee7, this);
1080
+ }, _callee8, this);
1040
1081
  }));
1041
- function loadScene(_x9) {
1082
+ function loadScene(_x12) {
1042
1083
  return _loadScene.apply(this, arguments);
1043
1084
  }
1044
1085
  return loadScene;
@@ -1360,27 +1401,27 @@ var Three3DScene = exports.Three3DScene = /*#__PURE__*/function (_Three3D) {
1360
1401
  }, {
1361
1402
  key: "update",
1362
1403
  value: function () {
1363
- var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(configuration) {
1404
+ var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(configuration) {
1364
1405
  var sceneData;
1365
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1366
- while (1) switch (_context8.prev = _context8.next) {
1406
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1407
+ while (1) switch (_context9.prev = _context9.next) {
1367
1408
  case 0:
1368
1409
  this._configuration = configuration;
1369
1410
  sceneData = (0, _get["default"])(configuration, "visualizationData.sceneData", false) || (0, _get["default"])(configuration, "visualizationData.designViews[0].models.".concat(this._materialVariantPath), false);
1370
- _context8.t0 = sceneData;
1371
- if (!_context8.t0) {
1372
- _context8.next = 6;
1411
+ _context9.t0 = sceneData;
1412
+ if (!_context9.t0) {
1413
+ _context9.next = 6;
1373
1414
  break;
1374
1415
  }
1375
- _context8.next = 6;
1416
+ _context9.next = 6;
1376
1417
  return this.loadSceneSync(sceneData);
1377
1418
  case 6:
1378
1419
  case "end":
1379
- return _context8.stop();
1420
+ return _context9.stop();
1380
1421
  }
1381
- }, _callee8, this);
1422
+ }, _callee9, this);
1382
1423
  }));
1383
- function update(_x10) {
1424
+ function update(_x13) {
1384
1425
  return _update.apply(this, arguments);
1385
1426
  }
1386
1427
  return update;
@@ -1388,24 +1429,24 @@ var Three3DScene = exports.Three3DScene = /*#__PURE__*/function (_Three3D) {
1388
1429
  }, {
1389
1430
  key: "updateMaterial",
1390
1431
  value: function () {
1391
- var _updateMaterial = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
1432
+ var _updateMaterial = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
1392
1433
  var sceneData;
1393
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1394
- while (1) switch (_context9.prev = _context9.next) {
1434
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1435
+ while (1) switch (_context10.prev = _context10.next) {
1395
1436
  case 0:
1396
1437
  sceneData = (0, _get["default"])(this._designAreaList, "[0].designView.models.".concat(this._materialVariantPath)) || (0, _get["default"])(this._configuration, "visualizationData.designViews[0].models.".concat(this._materialVariantPath)) || false;
1397
- _context9.t0 = sceneData;
1398
- if (!_context9.t0) {
1399
- _context9.next = 5;
1438
+ _context10.t0 = sceneData;
1439
+ if (!_context10.t0) {
1440
+ _context10.next = 5;
1400
1441
  break;
1401
1442
  }
1402
- _context9.next = 5;
1443
+ _context10.next = 5;
1403
1444
  return this.loadSceneSync(sceneData);
1404
1445
  case 5:
1405
1446
  case "end":
1406
- return _context9.stop();
1447
+ return _context10.stop();
1407
1448
  }
1408
- }, _callee9, this);
1449
+ }, _callee10, this);
1409
1450
  }));
1410
1451
  function updateMaterial() {
1411
1452
  return _updateMaterial.apply(this, arguments);
@@ -1415,27 +1456,27 @@ var Three3DScene = exports.Three3DScene = /*#__PURE__*/function (_Three3D) {
1415
1456
  }, {
1416
1457
  key: "updateDesignAreaList",
1417
1458
  value: function () {
1418
- var _updateDesignAreaList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(designAreaList) {
1459
+ var _updateDesignAreaList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(designAreaList) {
1419
1460
  var sceneData;
1420
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1421
- while (1) switch (_context10.prev = _context10.next) {
1461
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1462
+ while (1) switch (_context11.prev = _context11.next) {
1422
1463
  case 0:
1423
1464
  this._designAreaList = designAreaList;
1424
1465
  sceneData = (0, _get["default"])(designAreaList, "[0].designView.models.".concat(this._materialVariantPath));
1425
- _context10.t0 = sceneData;
1426
- if (!_context10.t0) {
1427
- _context10.next = 6;
1466
+ _context11.t0 = sceneData;
1467
+ if (!_context11.t0) {
1468
+ _context11.next = 6;
1428
1469
  break;
1429
1470
  }
1430
- _context10.next = 6;
1471
+ _context11.next = 6;
1431
1472
  return this.loadSceneSync(sceneData);
1432
1473
  case 6:
1433
1474
  case "end":
1434
- return _context10.stop();
1475
+ return _context11.stop();
1435
1476
  }
1436
- }, _callee10, this);
1477
+ }, _callee11, this);
1437
1478
  }));
1438
- function updateDesignAreaList(_x11) {
1479
+ function updateDesignAreaList(_x14) {
1439
1480
  return _updateDesignAreaList.apply(this, arguments);
1440
1481
  }
1441
1482
  return updateDesignAreaList;