private void OnGUI() { if (import) { Painting.Format newFormat = (Painting.Format)GUILayout.Toolbar((int)format, new string[] { "Color", "Value", "Multi" }); if (format != newFormat) { format = newFormat; FetchSpecsForFormat(); } if (format == Painting.Format.Multi) { GUILayout.Label("Texture Count: " + textureCount); channelCount = EditorGUILayout.IntSlider("Channel Count", channelCount, (textureCount - 1) * 4 + 1, textureCount * 4); } bitDepth = (RawImportExport.BitDepth)EditorGUILayout.EnumPopup("Depth", bitDepth); sizeX = EditorGUILayout.IntField("Size X", sizeX); sizeY = EditorGUILayout.IntField("Size Y", sizeY); if ((byteLength / sizeX / sizeY) != (int)bitDepth * (format != Painting.Format.Value? 4 : 1)) { EditorGUILayout.HelpBox("Specs do not match the file size!", MessageType.Warning); } else if (GUILayout.Button("Import")) { if (Painter.ImportCanvas(importPath, format, channelCount, sizeX, sizeY)) { Close(); } else { ShowNotification(new GUIContent("Failed to Import texture!")); } } } else { GUILayout.Label(format + " Raw"); bitDepth = (RawImportExport.BitDepth)EditorGUILayout.EnumPopup("Depth", bitDepth); GUILayout.Label("Width: " + sizeX); GUILayout.Label("Height: " + sizeY); GUILayout.Label("Texture Count: " + textureCount); GUILayout.Label("Channel Count: " + channelCount); if (GUILayout.Button("Export")) { path = EditorUtility.SaveFilePanel("Export raw File", Painter.canvasName, "raw", "Choose a path to save the canvas image to."); if (!string.IsNullOrEmpty(path)) { if (Painter.ExportCanvas(path)) { AssetDatabase.Refresh(); Close(); } else { ShowNotification(new GUIContent("Failed to Export texture!")); } } else { Close(); } } if (bitDepth == RawImportExport.BitDepth.Bit32) { EditorGUILayout.HelpBox("Unity Terrain can't import 32-Bit raws, only 8- or 16-Bit! You can import it into Terrain Painter again though.", MessageType.Info); } } }