@crystaldesign/real-time-viewer 25.15.0-beta.8 → 25.16.0-beta.1

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.
@@ -3758,7 +3758,7 @@ var buildScene = function buildScene(_ref) {
3758
3758
  var geo = mesh.clone('geo_' + mesh.name, parentNode);
3759
3759
  geo.position = new Vector3(curGeo.pos.x / 100, curGeo.pos.y / 100, curGeo.pos.z / 100);
3760
3760
  geo.rotation = utilStore.degreesToRadians({
3761
- x: hqsGeo.isIDM3D ? 90 - curGeo.rot.x : -curGeo.rot.x,
3761
+ x: hqsGeo.isIDM3D && curGeo.rot.x != 0 ? 90 - curGeo.rot.x : -curGeo.rot.x,
3762
3762
  y: 360 - curGeo.rot.y,
3763
3763
  z: 360 - curGeo.rot.z
3764
3764
  });
@@ -3897,16 +3897,41 @@ function _createForOfIteratorHelper$1(r, e) { var t = "undefined" != typeof Symb
3897
3897
  function _unsupportedIterableToArray$1(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$1(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0; } }
3898
3898
  function _arrayLikeToArray$1(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
3899
3899
  function findMaterials(cache) {
3900
+ var matsOnMeshes = {};
3900
3901
  //! parent = the parent from which on every child should receive the Material
3901
3902
  //! id = the id which points to the material that should be assigned
3902
3903
  var setMaterials = function setMaterials(onNode, mat) {
3903
- if (onNode !== null && onNode !== void 0 && onNode._isMesh) onNode.material = mat;
3904
+ if (onNode !== null && onNode !== void 0 && onNode._isMesh) {
3905
+ matsOnMeshes[onNode.uniqueId] = {
3906
+ mat: mat,
3907
+ onNode: onNode
3908
+ };
3909
+ onNode.material = mat;
3910
+ }
3904
3911
  var _iterator = _createForOfIteratorHelper$1(onNode.getChildMeshes()),
3905
3912
  _step;
3906
3913
  try {
3914
+ var _loop = function _loop() {
3915
+ var mesh = _step.value;
3916
+ var existing = Object.keys(matsOnMeshes).find(function (key) {
3917
+ return key == mesh.uniqueId.toString();
3918
+ });
3919
+ if (existing) {
3920
+ if (onNode.uniqueId.toString() == existing) return 0; // continue
3921
+ if (onNode.getChildren().find(function (node) {
3922
+ return node.uniqueId.toString() == existing;
3923
+ })) return 0; // continue
3924
+ }
3925
+ matsOnMeshes[mesh.uniqueId] = {
3926
+ mat: mat,
3927
+ onNode: onNode
3928
+ };
3929
+ mesh.material = mat;
3930
+ },
3931
+ _ret;
3907
3932
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
3908
- var mesh = _step.value;
3909
- mesh.material = mat;
3933
+ _ret = _loop();
3934
+ if (_ret === 0) continue;
3910
3935
  }
3911
3936
  } catch (err) {
3912
3937
  _iterator.e(err);
@@ -3916,7 +3941,7 @@ function findMaterials(cache) {
3916
3941
  };
3917
3942
 
3918
3943
  //! find On Node from json to scene and then call setMaterials to apply it to all Children
3919
- var findOnNode = function findOnNode(mat, parent) {
3944
+ var findOnNode = function findOnNode(mat, parent, onNode) {
3920
3945
  if (!mat.onNodes) return;
3921
3946
  var children = parent.getChildTransformNodes(false);
3922
3947
  var _iterator2 = _createForOfIteratorHelper$1(children),
@@ -3924,20 +3949,10 @@ function findMaterials(cache) {
3924
3949
  try {
3925
3950
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
3926
3951
  var child = _step2.value;
3927
- var _iterator3 = _createForOfIteratorHelper$1(mat.onNodes),
3928
- _step3;
3929
- try {
3930
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
3931
- var onNode = _step3.value;
3932
- if (onNode == "" || onNode == "ALL") setMaterials(child, mat.mat);
3933
- if (child.name.startsWith(onNode) || child.name.startsWith('geo_') && child.name.includes(onNode)) {
3934
- setMaterials(child, mat.mat);
3935
- }
3936
- }
3937
- } catch (err) {
3938
- _iterator3.e(err);
3939
- } finally {
3940
- _iterator3.f();
3952
+ if (onNode == "" || onNode == "ALL") setMaterials(child, mat.mat);
3953
+ if (child.name.startsWith(onNode) || child.name.startsWith('geo_') && child.name.includes(onNode)) {
3954
+ if (child.getChildren(undefined, true)) {}
3955
+ setMaterials(child, mat.mat);
3941
3956
  }
3942
3957
  }
3943
3958
  } catch (err) {
@@ -3946,29 +3961,22 @@ function findMaterials(cache) {
3946
3961
  _iterator2.f();
3947
3962
  }
3948
3963
  };
3949
- var _iterator4 = _createForOfIteratorHelper$1(cache),
3950
- _step4;
3964
+ var _iterator3 = _createForOfIteratorHelper$1(cache),
3965
+ _step3;
3951
3966
  try {
3952
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
3953
- var element = _step4.value;
3967
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
3968
+ var element = _step3.value;
3954
3969
  if (!element.material || !element.material.parents) continue;
3955
- var _iterator5 = _createForOfIteratorHelper$1(element.material.parents),
3956
- _step5;
3957
- try {
3958
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
3959
- var parent = _step5.value;
3960
- findOnNode(element.material, parent);
3961
- }
3962
- } catch (err) {
3963
- _iterator5.e(err);
3964
- } finally {
3965
- _iterator5.f();
3970
+ for (var idx = 0; idx < element.material.parents.length; idx++) {
3971
+ var parent = element.material.parents[idx];
3972
+ var onNode = element.material.onNodes[idx];
3973
+ findOnNode(element.material, parent, onNode);
3966
3974
  }
3967
3975
  }
3968
3976
  } catch (err) {
3969
- _iterator4.e(err);
3977
+ _iterator3.e(err);
3970
3978
  } finally {
3971
- _iterator4.f();
3979
+ _iterator3.f();
3972
3980
  }
3973
3981
  return findMaterials;
3974
3982
  }
@@ -4228,50 +4236,49 @@ function useRealTimeRenderData (_ref) {
4228
4236
  return _context2.abrupt("return");
4229
4237
  case 2:
4230
4238
  sceneStore.isInitializing = true;
4231
- if (!overlayImage && !disableToggleLoading) actions.toggleLoading('buildScene', false, true);
4232
4239
  if (sceneStore.hasRendered) {
4233
- _context2.next = 10;
4240
+ _context2.next = 9;
4234
4241
  break;
4235
4242
  }
4236
4243
  if (inBackground) sceneStore.scene.getEngine().setHardwareScalingLevel(5);
4237
4244
  sceneStore.init(apiConfig.diva3darchive + '/', gameCanvas.current, viewpoint, resolution);
4238
4245
  uiStore.resize();
4239
- _context2.next = 15;
4246
+ _context2.next = 13;
4240
4247
  break;
4241
- case 10:
4248
+ case 9:
4242
4249
  sceneStore.hqRenderScript = JSON.parse(renderjob);
4243
4250
  if (checkCachedData()) {
4244
- _context2.next = 15;
4251
+ _context2.next = 13;
4245
4252
  break;
4246
4253
  }
4247
- if (!overlayImage && !disableToggleLoading) actions.toggleLoading('buildScene', false, false);
4248
4254
  sceneStore.isInitializing = false;
4249
4255
  return _context2.abrupt("return");
4250
- case 15:
4256
+ case 13:
4257
+ if (!overlayImage && !disableToggleLoading) actions.toggleLoading('buildScene', false, true);
4251
4258
  LOG.startTransaction({
4252
4259
  event: 'buildScene',
4253
4260
  message: 'Start Building Realtime Scene',
4254
4261
  eventId: 'BUILD_SCENE'
4255
4262
  });
4256
- _context2.prev = 16;
4263
+ _context2.prev = 15;
4257
4264
  uiStore.deactivateHighlightLayer();
4258
- _context2.next = 20;
4265
+ _context2.next = 19;
4259
4266
  return parser();
4260
- case 20:
4267
+ case 19:
4261
4268
  uiStore.initGui(callbacks.onElementSelected, sceneStore.elements);
4262
4269
  if ((uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.plannerMode) != 'BoxPlanner' && (freePlacesOnGrids || plannedPlacesOnGrids)) gridStore.getGrids('ShelfPlanner', undefined, freePlacesOnGrids, plannedPlacesOnGrids);else if (viewHandler !== null && viewHandler !== void 0 && viewHandler.settingsState.generalPlanningState) gridStore.getGrids('BoxPlanner', viewHandler.settingsState.generalPlanningState);
4263
- _context2.next = 29;
4270
+ _context2.next = 28;
4264
4271
  break;
4265
- case 24:
4266
- _context2.prev = 24;
4267
- _context2.t0 = _context2["catch"](16);
4272
+ case 23:
4273
+ _context2.prev = 23;
4274
+ _context2.t0 = _context2["catch"](15);
4268
4275
  LOG.errorTransaction('BUILD_SCENE', 'RTS_0001', _context2.t0.message);
4269
4276
  LOG.error(new DivaError('Error building scene', {
4270
4277
  cause: _context2.t0,
4271
4278
  code: 'RTS_0001'
4272
4279
  }));
4273
4280
  sceneStore.isInitializing = false;
4274
- case 29:
4281
+ case 28:
4275
4282
  if (callbacks.setGlb) {
4276
4283
  sceneStore.exportScene(callbacks.setGlb);
4277
4284
  } else {
@@ -4283,11 +4290,11 @@ function useRealTimeRenderData (_ref) {
4283
4290
  sceneStore.runRenderLoopForTime(5000);
4284
4291
  sceneStore.scene.onAfterRenderObservable.add(onFirstFrame);
4285
4292
  LOG.successTransaction('BUILD_SCENE');
4286
- case 34:
4293
+ case 33:
4287
4294
  case "end":
4288
4295
  return _context2.stop();
4289
4296
  }
4290
- }, _callee2, null, [[16, 24]]);
4297
+ }, _callee2, null, [[15, 23]]);
4291
4298
  }));
