Skip to content

Commit

Permalink
USDZExporter: Added console warning when the material type is unsuppo…
Browse files Browse the repository at this point in the history
…rted.
  • Loading branch information
mrdoob committed Nov 15, 2021
1 parent 4e4e75f commit 6e4f7a5
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions examples/jsm/exporters/USDZExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,35 @@ class USDZExporter {

scene.traverseVisible( ( object ) => {

if ( object.isMesh && object.material.isMeshStandardMaterial ) {
if ( object.isMesh ) {

const geometry = object.geometry;
const material = object.material;
if ( object.material.isMeshStandardMaterial ) {

const geometryFileName = 'geometries/Geometry_' + geometry.id + '.usd';
const geometry = object.geometry;
const material = object.material;

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

const meshObject = buildMeshObject( geometry );
files[ geometryFileName ] = buildUSDFileAsString( meshObject );
if ( ! ( geometryFileName in files ) ) {

}
const meshObject = buildMeshObject( geometry );
files[ geometryFileName ] = buildUSDFileAsString( meshObject );

if ( ! ( material.uuid in materials ) ) {
}

materials[ material.uuid ] = material;
if ( ! ( material.uuid in materials ) ) {

}
materials[ material.uuid ] = material;

}

output += buildXform( object, geometry, material );

output += buildXform( object, geometry, material );
} else {

console.warn( 'THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)', object );

}

}

Expand Down

2 comments on commit 6e4f7a5

@optimus007
Copy link

@optimus007 optimus007 commented on 6e4f7a5 Nov 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mrdoob
Clearcoat is checking for meshPhysical material

if ( material.isMeshPhysicalMaterial ) {

so physical should also be allowed ?

@Mugen87
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MeshPhysicalMaterial is derived from MeshStandardMaterial so checking isMeshStandardMaterial evaluates to true.

Please sign in to comment.