Browse Source

Editor: Converted indents to tabs and clean up.

Mr.doob 12 years ago
parent
commit
1bdf6995d3

+ 659 - 659
editor/js/Editor.js

@@ -1,1100 +1,1100 @@
 var Editor = function ( scene ) {
 
-  this.geometries = {};
-  this.materials = {};
-  this.textures = {};
-  this.objects = {};
+	this.geometries = {};
+	this.materials = {};
+	this.textures = {};
+	this.objects = {};
 
-  this.selected = {};
-  this.helpers = {};
+	this.selected = {};
+	this.helpers = {};
 
-  this.scene = new THREE.Scene();
-  this.scene.name = ( scene && scene.name ) ? scene.name : 'Scene';
-  this.addObject( this.scene );
-  
-  this.sceneHelpers = new THREE.Scene();
+	this.scene = new THREE.Scene();
+	this.scene.name = ( scene && scene.name ) ? scene.name : 'Scene';
+	this.addObject( this.scene );
 
-  this.defaultMaterial = new THREE.MeshPhongMaterial();
-  this.defaultMaterial.name = 'Default Material';
-  this.addMaterial( this.defaultMaterial );
+	this.sceneHelpers = new THREE.Scene();
+
+	this.defaultMaterial = new THREE.MeshPhongMaterial();
+	this.defaultMaterial.name = 'Default Material';
+	this.addMaterial( this.defaultMaterial );
 
 }
 
 Editor.prototype = {
 
-  // Assets
+	// Assets
+
+	setScene: function( scene ) {
+
+		this.deleteAll(); // WARNING! deletes everything 
+
+		if ( scene ) {
+
+			this.scene.name = scene.name;
+			this.scene.userData = JSON.parse( JSON.stringify( scene.userData ) );
+
+			if ( scene.children.length ) this.addObject( scene.children );
+
+		}
+
+		signals.sceneChanged.dispatch( this.scene );
+
+		return this.scene 
+
+	},
+
+	createObject: function( type, parameters, material ) {
+
+		type = type ? type : 'Group';
+
+		var object;
+		var geometry;
+
+		material = material ? material : this.defaultMaterial;
+
+		parameters = parameters ? parameters : {};
+
+		var name = parameters.name ? parameters.name : this.incrementName( type, 'object' );
+		var color = parameters.color ? parameters.color : null;
+		var groundColor = parameters.groundColor ? parameters.groundColor : null;
+		var intensity = parameters.intensity ? parameters.intensity : null;
+		var distance = parameters.distance ? parameters.distance : null;
+		var angle = parameters.angle ? parameters.angle : null;
+		var exponent = parameters.exponent ? parameters.exponent : null;
+
+		if ( type == 'Group' ) {
 
-  setScene: function( scene ) {
+			object = new THREE.Object3D();
 
-    this.deleteAll(); // WARNING! deletes everything 
+		} else if ( type == 'Plane' ) {
 
-    if ( scene ) {
+			geometry = this.createGeometry( type, parameters );
+			object = new THREE.Mesh( geometry, this.defaultMaterial );
 
-      this.scene.name = scene.name;
-      this.scene.userData = JSON.parse( JSON.stringify( scene.userData ) );
+			object.rotation.x = - Math.PI/2;
 
-      if ( scene.children.length ) this.addObject( scene.children );
+		} else if ( type == 'Cube' ) {
 
-    }
+			geometry = this.createGeometry( type, parameters );
+			object = new THREE.Mesh( geometry, this.defaultMaterial );
 
-    signals.sceneChanged.dispatch( this.scene );
+		} else if ( type == 'Cylinder' ) {
 
-    return this.scene 
+			geometry = this.createGeometry( type, parameters );
+			object = new THREE.Mesh( geometry, this.defaultMaterial );
 
-  },
+		} else if ( type == 'Sphere' ) {
 
-  createObject: function( type, parameters, material ) {
+			geometry = this.createGeometry( type, parameters );
+			object = new THREE.Mesh( geometry, this.defaultMaterial );
 
-    type = type ? type : 'Group';
+		} else if ( type == 'Icosahedron' ) {
 
-    var object;
-    var geometry;
+			geometry = this.createGeometry( type, parameters );
+			object = new THREE.Mesh( geometry, this.defaultMaterial );
 
-    material = material ? material : this.defaultMaterial;
+		} else if ( type == 'Torus' ) {
 
-    parameters = parameters ? parameters : {};
+			geometry = this.createGeometry( type, parameters );
+			object = new THREE.Mesh( geometry, this.defaultMaterial );
 
-    var name = parameters.name ? parameters.name : this.incrementName( type, 'object' );
-    var color = parameters.color ? parameters.color : null;
-    var groundColor = parameters.groundColor ? parameters.groundColor : null;
-    var intensity = parameters.intensity ? parameters.intensity : null;
-    var distance = parameters.distance ? parameters.distance : null;
-    var angle = parameters.angle ? parameters.angle : null;
-    var exponent = parameters.exponent ? parameters.exponent : null;
+		} else if ( type == 'TorusKnot' ) {
 
-    if ( type == 'Group' ) {
+			geometry = this.createGeometry( type, parameters );
+			object = new THREE.Mesh( geometry, this.defaultMaterial );
 
-      object = new THREE.Object3D();
+		} else if ( type == 'PointLight' ) {
 
-    } else if ( type == 'Plane' ) {
+			color = color ? color : 0xffffff;
+			intensity = intensity ? intensity : 1;
+			distance = distance ? distance : 0;
 
-      geometry = this.createGeometry( type, parameters );
-      object = new THREE.Mesh( geometry, this.defaultMaterial );
+			object = new THREE.PointLight( color, intensity, distance );
 
-      object.rotation.x = - Math.PI/2;
+		} else if ( type == 'SpotLight' ) {
 
-    } else if ( type == 'Cube' ) {
+			color = color ? color : 0xffffff;
+			intensity = intensity ? intensity : 1;
+			distance = distance ? distance : 0;
+			angle = angle ? angle : Math.PI * 0.1;
+			exponent = exponent ? exponent : 10;
 
-      geometry = this.createGeometry( type, parameters );
-      object = new THREE.Mesh( geometry, this.defaultMaterial );
+			object = new THREE.SpotLight( color, intensity, distance, angle, exponent );
+			object.target.name = object.name + ' Target';
 
-    } else if ( type == 'Cylinder' ) {
+			object.position.set( 0, 1, 0 ).multiplyScalar( 200 );
 
-      geometry = this.createGeometry( type, parameters );
-      object = new THREE.Mesh( geometry, this.defaultMaterial );
+		} else if ( type == 'DirectionalLight' ) {
 
-    } else if ( type == 'Sphere' ) {
+			color = color ? color : 0xffffff;
+			intensity = intensity ? intensity : 1;
 
-      geometry = this.createGeometry( type, parameters );
-      object = new THREE.Mesh( geometry, this.defaultMaterial );
+			object = new THREE.DirectionalLight( color, intensity );
+			object.target.name = object.name + ' Target';
 
-    } else if ( type == 'Icosahedron' ) {
+			object.position.set( 1, 1, 1 ).multiplyScalar( 200 );
 
-      geometry = this.createGeometry( type, parameters );
-      object = new THREE.Mesh( geometry, this.defaultMaterial );
+		} else if ( type == 'HemisphereLight' ) {
 
-    } else if ( type == 'Torus' ) {
+			color = color ? color : 0x00aaff;
+			groundColor = groundColor ? groundColor : 0xffaa00;
+			intensity = intensity ? intensity : 1;
 
-      geometry = this.createGeometry( type, parameters );
-      object = new THREE.Mesh( geometry, this.defaultMaterial );
-      
-    } else if ( type == 'TorusKnot' ) {
+			object = new THREE.HemisphereLight( color, groundColor, intensity );
 
-      geometry = this.createGeometry( type, parameters );
-      object = new THREE.Mesh( geometry, this.defaultMaterial );
+			object.position.set( 1, 1, 1 ).multiplyScalar( 200 );
 
-    } else if ( type == 'PointLight' ) {
+		} else if ( type == 'AmbientLight' ) {
 
-      color = color ? color : 0xffffff;
-      intensity = intensity ? intensity : 1;
-      distance = distance ? distance : 0;
+			color = color ? color : 0x222222;
 
-      object = new THREE.PointLight( color, intensity, distance );
+			object = new THREE.AmbientLight( color );
 
-    } else if ( type == 'SpotLight' ) {
+		}
 
-      color = color ? color : 0xffffff;
-      intensity = intensity ? intensity : 1;
-      distance = distance ? distance : 0;
-      angle = angle ? angle : Math.PI * 0.1;
-      exponent = exponent ? exponent : 10;
+		object.name = name;
+		this.addObject( object );
 
-      object = new THREE.SpotLight( color, intensity, distance, angle, exponent );
-      object.target.name = object.name + ' Target';
+		return object;
 
-      object.position.set( 0, 1, 0 ).multiplyScalar( 200 );
+	},
 
-    } else if ( type == 'DirectionalLight' ) {
+	createGeometry: function( type, parameters ) {
 
-      color = color ? color : 0xffffff;
-      intensity = intensity ? intensity : 1;
+		type = type ? type : 'Geometry';
+		parameters = parameters ? parameters : {};
 
-      object = new THREE.DirectionalLight( color, intensity );
-      object.target.name = object.name + ' Target';
+		var name = parameters.name ? parameters.name : this.incrementName( type + 'Geometry', 'geometry' );
+		var width = parameters.width ? parameters.width : null;
+		var height = parameters.height ? parameters.height : null;
+		var depth = parameters.depth ? parameters.depth : null;
+		var widthSegments = parameters.widthSegments ? parameters.widthSegments : null;
+		var heightSegments = parameters.heightSegments ? parameters.heightSegments : null;
+		var depthSegments = parameters.depthSegments ? parameters.depthSegments : null;
+		var radialSegments = parameters.radialSegments ? parameters.radialSegments : null;
+		var tubularSegments = parameters.tubularSegments ? parameters.tubularSegments : null;
+		var radius = parameters.radius ? parameters.radius : null;
+		var radiusTop = parameters.radiusTop ? parameters.radiusTop : null;
+		var radiusBottom = parameters.radiusBottom ? parameters.radiusBottom : null;
+		var phiStart = parameters.phiStart ? parameters.phiStart : null;
+		var phiLength = parameters.phiLength ? parameters.phiLength : null;
+		var thetaStart = parameters.thetaStart ? parameters.thetaStart : null;
+		var thetaLength = parameters.thetaLength ? parameters.thetaLength : null;
+		var tube = parameters.tube ? parameters.tube : null;
+		var arc = parameters.arc ? parameters.arc : null;
+		var detail = parameters.detail ? parameters.detail : null;
+		var p = parameters.p ? parameters.p : null;
+		var q = parameters.q ? parameters.q : null;
+		var heightScale = parameters.heightScale ? parameters.heightScale : null;
+		var openEnded = parameters.openEnded ? parameters.openEnded : false;
 
-      object.position.set( 1, 1, 1 ).multiplyScalar( 200 );
+		var geometry;
 
-    } else if ( type == 'HemisphereLight' ) {
+		if ( type == 'Geometry' ) {
 
-      color = color ? color : 0x00aaff;
-      groundColor = groundColor ? groundColor : 0xffaa00;
-      intensity = intensity ? intensity : 1;
+			geometry = new THREE.Geometry();
 
-      object = new THREE.HemisphereLight( color, groundColor, intensity );
+		} else if ( type == 'Plane' ) {
 
-      object.position.set( 1, 1, 1 ).multiplyScalar( 200 );
+			width = width ? width : 200;
+			height = height ? height : 200;
+			widthSegments = widthSegments ? widthSegments : 1;
+			heightSegments = heightSegments ? heightSegments : 1;
 
-    } else if ( type == 'AmbientLight' ) {
+			geometry = new THREE.PlaneGeometry( width, height, widthSegments, heightSegments );
 
-      color = color ? color : 0x222222;
+		} else if ( type == 'Cube' ) {
 
-      object = new THREE.AmbientLight( color );
+			width = width ? width : 100;
+			height = height ? height : 100;
+			depth = depth ? depth : 100;
+			widthSegments = widthSegments ? widthSegments : 1;
+			heightSegments = heightSegments ? heightSegments : 1;
+			depthSegments = depthSegments ? depthSegments : 1;
 
-    }
+			geometry = new THREE.CubeGeometry( width, height, depth, widthSegments, heightSegments, depthSegments );
 
-    object.name = name;
-    this.addObject( object );
+		} else if ( type == 'Cylinder' ) {
 
-    return object;
+			radiusTop = radiusTop ? radiusTop : 20;
+			radiusBottom = radiusBottom ? radiusBottom : 20;
+			height = height ? height : 100;
+			radialSegments = radialSegments ? radialSegments : 8;
+			heightSegments = heightSegments ? heightSegments : 1;
+			openEnded = openEnded ? openEnded : false;
 
-  },
+			geometry = new THREE.CylinderGeometry( radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded );
 
-  createGeometry: function( type, parameters ) {
+		} else if ( type == 'Sphere' ) {
 
-    type = type ? type : 'Geometry';
-    parameters = parameters ? parameters : {};
+			radius = radius ? radius : 75;
+			widthSegments = widthSegments ? widthSegments : 32;
+			heightSegments = heightSegments ? heightSegments : 16;
+			widthSegments = widthSegments ? widthSegments : 32;
+			heightSegments = heightSegments ? heightSegments : 16;
+			phiStart = phiStart ? phiStart : 0;
+			phiLength = phiLength ? phiLength : Math.PI * 2;
+			thetaStart = thetaStart ? thetaStart : 0;
+			thetaLength = thetaLength ? thetaLength : Math.PI;
 
-    var name = parameters.name ? parameters.name : this.incrementName( type + 'Geometry', 'geometry' );
-    var width = parameters.width ? parameters.width : null;
-    var height = parameters.height ? parameters.height : null;
-    var depth = parameters.depth ? parameters.depth : null;
-    var widthSegments = parameters.widthSegments ? parameters.widthSegments : null;
-    var heightSegments = parameters.heightSegments ? parameters.heightSegments : null;
-    var depthSegments = parameters.depthSegments ? parameters.depthSegments : null;
-    var radialSegments = parameters.radialSegments ? parameters.radialSegments : null;
-    var tubularSegments = parameters.tubularSegments ? parameters.tubularSegments : null;
-    var radius = parameters.radius ? parameters.radius : null;
-    var radiusTop = parameters.radiusTop ? parameters.radiusTop : null;
-    var radiusBottom = parameters.radiusBottom ? parameters.radiusBottom : null;
-    var phiStart = parameters.phiStart ? parameters.phiStart : null;
-    var phiLength = parameters.phiLength ? parameters.phiLength : null;
-    var thetaStart = parameters.thetaStart ? parameters.thetaStart : null;
-    var thetaLength = parameters.thetaLength ? parameters.thetaLength : null;
-    var tube = parameters.tube ? parameters.tube : null;
-    var arc = parameters.arc ? parameters.arc : null;
-    var detail = parameters.detail ? parameters.detail : null;
-    var p = parameters.p ? parameters.p : null;
-    var q = parameters.q ? parameters.q : null;
-    var heightScale = parameters.heightScale ? parameters.heightScale : null;
-    var openEnded = parameters.openEnded ? parameters.openEnded : false;
+			geometry = new THREE.SphereGeometry( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength );
 
-    var geometry;
+		} else if ( type == 'Icosahedron' ) {
 
-    if ( type == 'Geometry' ) {
+			radius = radius ? radius : 75;
+			detail = detail ? detail : 2;
 
-      geometry = new THREE.Geometry();
+			geometry = new THREE.IcosahedronGeometry ( radius, detail );
 
-    } else if ( type == 'Plane' ) {
+		} else if ( type == 'Torus' ) {
 
-      width = width ? width : 200;
-      height = height ? height : 200;
-      widthSegments = widthSegments ? widthSegments : 1;
-      heightSegments = heightSegments ? heightSegments : 1;
+			radius = radius ? radius : 100;
+			tube = tube ? tube : 40;
+			radialSegments = radialSegments ? radialSegments : 8;
+			tubularSegments = tubularSegments ? tubularSegments : 6;
+			arc = arc ? arc : Math.PI * 2;
 
-      geometry = new THREE.PlaneGeometry( width, height, widthSegments, heightSegments );
+			geometry = new THREE.TorusGeometry( radius, tube, radialSegments, tubularSegments, arc );
 
-    } else if ( type == 'Cube' ) {
+		} else if ( type == 'TorusKnot' ) {
 
-      width = width ? width : 100;
-      height = height ? height : 100;
-      depth = depth ? depth : 100;
-      widthSegments = widthSegments ? widthSegments : 1;
-      heightSegments = heightSegments ? heightSegments : 1;
-      depthSegments = depthSegments ? depthSegments : 1;
+			radius = radius ? radius : 100;
+			tube = tube ? tube : 40;
+			radialSegments = radialSegments ? radialSegments : 64;
+			tubularSegments = tubularSegments ? tubularSegments : 8;
+			p = p ? p : 2;
+			q = q ? q : 3;
+			heightScale = heightScale ? heightScale : 1;
 
-      geometry = new THREE.CubeGeometry( width, height, depth, widthSegments, heightSegments, depthSegments );
+			geometry = new THREE.TorusKnotGeometry( radius, tube, radialSegments, tubularSegments, p, q, heightScale );
 
-    } else if ( type == 'Cylinder' ) {
+		}
 
-      radiusTop = radiusTop ? radiusTop : 20;
-      radiusBottom = radiusBottom ? radiusBottom : 20;
-      height = height ? height : 100;
-      radialSegments = radialSegments ? radialSegments : 8;
-      heightSegments = heightSegments ? heightSegments : 1;
-      openEnded = openEnded ? openEnded : false;
+		geometry.name = name;
+		geometry.computeBoundingSphere();
 
-      geometry = new THREE.CylinderGeometry( radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded );
+		return geometry;
 
-    } else if ( type == 'Sphere' ) {
+	},
 
-      radius = radius ? radius : 75;
-      widthSegments = widthSegments ? widthSegments : 32;
-      heightSegments = heightSegments ? heightSegments : 16;
-      widthSegments = widthSegments ? widthSegments : 32;
-      heightSegments = heightSegments ? heightSegments : 16;
-      phiStart = phiStart ? phiStart : 0;
-      phiLength = phiLength ? phiLength : Math.PI * 2;
-      thetaStart = thetaStart ? thetaStart : 0;
-      thetaLength = thetaLength ? thetaLength : Math.PI;
+	createMaterial: function( type, parameters ) {
 
-      geometry = new THREE.SphereGeometry( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength );
+		type = type ? type : 'MeshPhongMaterial';
 
-    } else if ( type == 'Icosahedron' ) {
+		parameters = parameters ? parameters : {};
 
-      radius = radius ? radius : 75;
-      detail = detail ? detail : 2;
+		var material;
+		var name = parameters.name ? parameters.name : this.incrementName( type, 'material' );
 
-      geometry = new THREE.IcosahedronGeometry ( radius, detail );
+		if ( type == 'MeshPhongMaterial' ) {
 
-    } else if ( type == 'Torus' ) {
+			material = new THREE.MeshPhongMaterial( parameters );
 
-      radius = radius ? radius : 100;
-      tube = tube ? tube : 40;
-      radialSegments = radialSegments ? radialSegments : 8;
-      tubularSegments = tubularSegments ? tubularSegments : 6;
-      arc = arc ? arc : Math.PI * 2;
+		} else if ( type == 'MeshLambertMaterial' ) {
 
-      geometry = new THREE.TorusGeometry( radius, tube, radialSegments, tubularSegments, arc );
+			material = new THREE.MeshLambertMaterial( parameters );
 
-    } else if ( type == 'TorusKnot' ) {
+		} else if ( type == 'MeshNormalMaterial' ) {
 
-      radius = radius ? radius : 100;
-      tube = tube ? tube : 40;
-      radialSegments = radialSegments ? radialSegments : 64;
-      tubularSegments = tubularSegments ? tubularSegments : 8;
-      p = p ? p : 2;
-      q = q ? q : 3;
-      heightScale = heightScale ? heightScale : 1;
+			material = new THREE.MeshNormalMaterial( parameters );
 
-      geometry = new THREE.TorusKnotGeometry( radius, tube, radialSegments, tubularSegments, p, q, heightScale );
+		} else if ( type == 'MeshBasicMaterial' ) {
 
-    }
+			material = new THREE.MeshBasicMaterial( parameters );
 
-    geometry.name = name;
-    geometry.computeBoundingSphere();
+		}
 
-    return geometry;
+		material.name = name;
+		this.addMaterial( material );
+		return material;
 
-  },
+	},
 
-  createMaterial: function( type, parameters ) {
-    
-    type = type ? type : 'MeshPhongMaterial';
+	createTexture: function( image, parameters ) {
 
-    parameters = parameters ? parameters : {};
+		image = image ? image : '../examples/textures/ash_uvgrid01.jpg';
 
-    var material;
-    var name = parameters.name ? parameters.name : this.incrementName( type, 'material' );
+		parameters = parameters ? parameters : {};
 
-    if ( type == 'MeshPhongMaterial' ) {
+		// TODO: implement parameters
 
-      material = new THREE.MeshPhongMaterial( parameters );
+		var texture = THREE.ImageUtils.loadTexture( image );
+		texture.name = parameters.name ? parameters.name : this.incrementName( 'Texture', 'texture' );
 
-    } else if ( type == 'MeshLambertMaterial' ) {
+		this.addTexture( texture );
+		return texture;
 
-      material = new THREE.MeshLambertMaterial( parameters );
+	},
 
-    } else if ( type == 'MeshNormalMaterial' ) {
+	addObject: function( list, parent ) {
 
-      material = new THREE.MeshNormalMaterial( parameters );
+		list = ( list instanceof Array ) ? [].concat( list ) : [ list ];
 
-    } else if ( type == 'MeshBasicMaterial' ) {
+		parent = parent ? parent : this.scene;
 
-      material = new THREE.MeshBasicMaterial( parameters );
+		for ( var i in list ) {
 
-    }
+			this.objects[ list[ i ].id ] = list[ i ];
+			this.addHelper( list[ i ] );
 
-    material.name = name;
-    this.addMaterial( material );
-    return material;
+			if ( list[ i ].target ) {
 
-  },
+				this.objects[ list[ i ].target.id ] = list[ i ].target;
 
-  createTexture: function( image, parameters ) {
+			}
 
-    image = image ? image : '../examples/textures/ash_uvgrid01.jpg';
+			if ( list[ i ].material ) this.addMaterial( list[ i ].material );
+			if ( list[ i ].geometry ) this.addGeometry( list[ i ].geometry );
 
-    parameters = parameters ? parameters : {};
+			if ( parent != list[ i ] ) {
 
-    // TODO: implement parameters
+				// Add object to the scene
 
-    var texture = THREE.ImageUtils.loadTexture( image );
-    texture.name = parameters.name ? parameters.name : this.incrementName( 'Texture', 'texture' );
+				parent.add( list[ i ] );
 
-    this.addTexture( texture );
-    return texture;
+				if ( list[ i ] instanceof THREE.Light ) this.updateMaterials();
 
-  },
+				signals.objectAdded.dispatch( list[ i ] );
 
-  addObject: function( list, parent ) {
+				// Continue adding children
 
-    list = ( list instanceof Array ) ? [].concat( list ) : [ list ];
+				if ( list[ i ].children && list[ i ].children.length ) {
 
-    parent = parent ? parent : this.scene;
+					this.addObject( list[ i ].children, list[ i ] );
 
-    for ( var i in list ) {
+				}
 
-      this.objects[ list[ i ].id ] = list[ i ];
-      this.addHelper( list[ i ] );
+			}
 
-      if ( list[ i ].target ) {
+		}
 
-        this.objects[ list[ i ].target.id ] = list[ i ].target;
+		signals.sceneChanged.dispatch( this.scene );
 
-      }
+	},
 
-      if ( list[ i ].material ) this.addMaterial( list[ i ].material );
-      if ( list[ i ].geometry ) this.addGeometry( list[ i ].geometry );
+	addHelper: function( object ) {
 
-      if ( parent != list[ i ] ) {
+		if ( object instanceof THREE.PointLight ) {
 
-        // Add object to the scene
+			this.helpers[ object.id ] = new THREE.PointLightHelper( object, 10 );
+			this.sceneHelpers.add( this.helpers[ object.id ] );
+			this.helpers[ object.id ].lightSphere.id = object.id;
 
-        parent.add( list[ i ] );
+		} else if ( object instanceof THREE.DirectionalLight ) {
 
-        if ( list[ i ] instanceof THREE.Light ) this.updateMaterials();
+			this.helpers[ object.id ] = new THREE.DirectionalLightHelper( object, 10 );
+			this.sceneHelpers.add( this.helpers[ object.id ] );
+			this.helpers[ object.id ].lightSphere.id = object.id;
 
-        signals.objectAdded.dispatch( list[ i ] );
+		} else if ( object instanceof THREE.SpotLight ) {
 
-        // Continue adding children
+			this.helpers[ object.id ] = new THREE.SpotLightHelper( object, 10 );
+			this.sceneHelpers.add( this.helpers[ object.id ] );
+			// this.helpers[ object.id ].lightSphere.id = object.id;
 
-        if ( list[ i ].children && list[ i ].children.length ) {
+		} else if ( object instanceof THREE.HemisphereLight ) {
 
-          this.addObject( list[ i ].children, list[ i ] );
+			this.helpers[ object.id ] = new THREE.HemisphereLightHelper( object, 10 );
+			this.sceneHelpers.add( this.helpers[ object.id ] );
+			this.helpers[ object.id ].lightSphere.id = object.id;
 
-        }
+		}
 
-      }
+		signals.sceneChanged.dispatch( this.scene );
 
-    }
+	},
 
-    signals.sceneChanged.dispatch( this.scene );
+	deleteHelper: function( object ) {
 
-  },
+		if ( this.helpers[ object.id ] ) {
 
-  addHelper: function( object ) {
+			this.helpers[ object.id ].parent.remove( this.helpers[ object.id ] );
+			delete this.helpers[ object.id ];
 
-    if ( object instanceof THREE.PointLight ) {
+		}
 
-      this.helpers[ object.id ] = new THREE.PointLightHelper( object, 10 );
-      this.sceneHelpers.add( this.helpers[ object.id ] );
-      this.helpers[ object.id ].lightSphere.id = object.id;
+	},
 
-    } else if ( object instanceof THREE.DirectionalLight ) {
+	addGeometry: function( geometry ) {
 
-      this.helpers[ object.id ] = new THREE.DirectionalLightHelper( object, 10 );
-      this.sceneHelpers.add( this.helpers[ object.id ] );
-      this.helpers[ object.id ].lightSphere.id = object.id;
+		this.geometries[ geometry.id ] = geometry;
+		signals.geometryAdded.dispatch( geometry );
 
-    } else if ( object instanceof THREE.SpotLight ) {
+	},
 
-      this.helpers[ object.id ] = new THREE.SpotLightHelper( object, 10 );
-      this.sceneHelpers.add( this.helpers[ object.id ] );
-      // this.helpers[ object.id ].lightSphere.id = object.id;
+	addMaterial: function( material ) {
 
-    } else if ( object instanceof THREE.HemisphereLight ) {
+		if ( material.name == 'Default Material' ) {
+			this.delete( this.defaultMaterial );
+			this.defaultMaterial = material;
+		}
 
-      this.helpers[ object.id ] = new THREE.HemisphereLightHelper( object, 10 );
-      this.sceneHelpers.add( this.helpers[ object.id ] );
-      this.helpers[ object.id ].lightSphere.id = object.id;
+		this.materials[ material.id ] = material;
+		signals.materialAdded.dispatch( material );
+		signals.sceneChanged.dispatch( this.scene );
 
-    }
+	},
 
-    signals.sceneChanged.dispatch( this.scene );
+	addTexture: function( texture ) {
 
-  },
+		this.textures[ texture.id ] = texture;
+		signals.textureAdded.dispatch( texture );
+		signals.sceneChanged.dispatch( this.scene );
 
-  deleteHelper: function( object ) {
+	},
 
-    if ( this.helpers[ object.id ] ) {
+	// Selection
 
-      this.helpers[ object.id ].parent.remove( this.helpers[ object.id ] );
-      delete this.helpers[ object.id ];
+	select: function( list, additive ) {
 
-    }
+		//TODO toggle
 
-  },
+		list = ( list instanceof Array ) ? list : [ list ];
 
-  addGeometry: function( geometry ) {
+		if ( !additive ) this.selected = {};
 
-    this.geometries[ geometry.id ] = geometry;
-    signals.geometryAdded.dispatch( geometry );
+		for ( var i in list ) {
 
-  },
+			this.selected[ list[ i ].id ] = list[ i ];
 
-  addMaterial: function( material ) {
+		}
 
-    if ( material.name == 'Default Material' ) {
-      this.delete( this.defaultMaterial );
-      this.defaultMaterial = material;
-    }
+		signals.selected.dispatch( this.selected );
 
-    this.materials[ material.id ] = material;
-    signals.materialAdded.dispatch( material );
-    signals.sceneChanged.dispatch( this.scene );
+	},
 
-  },
+	selectById: function( id, additive ) {
 
-  addTexture: function( texture ) {
+		var list = this.list();
 
-    this.textures[ texture.id ] = texture;
-    signals.textureAdded.dispatch( texture );
-    signals.sceneChanged.dispatch( this.scene );
+		if ( !additive ) this.selected = {};
 
-  },
+		for ( var i in list ) {
 
-  // Selection
+			if ( list[ i ].id == id ) this.select( list[ i ], true );
 
-  select: function( list, additive ) {
+		}
 
-    //TODO toggle
+	},
 
-    list = ( list instanceof Array ) ? list : [ list ];
+	selectByName: function( name, type, additive ) {
 
-    if ( !additive ) this.selected = {};
+		type = type ? type : "all";
 
-    for ( var i in list ) {
+		this.select( this.listByName( name, type ), additive );
 
-      this.selected[ list[ i ].id ] = list[ i ];
+	},
 
-    }
+	selectAll: function( type, additive ) {
 
-    signals.selected.dispatch( this.selected );
+		type = type ? type : "all";
 
-  },
+		this.select( this.listByName( '*', type ), additive );
 
-  selectById: function( id, additive ) {
+	},
 
-    var list = this.list();
+	deselect: function( list ) {
 
-    if ( !additive ) this.selected = {};
+		list = ( list instanceof Array ) ? list : [ list ];
 
-    for ( var i in list ) {
+		for ( var i in list ) {
 
-      if ( list[ i ].id == id ) this.select( list[ i ], true );
+			if ( this.selected[ list[ i ].id ] ) delete this.selected[ list[ i ].id ];
 
-    }
+		}
 
-  },
+		signals.selected.dispatch( this.selected );
 
-  selectByName: function( name, type, additive ) {
+	},
 
-    type = type ? type : "all";
+	deselectById: function( id ) {
 
-    this.select( this.listByName( name, type ), additive );
+		if ( this.selected[ id ] ) delete this.selected[ id ];
 
-  },
+	},
 
-  selectAll: function( type, additive ) {
+	deselectByName: function( name, type ) {
 
-    type = type ? type : "all";
+		type = type ? type : "all";
 
-    this.select( this.listByName( '*', type ), additive );
+		this.deselect( this.listByName( name, type ) );
 
-  },
+	},
 
-  deselect: function( list ) {
+	deselectAll: function( type ) {
 
-    list = ( list instanceof Array ) ? list : [ list ];
+		type = type ? type : "all";
 
-    for ( var i in list ) {
+		this.deselect( this.list( "all" ) );
 
-      if ( this.selected[ list[ i ].id ] ) delete this.selected[ list[ i ].id ];
+	},
 
-    }
+	pickWalk: function( direction ) {
 
-    signals.selected.dispatch( this.selected );
+		direction = direction.toLowerCase();
 
-  },
+		var selection = this.listSelected();
+		var newSelection = [];
 
-  deselectById: function( id ) {
+		if ( direction === 'up' ) {
 
-    if ( this.selected[ id ] ) delete this.selected[ id ];
+			for ( var i in selection ) {
 
-  },
+				if ( selection[ i ].parent )
+					newSelection.push( selection[ i ].parent );
 
-  deselectByName: function( name, type ) {
+				else newSelection.push( selection[ i ] );
 
-    type = type ? type : "all";
+			}
 
-    this.deselect( this.listByName( name, type ) );
+		} else if ( direction === 'down' ) {
 
-  },
+			for ( var i in selection ) {
 
-  deselectAll: function( type ) {
+				if ( selection[ i ].children && selection[ i ].children.length )
+					newSelection.push( selection[ i ].children[0] );
 
-    type = type ? type : "all";
+				else newSelection.push( selection[ i ] );
 
-    this.deselect( this.list( "all" ) );
+			}
 
-  },
+		} else if ( direction === 'left' || direction === 'right' ) {
 
-  pickWalk: function( direction ) {
+			for ( var i in selection ) {
 
-    direction = direction.toLowerCase();
+				var siblings = null;
+				var index = null;
+				var newIndex = null;
 
-    var selection = this.listSelected();
-    var newSelection = [];
+				if ( selection[ i ].parent ) {
 
-    if ( direction === 'up' ) {
+					siblings = selection[ i ].parent.children;
+					index = selection[ i ].parent.children.indexOf( selection[ i ] );
+					newIndex = index;
 
-      for ( var i in selection ) {
+					if ( siblings.length > 1 && direction === 'left' )
+						newIndex = ( index + siblings.length + 1 ) % siblings.length;
 
-        if ( selection[ i ].parent )
-          newSelection.push( selection[ i ].parent );
-        
-        else newSelection.push( selection[ i ] );
+					else if ( siblings.length > 1 && direction === 'right' )
+						newIndex = ( index + siblings.length - 1 ) % siblings.length;
 
-      }
+					newSelection.push( siblings[ newIndex ] );
 
-    } else if ( direction === 'down' ) {
+				} else {
 
-      for ( var i in selection ) {
+					newSelection.push( selection[ i ] );
 
-        if ( selection[ i ].children && selection[ i ].children.length )
-          newSelection.push( selection[ i ].children[0] );
-        
-        else newSelection.push( selection[ i ] );
+				}
 
-      }
+			}
 
-    } else if ( direction === 'left' || direction === 'right' ) {
+		}
 
-      for ( var i in selection ) {
+		if ( newSelection.length ) this.select( newSelection );
 
-        var siblings = null;
-        var index = null;
-        var newIndex = null;
+	},
 
-        if ( selection[ i ].parent ) {
+	// List
 
-          siblings = selection[ i ].parent.children;
-          index = selection[ i ].parent.children.indexOf( selection[ i ] );
-          newIndex = index;
+	list: function( type ) {
 
-          if ( siblings.length > 1 && direction === 'left' )
-            newIndex = ( index + siblings.length + 1 ) % siblings.length;
+		type = type ? type : "all";
 
-          else if ( siblings.length > 1 && direction === 'right' )
-            newIndex = ( index + siblings.length - 1 ) % siblings.length;
-          
-          newSelection.push( siblings[ newIndex ] );
+		var list = this.listByName( '*', type );
 
-        } else {
+		return list;
 
-          newSelection.push( selection[ i ] );
+	},
 
-        }
+	listSelected: function( type ) {
 
-      }
+		var list = this.listByName( '*', 'selected' );
 
-    }
+		if ( type ) {
 
-    if ( newSelection.length ) this.select( newSelection );
+			var typeList = this.listByName( '*', type );
 
-  },
+			var list = list.filter(function(n) {
+				if(typeList.indexOf(n) == -1) return false;
+				return true;
+			});
 
-  // List
+		} 
 
-  list: function( type ) {
+		return list;
 
-    type = type ? type : "all";
+	},
 
-    var list = this.listByName( '*', type );
+	listByName: function( name, type ) {
 
-    return list;
+		type = type ? type.toLowerCase() : "all";
 
-  },
+		var scope = this;
+		var list = [];
 
-  listSelected: function( type ) {
+		function listFromMap( map, name ) {
 
-    var list = this.listByName( '*', 'selected' );
+			for ( var id in map ) {
 
-    if ( type ) {
+				if ( scope.regexMatch( map[ id ].name, name ) ) {
 
-      var typeList = this.listByName( '*', type );
+					list.push( map[ id ] );
 
-      var list = list.filter(function(n) {
-        if(typeList.indexOf(n) == -1) return false;
-        return true;
-      });
+				}
 
-    } 
 
-    return list;
+			}
 
-  },
+		}
 
-  listByName: function( name, type ) {
+		if ( type == 'all' || type == 'object' ) {
 
-    type = type ? type.toLowerCase() : "all";
+			listFromMap( this.objects, name );
 
-    var scope = this;
-    var list = [];
+		}
 
-    function listFromMap( map, name ) {
+		if ( type == 'all' || type == 'geometry' ) {
 
-      for ( var id in map ) {
+			listFromMap( this.geometries, name );
 
-        if ( scope.regexMatch( map[ id ].name, name ) ) {
+		}
 
-          list.push( map[ id ] );
+		if ( type == 'all' || type == 'material' ) {
 
-        }
+			listFromMap( this.materials, name );
 
+		}
 
-      }
+		if ( type == 'all' || type == 'texture' ) {
 
-    }
-    
-    if ( type == 'all' || type == 'object' ) {
+			listFromMap( this.textures, name );
 
-      listFromMap( this.objects, name );
+		}
 
-    }
+		if ( type == 'all' || type == 'selected' ) {
 
-    if ( type == 'all' || type == 'geometry' ) {
+			listFromMap( this.selected, name );
 
-      listFromMap( this.geometries, name );
+		}
 
-    }
+		return list;
 
-    if ( type == 'all' || type == 'material' ) {
+	},
 
-      listFromMap( this.materials, name );
+	// Delete
 
-    }
+	delete: function( list ) {
 
-    if ( type == 'all' || type == 'texture' ) {
+		list = list ? list : this.list( 'selected' );
 
-      listFromMap( this.textures, name );
+		list = ( list instanceof Array ) ? list : [ list ];
 
-    }
+		this.deselect( list );
 
-    if ( type == 'all' || type == 'selected' ) {
+		var deletedObjects = {};
 
-      listFromMap( this.selected, name );
+		for ( var i in list ) {
 
-    }
+			if ( this.objects[ list[ i ].id ] && list[ i ] != this.scene ) {
 
-    return list;
+				delete this.objects[ list[ i ].id ];
+				this.deleteHelper( list[ i ] );
 
-  },
+				deletedObjects[ list[ i ].id ] = list[ i ];
 
-  // Delete
+				if ( list[ i ] instanceof THREE.Light ) this.updateMaterials();
 
-  delete: function( list ) {
+				signals.objectDeleted.dispatch();
 
-    list = list ? list : this.list( 'selected' );
+				if ( list[ i ].children.length ) this.delete( list[ i ].children );
 
-    list = ( list instanceof Array ) ? list : [ list ];
+			}
 
-    this.deselect( list );
+			if ( this.geometries[ list[ i ].id ] ) {
 
-    var deletedObjects = {};
+				delete this.geometries[ list[ i ].id ];
+				signals.objectDeleted.dispatch();
 
-    for ( var i in list ) {
-      
-      if ( this.objects[ list[ i ].id ] && list[ i ] != this.scene ) {
+			}
 
-        delete this.objects[ list[ i ].id ];
-        this.deleteHelper( list[ i ] );
+			if ( this.materials[ list[ i ].id ] ) {
 
-        deletedObjects[ list[ i ].id ] = list[ i ];
+				delete this.materials[ list[ i ].id ];
+				signals.materialDeleted.dispatch();
 
-        if ( list[ i ] instanceof THREE.Light ) this.updateMaterials();
+			}
 
-        signals.objectDeleted.dispatch();
+			if ( this.textures[ list[ i ].id ] ) {
 
-        if ( list[ i ].children.length ) this.delete( list[ i ].children );
-      
-      }
+				delete this.textures[ list[ i ].id ];
+				signals.textureDeleted.dispatch();
 
-      if ( this.geometries[ list[ i ].id ] ) {
+			}
 
-        delete this.geometries[ list[ i ].id ];
-        signals.objectDeleted.dispatch();
+		} 
 
-      } 
+		for ( var i in deletedObjects ) {
 
-      if ( this.materials[ list[ i ].id ] ) {
-      
-        delete this.materials[ list[ i ].id ];
-        signals.materialDeleted.dispatch();
-      
-      }
+			if ( deletedObjects[ i ].parent ) {
 
-      if ( this.textures[ list[ i ].id ] ) {
+				deletedObjects[ i ].parent.remove( deletedObjects[ i ] );
 
-        delete this.textures[ list[ i ].id ];
-        signals.textureDeleted.dispatch();
+			}
 
-      }
+		}
 
-    } 
+		delete deletedObjects;
 
-    for ( var i in deletedObjects ) {
+		signals.sceneChanged.dispatch( this.scene );
 
-        if ( deletedObjects[ i ].parent ) {
-        
-          deletedObjects[ i ].parent.remove( deletedObjects[ i ] );
-        
-        }
+	},
 
-    }
+	deleteByName: function( name, type ) {
 
-    delete deletedObjects;
+		type = type ? type : "all";
 
-    signals.sceneChanged.dispatch( this.scene );
+		this.delete( this.listByName( name, type ) );
 
-  },
+	},
 
-  deleteByName: function( name, type ) {
+	deleteAll: function( type ) {
 
-    type = type ? type : "all";
+		type = type ? type : 'all';
 
-    this.delete( this.listByName( name, type ) );
+		this.delete( this.listByName( '*', type ) );
 
-  },
+	},
 
-  deleteAll: function( type ) {
+	deleteUnused: function( type ) {
 
-    type = type ? type : 'all';
+		// TODO: test with textures
 
-    this.delete( this.listByName( '*', type ) );
+		type = type ? type.toLowerCase() : 'all';
 
-  },
+		var used = {};
 
-  deleteUnused: function( type ) {
+		this.scene.traverse( function( object ) {
 
-    // TODO: test with textures
+			used[ object.id ] = object; 
 
-    type = type ? type.toLowerCase() : 'all';
+			if ( object.geometry ) used[ object.geometry.id ] = object.geometry; 
 
-    var used = {};
+			if ( object.material ) {
 
-    this.scene.traverse( function( object ) {
+				used[ object.material.id ] = object.material;
 
-      used[ object.id ] = object; 
+				for ( var i in object.material ){
 
-      if ( object.geometry ) used[ object.geometry.id ] = object.geometry; 
+					if ( object.material[ i ] instanceof THREE.Texture ) {
 
-      if ( object.material ) {
+						used[ object.material[ i ].id ] = object.material[ i ];
 
-        used[ object.material.id ] = object.material;
+					}
 
-        for ( var i in object.material ){
+				}
 
-          if ( object.material[ i ] instanceof THREE.Texture ) {
+			}
 
-            used[ object.material[ i ].id ] = object.material[ i ];
+		} );
 
-          }
+		if ( !type || type == 'object' ) {
+			for ( var id in this.objects ) {
+				if ( !used[ id ] ) this.delete( this.objects[ id ] );
+			}
+		}
 
-        }
+		if ( !type || type == 'geometry' ) {
+			for ( var id in this.geometries ) {
+				if ( !used[ id ] ) this.delete( this.geometries[ id ] );
+			}
+		}
 
-      }
+		if ( !type || type == 'material' ) {
+			for ( var id in this.materials ) {
+				if ( !used[ id ] ) this.delete( this.materials[ id ] );
+			}
+		}
 
-    } );
+		if ( !type || type == 'texture' ) {
+			for ( var id in this.textures ) {
+				if ( !used[ id ] ) this.delete( this.textures[ id ] );
+			}
+		}
 
-    if ( !type || type == 'object' ) {
-      for ( var id in this.objects ) {
-        if ( !used[ id ] ) this.delete( this.objects[ id ] );
-      }
-    }
+		delete used;
 
-    if ( !type || type == 'geometry' ) {
-      for ( var id in this.geometries ) {
-        if ( !used[ id ] ) this.delete( this.geometries[ id ] );
-      }
-    }
+	},
 
-    if ( !type || type == 'material' ) {
-      for ( var id in this.materials ) {
-        if ( !used[ id ] ) this.delete( this.materials[ id ] );
-      }
-    }
+	// Hierarchy
 
-    if ( !type || type == 'texture' ) {
-      for ( var id in this.textures ) {
-        if ( !used[ id ] ) this.delete( this.textures[ id ] );
-      }
-    }
+	clone: function( assets, recursive, deep ) {
 
-    delete used;
+		// TODO: consider using list
 
-  },
+		// TODO: Implement non-recursive and deep
 
-  // Hierarchy
+		var assets = assets ? assets : this.selected;
+		// recursive = recursive ? recursive : true;
+		// deep = deep ? deep : false;
 
-  clone: function( assets, recursive, deep ) {
+		var clones = {};
 
-    // TODO: consider using list
+		for ( var i in assets ){
 
-    // TODO: Implement non-recursive and deep
+			if ( this.objects[ i ] ) {
 
-    var assets = assets ? assets : this.selected;
-    // recursive = recursive ? recursive : true;
-    // deep = deep ? deep : false;
+				var clonedObject = this.objects[assets[ i ].id ].clone();
 
-    var clones = {};
+				clonedObject.traverse( function( child ) {
 
-    for ( var i in assets ){
+					child.name += ' Clone';
 
-      if ( this.objects[ i ] ) {
+				} );
 
-        var clonedObject = this.objects[assets[ i ].id ].clone();
+				this.addObject( clonedObject, assets[ i ].parent );
+				clones[ clonedObject.id ] = clonedObject;
 
-        clonedObject.traverse( function( child ) {
+			}
 
-          child.name += ' Clone';
+		}
 
-        } );
+		return clones;
 
-        this.addObject( clonedObject, assets[ i ].parent );
-        clones[ clonedObject.id ] = clonedObject;
+	},
 
-      }
+	parent: function( list, parent, locked ) {
 
-    }
-      
-    return clones;
+		//TODO: implement locked
 
-  },
+		list = list ? list : this.list( 'selected' );
 
-  parent: function( list, parent, locked ) {
+		list = ( list instanceof Array ) ? list : [ list ];
 
-    //TODO: implement locked
+		parent = parent ? parent : this.scene;
 
-    list = list ? list : this.list( 'selected' );
+		for ( var i in list ) {
 
-    list = ( list instanceof Array ) ? list : [ list ];
+			if ( list[ i ] !== parent && list[ i ] !== this.scene ) {
 
-    parent = parent ? parent : this.scene;
+				parent.add( list[ i ] );
+				signals.objectChanged.dispatch( list[ i ] );
 
-    for ( var i in list ) {
+			}
 
-      if ( list[ i ] !== parent && list[ i ] !== this.scene ) {
+		}
 
-        parent.add( list[ i ] );
-        signals.objectChanged.dispatch( list[ i ] );
+		signals.sceneChanged.dispatch( this.scene );
 
-      }
+	},
 
-    }
+	unparent: function( list ) {
 
-    signals.sceneChanged.dispatch( this.scene );
+		this.parent( list, this.scene );
 
-  },
-  
-  unparent: function( list ) {
+	},
 
-    this.parent( list, this.scene );
+	group: function( list ) {
 
-  },
+		list = list ? list : this.listSelected( 'objects' );
 
-  group: function( list ) {
+		list = ( list instanceof Array ) ? list : [ list ];
 
-    list = list ? list : this.listSelected( 'objects' );
+		var parent = ( list.length && list[0].parent ) ? list[0].parent : this.scene;
 
-    list = ( list instanceof Array ) ? list : [ list ];
+		var group = this.createObject();
 
-    var parent = ( list.length && list[0].parent ) ? list[0].parent : this.scene;
+		this.parent( group, parent );
 
-    var group = this.createObject();
+		this.parent( list, group );
 
-    this.parent( group, parent );
+	},
 
-    this.parent( list, group );
+	// Utils
 
-  },
+	updateObject: function( object, parameters ) {
 
-  // Utils
+		parameters = parameters ? parameters : {};
 
-  updateObject: function( object, parameters ) {
+		if ( parameters.parent && object.parent && object.parent != parameters.parent)
+			editor.parent( object, parameters.parent );
 
-    parameters = parameters ? parameters : {};
+		if ( parameters.geometry && object.geometry && object.geometry != parameters.geometry) {
+			object.geometry = parameters.geometry;
+			this.updateGeometry( object.geometry );
+		}
 
-    if ( parameters.parent && object.parent && object.parent != parameters.parent)
-      editor.parent( object, parameters.parent );
+		if ( parameters.material && object.material && object.material != parameters.material)
+			object.material = parameters.material;
 
-    if ( parameters.geometry && object.geometry && object.geometry != parameters.geometry) {
-      object.geometry = parameters.geometry;
-      this.updateGeometry( object.geometry );
-    }
+		if ( parameters.name !== undefined ) object.name = parameters.name;
 
-    if ( parameters.material && object.material && object.material != parameters.material)
-      object.material = parameters.material;
+		if ( parameters.position !== undefined ) object.position = parameters.position;
+		if ( parameters.rotation !== undefined ) object.rotation = parameters.rotation;
+		if ( parameters.scale !== undefined ) object.scale = parameters.scale;
 
-    if ( parameters.name !== undefined ) object.name = parameters.name;
+		if ( object.fov !== undefined && parameters.fov !== undefined ) object.fov = parameters.fov;
+		if ( object.near !== undefined && parameters.near !== undefined ) object.near = parameters.near;
+		if ( object.far !== undefined && parameters.far !== undefined ) object.far = parameters.far;
+		if ( object.intensity !== undefined && parameters.intensity !== undefined ) object.intensity = parameters.intensity;
 
-    if ( parameters.position !== undefined ) object.position = parameters.position;
-    if ( parameters.rotation !== undefined ) object.rotation = parameters.rotation;
-    if ( parameters.scale !== undefined ) object.scale = parameters.scale;
+		if ( object.color && parameters.color !== undefined ) object.color.setHex( parameters.color );
+		if ( object.groundColor && parameters.groundColor !== undefined ) object.groundColor.setHex( parameters.groundColor );
 
-    if ( object.fov !== undefined && parameters.fov !== undefined ) object.fov = parameters.fov;
-    if ( object.near !== undefined && parameters.near !== undefined ) object.near = parameters.near;
-    if ( object.far !== undefined && parameters.far !== undefined ) object.far = parameters.far;
-    if ( object.intensity !== undefined && parameters.intensity !== undefined ) object.intensity = parameters.intensity;
+		if ( object.distance !== undefined && parameters.distance !== undefined ) object.distance = parameters.distance;
+		if ( object.angle !== undefined && parameters.angle !== undefined ) object.angle = parameters.angle;
+		if ( object.exponent !== undefined && parameters.exponent !== undefined ) object.exponent = parameters.exponent;
+		if ( object.visible !== undefined && parameters.visible !== undefined ) object.visible = parameters.visible;
 
-    if ( object.color && parameters.color !== undefined ) object.color.setHex( parameters.color );
-    if ( object.groundColor && parameters.groundColor !== undefined ) object.groundColor.setHex( parameters.groundColor );
+		if ( parameters.userData !== undefined ) {
 
-    if ( object.distance !== undefined && parameters.distance !== undefined ) object.distance = parameters.distance;
-    if ( object.angle !== undefined && parameters.angle !== undefined ) object.angle = parameters.angle;
-    if ( object.exponent !== undefined && parameters.exponent !== undefined ) object.exponent = parameters.exponent;
-    if ( object.visible !== undefined && parameters.visible !== undefined ) object.visible = parameters.visible;
-    
-    if ( parameters.userData !== undefined ) {
+			try {
 
-      try {
+				object.userData = JSON.parse( parameters.userData );
 
-        object.userData = JSON.parse( parameters.userData );
+			} catch ( error ) {
 
-      } catch ( error ) {
+			 console.log( error );
 
-       console.log( error );
+			}
 
-      }
+		};
 
-    };
+		if ( object.updateProjectionMatrix ) object.updateProjectionMatrix();
 
-    if ( object.updateProjectionMatrix ) object.updateProjectionMatrix();
+		signals.objectChanged.dispatch( object );
 
-    signals.objectChanged.dispatch( object );
+	},
 
-  },
+	updateMaterials: function( list ) {
 
-  updateMaterials: function( list ) {
+		list = list ? list : this.list( 'material' );
 
-    list = list ? list : this.list( 'material' );
+		list = ( list instanceof Array ) ? list : [ list ];
 
-    list = ( list instanceof Array ) ? list : [ list ];
+		for ( var i in list ) {
 
-    for ( var i in list ) {
+			list[ i ].needsUpdate = true;
 
-      list[ i ].needsUpdate = true;
+			if ( list[ i ] instanceof THREE.MeshFaceMaterial ) {
 
-      if ( list[ i ] instanceof THREE.MeshFaceMaterial ) {
+				for ( var j in list[ i ].materials ) {
 
-        for ( var j in list[ i ].materials ) {
+					list[ i ].materials[ j ].needsUpdate = true;
 
-          list[ i ].materials[ j ].needsUpdate = true;
+				}
 
-        }
+			}
 
-      }
+		}
 
-    }
+	},
 
-  },
+	updateGeometry: function( geometry, parameters ) {
 
-  updateGeometry: function( geometry, parameters ) {
+		parameters = parameters ? parameters : {};
 
-    parameters = parameters ? parameters : {};
+		var id = geometry.id;
+		var name = geometry.name;
 
-    var id = geometry.id;
-    var name = geometry.name;
+		if ( geometry instanceof THREE.PlaneGeometry )
+			geometry = this.createGeometry( 'Plane', parameters );
 
-    if ( geometry instanceof THREE.PlaneGeometry )
-      geometry = this.createGeometry( 'Plane', parameters );
+		if ( geometry instanceof THREE.CubeGeometry )
+			geometry = this.createGeometry( 'Cube', parameters );
 
-    if ( geometry instanceof THREE.CubeGeometry )
-      geometry = this.createGeometry( 'Cube', parameters );
+		if ( geometry instanceof THREE.CylinderGeometry )
+			geometry = this.createGeometry( 'Cylinder', parameters );
 
-    if ( geometry instanceof THREE.CylinderGeometry )
-      geometry = this.createGeometry( 'Cylinder', parameters );
+		if ( geometry instanceof THREE.SphereGeometry )
+			geometry = this.createGeometry( 'Sphere', parameters );
 
-    if ( geometry instanceof THREE.SphereGeometry )
-      geometry = this.createGeometry( 'Sphere', parameters );
+		if ( geometry instanceof THREE.IcosahedronGeometry )
+			geometry = this.createGeometry( 'Icosahedron', parameters );
 
-    if ( geometry instanceof THREE.IcosahedronGeometry )
-      geometry = this.createGeometry( 'Icosahedron', parameters );
+		if ( geometry instanceof THREE.TorusGeometry )
+			geometry = this.createGeometry( 'Torus', parameters );
 
-    if ( geometry instanceof THREE.TorusGeometry )
-      geometry = this.createGeometry( 'Torus', parameters );
+		if ( geometry instanceof THREE.TorusKnotGeometry )
+			geometry = this.createGeometry( 'Torusknot', parameters );
 
-    if ( geometry instanceof THREE.TorusKnotGeometry )
-      geometry = this.createGeometry( 'Torusknot', parameters );
+		geometry.computeBoundingSphere();
+		geometry.id = id;
+		geometry.name = name;
 
-    geometry.computeBoundingSphere();
-    geometry.id = id;
-    geometry.name = name;
+		for ( var i in editor.objects ) {
 
-    for ( var i in editor.objects ) {
+			var object = editor.objects[i];
 
-      var object = editor.objects[i];
+			if ( object.geometry && object.geometry.id == id ) {
 
-      if ( object.geometry && object.geometry.id == id ) {
+				delete object.__webglInit; // TODO: Remove hack (WebGLRenderer refactoring)
+				object.geometry.dispose();
 
-        delete object.__webglInit; // TODO: Remove hack (WebGLRenderer refactoring)
-        object.geometry.dispose();
+				object.geometry = geometry;
 
-        object.geometry = geometry;
+				signals.objectChanged.dispatch( object );
 
-        signals.objectChanged.dispatch( object );
+			}
 
-      }
+		}
 
-    }
+	},
 
-  },
+	setFog: function( parameters ) {
 
-  setFog: function( parameters ) {
+		var fogType = parameters.fogType ? parameters.fogType : null;
+		var near = parameters.near ? parameters.near : null;
+		var far = parameters.far ? parameters.far : null;
+		var density = parameters.density ? parameters.density : null;
+		var color = parameters.color ? parameters.color : null;
 
-    var fogType = parameters.fogType ? parameters.fogType : null;
-    var near = parameters.near ? parameters.near : null;
-    var far = parameters.far ? parameters.far : null;
-    var density = parameters.density ? parameters.density : null;
-    var color = parameters.color ? parameters.color : null;
+		if ( fogType ) {
 
-    if ( fogType ) {
+			if ( fogType === "None" ) this.scene.fog = null;
 
-      if ( fogType === "None" ) this.scene.fog = null;
+			else if ( fogType === "Fog" ) this.scene.fog = new THREE.Fog();
 
-      else if ( fogType === "Fog" ) this.scene.fog = new THREE.Fog();
+			else if ( fogType === "FogExp2" ) this.scene.fog = new THREE.FogExp2();
 
-      else if ( fogType === "FogExp2" ) this.scene.fog = new THREE.FogExp2();
+		}
 
-    }
+		if ( this.scene.fog ) {
 
-    if ( this.scene.fog ) {
+			if ( fogType ) this.scene.fog.fogType = fogType;
+			if ( near ) this.scene.fog.near = near;
+			if ( far ) this.scene.fog.far = far;
+			if ( density ) this.scene.fog.density = density;
+			if ( color ) this.scene.fog.color.setHex( color );
 
-      if ( fogType ) this.scene.fog.fogType = fogType;
-      if ( near ) this.scene.fog.near = near;
-      if ( far ) this.scene.fog.far = far;
-      if ( density ) this.scene.fog.density = density;
-      if ( color ) this.scene.fog.color.setHex( color );
+		}
 
-    }
+		this.updateMaterials();
+		signals.fogChanged.dispatch( this.scene.fog );
 
-    this.updateMaterials();
-    signals.fogChanged.dispatch( this.scene.fog );
+	},
 
-  },
+	regexMatch: function( name, filter ) {
 
-  regexMatch: function( name, filter ) {
+		name = name.toLowerCase();
+		filter = '^' + filter.toLowerCase().replace(/\*/g, '.*').replace(/\?/g, '.') + '$';
 
-    name = name.toLowerCase();
-    filter = '^' + filter.toLowerCase().replace(/\*/g, '.*').replace(/\?/g, '.') + '$';
+		var regex = new RegExp(filter);
+		return regex.test( name );
 
-    var regex = new RegExp(filter);
-    return regex.test( name );
+	},
 
-  },
+	incrementName: function( name, type ) {
 
-  incrementName: function( name, type ) {
+		var list = this.listByName( name+'\\d+', type );
+		var lastIncrement = 0;
 
-    var list = this.listByName( name+'\\d+', type );
-    var lastIncrement = 0;
+		for ( var i in list ) {
+			var Increment = parseFloat( list[i].name.replace( name, '' ) );
+			if ( Increment > lastIncrement ) lastIncrement = Increment;
+		}
 
-    for ( var i in list ) {
-      var Increment = parseFloat( list[i].name.replace( name, '' ) );
-      if ( Increment > lastIncrement ) lastIncrement = Increment;
-    }
-    
-    return name + ( lastIncrement + 1 );
+		return name + ( lastIncrement + 1 );
 
-  }
+	}
 
 }

