Sfoglia il codice sorgente

Editor: Auto select material in material browser.

Mr.doob 6 anni fa
parent
commit
b8903a43a8
1 ha cambiato i file con 13 aggiunte e 0 eliminazioni
  1. 13 0
      editor/js/Sidebar.Project.js

+ 13 - 0
editor/js/Sidebar.Project.js

@@ -222,6 +222,19 @@ Sidebar.Project = function ( editor ) {
 
 	container.add( materials );
 
+	// events
+
+	signals.objectSelected.add( function ( object ) {
+
+		if ( object !== null ) {
+
+			var index = Object.values( editor.materials ).indexOf( object.material );
+			listbox.selectIndex( index );
+
+		}
+
+	} );
+
 	return container;
 
 };