public static MA_TextureAtlasserProSettings LoadSettings()
        {
            MA_TextureAtlasserProSettings _settings = AssetDatabase.LoadAssetAtPath(SETTINGSASSETPATH + "MA_TextureAtlasserProSettings.asset", typeof(MA_TextureAtlasserProSettings)) as MA_TextureAtlasserProSettings;

            if (_settings == null)
            {
                _settings = CreateSettings();
            }

            return(_settings);
        }
        public static MA_TextureAtlasserProSettings CreateSettings()
        {
            MA_TextureAtlasserProSettings _settings = ScriptableObject.CreateInstance <MA_TextureAtlasserProSettings>();

            if (_settings != null)
            {
                AssetDatabase.CreateAsset(_settings, SETTINGSASSETPATH + "MA_TextureAtlasserProSettings.asset");
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();

                return(_settings);
            }
            else
            {
                return(null);
            }
        }
        public static void LoadEditorGui(MA_TextureAtlasserProSettings settings)
        {
            createAtlasGC          = new GUIContent();
            loadAtlasGC            = new GUIContent();
            exportAtlasGC          = new GUIContent();
            createQuadGC           = new GUIContent();
            removeQuadGC           = new GUIContent();
            duplicateQuadGC        = new GUIContent();
            showTexturesOnGC       = new GUIContent();
            showTexturesOffGC      = new GUIContent();
            dragHandleGC           = new GUIContent();
            editGC                 = new GUIContent();
            createExportSettingsGC = new GUIContent();

            switch (settings.editorGuiSettings.editorGuiMode)
            {
            case MA_EditorGuiMode.IconAndText:
                LoadIcons();
                LoadText();
                break;

            case MA_EditorGuiMode.Icon:
                LoadIcons();
                break;

            case MA_EditorGuiMode.Text:
                LoadText();
                break;

            default:
                LoadIcons();
                break;
            }

            if (settings.editorGuiSettings.enableToolTips)
            {
                LoadToolTips(settings);
            }

            //Exceptions.
            dragHandleGC.image = (Texture)EditorGUIUtility.Load(LOADICONPATH + "dragHandleIcon" + ".png");
            dragHandleGC.text  = "";
            editGC.image       = (Texture)EditorGUIUtility.Load(LOADICONPATH + "editIcon" + ".png");
            editGC.text        = "";
        }
 private static void LoadToolTips(MA_TextureAtlasserProSettings settings)
 {
     createAtlasGC.tooltip = "Opens the create atlas window.";
     loadAtlasGC.tooltip   = "Load an existing atlas.";
     exportAtlasGC.tooltip = "Opens the export window.";
     if (settings.useHotkeys)
     {
         createQuadGC.tooltip    = string.Format("({0}+{1}), Creates a new quad.", settings.modifierKey, settings.addQuadHotKey);
         removeQuadGC.tooltip    = string.Format("({0}+{1}), Removes the selected quad.", settings.modifierKey, settings.removeQuadHotKey);
         duplicateQuadGC.tooltip = string.Format("({0}+{1}), Duplicates the selected quad.", settings.modifierKey, settings.duplicateHotKey);
     }
     else
     {
         createQuadGC.tooltip    = "Creates a new quad.";
         removeQuadGC.tooltip    = "Removes the selected quad.";
         duplicateQuadGC.tooltip = "Duplicates the selected quad.";
     }
     showTexturesOnGC.tooltip       = "Hides the preview of the first texture on the quads.";
     showTexturesOffGC.tooltip      = "Shows a preview of the first texture on the quads.";
     createExportSettingsGC.tooltip = "Opens the create export settings window.";
 }