+ 10 - 9
editor/js/Sidebar.Animation.js

@@ -16,15 +16,15 @@ Sidebar.Animation = function ( signals ) {
 	AnimationsRow.add( Animations );
 	container.add( AnimationsRow );
 	container.add( new UI.Break() );
-		
+
 	var PlayRow = new UI.Panel();
 	var playButton = new UI.Button().setLabel("Play").onClick(play);
 	PlayRow.add( playButton );
 	container.add( PlayRow );
 	container.add( new UI.Break() );
-	
+
 	function play(){
-		
+
 		var value = Animations.getValue();
 		if (possibleAnimations[value]){
 			var anims = possibleAnimations[value]
@@ -33,8 +33,9 @@ Sidebar.Animation = function ( signals ) {
 			}
 			signals.playAnimations.dispatch( anims );
 		};
+
 	}
-	
+
 	signals.objectAdded.add( function ( object ) {
 
 		if (object instanceof THREE.Mesh){
@@ -44,24 +45,24 @@ Sidebar.Animation = function ( signals ) {
 				var name = object.geometry.animation.name;
 				options[name] = name
 				Animations.setOptions(options);
-				
+
 				THREE.AnimationHandler.add(object.geometry.animation);
 				var animation = new THREE.Animation(object, 
      				name, 
      				THREE.AnimationHandler.CATMULLROM)
-				
+
 				if (possibleAnimations[name]){
 					possibleAnimations[name].push(animation);
 				} else {
 					possibleAnimations[name] = [animation];
 				}
-				
+
 			}
-			
+
 		}
 
 	} );
-	
+s
 	return container;
 
 }

