@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 +6 -0
- package/dist/helpers/utilityHelpers.js +24 -22
- package/package.json +1 -1
- package/src/package/helpers/utilityHelpers.js +29 -24
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
|
|
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
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
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
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
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
|
@@ -341,7 +341,7 @@ export const buildSelectedMaterialArray = () => {
|
|
|
341
341
|
return [ mainMaterial ];
|
|
342
342
|
}
|
|
343
343
|
|
|
344
|
-
const arr = selectedMeshes
|
|
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
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
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
|
};
|