Browse Source

Editor: Auto select material in material browser.

Mr.doob 5 years ago
parent
commit
b8903a43a8
1 changed files with 13 additions and 0 deletions
  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;
 
 };