+ 347 - 347
editor/js/Sidebar.Attributes.js

@@ -1,462 +1,462 @@
 Sidebar.Attributes = function ( signals ) {
 
-  var scope = this;
-  var model;
-  var param = {};
-
-  var primaryParams = [ 'name', 'parent', 'geometry', 'material', 'position', 'rotation', 'scale', 'width', 'height', 'depth',
-  'widthSegments', 'heightSegments', 'depthSegments', 'radialSegments', 'tubularSegments', 'radius', 'radiusTop', 'radiusBottom',
-  'phiStart', 'phiLength', 'thetaStart', 'thetaLength', 'tube', 'arc', 'detail', 'p', 'q', 'heightScale', 'openEnded',
-  'image', 'sourceFile', 'wrapS', 'wrapT', 'minFilter', 'magFilter', 'format', 'repeat', 'offset', 'flipY', 'type', 'color',
-  'groundColor', 'ambient', 'emissive', 'specular', 'reflectivity', 'shininess', 'intensity', 'opacity', 'transparent', 'metal',
-  'wireframe', 'wireframeLinewidth', 'linewidth', 'visible', 'fog', 'near', 'far', 'exponent', 'map', 'lightMap', 'bumpMap',
-  'normalMap', 'specularMap', 'envMap', 'normalScale', 'bumpScale', 'userData' ];
-  
-  var secondaryParams = [ 'quaternion', 'up', 'distance', 'castShadow', 'receiveShadow', 'useQuaternion', 'depthTest', 'depthWrite',
-  'dynamic', 'children', 'elements', 'vertices', 'normals', 'colors', 'faces', 'faceUvs', 'faceVertexUvs', 'boundingBox',
-  'boundingSphere', 'verticesNeedUpdate', 'elementsNeedUpdate', 'uvsNeedUpdate', 'normalsNeedUpdate', 'tangentsNeedUpdate',
-  'colorsNeedUpdate', 'lineDistancesNeedUpdate', 'buffersNeedUpdate', 'matrix', 'matrixWorld', 'blending', 'side', 'blendSrc',
-  'blendDst', 'blendEquation', 'generateMipmaps', 'premultiplyAlpha', 'needsUpdate', 'anisothropy' ];
-
-  var integerParams = [ 'widthSegments', 'heightSegments', 'depthSegments', 'radialSegments', 'tubularSegments' ];
-
-  var textureParams = [ 'map', 'lightMap', 'bumpMap', 'normalMap', 'specularMap', 'envMap' ];
-
-  var multiOptions = {
-    'blending': {
-      'NoBlending': THREE.NoBlending,
-      'NormalBlending': THREE.NormalBlending,
-      'AdditiveBlending': THREE.AdditiveBlending,
-      'SubtractiveBlending': THREE.SubtractiveBlending,
-      'MultiplyBlending': THREE.MultiplyBlending,
-      'CustomBlending': THREE.CustomBlending
-    }
-    ,
-    'side': {
-      'FrontSide': THREE.FrontSide,
-      'BackSide': THREE.BackSide,
-      'DoubleSide': THREE.DoubleSide
-    },
-    'blendSrc': {
-      'ZeroFactor': THREE.ZeroFactor,
-      'OneFactor': THREE.OneFactor,
-      'SrcAlphaFactor': THREE.SrcAlphaFactor,
-      'OneMinusSrcAlphaFactor': THREE.OneMinusSrcAlphaFactor,
-      'DstAlphaFactor': THREE.DstAlphaFactor,
-      'OneMinusDstAlphaFactor': THREE.OneMinusDstAlphaFactor,      
-      'DstColorFactor': THREE.DstColorFactor,
-      'OneMinusDstColorFactor': THREE.OneMinusDstColorFactor,
-      'SrcAlphaSaturateFactor': THREE.SrcAlphaSaturateFactor
-    },
-    'blendDst': {
-      'ZeroFactor': THREE.ZeroFactor,
-      'OneFactor': THREE.OneFactor,
-      'SrcColorFactor': THREE.SrcColorFactor,
-      'OneMinusSrcColorFactor': THREE.OneMinusSrcColorFactor,
-      'SrcAlphaFactor': THREE.SrcAlphaFactor,
-      'OneMinusSrcAlphaFactor': THREE.OneMinusSrcAlphaFactor,
-      'DstAlphaFactor': THREE.DstAlphaFactor,
-      'OneMinusDstAlphaFactor': THREE.OneMinusDstAlphaFactor
-    },
-    'blendEquation': {
-      'AddEquation': THREE.AddEquation,
-      'SubtractEquation': THREE.SubtractEquation,
-      'ReverseSubtractEquation': THREE.ReverseSubtractEquation
-    },
-    'wrapS': {
-      'RepeatWrapping': THREE.RepeatWrapping,
-      'ClampToEdgeWrapping': THREE.ClampToEdgeWrapping,
-      'MirroredRepeatWrapping': THREE.MirroredRepeatWrapping,
-    },
-    'wrapT': {
-      'RepeatWrapping': THREE.RepeatWrapping,
-      'ClampToEdgeWrapping': THREE.ClampToEdgeWrapping,
-      'MirroredRepeatWrapping': THREE.MirroredRepeatWrapping,
-    },
-    'magFilter': {
-      'NearestFilter': THREE.NearestFilter,
-      'NearestMipMapNearestFilter': THREE.NearestMipMapNearestFilter,
-      'NearestMipMapLinearFilter': THREE.NearestMipMapLinearFilter,
-      'LinearFilter': THREE.LinearFilter,
-      'LinearMipMapNearestFilter': THREE.LinearMipMapNearestFilter,
-      'LinearMipMapLinearFilter': THREE.LinearMipMapLinearFilter,
-    },
-    'minFilter': {
-      'NearestFilter': THREE.NearestFilter,
-      'NearestMipMapNearestFilter': THREE.NearestMipMapNearestFilter,
-      'NearestMipMapLinearFilter': THREE.NearestMipMapLinearFilter,
-      'LinearFilter': THREE.LinearFilter,
-      'LinearMipMapNearestFilter': THREE.LinearMipMapNearestFilter,
-      'LinearMipMapLinearFilter': THREE.LinearMipMapLinearFilter,
-    },
-    'type': {
-      'UnsignedByteType': THREE.UnsignedByteType,
-      'ByteType': THREE.ByteType,
-      'ShortType': THREE.ShortType,
-      'UnsignedShortType': THREE.UnsignedShortType,
-      'IntType': THREE.IntType,
-      'UnsignedIntType': THREE.UnsignedIntType,
-      'FloatType': THREE.FloatType
-    },
-    'format': {
-      'AlphaFormat': THREE.AlphaFormat,
-      'RGBFormat': THREE.RGBFormat,
-      'RGBAFormat': THREE.RGBAFormat,
-      'LuminanceFormat': THREE.LuminanceFormat,
-      'LuminanceAlphaFormat': THREE.LuminanceAlphaFormat,
-      'RGB_S3TC_DXT1_Format': THREE.RGB_S3TC_DXT1_Format,
-      'RGBA_S3TC_DXT1_Format': THREE.RGBA_S3TC_DXT1_Format,
-      'RGBA_S3TC_DXT3_Format': THREE.RGBA_S3TC_DXT3_Format,
-      'RGBA_S3TC_DXT5_Format': THREE.RGBA_S3TC_DXT5_Format,
-      'RGB_PVRTC_4BPPV1_Format': THREE.RGB_PVRTC_4BPPV1_Format,
-      'RGB_PVRTC_2BPPV1_Format': THREE.RGB_PVRTC_2BPPV1_Format,
-      'RGBA_PVRTC_4BPPV1_Format': THREE.RGBA_PVRTC_4BPPV1_Format,
-      'RGBA_PVRTC_2BPPV1_Format': THREE.RGBA_PVRTC_2BPPV1_Format,
-    }
-  }
-
-  var container = new UI.Panel();
-
-  var group1 = new UI.Panel().setBorderTop( '1px solid #ccc' ).setPadding( '10px' ).setBackgroundColor( '#ddd' ); // Primary parameters
-  var group2 = new UI.Panel().setBorderTop( '1px solid #ccc' ).setPadding( '10px' ); // Secondary params 
-  var group3 = new UI.Panel().setBorderTop( '1px solid #ccc' ).setPadding( '10px' ).setBackgroundColor( '#ddd' ).setOpacity( 0.25 );//.setDisplay( 'none' ); // everything else
-
-  container.add( group1, group2, group3 );
-
-  signals.objectChanged.add( function ( changed ) {
-      
-    if ( model === changed ) updateUI();
-
-  } );
-
-  signals.selected.add( function ( selected ) {
-      
-    var selected = editor.listSelected();
-    var firstSelected = ( selected.length ) ? selected[0] : null;
-    createUI( firstSelected );
-
-  } );
-
-  function createUI( newModel ) {
-
-    model = newModel;
-
-    param = {};
-
-    while ( group1.dom.hasChildNodes() ) group1.dom.removeChild( group1.dom.lastChild );
-    while ( group2.dom.hasChildNodes() ) group2.dom.removeChild( group2.dom.lastChild );
-    while ( group3.dom.hasChildNodes() ) group3.dom.removeChild( group3.dom.lastChild );
-
-    if ( model ) {
-      for ( var i in primaryParams ) addElement( primaryParams[i], group1 );
-      for ( var i in secondaryParams ) addElement( secondaryParams[i], group2 );
-      for ( var key in model ) addElement( key, group3 );
-    }
-
-    updateUI();
-
-  }
-
-  function addElement( key, parent ) {
+	var scope = this;
+	var model;
+	var param = {};
+
+	var primaryParams = [ 'name', 'parent', 'geometry', 'material', 'position', 'rotation', 'scale', 'width', 'height', 'depth',
+	'widthSegments', 'heightSegments', 'depthSegments', 'radialSegments', 'tubularSegments', 'radius', 'radiusTop', 'radiusBottom',
+	'phiStart', 'phiLength', 'thetaStart', 'thetaLength', 'tube', 'arc', 'detail', 'p', 'q', 'heightScale', 'openEnded',
+	'image', 'sourceFile', 'wrapS', 'wrapT', 'minFilter', 'magFilter', 'format', 'repeat', 'offset', 'flipY', 'type', 'color',
+	'groundColor', 'ambient', 'emissive', 'specular', 'reflectivity', 'shininess', 'intensity', 'opacity', 'transparent', 'metal',
+	'wireframe', 'wireframeLinewidth', 'linewidth', 'visible', 'fog', 'near', 'far', 'exponent', 'map', 'lightMap', 'bumpMap',
+	'normalMap', 'specularMap', 'envMap', 'normalScale', 'bumpScale', 'userData' ];
+
+	var secondaryParams = [ 'quaternion', 'up', 'distance', 'castShadow', 'receiveShadow', 'useQuaternion', 'depthTest', 'depthWrite',
+	'dynamic', 'children', 'elements', 'vertices', 'normals', 'colors', 'faces', 'faceUvs', 'faceVertexUvs', 'boundingBox',
+	'boundingSphere', 'verticesNeedUpdate', 'elementsNeedUpdate', 'uvsNeedUpdate', 'normalsNeedUpdate', 'tangentsNeedUpdate',
+	'colorsNeedUpdate', 'lineDistancesNeedUpdate', 'buffersNeedUpdate', 'matrix', 'matrixWorld', 'blending', 'side', 'blendSrc',
+	'blendDst', 'blendEquation', 'generateMipmaps', 'premultiplyAlpha', 'needsUpdate', 'anisothropy' ];
+
+	var integerParams = [ 'widthSegments', 'heightSegments', 'depthSegments', 'radialSegments', 'tubularSegments' ];
+
+	var textureParams = [ 'map', 'lightMap', 'bumpMap', 'normalMap', 'specularMap', 'envMap' ];
+
+	var multiOptions = {
+		'blending': {
+			'NoBlending': THREE.NoBlending,
+			'NormalBlending': THREE.NormalBlending,
+			'AdditiveBlending': THREE.AdditiveBlending,
+			'SubtractiveBlending': THREE.SubtractiveBlending,
+			'MultiplyBlending': THREE.MultiplyBlending,
+			'CustomBlending': THREE.CustomBlending
+		}
+		,
+		'side': {
+			'FrontSide': THREE.FrontSide,
+			'BackSide': THREE.BackSide,
+			'DoubleSide': THREE.DoubleSide
+		},
+		'blendSrc': {
+			'ZeroFactor': THREE.ZeroFactor,
+			'OneFactor': THREE.OneFactor,
+			'SrcAlphaFactor': THREE.SrcAlphaFactor,
+			'OneMinusSrcAlphaFactor': THREE.OneMinusSrcAlphaFactor,
+			'DstAlphaFactor': THREE.DstAlphaFactor,
+			'OneMinusDstAlphaFactor': THREE.OneMinusDstAlphaFactor,			
+			'DstColorFactor': THREE.DstColorFactor,
+			'OneMinusDstColorFactor': THREE.OneMinusDstColorFactor,
+			'SrcAlphaSaturateFactor': THREE.SrcAlphaSaturateFactor
+		},
+		'blendDst': {
+			'ZeroFactor': THREE.ZeroFactor,
+			'OneFactor': THREE.OneFactor,
+			'SrcColorFactor': THREE.SrcColorFactor,
+			'OneMinusSrcColorFactor': THREE.OneMinusSrcColorFactor,
+			'SrcAlphaFactor': THREE.SrcAlphaFactor,
+			'OneMinusSrcAlphaFactor': THREE.OneMinusSrcAlphaFactor,
+			'DstAlphaFactor': THREE.DstAlphaFactor,
+			'OneMinusDstAlphaFactor': THREE.OneMinusDstAlphaFactor
+		},
+		'blendEquation': {
+			'AddEquation': THREE.AddEquation,
+			'SubtractEquation': THREE.SubtractEquation,
+			'ReverseSubtractEquation': THREE.ReverseSubtractEquation
+		},
+		'wrapS': {
+			'RepeatWrapping': THREE.RepeatWrapping,
+			'ClampToEdgeWrapping': THREE.ClampToEdgeWrapping,
+			'MirroredRepeatWrapping': THREE.MirroredRepeatWrapping,
+		},
+		'wrapT': {
+			'RepeatWrapping': THREE.RepeatWrapping,
+			'ClampToEdgeWrapping': THREE.ClampToEdgeWrapping,
+			'MirroredRepeatWrapping': THREE.MirroredRepeatWrapping,
+		},
+		'magFilter': {
+			'NearestFilter': THREE.NearestFilter,
+			'NearestMipMapNearestFilter': THREE.NearestMipMapNearestFilter,
+			'NearestMipMapLinearFilter': THREE.NearestMipMapLinearFilter,
+			'LinearFilter': THREE.LinearFilter,
+			'LinearMipMapNearestFilter': THREE.LinearMipMapNearestFilter,
+			'LinearMipMapLinearFilter': THREE.LinearMipMapLinearFilter,
+		},
+		'minFilter': {
+			'NearestFilter': THREE.NearestFilter,
+			'NearestMipMapNearestFilter': THREE.NearestMipMapNearestFilter,
+			'NearestMipMapLinearFilter': THREE.NearestMipMapLinearFilter,
+			'LinearFilter': THREE.LinearFilter,
+			'LinearMipMapNearestFilter': THREE.LinearMipMapNearestFilter,
+			'LinearMipMapLinearFilter': THREE.LinearMipMapLinearFilter,
+		},
+		'type': {
+			'UnsignedByteType': THREE.UnsignedByteType,
+			'ByteType': THREE.ByteType,
+			'ShortType': THREE.ShortType,
+			'UnsignedShortType': THREE.UnsignedShortType,
+			'IntType': THREE.IntType,
+			'UnsignedIntType': THREE.UnsignedIntType,
+			'FloatType': THREE.FloatType
+		},
+		'format': {
+			'AlphaFormat': THREE.AlphaFormat,
+			'RGBFormat': THREE.RGBFormat,
+			'RGBAFormat': THREE.RGBAFormat,
+			'LuminanceFormat': THREE.LuminanceFormat,
+			'LuminanceAlphaFormat': THREE.LuminanceAlphaFormat,
+			'RGB_S3TC_DXT1_Format': THREE.RGB_S3TC_DXT1_Format,
+			'RGBA_S3TC_DXT1_Format': THREE.RGBA_S3TC_DXT1_Format,
+			'RGBA_S3TC_DXT3_Format': THREE.RGBA_S3TC_DXT3_Format,
+			'RGBA_S3TC_DXT5_Format': THREE.RGBA_S3TC_DXT5_Format,
+			'RGB_PVRTC_4BPPV1_Format': THREE.RGB_PVRTC_4BPPV1_Format,
+			'RGB_PVRTC_2BPPV1_Format': THREE.RGB_PVRTC_2BPPV1_Format,
+			'RGBA_PVRTC_4BPPV1_Format': THREE.RGBA_PVRTC_4BPPV1_Format,
+			'RGBA_PVRTC_2BPPV1_Format': THREE.RGBA_PVRTC_2BPPV1_Format,
+		}
+	}
+
+	var container = new UI.Panel();
+
+	var group1 = new UI.Panel().setBorderTop( '1px solid #ccc' ).setPadding( '10px' ).setBackgroundColor( '#ddd' ); // Primary parameters
+	var group2 = new UI.Panel().setBorderTop( '1px solid #ccc' ).setPadding( '10px' ); // Secondary params 
+	var group3 = new UI.Panel().setBorderTop( '1px solid #ccc' ).setPadding( '10px' ).setBackgroundColor( '#ddd' ).setOpacity( 0.25 );//.setDisplay( 'none' ); // everything else
+
+	container.add( group1, group2, group3 );
+
+	signals.objectChanged.add( function ( changed ) {
+
+		if ( model === changed ) updateUI();
+
+	} );
+
+	signals.selected.add( function ( selected ) {
+
+		var selected = editor.listSelected();
+		var firstSelected = ( selected.length ) ? selected[0] : null;
+		createUI( firstSelected );
+
+	} );
+
+	function createUI( newModel ) {
+
+		model = newModel;
+
+		param = {};
+
+		while ( group1.dom.hasChildNodes() ) group1.dom.removeChild( group1.dom.lastChild );
+		while ( group2.dom.hasChildNodes() ) group2.dom.removeChild( group2.dom.lastChild );
+		while ( group3.dom.hasChildNodes() ) group3.dom.removeChild( group3.dom.lastChild );
+
+		if ( model ) {
+			for ( var i in primaryParams ) addElement( primaryParams[i], group1 );
+			for ( var i in secondaryParams ) addElement( secondaryParams[i], group2 );
+			for ( var key in model ) addElement( key, group3 );
+		}
 
-    if ( model[ key ] !== undefined && param[ key ] === undefined ) {
+		updateUI();
 
-      // Params from multiOptions
+	}
 
-      for ( var i in multiOptions ) {
-        if ( i == key ) {
-          param[ key ] = new UI.ParamSelect( key ).onChange( updateParam );
-          parent.add( param[ key ] );
-          return;
-        }
-      }
+	function addElement( key, parent ) {
 
-      // Special params
+		if ( model[ key ] !== undefined && param[ key ] === undefined ) {
 
-      if ( key === 'parent' ) {
+			// Params from multiOptions
 
-        param[ key ] = new UI.ParamSelect( key ).onChange( updateParam );
-        param[ key ].name.setColor( '#0080f0' ).onClick( function(){ createUI( editor.objects[ param[ key ].getValue() ] ) } );
-        parent.add( param[ key ] );
-        return;
+			for ( var i in multiOptions ) {
+				if ( i == key ) {
+					param[ key ] = new UI.ParamSelect( key ).onChange( updateParam );
+					parent.add( param[ key ] );
+					return;
+				}
+			}
 
-      }
+			// Special params
 
-      if ( key === 'geometry' ) {
+			if ( key === 'parent' ) {
 
-        param[ key ] = new UI.ParamSelect( key ).onChange( updateParam );
-        param[ key ].name.setColor( '#0080f0' ).onClick( function(){  createUI( editor.geometries[ param[ key ].getValue() ] ) } );
-        parent.add( param[ key ] );
-        return;
+				param[ key ] = new UI.ParamSelect( key ).onChange( updateParam );
+				param[ key ].name.setColor( '#0080f0' ).onClick( function(){ createUI( editor.objects[ param[ key ].getValue() ] ) } );
+				parent.add( param[ key ] );
+				return;
 
-      }
+			}
 
-      if ( key == 'material' ) {
+			if ( key === 'geometry' ) {
 
-        param[ key ] = new UI.ParamSelect( key ).onChange( updateParam );
-        param[ key ].name.setColor( '#0080f0' ).onClick( function(){  createUI( editor.materials[ param[ key ].getValue() ] ) } );
-        parent.add( param[ key ] );
-        return;
+				param[ key ] = new UI.ParamSelect( key ).onChange( updateParam );
+				param[ key ].name.setColor( '#0080f0' ).onClick( function(){	createUI( editor.geometries[ param[ key ].getValue() ] ) } );
+				parent.add( param[ key ] );
+				return;
 
-      }
+			}
 
-      if ( key == 'userData' ) {
+			if ( key == 'material' ) {
 
-        param[ key ] = new UI.ParamJson( key ).onChange( updateParam );
-        parent.add( param[ key ] );
-        return;
+				param[ key ] = new UI.ParamSelect( key ).onChange( updateParam );
+				param[ key ].name.setColor( '#0080f0' ).onClick( function(){	createUI( editor.materials[ param[ key ].getValue() ] ) } );
+				parent.add( param[ key ] );
+				return;
 
-      }
+			}
 
-      // Texture params
+			if ( key == 'userData' ) {
 
-      for ( var i in textureParams ) {
+				param[ key ] = new UI.ParamJson( key ).onChange( updateParam );
+				parent.add( param[ key ] );
+				return;
 
-        if ( key == textureParams[ i ] ) {
+			}
 
-          param[ key ] = new UI.ParamSelect( key ).onChange( updateParam );
-          param[ key ].name.setColor( '#0080f0' ).onClick( function(){
+			// Texture params
 
-            var value = param[ key ].getValue();
-            if ( value == 'new' ) {
+			for ( var i in textureParams ) {
 
-              var texture = editor.createTexture();
-              model[ key ] = texture;
-              createUI( texture );
+				if ( key == textureParams[ i ] ) {
 
-            } else createUI( editor.textures[ value ] )
+					param[ key ] = new UI.ParamSelect( key ).onChange( updateParam );
+					param[ key ].name.setColor( '#0080f0' ).onClick( function(){
 
-          } );
-          parent.add( param[ key ] );
-          return;
+						var value = param[ key ].getValue();
+						if ( value == 'new' ) {
 
-        }
-        
-      }
+							var texture = editor.createTexture();
+							model[ key ] = texture;
+							createUI( texture );
 
-      // Params by type
+						} else createUI( editor.textures[ value ] )
 
-      if ( typeof model[ key ] === 'string' ) {
+					} );
+					parent.add( param[ key ] );
+					return;
 
-        param[ key ] = new UI.ParamString( key ).onChange( updateParam );
-        parent.add( param[ key ] );
+				}
 
-      } else if ( typeof model[ key ] === 'boolean' ) {
+			}
 
-        param[ key ] = new UI.ParamBool( key ).onChange( updateParam );
-        parent.add( param[ key ] );
+			// Params by type
 
-      } else if ( typeof model[ key ] === 'number' ) {
+			if ( typeof model[ key ] === 'string' ) {
 
-        if ( integerParams.indexOf( key ) != -1 )
-          param[ key ] = new UI.ParamInteger( key ).onChange( updateParam );
+				param[ key ] = new UI.ParamString( key ).onChange( updateParam );
+				parent.add( param[ key ] );
 
-        else
-          param[ key ] = new UI.ParamFloat( key ).onChange( updateParam );
-        
-        parent.add( param[ key ] );
+			} else if ( typeof model[ key ] === 'boolean' ) {
 
-      } else if ( model[ key ] instanceof THREE.Vector2 ) {
+				param[ key ] = new UI.ParamBool( key ).onChange( updateParam );
+				parent.add( param[ key ] );
 
-        param[ key ] = new UI.ParamVector2( key ).onChange( updateParam );
-        parent.add( param[ key ] );
+			} else if ( typeof model[ key ] === 'number' ) {
 
-      } else if ( model[ key ] instanceof THREE.Vector3 ) {
+				if ( integerParams.indexOf( key ) != -1 )
+					param[ key ] = new UI.ParamInteger( key ).onChange( updateParam );
 
-        param[ key ] = new UI.ParamVector3( key ).onChange( updateParam );
-        parent.add( param[ key ] );
+				else
+					param[ key ] = new UI.ParamFloat( key ).onChange( updateParam );
 
-      } else if ( model[ key ] instanceof THREE.Vector4 || model[ key ] instanceof THREE.Quaternion ) {
+				parent.add( param[ key ] );
 
-        param[ key ] = new UI.ParamVector4( key ).onChange( updateParam );
-        parent.add( param[ key ] );
+			} else if ( model[ key ] instanceof THREE.Vector2 ) {
 
-      } else if ( model[ key ] instanceof THREE.Color ) {
+				param[ key ] = new UI.ParamVector2( key ).onChange( updateParam );
+				parent.add( param[ key ] );
 
-        param[ key ] = new UI.ParamColor( key ).onChange( updateParam );
-        parent.add( param[ key ] );
+			} else if ( model[ key ] instanceof THREE.Vector3 ) {
 
-      } else if ( model[ key ] instanceof Array ) {
+				param[ key ] = new UI.ParamVector3( key ).onChange( updateParam );
+				parent.add( param[ key ] );
 
-        if ( model[ key ].length ) {
+			} else if ( model[ key ] instanceof THREE.Vector4 || model[ key ] instanceof THREE.Quaternion ) {
 
-          param[ key ] = new UI.Text( key ).setColor( '#0080f0' ).onClick( function(){  createUI( model[ key ] ) } );
-          parent.add( param[ key ], new UI.Break() );
-          
-        }
+				param[ key ] = new UI.ParamVector4( key ).onChange( updateParam );
+				parent.add( param[ key ] );
 
-      } else if ( typeof model[ key ] !== 'function' ) {
+			} else if ( model[ key ] instanceof THREE.Color ) {
 
-        param[ key ] = new UI.Text( key ).setColor( '#0080f0' ).onClick( function(){  createUI( model[ key ] ) } );
-        parent.add( param[ key ], new UI.Break() );
+				param[ key ] = new UI.ParamColor( key ).onChange( updateParam );
+				parent.add( param[ key ] );
 
-      }
+			} else if ( model[ key ] instanceof Array ) {
 
-    }
-         
-  }
+				if ( model[ key ].length ) {
 
-  function updateUI() {
+					param[ key ] = new UI.Text( key ).setColor( '#0080f0' ).onClick( function(){	createUI( model[ key ] ) } );
+					parent.add( param[ key ], new UI.Break() );
 
-    if ( model ) {
+				}
 
-      for ( var key in model ) {
+			} else if ( typeof model[ key ] !== 'function' ) {
 
-        if ( param[ key ] === undefined ) continue;
+				param[ key ] = new UI.Text( key ).setColor( '#0080f0' ).onClick( function(){	createUI( model[ key ] ) } );
+				parent.add( param[ key ], new UI.Break() );
 
-        // Params from multiOptions
+			}
 
-        for ( var i in multiOptions ) {
-          if ( i == key ) {
-            for ( var j in multiOptions[ i ] ) {
+		}
 
-              var options = {};
+	}
 
-              for ( var j in multiOptions[ i ] ) options[ multiOptions[ i ][ j ] ] = j;
-              
-              param[ key ].setOptions( options );
-              param[ key ].setValue( model[ key ] );
-              break;
+	function updateUI() {
 
-            }
-          }
-        }
+		if ( model ) {
 
-        // Special params
+			for ( var key in model ) {
 
-        if ( key === 'parent' ) {
+				if ( param[ key ] === undefined ) continue;
 
-          var options = {};
-          for ( var id in editor.objects ) if ( model.id != id ) options[ id ] = editor.objects[ id ].name;
-          param[ key ].setOptions( options );
-          if ( model[ key ] !== undefined ) param[ key ].setValue( model[ key ].id );
+				// Params from multiOptions
 
-        } else if ( key === 'geometry' ) {
+				for ( var i in multiOptions ) {
+					if ( i == key ) {
+						for ( var j in multiOptions[ i ] ) {
 
-          var options = {};
-          for ( var id in editor.geometries ) options[ id ] = editor.geometries[ id ].name;
-          param[ key ].setOptions( options );
-          if ( model[ key ] !== undefined ) param[ key ].setValue( model[ key ].id );
+							var options = {};
 
-        } else if ( key === 'material' ) {
+							for ( var j in multiOptions[ i ] ) options[ multiOptions[ i ][ j ] ] = j;
 
-          var options = {};
-          for ( var id in editor.materials ) options[ id ] = editor.materials[ id ].name;
-          param[ key ].setOptions( options );
-          if ( model[ key ] !== undefined ) param[ key ].setValue( model[ key ].id );
+							param[ key ].setOptions( options );
+							param[ key ].setValue( model[ key ] );
+							break;
 
-        } else if ( key == 'userData' ) {
+						}
+					}
+				}
 
-          try {
+				// Special params
 
-            param[ key ].setValue( JSON.stringify( model.userData, null, '  ' ) );
+				if ( key === 'parent' ) {
 
-          } catch ( error ) {
+					var options = {};
+					for ( var id in editor.objects ) if ( model.id != id ) options[ id ] = editor.objects[ id ].name;
+					param[ key ].setOptions( options );
+					if ( model[ key ] !== undefined ) param[ key ].setValue( model[ key ].id );
 
-            console.log( error );
+				} else if ( key === 'geometry' ) {
 
-          }
+					var options = {};
+					for ( var id in editor.geometries ) options[ id ] = editor.geometries[ id ].name;
+					param[ key ].setOptions( options );
+					if ( model[ key ] !== undefined ) param[ key ].setValue( model[ key ].id );
 
-        // Texture params
+				} else if ( key === 'material' ) {
 
-        } else if ( textureParams.indexOf( key ) != -1 ) {
+					var options = {};
+					for ( var id in editor.materials ) options[ id ] = editor.materials[ id ].name;
+					param[ key ].setOptions( options );
+					if ( model[ key ] !== undefined ) param[ key ].setValue( model[ key ].id );
 
-          var options = {};
-          options[ 'new' ] = 'New texture';
-          for ( var id in editor.textures ) options[ id ] = editor.textures[ id ].name;
-          param[ key ].setOptions( options );
+				} else if ( key == 'userData' ) {
 
-          param[ key ].setValue( 'new' );
-          if ( model[ key ] ) param[ key ].setValue( model[ key ].id );
+					try {
 
-        } 
+						param[ key ].setValue( JSON.stringify( model.userData, null, '	' ) );
 
-        // Params by type
+					} catch ( error ) {
 
-        else if ( typeof model[ key ] === 'string' ) param[ key ].setValue( model[ key ] );
+						console.log( error );
 
-        else if ( typeof model[ key ] === 'boolean' ) param[ key ].setValue( model[ key ] );
+					}
 
-        else if ( typeof model[ key ] === 'number' ) param[ key ].setValue( model[ key ] );
+				// Texture params
 
-        else if ( model[ key ] instanceof THREE.Vector3 ) param[ key ].setValue( model[ key ] );
+				} else if ( textureParams.indexOf( key ) != -1 ) {
 
-        else if ( model[ key ] instanceof THREE.Color ) param[ key ].setValue( model[ key ] );
+					var options = {};
+					options[ 'new' ] = 'New texture';
+					for ( var id in editor.textures ) options[ id ] = editor.textures[ id ].name;
+					param[ key ].setOptions( options );
 
-      }
+					param[ key ].setValue( 'new' );
+					if ( model[ key ] ) param[ key ].setValue( model[ key ].id );
 
-    }
+				} 
 
-  }
+				// Params by type
 
-  function updateParam( event ) {
+				else if ( typeof model[ key ] === 'string' ) param[ key ].setValue( model[ key ] );
 
-    var key = event.srcElement.name;
-    var value = ( param[ key ].getValue ) ? param[ key ].getValue() : null;
+				else if ( typeof model[ key ] === 'boolean' ) param[ key ].setValue( model[ key ] );
 
-    // Special params
+				else if ( typeof model[ key ] === 'number' ) param[ key ].setValue( model[ key ] );
 
-    if ( key === 'parent' ) editor.parent( object, editor.objects[ value ] );
+				else if ( model[ key ] instanceof THREE.Vector3 ) param[ key ].setValue( model[ key ] );
 
-    else if ( key === 'geometry' ) model[ key ] = editor.geometries[ value ];
+				else if ( model[ key ] instanceof THREE.Color ) param[ key ].setValue( model[ key ] );
 
-    else if ( key === 'material' ) model[ key ] = editor.materials[ value ];
+			}
 
-    else if ( key === 'userData' ) {
-    
-      try {
-         model[ key ] = JSON.parse( value );
-      } catch ( error ) {
-        console.log( error );
-      }
-    
-    } else if ( textureParams.indexOf( key ) != -1 ) {
-      
-      if ( value == 'new' ) {
+		}
 
-        var texture = editor.createTexture();
-        model[ key ] = texture;
-        createUI( texture );
+	}
 
-      } else model[ key ] = editor.textures[ value ];
+	function updateParam( event ) {
 
-    }
+		var key = event.srcElement.name;
+		var value = ( param[ key ].getValue ) ? param[ key ].getValue() : null;
 
-    // Params by type
+		// Special params
 
-    else if ( typeof model[ key ] === 'string' ) model[ key ] = value;
+		if ( key === 'parent' ) editor.parent( object, editor.objects[ value ] );
 
-    else if ( typeof model[ key ] === 'boolean' ) model[ key ] = value;
+		else if ( key === 'geometry' ) model[ key ] = editor.geometries[ value ];
 
-    else if ( typeof model[ key ] === 'number' ) model[ key ] = parseFloat( value );
+		else if ( key === 'material' ) model[ key ] = editor.materials[ value ];
 
-    else if ( model[ key ] instanceof THREE.Color ) model[ key ].setHex( value );
+		else if ( key === 'userData' ) {
 
-    else if ( model[ key ] instanceof THREE.Vector3 ) model[ key ].copy( value );
+			try {
+				 model[ key ] = JSON.parse( value );
+			} catch ( error ) {
+				console.log( error );
+			}
 
-    // Post actions
+		} else if ( textureParams.indexOf( key ) != -1 ) {
 
-    if ( model instanceof THREE.Object3D ) {
+			if ( value == 'new' ) {
 
-      signals.objectChanged.dispatch( model );
+				var texture = editor.createTexture();
+				model[ key ] = texture;
+				createUI( texture );
 
-    } else if ( model instanceof THREE.Geometry ) {
+			} else model[ key ] = editor.textures[ value ];
 
-      var geoParams = {};
-      for ( var i in param )
-        if ( param[ i ].getValue ) geoParams[ i ] = param[ i ].getValue();
-      editor.updateGeometry( model, geoParams );
+		}
 
-    } else if ( model instanceof THREE.Material ) {
+		// Params by type
 
-      signals.materialChanged.dispatch( model );
+		else if ( typeof model[ key ] === 'string' ) model[ key ] = value;
 
-    }
+		else if ( typeof model[ key ] === 'boolean' ) model[ key ] = value;
 
-    signals.sceneChanged.dispatch( editor.scene );
+		else if ( typeof model[ key ] === 'number' ) model[ key ] = parseFloat( value );
 
-  }
+		else if ( model[ key ] instanceof THREE.Color ) model[ key ].setHex( value );
 
-  return container;
+		else if ( model[ key ] instanceof THREE.Vector3 ) model[ key ].copy( value );
+
+		// Post actions
+
+		if ( model instanceof THREE.Object3D ) {
+
+			signals.objectChanged.dispatch( model );
+
+		} else if ( model instanceof THREE.Geometry ) {
+
+			var geoParams = {};
+			for ( var i in param )
+				if ( param[ i ].getValue ) geoParams[ i ] = param[ i ].getValue();
+			editor.updateGeometry( model, geoParams );
+
+		} else if ( model instanceof THREE.Material ) {
+
+			signals.materialChanged.dispatch( model );
+
+		}
+
+		signals.sceneChanged.dispatch( editor.scene );
+
+	}
+
+	return container;
 
 }

