private void DrawExportMenu()
        {
            GUILayout.BeginHorizontal(EditorStyles.helpBox, GUILayout.Height(44));

            if (GUILayout.Button(MA_TextureAtlasserProGuiLoader.createExportSettingsGC, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
            {
                MA_TextureAtlasserProCreateExportWindow.InitWindow(curWindow);
            }

            bool wasEnabled = GUI.enabled;

            if (curWindow.textureAtlas.exportSettings != null)
            {
                GUI.enabled = true;
            }
            else
            {
                GUI.enabled = false;
            }

            if (GUILayout.Button("Export", GUILayout.ExpandWidth(true), GUILayout.Height(37)))
            {
                string[] textures = null;
                string   material = null;
                string[] models   = null;

                if (curWindow.textureAtlas.exportSettings.exportTextures)
                {
                    textures = MA_TextureAtlasserProUtils.ExportAtlasTextures(curWindow.textureAtlas, curWindow.textureAtlas.exportSettings.textureExportSettings);
                }

                if (curWindow.textureAtlas.exportSettings.exportMaterials)
                {
                    material = MA_TextureAtlasserProUtils.ExportAtlasMaterial(curWindow.textureAtlas, curWindow.textureAtlas.exportSettings.materialExportSettings, textures: textures);
                }

                if (curWindow.textureAtlas.exportSettings.exportModels)
                {
                    models = MA_TextureAtlasserProUtils.ExportAtlasModels(curWindow.textureAtlas, curWindow.textureAtlas.exportSettings.modelExportSettings, materialPath: material);
                }
            }

            GUI.enabled = wasEnabled;

            GUILayout.EndHorizontal();
        }
 private static void GetCurrentWindow()
 {
     thisWindow = (MA_TextureAtlasserProCreateExportWindow)EditorWindow.GetWindow <MA_TextureAtlasserProCreateExportWindow>();
 }
        private void DrawExportMenu()
        {
            GUILayout.BeginHorizontal(EditorStyles.helpBox, GUILayout.Height(44));

            if (GUILayout.Button(MA_TextureAtlasserProIcons.createAtlasIcon, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
            {
                MA_TextureAtlasserProCreateExportWindow.InitWindow(curWindow);
            }

            bool wasEnabled = GUI.enabled;

            if (curWindow.textureAtlas.exportSettings != null)
            {
                GUI.enabled = true;
            }
            else
            {
                GUI.enabled = false;
            }

            if (GUILayout.Button("Export", GUILayout.ExpandWidth(true), GUILayout.Height(37)))
            {
                bool export = false;

                if (curWindow.textureAtlas.exportSettings.modelExportSettings.modelFormat == ModelFormat.ReplaceMesh)
                {
                    if (EditorUtility.DisplayDialog("Replace original models?", "Are you sure you want to replace the original models, this can't be undone!", "Replace", "Cancel"))
                    {
                        export = true;
                    }
                }
                else
                {
                    export = true;
                }

                if (export)
                {
                    string[] textures = null;
                    string   material = null;
                    string[] models   = null;

                    if (curWindow.textureAtlas.exportSettings.exportTextures)
                    {
                        textures = MA_TextureAtlasserProUtils.ExportAtlasTextures(curWindow.textureAtlas, curWindow.textureAtlas.exportSettings.textureExportSettings);
                    }

                    if (curWindow.textureAtlas.exportSettings.exportMaterials)
                    {
                        material = MA_TextureAtlasserProUtils.ExportAtlasMaterial(curWindow.textureAtlas, curWindow.textureAtlas.exportSettings.materialExportSettings, textures: textures);
                    }

                    if (curWindow.textureAtlas.exportSettings.exportModels)
                    {
                        models = MA_TextureAtlasserProUtils.ExportAtlasModels(curWindow.textureAtlas, curWindow.textureAtlas.exportSettings.modelExportSettings, material: material);
                    }
                }
            }

            GUI.enabled = wasEnabled;

            GUILayout.EndHorizontal();
        }