فهرست منبع

Editor: More useful BufferGeometry panel.

Mr.doob 10 سال پیش
والد
کامیت
3ff2945927
1فایلهای تغییر یافته به همراه9 افزوده شده و 31 حذف شده
  1. 9 31
      editor/js/Sidebar.Geometry.BufferGeometry.js

+ 9 - 31
editor/js/Sidebar.Geometry.BufferGeometry.js

@@ -6,47 +6,25 @@ Sidebar.Geometry.BufferGeometry = function ( signals ) {
 
 	var container = new UI.Panel();
 
-	// vertices
-
-	var verticesRow = new UI.Panel();
-	var vertices = new UI.Text().setFontSize( '12px' );
-
-	verticesRow.add( new UI.Text( 'Vertices' ).setWidth( '90px' ) );
-	verticesRow.add( vertices );
-
-	container.add( verticesRow );
-
-	// faces
-
-	var facesRow = new UI.Panel();
-	var faces = new UI.Text().setFontSize( '12px' );
-
-	facesRow.add( new UI.Text( 'Faces' ).setWidth( '90px' ) );
-	facesRow.add( faces );
-
-	container.add( facesRow );
-
-	//
-
-	var update = function ( object ) {
+	function update( object ) {
 
 		if ( object === null ) return;
 
 		var geometry = object.geometry;
 
-		if ( geometry instanceof THREE.BufferGeometry ) { 
+		if ( geometry instanceof THREE.BufferGeometry ) {
 
+			container.clear();
 			container.setDisplay( 'block' );
 
-			vertices.setValue( ( geometry.attributes.position.array.length / 3 ).format() );
-
-			if ( geometry.attributes.index !== undefined ) {
-
-				faces.setValue( ( geometry.attributes.index.array.length / 3 ).format() );
+			var attributes = geometry.attributes;
 
-			} else {
+			for ( var name in attributes ) {
 
-				faces.setValue( ( geometry.attributes.position.array.length / 9 ).format() );
+				var panel = new UI.Panel();
+				panel.add( new UI.Text( name ).setWidth( '90px' ) );
+				panel.add( new UI.Text( ( attributes[ name ].count ).format() ).setFontSize( '12px' ) );
+				container.add( panel );
 
 			}