@archvisioninc/canvas 2.8.0 → 2.8.2
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.
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
1
|
import { getUserMeshes, resetSelectedMeshes, addNewMesh, scene, mirrorGround, ground, newVector, newColor, newScreenshot, serializeScene, newMetaDataEntry, selectedMeshes, singleMeshTNode, toRadians, toDegrees, multiMeshTNode, handleMousePointerTap, prepareCamera, buildMaterialsArray, buildMeshPositionsArray, createBoundingMesh, attachToSelectMeshesNode, newTexture, getUserMaterials, buildSelectedMaterialArray, buildMeshIdArray, refreshHighlight, guiTexture, getBoundingMeshData, getScaleFactor, gizmoManager } from '../helpers';
|
|
3
2
|
import { toggleSafeFrame, toggleOrthographicViews, toggleBoundingBoxWidget, resetManagerGizmos, modelToOrigin, focusCamera } from '../actions';
|
|
4
3
|
import { GLTF2 } from 'babylonjs-loaders';
|
|
@@ -67,8 +66,8 @@ const performTransform = args => {
|
|
|
67
66
|
const userMeshes = getUserMeshes();
|
|
68
67
|
const updatedPositions = scene.metadata.meshChangeTracking.map(mesh => {
|
|
69
68
|
const userMesh = userMeshes.find(userMesh => userMesh.id === mesh.meshId);
|
|
70
|
-
const parent = userMesh
|
|
71
|
-
userMesh
|
|
69
|
+
const parent = userMesh?.parent;
|
|
70
|
+
userMesh?.setParent?.(null);
|
|
72
71
|
const boundingBox = getBoundingMeshData([userMesh]);
|
|
73
72
|
const {
|
|
74
73
|
center,
|
|
@@ -83,7 +82,7 @@ const performTransform = args => {
|
|
|
83
82
|
ry: toDegrees(rotation.y) % 360,
|
|
84
83
|
rz: -toDegrees(rotation.z) % 360
|
|
85
84
|
};
|
|
86
|
-
userMesh
|
|
85
|
+
userMesh?.setParent?.(parent);
|
|
87
86
|
return newTracking;
|
|
88
87
|
});
|
|
89
88
|
return updatedPositions;
|
|
@@ -365,8 +364,8 @@ export const updateMaterial = inboundData => {
|
|
|
365
364
|
if (uvChangeRequest) {
|
|
366
365
|
const workingMaterial = scene.metadata.materials.find(mat => mat.materialId === id) || {};
|
|
367
366
|
Object.keys(workingMaterial)?.forEach(key => {
|
|
368
|
-
const validMaterialWithTexture = _.isObject(material[key]) && !_.isArray(material[key]) && key.endsWith('Texture');
|
|
369
367
|
const texture = material[key];
|
|
368
|
+
const validMaterialWithTexture = _.isObject(texture) && !_.isArray(texture) && key.endsWith('Texture');
|
|
370
369
|
const hasAllKeys = texture && ['uAng', 'wAng', 'vAng', 'uOffset', 'vOffset', 'uScale', 'vScale'].every(key => texture[key] !== undefined);
|
|
371
370
|
if (validMaterialWithTexture && hasAllKeys) {
|
|
372
371
|
if (xRotationReq) texture.uAng = uvXRotation;
|
|
@@ -619,11 +619,11 @@ export const takePreviewScreenshots = () => {
|
|
|
619
619
|
const yAxisMesh = scene.getMeshByName('yAxisMesh');
|
|
620
620
|
const zAxisMesh = scene.getMeshByName('zAxisMesh');
|
|
621
621
|
const hdrSkyBox = scene.getMeshByName('hdrSkyBox');
|
|
622
|
-
const axesVisible = xAxisMesh
|
|
623
|
-
const skyBoxVisible = hdrSkyBox
|
|
624
|
-
const frameVisible = outerFrame
|
|
625
|
-
const groundVisible = ground
|
|
626
|
-
const mirrorGroundVisible = mirrorGround
|
|
622
|
+
const axesVisible = xAxisMesh?.isVisible;
|
|
623
|
+
const skyBoxVisible = hdrSkyBox?.isVisible;
|
|
624
|
+
const frameVisible = outerFrame?.isVisible;
|
|
625
|
+
const groundVisible = ground?.isVisible;
|
|
626
|
+
const mirrorGroundVisible = mirrorGround?.isVisible;
|
|
627
627
|
const {
|
|
628
628
|
positionGizmoEnabled,
|
|
629
629
|
rotationGizmoEnabled,
|
package/package.json
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
1
|
import {
|
|
3
2
|
getUserMeshes,
|
|
4
3
|
resetSelectedMeshes,
|
|
@@ -103,9 +102,9 @@ const performTransform = args => {
|
|
|
103
102
|
const userMeshes = getUserMeshes();
|
|
104
103
|
const updatedPositions = scene.metadata.meshChangeTracking.map(mesh => {
|
|
105
104
|
const userMesh = userMeshes.find(userMesh => userMesh.id === mesh.meshId);
|
|
106
|
-
const parent = userMesh
|
|
105
|
+
const parent = userMesh?.parent;
|
|
107
106
|
|
|
108
|
-
userMesh
|
|
107
|
+
userMesh?.setParent?.(null);
|
|
109
108
|
|
|
110
109
|
const boundingBox = getBoundingMeshData([ userMesh ]);
|
|
111
110
|
const { center, rotation } = boundingBox;
|
|
@@ -120,7 +119,7 @@ const performTransform = args => {
|
|
|
120
119
|
rz: -toDegrees(rotation.z) % 360,
|
|
121
120
|
};
|
|
122
121
|
|
|
123
|
-
userMesh
|
|
122
|
+
userMesh?.setParent?.(parent);
|
|
124
123
|
return newTracking;
|
|
125
124
|
});
|
|
126
125
|
|
|
@@ -158,7 +157,15 @@ const applyUVSettings = args => {
|
|
|
158
157
|
|
|
159
158
|
if (!_.isEmpty(texture) && !_.isEmpty(material)) {
|
|
160
159
|
const workingMaterial = scene.metadata.materials.find(mat => mat.materialId === material.id);
|
|
161
|
-
const {
|
|
160
|
+
const {
|
|
161
|
+
uvXScale,
|
|
162
|
+
uvYScale,
|
|
163
|
+
uvXRotation,
|
|
164
|
+
uvYRotation,
|
|
165
|
+
uvZRotation,
|
|
166
|
+
uvXOffset,
|
|
167
|
+
uvYOffset,
|
|
168
|
+
} = workingMaterial?.uvSettings || {};
|
|
162
169
|
|
|
163
170
|
texture.uAng = uvXRotation;
|
|
164
171
|
texture.wAng = uvYRotation;
|
|
@@ -385,14 +392,15 @@ export const updateMaterial = inboundData => {
|
|
|
385
392
|
const zRotationReq = uvZRotation !== undefined;
|
|
386
393
|
const xOffsetReq = uvXOffset !== undefined;
|
|
387
394
|
const yOffsetReq = uvYOffset !== undefined;
|
|
388
|
-
const uvChangeRequest = xScaleReq || yScaleReq || xRotationReq
|
|
395
|
+
const uvChangeRequest = xScaleReq || yScaleReq || xRotationReq
|
|
396
|
+
|| yRotationReq || zRotationReq || xOffsetReq || yOffsetReq;
|
|
389
397
|
|
|
390
398
|
if (uvChangeRequest) {
|
|
391
399
|
const workingMaterial = scene.metadata.materials.find(mat => mat.materialId === id) || {};
|
|
392
400
|
|
|
393
401
|
Object.keys(workingMaterial)?.forEach(key => {
|
|
394
|
-
const validMaterialWithTexture = _.isObject(material[key]) && !_.isArray(material[key]) && key.endsWith('Texture');
|
|
395
402
|
const texture = material[key];
|
|
403
|
+
const validMaterialWithTexture = _.isObject(texture) && !_.isArray(texture) && key.endsWith('Texture');
|
|
396
404
|
const hasAllKeys = texture && [ 'uAng', 'wAng', 'vAng', 'uOffset', 'vOffset', 'uScale', 'vScale' ]
|
|
397
405
|
.every(key => texture[key] !== undefined);
|
|
398
406
|
|
|
@@ -683,11 +683,11 @@ export const takePreviewScreenshots = () => {
|
|
|
683
683
|
const yAxisMesh = scene.getMeshByName('yAxisMesh');
|
|
684
684
|
const zAxisMesh = scene.getMeshByName('zAxisMesh');
|
|
685
685
|
const hdrSkyBox = scene.getMeshByName('hdrSkyBox');
|
|
686
|
-
const axesVisible = xAxisMesh
|
|
687
|
-
const skyBoxVisible = hdrSkyBox
|
|
688
|
-
const frameVisible = outerFrame
|
|
689
|
-
const groundVisible = ground
|
|
690
|
-
const mirrorGroundVisible = mirrorGround
|
|
686
|
+
const axesVisible = xAxisMesh?.isVisible;
|
|
687
|
+
const skyBoxVisible = hdrSkyBox?.isVisible;
|
|
688
|
+
const frameVisible = outerFrame?.isVisible;
|
|
689
|
+
const groundVisible = ground?.isVisible;
|
|
690
|
+
const mirrorGroundVisible = mirrorGround?.isVisible;
|
|
691
691
|
const {
|
|
692
692
|
positionGizmoEnabled,
|
|
693
693
|
rotationGizmoEnabled,
|