Ejemplo n.º 1
0
 public static ReorderableList CreateMaterialList(
     SerializedObject serializedObject,
     SerializedProperty serializedProperty,
     IEnumerable <Material> materialsToExclude,
     Action <List <Material> > materialsWillAdd)
 {
     return(CreateReorderableList <Material>(serializedObject, serializedProperty,
                                             () =>
     {
         MaterialPickerWindow.Open(materialsToExclude, x => materialsWillAdd(x));
     }));
 }
Ejemplo n.º 2
0
 public static void Open(IEnumerable <Material> materialsToExclude, Action <List <Material> > onAddButtonPushed)
 {
     if (pickerWindow == null)
     {
         pickerWindow = CreateInstance <MaterialPickerWindow>();
         pickerWindow.titleContent = new GUIContent("Select Material");
     }
     pickerWindow.OnAddButtonPushed = onAddButtonPushed;
     pickerWindow.treeView          = new PickerTreeView <Material>(
         new TreeViewState(),
         () => EnumerateMaterials().Where(x => !materialsToExclude.Contains(x)),
         EditorGUIUtility.IconContent("Material Icon").image as Texture2D);
     pickerWindow.treeView.ItemDoubleClicked = (x) =>
     {
         onAddButtonPushed(new List <Material> {
             x
         });
         pickerWindow.Close();
     };
     pickerWindow.treeView.Reload();
     pickerWindow.ShowAuxWindow();
 }