private static void DoSomethingWithVariable() { if (Selection.activeObject == null) { return; } List <string> notRelativePaths = new List <string>(); string path; foreach (UnityEngine.Object obj in Selection.objects) { path = AssetDatabase.GetAssetPath(obj); FileInfo fileinfo = new FileInfo(path); if (fileinfo.Extension.ToLower() != ".cs" && fileinfo.Extension.ToLower() != ".js") { DirectoryInfo dirInfo = new DirectoryInfo(path); if (!dirInfo.Exists) { continue; } } notRelativePaths.Add(CTL_Tools.GetNotRelativePath(path)); } CTL_Settings.AddExludedPath(notRelativePaths.ToArray()); }
//CTL...DRAW panel settings void DrawSettingsPanel() { mScrollPosSettingsTab = EditorGUILayout.BeginScrollView(mScrollPosSettingsTab); bool prevState = false; //CTL...SETTINGS toogle auto refresh CTL_Settings.AutoRefresh = EditorGUILayout.Toggle(CTL_Styles.sGUIC_Settings_AutoRefresh, CTL_Settings.AutoRefresh); //CTL...SETTINGS trim comment prevState = CTL_Settings.TrimCommentOnParse; CTL_Settings.TrimCommentOnParse = EditorGUILayout.Toggle(CTL_Styles.sGUIC_Settings_TrimCommentOnRefresh, CTL_Settings.TrimCommentOnParse); if (CTL_Settings.TrimCommentOnParse != prevState) { sNeedRefreshAuto = true; } //CTL...SETTINGS CS/JS parsing prevState = CTL_Settings.ParseCSFiles; CTL_Settings.ParseCSFiles = EditorGUILayout.Toggle(CTL_Styles.sGUIC_Settings_ParseCSFiles, CTL_Settings.ParseCSFiles); if (CTL_Settings.ParseCSFiles != prevState) { sNeedRefreshAuto = true; } prevState = CTL_Settings.ParseJSFiles; CTL_Settings.ParseJSFiles = EditorGUILayout.Toggle(CTL_Styles.sGUIC_Settings_ParseJSFiles, CTL_Settings.ParseJSFiles); if (CTL_Settings.ParseCSFiles != prevState) { sNeedRefreshAuto = true; } //CTL...SETTINGS toogle case sensitive prevState = CTL_Settings.CaseSensitive; CTL_Settings.CaseSensitive = EditorGUILayout.Toggle(CTL_Styles.sGUIC_Settings_CaseSensitive, CTL_Settings.CaseSensitive); if (CTL_Settings.CaseSensitive != prevState) { sNeedRefreshAuto = true; } //CTL...SETTINGS toogle enable help tooltip prevState = CTL_Settings.EnableHelpTooltips; CTL_Settings.EnableHelpTooltips = EditorGUILayout.Toggle(CTL_Styles.sGUIC_Settings_EnableHelpTooltips, CTL_Settings.EnableHelpTooltips); if (CTL_Settings.EnableHelpTooltips != prevState) { CTL_Styles.SetupStyles(true); } EventModifiers[] modifiers = new EventModifiers[] { EventModifiers.None, EventModifiers.Shift, EventModifiers.Control, EventModifiers.Alt }; string[] optionsModifiers = { "None", "Shift", "Control", "Alt" }; int index = 0; for (int i = 0; i < modifiers.Length; i++) { if (modifiers[i] == CTL_Settings.CommentClickModifier_OpenFile) { index = i; break; } } index = EditorGUILayout.Popup( CTL_Styles.sGUIC_Settings_CommentClickModifier_OpenFile, index, optionsModifiers); CTL_Settings.CommentClickModifier_OpenFile = modifiers[index]; CTL_Settings.eKeywordSortOrder[] keywordSortOrders = new CTL_Settings.eKeywordSortOrder[] { CTL_Settings.eKeywordSortOrder.ALPHABETICAL, CTL_Settings.eKeywordSortOrder.KEYWORD_ORDER }; string[] optionskeywordSortOrders = { "Alphabetical", "Keyword order" }; index = 0; for (int i = 0; i < keywordSortOrders.Length; i++) { if (keywordSortOrders[i] == CTL_Settings.KeywordSortOrder) { index = i; break; } } index = EditorGUILayout.Popup( CTL_Styles.sGUIC_Settings_KeywordSortOrder, index, optionskeywordSortOrders); CTL_Settings.KeywordSortOrder = keywordSortOrders[index]; //CTL...SETTINGS toogle enable comments tooltip EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.LabelField("Comments Tooltip", EditorStyles.boldLabel); CTL_Settings.EnableCommentTooltip = EditorGUILayout.Toggle(CTL_Styles.sGUIC_Settings_EnableCommentTooltip, CTL_Settings.EnableCommentTooltip); if (CTL_Settings.EnableCommentTooltip) { CTL_Settings.DisplayKeywordInCommentTooltip = EditorGUILayout.Toggle(CTL_Styles.sGUIC_Settings_DisplayKeywordInCommentTooltip, CTL_Settings.DisplayKeywordInCommentTooltip); CTL_Settings.DisplayFilenameAndLineInCommentTooltip = EditorGUILayout.Toggle(CTL_Styles.sGUIC_Settings_DisplayFilenameAndLineInCommentTooltip, CTL_Settings.DisplayFilenameAndLineInCommentTooltip); index = 0; for (int i = 0; i < modifiers.Length; i++) { if (modifiers[i] == CTL_Settings.DisplayTooltipModifier) { index = i; break; } } index = EditorGUILayout.Popup( CTL_Styles.sGUIC_Settings_DisplayTooltipModifier, index, optionsModifiers); CTL_Settings.DisplayTooltipModifier = modifiers[index]; } EditorGUILayout.EndHorizontal(); //CTL...SETTINGS btn exclude file/folder EditorGUILayout.BeginHorizontal(); if (GUILayout.Button(CTL_Styles.sGUIC_Settings_ExcludeFile)) { CTL_Settings.AddExludedPath(EditorUtility.OpenFilePanel(CTL_Styles.sGUIC_Settings_ExcludeFile.text, CTL_Tools.GetAssetFolderPath(), "cs")); } if (GUILayout.Button(CTL_Styles.sGUIC_Settings_ExcludeFolder)) { CTL_Settings.AddExludedPath(EditorUtility.OpenFolderPanel(CTL_Styles.sGUIC_Settings_ExcludeFolder.text, CTL_Tools.GetAssetFolderPath(), "")); } EditorGUILayout.EndHorizontal(); string excludedPath = null; foreach (string pathExcluded in CTL_Settings.ExcludedPaths.PathList) { EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("X", GUILayout.Width(30))) { excludedPath = pathExcluded; } if (GUILayout.Button("Select", GUILayout.Width(50))) { Selection.activeObject = AssetDatabase.LoadAssetAtPath <UnityEngine.Object>("ASSETS\\" + pathExcluded); } GUIStyle pathLabelStyle = new GUIStyle("label"); if (!CTL_Tools.IsValidPath("ASSETS\\" + pathExcluded)) { pathLabelStyle.normal.textColor = new Color(1f, .25f, .25f); } EditorGUILayout.LabelField(CTL_Tools.GetRelativePath(pathExcluded), pathLabelStyle); EditorGUILayout.EndHorizontal(); } if (excludedPath != null) { CTL_Settings.RemoveExludedPath(excludedPath); } EditorGUILayout.EndScrollView(); GUILayout.FlexibleSpace(); if (CTL_Settings.DEBUG_MODE) { //CTL...DEBUG btn load settings if (GUILayout.Button("/!\\ Load settings /!\\")) { CTL_Settings.Load(); } //CTL...DEBUG btn export settings if (GUILayout.Button("/!\\ Export settings /!\\")) { CTL_Settings.Instance.Export(); } //CTL...DEBUG btn refresh styles if (GUILayout.Button("/!\\ Refresh Styles /!\\")) { CTL_Styles.SetupStyles(true); } //CTL...DEBUG btn delete persistant data if (GUILayout.Button("/!\\ DeleteAllPersistantData /!\\")) { CTL_Settings.DeleteAllPersistantData(); } } EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Read the doc")) { Application.OpenURL("http://julien-foucher.com/?a=codetodolist&b=doc&s=assetsettings"); } if (GUILayout.Button("Rate this asset")) { Application.OpenURL("http://julien-foucher.com/?a=codetodolist&b=store&s=assetsettings"); } EditorGUILayout.EndHorizontal(); }