+ 17 - 17
editor/js/Sidebar.Outliner.Geometries.js

@@ -9,7 +9,7 @@ Sidebar.Outliner.Geometries = function ( signals ) {
 
 	var geometries = null;
 
-  function getGeometries() {
+	function getGeometries() {
 
 		var options = {};
 
@@ -21,24 +21,24 @@ Sidebar.Outliner.Geometries = function ( signals ) {
 		}
 
 		outliner.setOptions( options );
-    getSelected();
+		getSelected();
 
-  }
+	}
 
-  function getSelected() {
+	function getSelected() {
 
-    var selectedIds = [];
+		var selectedIds = [];
 
-    for ( var id in editor.selected ) {
+		for ( var id in editor.selected ) {
 
-      if ( editor.geometries[ id ] ) selectedIds.push( id );
+			if ( editor.geometries[ id ] ) selectedIds.push( id );
 
-    }
+		}
 
-    // TODO: implement multiple selection
-    outliner.setValue( selectedIds.length ? selectedIds[0] : null );
+		// TODO: implement multiple selection
+		outliner.setValue( selectedIds.length ? selectedIds[0] : null );
 
-  }
+	}
 
 	function selectFromOutliner() {
 
@@ -50,21 +50,21 @@ Sidebar.Outliner.Geometries = function ( signals ) {
 
 	// events
 
-  var timeout;
+	var timeout;
 
 	signals.sceneChanged.add( function () {
 
-    clearTimeout( timeout );
+		clearTimeout( timeout );
 
-    timeout = setTimeout( function () {
+		timeout = setTimeout( function () {
 
-      getGeometries();
+			getGeometries();
 
-    }, 100 );
+		}, 100 );
 
 	} );
 
-  signals.selected.add( getSelected );
+	signals.selected.add( getSelected );
 
 	return container;
 

+ 17 - 17
editor/js/Sidebar.Outliner.Materials.js

@@ -9,7 +9,7 @@ Sidebar.Outliner.Materials = function ( signals ) {
 
 	var materials = null;
 
-  function getMaterials() {
+	function getMaterials() {
 
 		var options = {};
 
@@ -21,24 +21,24 @@ Sidebar.Outliner.Materials = function ( signals ) {
 		}
 
 		outliner.setOptions( options );
-    getSelected();
+		getSelected();
 
-  }
+	}
 
-  function getSelected() {
+	function getSelected() {
 
-    var selectedIds = [];
+		var selectedIds = [];
 
-    for ( var id in editor.selected ) {
+		for ( var id in editor.selected ) {
 
-      if ( editor.materials[ id ] ) selectedIds.push( id );
+			if ( editor.materials[ id ] ) selectedIds.push( id );
 
-    }
+		}
 
-    // TODO: implement multiple selection
-    outliner.setValue( selectedIds.length ? selectedIds[0] : null );
+		// TODO: implement multiple selection
+		outliner.setValue( selectedIds.length ? selectedIds[0] : null );
 
-  }
+	}
 
 	function selectFromOutliner() {
 
@@ -50,21 +50,21 @@ Sidebar.Outliner.Materials = function ( signals ) {
 
 	// events
 
-  var timeout;
+	var timeout;
 
 	signals.sceneChanged.add( function () {
 
-    clearTimeout( timeout );
+		clearTimeout( timeout );
 
-    timeout = setTimeout( function () {
+		timeout = setTimeout( function () {
 
-      getMaterials();
+			getMaterials();
 
-    }, 100 );
+		}, 100 );
 
 	} );
 
-  signals.selected.add( getSelected );
+	signals.selected.add( getSelected );
 
 	return container;
 

+ 11 - 11
editor/js/Sidebar.Outliner.Scene.js

@@ -88,19 +88,19 @@ Sidebar.Outliner.Scene = function ( signals ) {
 
 	}
 
-  function getSelected() {
+	function getSelected() {
 
-    var selectedIds = [];
+		var selectedIds = [];
 
-    for ( var id in editor.selected ) {
+		for ( var id in editor.selected ) {
 
-      if ( editor.objects[ id ] ) selectedIds.push( id );
+			if ( editor.objects[ id ] ) selectedIds.push( id );
 
-    }
+		}
 
-    outliner.setValue( selectedIds.length ? selectedIds : null );
+		outliner.setValue( selectedIds.length ? selectedIds : null );
 
-  }
+	}
 
 	function getFog() {
 
@@ -134,13 +134,13 @@ Sidebar.Outliner.Scene = function ( signals ) {
 
 	signals.sceneChanged.add( function ( object ) {
 
-    clearTimeout( timeout );
+		clearTimeout( timeout );
 
-    timeout = setTimeout( function () {
+		timeout = setTimeout( function () {
 
-      getScene();
+			getScene();
 
-    }, 100 );
+		}, 100 );
 
 	} );
 

+ 19 - 19
editor/js/Sidebar.Outliner.Textures.js

@@ -9,7 +9,7 @@ Sidebar.Outliner.Textures = function ( signals ) {
 
 	var textures = null;
 
-  function getTextures() {
+	function getTextures() {
 
 		var options = {};
 
@@ -21,50 +21,50 @@ Sidebar.Outliner.Textures = function ( signals ) {
 		}
 
 		outliner.setOptions( options );
-    getSelected();
+		getSelected();
 
-  }
+	}
 
 	function selectFromOutliner() {
 
-    var id = outliner.getValue();
-    
+		var id = outliner.getValue();
+
 		editor.select( editor.textures[ id ] );
 
 	}
 
-  function getSelected() {
+	function getSelected() {
 
-    var selectedIds = [];
+		var selectedIds = [];
 
-    for ( var id in editor.selected ) {
+		for ( var id in editor.selected ) {
 
-      if ( editor.textures[ id ] ) selectedIds.push( id );
+			if ( editor.textures[ id ] ) selectedIds.push( id );
 
-    }
+		}
 
-    // TODO: implement multiple selection
-    outliner.setValue( selectedIds.length ? selectedIds[0] : null );
+		// TODO: implement multiple selection
+		outliner.setValue( selectedIds.length ? selectedIds[0] : null );
 
-  }
+	}
 
 	// events
 
-  var timeout;
+	var timeout;
 
 	signals.sceneChanged.add( function () {
 
-    clearTimeout( timeout );
+		clearTimeout( timeout );
 
-    timeout = setTimeout( function () {
+		timeout = setTimeout( function () {
 
-      getTextures();
+			getTextures();
 
-    }, 100 );
+		}, 100 );
 
 	} );
 
-  signals.selected.add( getSelected );
+	signals.selected.add( getSelected );
 
 	return container;
 

+ 6 - 6
editor/js/Sidebar.Outliner.js

@@ -1,12 +1,12 @@
 Sidebar.Outliner = function ( signals ) {
 
-  var container = new UI.TabbedPanel();
+	var container = new UI.TabbedPanel();
 
-  container.add( new Sidebar.Outliner.Scene( signals ) );
-  container.add( new Sidebar.Outliner.Geometries( signals ) );
-  container.add( new Sidebar.Outliner.Materials( signals ) );
-  container.add( new Sidebar.Outliner.Textures( signals ) );
+	container.add( new Sidebar.Outliner.Scene( signals ) );
+	container.add( new Sidebar.Outliner.Geometries( signals ) );
+	container.add( new Sidebar.Outliner.Materials( signals ) );
+	container.add( new Sidebar.Outliner.Textures( signals ) );
 
-  return container;
+	return container;
 
 }

+ 3 - 3
editor/js/Sidebar.js

@@ -5,9 +5,9 @@ var Sidebar = function ( editor, signals ) {
 	container.setClass( 'sidebar' );
 
 	container.add( new Sidebar.Renderer( signals ) );
-  container.add( new Sidebar.Outliner( signals ) );
-  container.add( new Sidebar.Attributes( signals ) );
-  container.add( new Sidebar.Animation( signals ) );
+	container.add( new Sidebar.Outliner( signals ) );
+	container.add( new Sidebar.Attributes( signals ) );
+	container.add( new Sidebar.Animation( signals ) );
 
 	return container;
 

+ 1 - 1
editor/js/Viewport.js

@@ -314,7 +314,7 @@ var Viewport = function ( editor, signals ) {
 		animate();
 
 	} );
-	
+
 	//
 
 	var renderer;