public void OnGUI() { GUILayout.Label("Heightmap File", EditorStyles.boldLabel); EditorGUI.BeginDisabledGroup(true); heightmapLabel = EditorGUILayout.TextField(String.Empty, heightmapLabel); EditorGUI.EndDisabledGroup(); if (GUILayout.Button("Load Heightmap Data")) { LoadHeightmap(); } EditorGUILayout.Space(); exportFormat = (BabylonHeightmapFormat)EditorGUILayout.EnumPopup("Export Format:", exportFormat, GUILayout.ExpandWidth(true)); EditorGUILayout.Space(); // .. EditorGUILayout.BeginHorizontal(); enableResolution = EditorGUILayout.Toggle("Scale Resolution:", enableResolution); if (enableResolution == false) { exportResolution = heightmapResolution; } EditorGUI.BeginDisabledGroup(enableResolution == false); exportResolution = (int)EditorGUILayout.Slider("", exportResolution, 0, heightmapResolution); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); exportScaling = (BabylonTextureScale)EditorGUILayout.EnumPopup("Map Image Scaling:", (BabylonTextureScale)exportScaling, GUILayout.ExpandWidth(true)); EditorGUILayout.Space(); EditorGUI.EndDisabledGroup(); // .. EditorGUILayout.BeginHorizontal(); keepGeneratorOpen = EditorGUILayout.Toggle("Keep Generator Open:", keepGeneratorOpen); int vertexCount = (exportResolution * exportResolution); string vertextLabel = String.Format("Estimated Mesh Density - {0}", (vertexCount > 0) ? vertexCount.ToString("#,#") : "0"); GUILayout.Label(vertextLabel, EditorStyles.boldLabel); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); // .. if (heightmapTexture == null) { heightmapTexture = new Texture2D(500, 500, TextureFormat.RGBA32, false); heightmapTexture.Clear(Color.black); } if (heightmapTexture != null) { GUI.DrawTexture(new Rect(10.0f, 180.0f, 500.0f, 500.0f), heightmapTexture, ScaleMode.ScaleToFit); } GUILayout.Space(510.0f); if (GUILayout.Button("Export Heightmap")) { if (heightmapTexture != null && !String.IsNullOrEmpty(heightmapFile)) { ExportHeightmap(); } else { ExporterWindow.ShowMessage("No heightmap data generated."); } } }
public void OnGUI() { // Update texture atlas window EditorGUILayout.Space(); skinMeshRenderer = EditorGUILayout.ObjectField("Skin Mesh Renderer:", skinMeshRenderer, typeof(SkinnedMeshRenderer), true) as SkinnedMeshRenderer; EditorGUILayout.Space(); bakeTextureMaps = EditorGUILayout.Toggle("Bake Texture Maps:", bakeTextureMaps); EditorGUILayout.Space(); bakeAlphaEncoding = EditorGUILayout.Toggle("Bake Image Alpha:", bakeAlphaEncoding); EditorGUILayout.Space(); EditorGUI.BeginDisabledGroup(true); EditorGUI.EndDisabledGroup(); textureAtlasSize = (int)EditorGUILayout.Slider("Texture Atlas Size:", textureAtlasSize, 128, 8192); EditorGUILayout.Space(); EditorGUI.BeginDisabledGroup(true); textureAtlasShader = EditorGUILayout.ObjectField("Texture Atlas Shader:", textureAtlasShader, typeof(Shader), true) as Shader; EditorGUILayout.Space(); textureAtlasFormat = (BabylonImageFormat)EditorGUILayout.EnumPopup("Texture Atlas Format:", textureAtlasFormat, GUILayout.ExpandWidth(true)); EditorGUILayout.Space(); EditorGUI.EndDisabledGroup(); textureImageScaling = (BabylonTextureScale)EditorGUILayout.EnumPopup("Texture Image Scale:", textureImageScaling, GUILayout.ExpandWidth(true)); EditorGUILayout.Space(); maxTextureImageSize = (int)EditorGUILayout.Slider("Texture Image Max:", maxTextureImageSize, 0, 4096); EditorGUILayout.Space(); linearInterpolation = EditorGUILayout.Toggle("Use Linear Interpolation:", linearInterpolation); EditorGUILayout.Space(); updateSkinRenderer = EditorGUILayout.Toggle("Update Skin Renderers:", updateSkinRenderer); EditorGUILayout.Space(); EditorGUILayout.Space(); if (GUILayout.Button("Bake Texture Atlas Skin")) { if (skinMeshRenderer) { Bake(); } if (!skinMeshRenderer) { ExporterWindow.ShowMessage("You must select a skin mesh renderer"); } } }