Browse Source

Editor: Sidebar.Material clean up.

Mr.doob 10 years ago
parent
commit
57271faf7b
1 changed files with 9 additions and 69 deletions
  1. 9 69
      editor/js/Sidebar.Material.js

+ 9 - 69
editor/js/Sidebar.Material.js

@@ -6,24 +6,6 @@ Sidebar.Material = function ( editor ) {
 
 
 	var signals = editor.signals;
 	var signals = editor.signals;
 
 
-	var materialClasses = {
-
-		'LineBasicMaterial': THREE.LineBasicMaterial,
-		'LineDashedMaterial': THREE.LineDashedMaterial,
-		'MeshBasicMaterial': THREE.MeshBasicMaterial,
-		'MeshDepthMaterial': THREE.MeshDepthMaterial,
-		'MeshFaceMaterial': THREE.MeshFaceMaterial,
-		'MeshLambertMaterial': THREE.MeshLambertMaterial,
-		'MeshNormalMaterial': THREE.MeshNormalMaterial,
-		'MeshPhongMaterial': THREE.MeshPhongMaterial,
-		'PointCloudMaterial': THREE.PointCloudMaterial,
-		'ShaderMaterial': THREE.ShaderMaterial,
-		'SpriteMaterial': THREE.SpriteMaterial,
-		'SpriteCanvasMaterial': THREE.SpriteCanvasMaterial,
-		'Material': THREE.Material
-
-	};
-
 	var container = new UI.CollapsiblePanel();
 	var container = new UI.CollapsiblePanel();
 	container.setCollapsed( editor.config.getKey( 'ui/sidebar/material/collapsed' ) );
 	container.setCollapsed( editor.config.getKey( 'ui/sidebar/material/collapsed' ) );
 	container.onCollapsedChange( function ( boolean ) {
 	container.onCollapsedChange( function ( boolean ) {
@@ -77,7 +59,6 @@ Sidebar.Material = function ( editor ) {
 		'LineDashedMaterial': 'LineDashedMaterial',
 		'LineDashedMaterial': 'LineDashedMaterial',
 		'MeshBasicMaterial': 'MeshBasicMaterial',
 		'MeshBasicMaterial': 'MeshBasicMaterial',
 		'MeshDepthMaterial': 'MeshDepthMaterial',
 		'MeshDepthMaterial': 'MeshDepthMaterial',
-		'MeshFaceMaterial': 'MeshFaceMaterial',
 		'MeshLambertMaterial': 'MeshLambertMaterial',
 		'MeshLambertMaterial': 'MeshLambertMaterial',
 		'MeshNormalMaterial': 'MeshNormalMaterial',
 		'MeshNormalMaterial': 'MeshNormalMaterial',
 		'MeshPhongMaterial': 'MeshPhongMaterial',
 		'MeshPhongMaterial': 'MeshPhongMaterial',
@@ -214,18 +195,6 @@ Sidebar.Material = function ( editor ) {
 
 
 	container.add( materialAlphaMapRow );
 	container.add( materialAlphaMapRow );
 
 
-	// light map
-
-	var materialLightMapRow = new UI.Panel();
-	var materialLightMapEnabled = new UI.Checkbox( false ).onChange( update );
-	var materialLightMap = new UI.Texture().onChange( update );
-
-	materialLightMapRow.add( new UI.Text( 'Light Map' ).setWidth( '90px' ) );
-	materialLightMapRow.add( materialLightMapEnabled );
-	materialLightMapRow.add( materialLightMap );
-
-	container.add( materialLightMapRow );
-
 	// bump map
 	// bump map
 
 
 	var materialBumpMapRow = new UI.Panel();
 	var materialBumpMapRow = new UI.Panel();
@@ -411,9 +380,9 @@ Sidebar.Material = function ( editor ) {
 
 
 			}
 			}
 
 
-			if ( material instanceof materialClasses[ materialClass.getValue() ] === false ) {
+			if ( material instanceof THREE[ materialClass.getValue() ] === false ) {
 
 
-				material = new materialClasses[ materialClass.getValue() ]();
+				material = new THREE[ materialClass.getValue() ]();
 				object.material = material;
 				object.material = material;
 
 
 			}
 			}
@@ -519,25 +488,6 @@ Sidebar.Material = function ( editor ) {
 
 
 			}
 			}
 
 
-			/*
-			if ( material.lightMap !== undefined ) {
-
-				var lightMapEnabled = materialLightMapEnabled.getValue() === true;
-
-				if ( objectHasUvs )  {
-
-					material.lightMap = lightMapEnabled ? materialLightMap.getValue() : null;
-					material.needsUpdate = true;
-
-				} else {
-
-					if ( lightMapEnabled ) textureWarning = true;
-
-				}
-
-			}
-			*/
-
 			if ( material.bumpMap !== undefined ) {
 			if ( material.bumpMap !== undefined ) {
 
 
 				var bumpMapEnabled = materialBumpMapEnabled.getValue() === true;
 				var bumpMapEnabled = materialBumpMapEnabled.getValue() === true;
@@ -706,7 +656,6 @@ Sidebar.Material = function ( editor ) {
 			'skinning': materialSkinningRow,
 			'skinning': materialSkinningRow,
 			'map': materialMapRow,
 			'map': materialMapRow,
 			'alphaMap': materialAlphaMapRow,
 			'alphaMap': materialAlphaMapRow,
-			'lightMap': materialLightMapRow,
 			'bumpMap': materialBumpMapRow,
 			'bumpMap': materialBumpMapRow,
 			'normalMap': materialNormalMapRow,
 			'normalMap': materialNormalMapRow,
 			'specularMap': materialSpecularMapRow,
 			'specularMap': materialSpecularMapRow,
@@ -823,15 +772,6 @@ Sidebar.Material = function ( editor ) {
 
 
 			}
 			}
 
 
-			/*
-			if ( material.lightMap !== undefined ) {
-
-				materialLightMapEnabled.setValue( material.lightMap !== null );
-				materialLightMap.setValue( material.lightMap );
-
-			}
-			*/
-
 			if ( material.bumpMap !== undefined ) {
 			if ( material.bumpMap !== undefined ) {
 
 
 				materialBumpMapEnabled.setValue( material.bumpMap !== null );
 				materialBumpMapEnabled.setValue( material.bumpMap !== null );
@@ -862,18 +802,18 @@ Sidebar.Material = function ( editor ) {
 
 
 			}
 			}
 
 
-			if ( material.aoMap !== undefined ) {
+			if ( material.lightMap !== undefined ) {
 
 
-				materialAOMapEnabled.setValue( material.aoMap !== null );
-				materialAOMap.setValue( material.aoMap );
-				materialAOScale.setValue( material.aoMapIntensity );
+				materialLightMapEnabled.setValue( material.lightMap !== null );
+				materialLightMap.setValue( material.lightMap );
 
 
 			}
 			}
 
 
-			if ( material.lightMap !== undefined ) {
+			if ( material.aoMap !== undefined ) {
 
 
-				materialLightMapEnabled.setValue( material.lightMap !== null );
-				materialLightMap.setValue( material.lightMap );
+				materialAOMapEnabled.setValue( material.aoMap !== null );
+				materialAOMap.setValue( material.aoMap );
+				materialAOScale.setValue( material.aoMapIntensity );
 
 
 			}
 			}