private static void SendAssetToSP() { // Get the currently selected mesh game object MeshInfo[] meshesInfo = MaterialsManipulation.GetSelectedMeshesInfo(); switch (meshesInfo.Length) { case 0: EditorUtility.DisplayDialog("Substance Painter", "You need to select one compatible mesh game object in the scene hierarchy respecting prerequisites:\n" + "- the mesh must be an fbx file imported in project assets\n" + "- materials must use the 'Standard' shader\n" + "- materials names must be the default ones (as defined in the mesh)", "OK"); break; case 1: SendMeshToSP(meshesInfo[0]); break; default: ItemSelectorWindow.ShowSelect( "Send to Substance Painter", "Select the mesh to send to Substance Painter", meshesInfo.ToList().Select(info => info.AssetPath).ToArray(), index => SendMeshToSP(meshesInfo[index])); break; } }
public static void ShowSelect(string title, string description, string[] entries, Action <int> callback) { ItemSelectorWindow window = EditorWindow.GetWindow(typeof(ItemSelectorWindow), true, title) as ItemSelectorWindow; window._description = description; window._entries = entries; window.EntrySelected += (o, e) => callback(e.Index); window.ShowPopup(); }