@archvisioninc/canvas 2.8.6 → 2.8.7

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/README_DEV.md CHANGED
@@ -152,6 +152,12 @@ a UI action/change from one of FOVEA's panels.
152
152
  * **setSerializedData**: Function type -- Canvas calls this any time something in Babylon has changed (usually from the `updateData` payload coming in to Canvas),
153
153
  and the host app needs that updated data to re-render it's UI.
154
154
  * **setBillboardImages**: Function type -- niche function only used when `updateData` payload comes in requesting screenshots for billboard proxy types.
155
+ * **integration**: Object type -- allows you to set specific overrides to the viewport. Currently only two options are supported:
156
+
157
+ ```jsx
158
+ // NOTE: Both of these should be boolean values
159
+ { shadows, meshHightling }
160
+ ```
155
161
 
156
162
  ### Preview Canvas Mode
157
163
  The preview mode is a simplified version of the standard canvas that hides the grid and other viewport widgets, limiting certain shortcuts and event listeners etc.
@@ -275,7 +275,7 @@ export const buildSelectedMaterialArray = () => {
275
275
  const mainMaterial = scene.metadata?.materials?.find?.(item => item.materialId === 'material');
276
276
  return [mainMaterial];
277
277
  }
278
- const arr = selectedMeshes.map(mesh => {
278
+ const arr = selectedMeshes?.map?.(mesh => {
279
279
  const material = mesh.material;
280
280
  if (material) {
281
281
  const existingMaterial = scene.metadata.materials?.find(mat => mat.materialId === material.id);
@@ -464,28 +464,30 @@ export const getExistingUVSettings = args => {
464
464
  };
465
465
  const userMaterials = getUserMaterials();
466
466
  const material = userMaterials.find(mat => mat.id === materialId);
467
- Object.keys(material)?.find?.(key => {
468
- const validMaterialWithTexture = _.isObject(material[key]) && !_.isArray(material[key]) && key.endsWith('Texture');
469
- const texture = material[key];
470
- const isEnvironment = key.toLowerCase().includes('environment');
471
- const hasAllKeys = texture && ['uAng', 'wAng', 'vAng', 'uOffset', 'vOffset', 'uScale', 'vScale'].every(key => texture[key] !== undefined);
467
+ if (material) {
468
+ Object.keys(material)?.find?.(key => {
469
+ const validMaterialWithTexture = _.isObject(material[key]) && !_.isArray(material[key]) && key.endsWith('Texture');
470
+ const texture = material[key];
471
+ const isEnvironment = key.toLowerCase().includes('environment');
472
+ const hasAllKeys = texture && ['uAng', 'wAng', 'vAng', 'uOffset', 'vOffset', 'uScale', 'vScale'].every(key => texture[key] !== undefined);
472
473
 
473
- // NOTE: All UV's are adjusted globally, at the same time in canvasUpdateHelpers.js
474
- // when **any** UV setting is changed. So we only need to find the first one to
475
- // restore the UV settings.
476
- if (!isEnvironment && validMaterialWithTexture && hasAllKeys && !settingsFound) {
477
- settingsFound = true;
478
- uvSettings = {
479
- uvXScale: texture.uScale,
480
- uvYScale: texture.vScale,
481
- uvXRotation: texture.uAng,
482
- uvYRotation: texture.wAng,
483
- uvZRotation: texture.vAng,
484
- uvXOffset: texture.uOffset,
485
- uvYOffset: texture.vOffset
486
- };
487
- }
488
- });
474
+ // NOTE: All UV's are adjusted globally, at the same time in canvasUpdateHelpers.js
475
+ // when **any** UV setting is changed. So we only need to find the first one to
476
+ // restore the UV settings.
477
+ if (!isEnvironment && validMaterialWithTexture && hasAllKeys && !settingsFound) {
478
+ settingsFound = true;
479
+ uvSettings = {
480
+ uvXScale: texture.uScale,
481
+ uvYScale: texture.vScale,
482
+ uvXRotation: texture.uAng,
483
+ uvYRotation: texture.wAng,
484
+ uvZRotation: texture.vAng,
485
+ uvXOffset: texture.uOffset,
486
+ uvYOffset: texture.vOffset
487
+ };
488
+ }
489
+ });
490
+ }
489
491
  return uvSettings;
490
492
  };
491
493
  export const materialData = material => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archvisioninc/canvas",
3
- "version": "2.8.6",
3
+ "version": "2.8.7",
4
4
  "private": false,
5
5
  "main": "dist/Canvas.js",
6
6
  "module": "dist/Canvas.js",
@@ -341,7 +341,7 @@ export const buildSelectedMaterialArray = () => {
341
341
  return [ mainMaterial ];
342
342
  }
343
343
 
344
- const arr = selectedMeshes.map(mesh => {
344
+ const arr = selectedMeshes?.map?.(mesh => {
345
345
  const material = mesh.material;
346
346
  if (material) {
347
347
  const existingMaterial = scene.metadata.materials?.find(mat => mat.materialId === material.id);
@@ -525,29 +525,34 @@ export const getExistingUVSettings = args => {
525
525
  const userMaterials = getUserMaterials();
526
526
  const material = userMaterials.find(mat => mat.id === materialId);
527
527
 
528
- Object.keys(material)?.find?.(key => {
529
- const validMaterialWithTexture = _.isObject(material[key]) && !_.isArray(material[key]) && key.endsWith('Texture');
530
- const texture = material[key];
531
- const isEnvironment = key.toLowerCase().includes('environment');
532
- const hasAllKeys = texture && [ 'uAng', 'wAng', 'vAng', 'uOffset', 'vOffset', 'uScale', 'vScale' ]
533
- .every(key => texture[key] !== undefined);
534
-
535
- // NOTE: All UV's are adjusted globally, at the same time in canvasUpdateHelpers.js
536
- // when **any** UV setting is changed. So we only need to find the first one to
537
- // restore the UV settings.
538
- if (!isEnvironment && validMaterialWithTexture && hasAllKeys && !settingsFound) {
539
- settingsFound = true;
540
- uvSettings = {
541
- uvXScale: texture.uScale,
542
- uvYScale: texture.vScale,
543
- uvXRotation: texture.uAng,
544
- uvYRotation: texture.wAng,
545
- uvZRotation: texture.vAng,
546
- uvXOffset: texture.uOffset,
547
- uvYOffset: texture.vOffset,
548
- };
549
- }
550
- });
528
+ if (material) {
529
+ Object.keys(material)?.find?.(key => {
530
+ const validMaterialWithTexture = _.isObject(material[key])
531
+ && !_.isArray(material[key])
532
+ && key.endsWith('Texture');
533
+
534
+ const texture = material[key];
535
+ const isEnvironment = key.toLowerCase().includes('environment');
536
+ const hasAllKeys = texture && [ 'uAng', 'wAng', 'vAng', 'uOffset', 'vOffset', 'uScale', 'vScale' ]
537
+ .every(key => texture[key] !== undefined);
538
+
539
+ // NOTE: All UV's are adjusted globally, at the same time in canvasUpdateHelpers.js
540
+ // when **any** UV setting is changed. So we only need to find the first one to
541
+ // restore the UV settings.
542
+ if (!isEnvironment && validMaterialWithTexture && hasAllKeys && !settingsFound) {
543
+ settingsFound = true;
544
+ uvSettings = {
545
+ uvXScale: texture.uScale,
546
+ uvYScale: texture.vScale,
547
+ uvXRotation: texture.uAng,
548
+ uvYRotation: texture.wAng,
549
+ uvZRotation: texture.vAng,
550
+ uvXOffset: texture.uOffset,
551
+ uvYOffset: texture.vOffset,
552
+ };
553
+ }
554
+ });
555
+ }
551
556
 
552
557
  return uvSettings;
553
558
  };