Explorar o código

Editor: Auto select material in material browser.

Mr.doob %!s(int64=6) %!d(string=hai) anos
pai
achega
b8903a43a8
Modificáronse 1 ficheiros con 13 adicións e 0 borrados
  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;
 
 };