|
@@ -337,19 +337,19 @@ class NodeMaterial extends ShaderMaterial {
|
|
|
|
|
|
static fromMaterial( material ) {
|
|
|
|
|
|
- const type = material.type.replace( 'Material', 'NodeMaterial' );
|
|
|
+ if ( material.isNodeMaterial === true ) { // is already a node material
|
|
|
|
|
|
- const nodeMaterial = createNodeMaterialFromType( type );
|
|
|
+ return material;
|
|
|
|
|
|
- if ( nodeMaterial === undefined ) {
|
|
|
+ }
|
|
|
|
|
|
- if ( material.isNodeMaterial !== true ) {
|
|
|
+ const type = material.type.replace( 'Material', 'NodeMaterial' );
|
|
|
|
|
|
- throw new Error( `NodeMaterial: Material "${ material.type }" is not compatible.` );
|
|
|
+ const nodeMaterial = createNodeMaterialFromType( type );
|
|
|
|
|
|
- }
|
|
|
+ if ( nodeMaterial === undefined ) {
|
|
|
|
|
|
- return material; // is already a node material
|
|
|
+ throw new Error( `NodeMaterial: Material "${ material.type }" is not compatible.` );
|
|
|
|
|
|
}
|
|
|
|