Bladeren bron

ColladaExporter: Clean up.

Mr.doob 4 jaren geleden
bovenliggende
commit
85490b18a0
1 gewijzigde bestanden met toevoegingen van 9 en 13 verwijderingen
  1. 9 13
      examples/jsm/exporters/ColladaExporter.js

+ 9 - 13
examples/jsm/exporters/ColladaExporter.js

@@ -30,27 +30,23 @@ class ColladaExporter {
 			unitMeter: null,
 			unitMeter: null,
 		}, options );
 		}, options );
 
 
-		if (options.upAxis.match(/^[XYZ]_UP$/) === null) {
+		if ( options.upAxis.match( /^[XYZ]_UP$/ ) === null ) {
 
 
-			console.error('ColladaExporter: Invalid upAxis: valid values are X_UP, Y_UP or Z_UP.');
+			console.error( 'ColladaExporter: Invalid upAxis: valid values are X_UP, Y_UP or Z_UP.' );
 			return null;
 			return null;
 
 
 		}
 		}
 
 
-		if ( (options.unitName === null) !== (options.unitMeter === null) ) {
+		if ( options.unitName !== null && options.unitMeter === null ) {
 
 
-			if ( options.unitMeter === null ) {
-
-				console.error('ColladaExporter: unitMeter needs to be specified if unitName is specified.');
-
-			}
-
-			if ( options.unitName === null ) {
+			console.error( 'ColladaExporter: unitMeter needs to be specified if unitName is specified.' );
+			return null;
 
 
-				console.error('ColladaExporter: unitName needs to be specified if unitMeter is specified.');
+		}
 
 
-			}
+		if ( options.unitMeter !== null && options.unitName === null ) {
 
 
+			console.error( 'ColladaExporter: unitName needs to be specified if unitMeter is specified.' );
 			return null;
 			return null;
 
 
 		}
 		}
@@ -661,7 +657,7 @@ class ColladaExporter {
 				'</contributor>' +
 				'</contributor>' +
 				`<created>${ ( new Date() ).toISOString() }</created>` +
 				`<created>${ ( new Date() ).toISOString() }</created>` +
 				`<modified>${ ( new Date() ).toISOString() }</modified>` +
 				`<modified>${ ( new Date() ).toISOString() }</modified>` +
-				( options.unitName !== null ? `<unit name="${ options.unitName }" meter="${ options.unitMeter }" />` : "" ) +
+				( options.unitName !== null ? `<unit name="${ options.unitName }" meter="${ options.unitMeter }" />` : '' ) +
 				`<up_axis>${ options.upAxis }</up_axis>`
 				`<up_axis>${ options.upAxis }</up_axis>`
 			) +
 			) +
 			'</asset>';
 			'</asset>';