@archvisioninc/canvas 2.6.1 → 2.6.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.
|
@@ -150,7 +150,8 @@ export const updateMaterial = inboundData => {
|
|
|
150
150
|
transparencyEnabled,
|
|
151
151
|
opacityTexture,
|
|
152
152
|
newSelectedMaterial,
|
|
153
|
-
albedoHasAlpha
|
|
153
|
+
albedoHasAlpha,
|
|
154
|
+
clearTextureChannels
|
|
154
155
|
} = payload;
|
|
155
156
|
const material = scene.getMaterialByName(id, true);
|
|
156
157
|
if (material) {
|
|
@@ -179,6 +180,16 @@ export const updateMaterial = inboundData => {
|
|
|
179
180
|
return;
|
|
180
181
|
}
|
|
181
182
|
|
|
183
|
+
// Reset supported texture channels, useful when manually importing a new material.
|
|
184
|
+
if (clearTextureChannels) {
|
|
185
|
+
material.albedoTexture = null;
|
|
186
|
+
material.metallicTexture = null;
|
|
187
|
+
material.microSurfaceTexture = null;
|
|
188
|
+
material.emissiveTexture = null;
|
|
189
|
+
material.bumpTexture = null;
|
|
190
|
+
material.opacityTexture = null;
|
|
191
|
+
}
|
|
192
|
+
|
|
182
193
|
// Back-face culling
|
|
183
194
|
if (backfaceCullingEnabled !== undefined) material.backFaceCulling = backfaceCullingEnabled;
|
|
184
195
|
|
package/package.json
CHANGED
|
@@ -187,6 +187,7 @@ export const updateMaterial = inboundData => {
|
|
|
187
187
|
opacityTexture,
|
|
188
188
|
newSelectedMaterial,
|
|
189
189
|
albedoHasAlpha,
|
|
190
|
+
clearTextureChannels,
|
|
190
191
|
} = payload;
|
|
191
192
|
|
|
192
193
|
const material = scene.getMaterialByName(id, true);
|
|
@@ -217,6 +218,16 @@ export const updateMaterial = inboundData => {
|
|
|
217
218
|
return;
|
|
218
219
|
}
|
|
219
220
|
|
|
221
|
+
// Reset supported texture channels, useful when manually importing a new material.
|
|
222
|
+
if (clearTextureChannels) {
|
|
223
|
+
material.albedoTexture = null;
|
|
224
|
+
material.metallicTexture = null;
|
|
225
|
+
material.microSurfaceTexture = null;
|
|
226
|
+
material.emissiveTexture = null;
|
|
227
|
+
material.bumpTexture = null;
|
|
228
|
+
material.opacityTexture = null;
|
|
229
|
+
}
|
|
230
|
+
|
|
220
231
|
// Back-face culling
|
|
221
232
|
if (backfaceCullingEnabled !== undefined) material.backFaceCulling = backfaceCullingEnabled;
|
|
222
233
|
|
package/src/scenes/App/App.js
CHANGED
|
@@ -64,6 +64,21 @@ const serializedResponseData = {
|
|
|
64
64
|
wireFrameEnabled: false,
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
+
const noTextureData = {
|
|
68
|
+
...serializedResponseData,
|
|
69
|
+
albedoColor: '#0675F7',
|
|
70
|
+
clearCoatEnabled: true,
|
|
71
|
+
environmentIntensity: 0.72,
|
|
72
|
+
metallic: 0,
|
|
73
|
+
roughness: 0.1,
|
|
74
|
+
albedoTexture: { url: '' },
|
|
75
|
+
bumpTexture: { url: '' },
|
|
76
|
+
emissiveTexture: { url: '' },
|
|
77
|
+
metallicTexture: { url: '' },
|
|
78
|
+
microSurfaceTexture: { url: '' },
|
|
79
|
+
opacityTexture: { url: '' },
|
|
80
|
+
};
|
|
81
|
+
|
|
67
82
|
const App = () => {
|
|
68
83
|
const [ notifications, setNotifications ] = useState([]);
|
|
69
84
|
const [ previewURL, setPreviewURL ] = useState(null);
|
|
@@ -165,6 +180,25 @@ const App = () => {
|
|
|
165
180
|
Import material
|
|
166
181
|
</Button>
|
|
167
182
|
|
|
183
|
+
<Button
|
|
184
|
+
theme={theme}
|
|
185
|
+
$selectedTheme={selectedTheme}
|
|
186
|
+
onClick={() => {
|
|
187
|
+
const inboundData = {
|
|
188
|
+
payload: {
|
|
189
|
+
id: 'material',
|
|
190
|
+
clearTextureChannels: true,
|
|
191
|
+
...noTextureData,
|
|
192
|
+
},
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
updateMaterial(inboundData);
|
|
196
|
+
console.log({ metadata: scene.metadata });
|
|
197
|
+
}}
|
|
198
|
+
>
|
|
199
|
+
Change material
|
|
200
|
+
</Button>
|
|
201
|
+
|
|
168
202
|
<Button
|
|
169
203
|
theme={theme}
|
|
170
204
|
$selectedTheme={selectedTheme}
|