Skip to content

Commit 6e4f7a5

Browse files
committed
USDZExporter: Added console warning when the material type is unsupported.
1 parent 4e4e75f commit 6e4f7a5

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

examples/jsm/exporters/USDZExporter.js

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,35 @@ class USDZExporter {
1717

1818
scene.traverseVisible( ( object ) => {
1919

20-
if ( object.isMesh && object.material.isMeshStandardMaterial ) {
20+
if ( object.isMesh ) {
2121

22-
const geometry = object.geometry;
23-
const material = object.material;
22+
if ( object.material.isMeshStandardMaterial ) {
2423

25-
const geometryFileName = 'geometries/Geometry_' + geometry.id + '.usd';
24+
const geometry = object.geometry;
25+
const material = object.material;
2626

27-
if ( ! ( geometryFileName in files ) ) {
27+
const geometryFileName = 'geometries/Geometry_' + geometry.id + '.usd';
2828

29-
const meshObject = buildMeshObject( geometry );
30-
files[ geometryFileName ] = buildUSDFileAsString( meshObject );
29+
if ( ! ( geometryFileName in files ) ) {
3130

32-
}
31+
const meshObject = buildMeshObject( geometry );
32+
files[ geometryFileName ] = buildUSDFileAsString( meshObject );
3333

34-
if ( ! ( material.uuid in materials ) ) {
34+
}
3535

36-
materials[ material.uuid ] = material;
36+
if ( ! ( material.uuid in materials ) ) {
3737

38-
}
38+
materials[ material.uuid ] = material;
39+
40+
}
41+
42+
output += buildXform( object, geometry, material );
3943

40-
output += buildXform( object, geometry, material );
44+
} else {
45+
46+
console.warn( 'THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)', object );
47+
48+
}
4149

4250
}
4351

0 commit comments

Comments
 (0)