@archvisioninc/canvas 3.1.3 → 3.1.4
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,4 @@
|
|
|
1
|
-
import { scene, newMetaDataEntry, selectedMeshes, updateCamera, updateEnvironment, buildMaterialsArray, buildSelectedMaterialArray } from '../helpers';
|
|
1
|
+
import { scene, newMetaDataEntry, selectedMeshes, updateCamera, updateEnvironment, buildMaterialsArray, buildSelectedMaterialArray, serializeScene } from '../helpers';
|
|
2
2
|
import { reactProps as props } from '../Canvas';
|
|
3
3
|
import { deleteSelected } from '../actions';
|
|
4
4
|
import { TRANSPARENCY_MODES } from '../constants';
|
|
@@ -96,6 +96,8 @@ export const removeFromMaterial = inboundData => {
|
|
|
96
96
|
material.metallicTexture.updateURL(updatedTexture);
|
|
97
97
|
newMetaDataEntry('materials', buildMaterialsArray());
|
|
98
98
|
newMetaDataEntry('selectedMaterials', buildSelectedMaterialArray());
|
|
99
|
+
props.clearNotifications?.();
|
|
100
|
+
props.setSerializedData?.(serializeScene());
|
|
99
101
|
}).catch(() => {
|
|
100
102
|
console.log('Failed to remove metallic texture');
|
|
101
103
|
});
|
|
@@ -128,6 +130,8 @@ export const removeFromMaterial = inboundData => {
|
|
|
128
130
|
material.metallicTexture.updateURL(updatedTexture);
|
|
129
131
|
newMetaDataEntry('materials', buildMaterialsArray());
|
|
130
132
|
newMetaDataEntry('selectedMaterials', buildSelectedMaterialArray());
|
|
133
|
+
props.clearNotifications?.();
|
|
134
|
+
props.setSerializedData?.(serializeScene());
|
|
131
135
|
}).catch(() => {
|
|
132
136
|
console.log('Failed to remove roughness texture');
|
|
133
137
|
});
|
|
@@ -151,7 +151,9 @@ const updateTextureChannel = (imageToMaintain, newImage, channelToUpdate) => {
|
|
|
151
151
|
const maxHeight = Math.max(...[maintainHeight, newHeight, 1024]);
|
|
152
152
|
const maxWidth = Math.max(...[maintainWidth, newWidth, 1024]);
|
|
153
153
|
const canvas = document.createElement('canvas');
|
|
154
|
-
const ctx = canvas.getContext('2d'
|
|
154
|
+
const ctx = canvas.getContext('2d', {
|
|
155
|
+
willReadFrequently: true
|
|
156
|
+
});
|
|
155
157
|
canvas.width = maxWidth;
|
|
156
158
|
canvas.height = maxHeight;
|
|
157
159
|
if (newImage) {
|
|
@@ -402,6 +404,8 @@ export const updateMaterial = inboundData => {
|
|
|
402
404
|
});
|
|
403
405
|
newMetaDataEntry('materials', buildMaterialsArray());
|
|
404
406
|
newMetaDataEntry('selectedMaterials', buildSelectedMaterialArray());
|
|
407
|
+
props.clearNotifications?.();
|
|
408
|
+
props.setSerializedData?.(serializeScene());
|
|
405
409
|
}).catch(err => {
|
|
406
410
|
console.log(`Error updating the roughness texture of material: ${material.name}`);
|
|
407
411
|
console.log({
|
|
@@ -441,6 +445,8 @@ export const updateMaterial = inboundData => {
|
|
|
441
445
|
});
|
|
442
446
|
newMetaDataEntry('materials', buildMaterialsArray());
|
|
443
447
|
newMetaDataEntry('selectedMaterials', buildSelectedMaterialArray());
|
|
448
|
+
props.clearNotifications?.();
|
|
449
|
+
props.setSerializedData?.(serializeScene());
|
|
444
450
|
}).catch(err => {
|
|
445
451
|
console.log(`Error updating the roughness texture of material: ${material.name}`);
|
|
446
452
|
console.log({
|
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
updateEnvironment,
|
|
7
7
|
buildMaterialsArray,
|
|
8
8
|
buildSelectedMaterialArray,
|
|
9
|
+
serializeScene,
|
|
9
10
|
} from '../helpers';
|
|
10
11
|
import { reactProps as props } from '../Canvas';
|
|
11
12
|
import { deleteSelected } from '../actions';
|
|
@@ -129,6 +130,8 @@ export const removeFromMaterial = inboundData => {
|
|
|
129
130
|
material.metallicTexture.updateURL(updatedTexture);
|
|
130
131
|
newMetaDataEntry('materials', buildMaterialsArray());
|
|
131
132
|
newMetaDataEntry('selectedMaterials', buildSelectedMaterialArray());
|
|
133
|
+
props.clearNotifications?.();
|
|
134
|
+
props.setSerializedData?.(serializeScene());
|
|
132
135
|
})
|
|
133
136
|
.catch(() => {
|
|
134
137
|
console.log('Failed to remove metallic texture');
|
|
@@ -167,6 +170,8 @@ export const removeFromMaterial = inboundData => {
|
|
|
167
170
|
material.metallicTexture.updateURL(updatedTexture);
|
|
168
171
|
newMetaDataEntry('materials', buildMaterialsArray());
|
|
169
172
|
newMetaDataEntry('selectedMaterials', buildSelectedMaterialArray());
|
|
173
|
+
props.clearNotifications?.();
|
|
174
|
+
props.setSerializedData?.(serializeScene());
|
|
170
175
|
})
|
|
171
176
|
.catch(() => {
|
|
172
177
|
console.log('Failed to remove roughness texture');
|
|
@@ -192,7 +192,8 @@ const updateTextureChannel = (imageToMaintain, newImage, channelToUpdate) => {
|
|
|
192
192
|
|
|
193
193
|
const canvas = document.createElement('canvas');
|
|
194
194
|
|
|
195
|
-
const ctx = canvas.getContext('2d');
|
|
195
|
+
const ctx = canvas.getContext('2d', { willReadFrequently: true });
|
|
196
|
+
|
|
196
197
|
|
|
197
198
|
canvas.width = maxWidth;
|
|
198
199
|
canvas.height = maxHeight;
|
|
@@ -459,6 +460,8 @@ export const updateMaterial = inboundData => {
|
|
|
459
460
|
applyUVSettings({ texture: material.metallicTexture, material });
|
|
460
461
|
newMetaDataEntry('materials', buildMaterialsArray());
|
|
461
462
|
newMetaDataEntry('selectedMaterials', buildSelectedMaterialArray());
|
|
463
|
+
props.clearNotifications?.();
|
|
464
|
+
props.setSerializedData?.(serializeScene());
|
|
462
465
|
})
|
|
463
466
|
.catch(err => {
|
|
464
467
|
console.log(`Error updating the roughness texture of material: ${material.name}`);
|
|
@@ -497,11 +500,13 @@ export const updateMaterial = inboundData => {
|
|
|
497
500
|
applyUVSettings({ texture: material.metallicTexture, material });
|
|
498
501
|
newMetaDataEntry('materials', buildMaterialsArray());
|
|
499
502
|
newMetaDataEntry('selectedMaterials', buildSelectedMaterialArray());
|
|
503
|
+
props.clearNotifications?.();
|
|
504
|
+
props.setSerializedData?.(serializeScene());
|
|
500
505
|
})
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
506
|
+
.catch(err => {
|
|
507
|
+
console.log(`Error updating the roughness texture of material: ${material.name}`);
|
|
508
|
+
console.log({ err });
|
|
509
|
+
});
|
|
505
510
|
|
|
506
511
|
}
|
|
507
512
|
|
package/src/scenes/App/App.js
CHANGED
|
@@ -176,7 +176,10 @@ const App = () => {
|
|
|
176
176
|
updateData={null}
|
|
177
177
|
reinitialize={null}
|
|
178
178
|
defaultEnvironments={ENVIRONMENTS.defaultEnvironments}
|
|
179
|
-
setSerializedData={payload =>
|
|
179
|
+
setSerializedData={payload => {
|
|
180
|
+
console.log(payload);
|
|
181
|
+
setSerializedData(payload);
|
|
182
|
+
}}
|
|
180
183
|
clearUpdateData={_.noop}
|
|
181
184
|
toDownload={false}
|
|
182
185
|
exportModel={exportModel}
|