@archvisioninc/canvas 3.3.0 → 3.3.1

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.
@@ -314,6 +314,10 @@ export const updateMaterial = inboundData => {
314
314
  if (newId) {
315
315
  material.id = newId;
316
316
  material.name = newId;
317
+ if (Array.isArray(scene.metadata.selectedMaterials) && scene.metadata.selectedMaterials.length > 0) {
318
+ // We currently only support one selectedMaterial at a time so we should set the changed material to selected
319
+ scene.metadata.selectedMaterials = [material];
320
+ }
317
321
  }
318
322
 
319
323
  // Select all meshes with current material.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archvisioninc/canvas",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "private": false,
5
5
  "main": "dist/Canvas.js",
6
6
  "module": "dist/Canvas.js",
@@ -374,6 +374,11 @@ export const updateMaterial = inboundData => {
374
374
  if (newId) {
375
375
  material.id = newId;
376
376
  material.name = newId;
377
+
378
+ if (Array.isArray(scene.metadata.selectedMaterials) && scene.metadata.selectedMaterials.length > 0) {
379
+ // We currently only support one selectedMaterial at a time so we should set the changed material to selected
380
+ scene.metadata.selectedMaterials = [ material ];
381
+ }
377
382
  }
378
383
 
379
384
  // Select all meshes with current material.
@@ -5,9 +5,9 @@ import { AppContainer, DebugButtons, Button } from './styles';
5
5
  import { theme } from 'static/theme';
6
6
  import { fetchDownloadURL } from 'helpers/fetchHelpers';
7
7
  import { ENVIRONMENTS } from 'constants';
8
- import { updateViewport, scene, updateLighting } from 'package/helpers';
8
+ import { updateViewport, scene, updateLighting, updateMaterial } from 'package/helpers';
9
9
  import Canvas from 'package/Canvas';
10
- import _ from 'lodash';
10
+ import _, { update } from 'lodash';
11
11
 
12
12
  const materialMode = false;
13
13
  const previewMode = false;
@@ -142,14 +142,15 @@ const App = () => {
142
142
  onClick={() => {
143
143
  const inboundData = {
144
144
  payload: {
145
- id: 'directional',
146
- intensity: 5,
145
+ id: 'Body',
146
+ newId: 'test',
147
147
  },
148
148
  };
149
- updateLighting(inboundData);
149
+ updateMaterial(inboundData);
150
+ console.log({ metadata: scene.metadata });
150
151
  }}
151
152
  >
152
- Update Intensity
153
+ Update Body Material
153
154
  </Button>
154
155
  </DebugButtons>
155
156
  </AppContainer>