@archvisioninc/canvas 2.5.1 → 2.5.3

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.
@@ -63,8 +63,6 @@ const tweakSceneForShaderball = () => {
63
63
  if (yAxis) yAxis.isVisible = false;
64
64
  if (zAxis) zAxis.isVisible = false;
65
65
  if (ground) ground.isVisible = false;
66
- const mainMaterial = scene.getMaterialById('material');
67
- newMetaDataEntry('selectedMaterial', mainMaterial?.id);
68
66
  prepareMaterialCamera();
69
67
  props.clearNotifications?.();
70
68
  };
@@ -454,6 +452,9 @@ export const initSceneFromFile = (sceneFromFile, fileName) => {
454
452
  title: fileName
455
453
  }
456
454
  } : {});
455
+ console.log({
456
+ metadata: scene?.metadata
457
+ });
457
458
  props.setSerializedData?.(serializeScene());
458
459
  }
459
460
  };
@@ -271,6 +271,10 @@ export const buildMaterialVariantsArray = () => {
271
271
  return variants;
272
272
  };
273
273
  export const buildSelectedMaterialArray = () => {
274
+ if (props.materialMode) {
275
+ const mainMaterial = scene.metadata?.materials?.find?.(item => item.materialId === 'material');
276
+ return [mainMaterial];
277
+ }
274
278
  const arr = selectedMeshes.map(mesh => {
275
279
  const material = mesh.material;
276
280
  if (material) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archvisioninc/canvas",
3
- "version": "2.5.1",
3
+ "version": "2.5.3",
4
4
  "private": false,
5
5
  "main": "dist/Canvas.js",
6
6
  "module": "dist/Canvas.js",
@@ -111,9 +111,6 @@ const tweakSceneForShaderball = () => {
111
111
  if (zAxis) zAxis.isVisible = false;
112
112
  if (ground) ground.isVisible = false;
113
113
 
114
- const mainMaterial = scene.getMaterialById('material');
115
-
116
- newMetaDataEntry('selectedMaterial', mainMaterial?.id);
117
114
  prepareMaterialCamera();
118
115
  props.clearNotifications?.();
119
116
  };
@@ -487,6 +484,9 @@ export const initSceneFromFile = (sceneFromFile, fileName) => {
487
484
  newMetaDataEntry('materialVariants', buildMaterialVariantsArray());
488
485
 
489
486
  updatePublish(fileName ? { payload: { title: fileName } } : {});
487
+
488
+ console.log({ metadata: scene?.metadata });
489
+
490
490
  props.setSerializedData?.(serializeScene());
491
491
  }
492
492
  };
@@ -336,6 +336,11 @@ export const buildMaterialVariantsArray = () => {
336
336
  };
337
337
 
338
338
  export const buildSelectedMaterialArray = () => {
339
+ if (props.materialMode) {
340
+ const mainMaterial = scene.metadata?.materials?.find?.(item => item.materialId === 'material');
341
+ return [ mainMaterial ];
342
+ }
343
+
339
344
  const arr = selectedMeshes.map(mesh => {
340
345
  const material = mesh.material;
341
346
  if (material) {