4292
4299
  return _onSceneReady.apply(this, arguments);
4293
4300
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,cAAc,gBAAgB,CAAC;AAO/B,QAAA,MAAM,gBAAgB,oCACZ,KAAK,uBA4Bd,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,cAAc,gBAAgB,CAAC;AAO/B,QAAA,MAAM,gBAAgB,oCACZ,KAAK,uBA+Bd,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/parser/findMaterials/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAY,MAAM,aAAa,CAAC;AAG9C,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,wBAgCnD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/parser/findMaterials/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAY,MAAM,aAAa,CAAC;AAG9C,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,wBA6CnD"}
@@ -1 +1 @@
1
- {"version":3,"file":"useRealTimeRenderData.d.ts","sourceRoot":"","sources":["../../../../src/useRealTimeRenderData.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAMhC,OAAO,8BAA8B,CAAC;AAUtC,MAAM,CAAC,OAAO,WAAW,EACvB,GAAG,EACH,SAAS,EACT,SAAS,EACT,SAAS,EACT,UAAU,EACV,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,EACpB,SAAS,EACT,QAAQ,EACR,kBAAkB,EAClB,QAAQ,EACR,oBAAoB,GACrB,EAAE,KAAK;;EA2PP"}
1
+ {"version":3,"file":"useRealTimeRenderData.d.ts","sourceRoot":"","sources":["../../../../src/useRealTimeRenderData.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAMhC,OAAO,8BAA8B,CAAC;AAUtC,MAAM,CAAC,OAAO,WAAW,EACvB,GAAG,EACH,SAAS,EACT,SAAS,EACT,SAAS,EACT,UAAU,EACV,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,EACpB,SAAS,EACT,QAAQ,EACR,kBAAkB,EAClB,QAAQ,EACR,oBAAoB,GACrB,EAAE,KAAK;;EA0PP"}