private void OnGUI() { if (thisWindow == null) { GetCurrentWindow(); return; } //Get current event Event e = ProcessEvents(); if (isLoaded) { GUILayout.BeginArea(new Rect(MA_TextureAtlasserProUtils.VIEWOFFSET, MA_TextureAtlasserProUtils.VIEWOFFSET, position.width - (MA_TextureAtlasserProUtils.VIEWOFFSET * 2), position.height - (MA_TextureAtlasserProUtils.VIEWOFFSET * 2))); GUILayout.BeginVertical(); if (curWindow != null && curWindow.textureAtlas != null) { //Export options GUILayout.Box("Note: No custom export options right now.. :<", EditorStyles.helpBox); //Export GUILayout.BeginVertical(EditorStyles.helpBox); GUILayout.Label("Meshes: OBJ | Textures: PNG"); if (GUILayout.Button("Export Atlas", GUILayout.ExpandWidth(true), GUILayout.Height(37))) { MA_TextureAtlasserProUtils.ExportAtlas(curWindow.textureAtlas); } GUILayout.EndVertical(); } else if (curWindow == null) { GUI.backgroundColor = Color.red; GUILayout.Box("Error: Link with the Texture Atlas Editor lost!", EditorStyles.helpBox); if (GUILayout.Button("Link Atlas Editor", GUILayout.ExpandWidth(true), GUILayout.Height(37))) { curWindow = (MA_TextureAtlasserProWindow)EditorWindow.GetWindow <MA_TextureAtlasserProWindow>(); } GUI.backgroundColor = Color.white; } else if (curWindow.textureAtlas == null) { GUI.backgroundColor = Color.red; GUILayout.Box("Error: No Texture Atlas found make sure to open one!", EditorStyles.helpBox); GUI.backgroundColor = Color.white; } GUILayout.EndVertical(); GUILayout.EndArea(); } if (e.type == EventType.Repaint) { isLoaded = true; } }
public static void CloseWindow(MA_TextureAtlasserProWindow curWindow) { if (curWindow == null) { Debug.LogError("Closing window Failed: curWindow == null"); } curWindow.Close(); }
private void OnGUI() { if (thisWindow == null) { GetCurrentWindow(); return; } //Get current event Event e = ProcessEvents(); if (isLoaded) { GUILayout.BeginArea(new Rect(MA_TextureAtlasserProUtils.VIEW_OFFSET, MA_TextureAtlasserProUtils.VIEW_OFFSET, position.width - (MA_TextureAtlasserProUtils.VIEW_OFFSET * 2), position.height - (MA_TextureAtlasserProUtils.VIEW_OFFSET * 2))); GUILayout.BeginVertical(); if (curWindow != null && curWindow.textureAtlas != null) { //Export GUILayout.BeginVertical(); DrawExportMenu(); curWindow.textureAtlas.exportSettings = (MA_TextureAtlasserProExportSettings)EditorGUILayout.ObjectField(curWindow.textureAtlas.exportSettings, typeof(MA_TextureAtlasserProExportSettings), false); if (curWindow.textureAtlas.exportSettings != null) { DrawExportOptions(); } GUILayout.EndVertical(); } else if (curWindow == null) { GUI.backgroundColor = Color.red; GUILayout.Box("Error: Link with the Texture Atlas Editor lost!", EditorStyles.helpBox); if (GUILayout.Button("Link Atlas Editor", GUILayout.ExpandWidth(true), GUILayout.Height(37))) { curWindow = (MA_TextureAtlasserProWindow)EditorWindow.GetWindow <MA_TextureAtlasserProWindow>(); } GUI.backgroundColor = Color.white; } else if (curWindow.textureAtlas == null) { GUI.backgroundColor = Color.red; GUILayout.Box("Error: No Texture Atlas found make sure to open one!", EditorStyles.helpBox); GUI.backgroundColor = Color.white; } GUILayout.EndVertical(); GUILayout.EndArea(); } if (e.type == EventType.Repaint) { isLoaded = true; } }
public static void InitEditorWindow(MA_TextureAtlasserProWindow currentEditorWindow) { curWindow = currentEditorWindow; GetCurrentWindow(); thisWindow.minSize = new Vector2(windowWidth, windowHeight); thisWindow.titleContent.text = "MA_ExportTextureAtlas"; thisWindow.Show(); }
public static void InitEditorWindow(MA_TextureAtlasserProWindow currentEditorWindow) { curWindow = currentEditorWindow; GetCurrentWindow(); thisWindow.minSize = new Vector2(500, 160); thisWindow.maxSize = new Vector2(500, 160); thisWindow.titleContent.text = "MA_CreateTextureAtlas"; thisWindow.Show(); }
public MA_TextureAtlasserProInspectorView(MA_TextureAtlasserProWindow currentEditorWindow, string title) : base(currentEditorWindow, title) { }
private void OnGUI() { if (thisWindow == null) { GetCurrentWindow(); return; } //Get current event Event e = ProcessEvents(); if (isLoaded) { GUILayout.BeginArea(new Rect(MA_TextureAtlasserProUtils.VIEWOFFSET, MA_TextureAtlasserProUtils.VIEWOFFSET, position.width - (MA_TextureAtlasserProUtils.VIEWOFFSET * 2), position.height - (MA_TextureAtlasserProUtils.VIEWOFFSET * 2))); GUILayout.BeginVertical(); if (curWindow != null && curWindow.textureAtlas != null) { //Export GUILayout.BeginVertical(); DrawExportModeEditor(); DrawAdvancedEditor(); GUILayout.BeginHorizontal(EditorStyles.helpBox); GUI.enabled = _selectedExportMode != ExportMode.None; if (GUILayout.Button("Export", GUILayout.ExpandWidth(true), GUILayout.Height(37))) { if (exportObjDefault) { MA_TextureAtlasserProUtils.ExportAtlasMeshesObj(curWindow.textureAtlas); } if (_replaceMeshes) { MA_TextureAtlasserProUtils.ModifyMeshes(curWindow.textureAtlas); } if (exportPngDefault) { if (exportSprite) { MA_TextureAtlasserProUtils.ExportAtlasSpritesPNG(curWindow.textureAtlas, exportSliceSprite); } else { MA_TextureAtlasserProUtils.ExportAtlasTexturesPNG(curWindow.textureAtlas); } } } GUI.enabled = true; GUILayout.EndHorizontal(); GUILayout.EndVertical(); } else if (curWindow == null) { GUI.backgroundColor = Color.red; GUILayout.Box("Error: Link with the Texture Atlas Editor lost!", EditorStyles.helpBox); if (GUILayout.Button("Link Atlas Editor", GUILayout.ExpandWidth(true), GUILayout.Height(37))) { curWindow = (MA_TextureAtlasserProWindow)EditorWindow.GetWindow <MA_TextureAtlasserProWindow>(); } GUI.backgroundColor = Color.white; } else if (curWindow.textureAtlas == null) { GUI.backgroundColor = Color.red; GUILayout.Box("Error: No Texture Atlas found make sure to open one!", EditorStyles.helpBox); GUI.backgroundColor = Color.white; } GUILayout.EndVertical(); GUILayout.EndArea(); } if (e.type == EventType.Repaint) { isLoaded = true; } }
public MA_TextureAtlasserProWorkView(MA_TextureAtlasserProWindow currentEditorWindow, string title) : base(currentEditorWindow, title) { zoomCoordsOrigin = new Vector2(-(curWindow.position.width / 2) + (curWindow.position.width / 3), -(curWindow.position.height / 2) + (curWindow.position.height / 3)); }
public MA_TextureAtlasserProViewBase(MA_TextureAtlasserProWindow currentEditorWindow, string title) { curWindow = currentEditorWindow; viewTitle = title; }
private void OnGUI() { if (thisWindow == null) { GetCurrentWindow(); return; } //Get current event Event e = ProcessEvents(); if (isLoaded) { GUILayout.BeginArea(new Rect(MA_TextureAtlasserProUtils.VIEWOFFSET, MA_TextureAtlasserProUtils.VIEWOFFSET, position.width - (MA_TextureAtlasserProUtils.VIEWOFFSET * 2), position.height - (MA_TextureAtlasserProUtils.VIEWOFFSET * 2))); GUILayout.BeginVertical(); if (curWindow != null && curWindow.textureAtlas != null) { //Export GUILayout.BeginVertical(); GUILayout.BeginHorizontal(EditorStyles.helpBox); if (GUILayout.Button("3D", GUILayout.ExpandWidth(false))) { exportObjDefault = true; exportPngDefault = true; exportSprite = false; exportSliceSprite = false; } if (GUILayout.Button("2D", GUILayout.ExpandWidth(false))) { exportObjDefault = false; exportPngDefault = true; exportSprite = true; exportSliceSprite = true; } GUILayout.EndHorizontal(); GUILayout.Label("Meshes:"); exportObjDefault = GUILayout.Toggle(exportObjDefault, "OBJ default."); GUILayout.Label("Textures:"); GUILayout.BeginHorizontal(); exportPngDefault = GUILayout.Toggle(exportPngDefault, "PNG default."); if (exportPngDefault) { exportSprite = GUILayout.Toggle(exportSprite, "Sprite."); if (exportSprite) { exportSliceSprite = GUILayout.Toggle(exportSliceSprite, "Slice sprites."); } } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(EditorStyles.helpBox); if (GUILayout.Button("Export", GUILayout.ExpandWidth(true), GUILayout.Height(37))) { if (exportObjDefault) { MA_TextureAtlasserProUtils.ExportAtlasMeshesObj(curWindow.textureAtlas); } if (exportPngDefault) { if (exportSprite) { MA_TextureAtlasserProUtils.ExportAtlasSpritesPNG(curWindow.textureAtlas, exportSliceSprite); } else { MA_TextureAtlasserProUtils.ExportAtlasTexturesPNG(curWindow.textureAtlas); } } } GUILayout.EndHorizontal(); GUILayout.EndVertical(); } else if (curWindow == null) { GUI.backgroundColor = Color.red; GUILayout.Box("Error: Link with the Texture Atlas Editor lost!", EditorStyles.helpBox); if (GUILayout.Button("Link Atlas Editor", GUILayout.ExpandWidth(true), GUILayout.Height(37))) { curWindow = (MA_TextureAtlasserProWindow)EditorWindow.GetWindow <MA_TextureAtlasserProWindow>(); } GUI.backgroundColor = Color.white; } else if (curWindow.textureAtlas == null) { GUI.backgroundColor = Color.red; GUILayout.Box("Error: No Texture Atlas found make sure to open one!", EditorStyles.helpBox); GUI.backgroundColor = Color.white; } GUILayout.EndVertical(); GUILayout.EndArea(); } if (e.type == EventType.Repaint) { isLoaded = true; } }
private static void GetCurrentWindow() { thisWindow = (MA_TextureAtlasserProWindow)EditorWindow.GetWindow <MA_TextureAtlasserProWindow>(); }
private void OnGUI() { if (thisWindow == null) { GetCurrentWindow(); return; } //Get current event Event e = ProcessEvents(); if (isLoaded) { GUILayout.BeginArea(new Rect(MA_TextureAtlasserProUtils.VIEWOFFSET, MA_TextureAtlasserProUtils.VIEWOFFSET, position.width - (MA_TextureAtlasserProUtils.VIEWOFFSET * 2), position.height - (MA_TextureAtlasserProUtils.VIEWOFFSET * 2))); GUILayout.BeginVertical(); if (curWindow != null && curWindow.textureAtlas != null) { //Export GUILayout.BeginVertical(); DrawExportPresetMenu(); DrawExportAdvancedOptions(); GUILayout.BeginHorizontal(EditorStyles.helpBox); switch (exportPreset) { case ExportPreset.Custom: break; case ExportPreset.Default: modelFormat = ModelFormat.Obj; textureFormat = TextureFormat.Png; textureType = TextureType.Default; textureScaleMode = MA_TextureUtils.TextureScaleMode.Bilinear; break; case ExportPreset.Sprites: modelFormat = ModelFormat.None; textureFormat = TextureFormat.Png; textureType = TextureType.SpriteSliced; textureScaleMode = MA_TextureUtils.TextureScaleMode.Bilinear; break; case ExportPreset.ReplaceObjMeshes: modelFormat = ModelFormat.ReplaceObj; textureFormat = TextureFormat.Png; textureType = TextureType.Default; textureScaleMode = MA_TextureUtils.TextureScaleMode.Bilinear; break; default: break; } if (GUILayout.Button("Export", GUILayout.ExpandWidth(true), GUILayout.Height(37))) { MA_TextureAtlasserProUtils.ExportAtlasModels(curWindow.textureAtlas, modelFormat); MA_TextureAtlasserProUtils.ExportAtlasTextures(curWindow.textureAtlas, textureFormat, textureType, textureScaleMode); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); } else if (curWindow == null) { GUI.backgroundColor = Color.red; GUILayout.Box("Error: Link with the Texture Atlas Editor lost!", EditorStyles.helpBox); if (GUILayout.Button("Link Atlas Editor", GUILayout.ExpandWidth(true), GUILayout.Height(37))) { curWindow = (MA_TextureAtlasserProWindow)EditorWindow.GetWindow <MA_TextureAtlasserProWindow>(); } GUI.backgroundColor = Color.white; } else if (curWindow.textureAtlas == null) { GUI.backgroundColor = Color.red; GUILayout.Box("Error: No Texture Atlas found make sure to open one!", EditorStyles.helpBox); GUI.backgroundColor = Color.white; } GUILayout.EndVertical(); GUILayout.EndArea(); } if (e.type == EventType.Repaint) { isLoaded = true; } }