From c7fee1385d0241dbf99f5a309707d7153314f85f Mon Sep 17 00:00:00 2001 From: sator-imaging <16752340+sator-imaging@users.noreply.github.com> Date: Sun, 3 Sep 2023 14:19:57 +0900 Subject: [PATCH] chore --- Editor/ProjectSettingsPanel.cs | 25 +++++++++++++------------ README.md | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Editor/ProjectSettingsPanel.cs b/Editor/ProjectSettingsPanel.cs index 0bca9c3..470eaae 100644 --- a/Editor/ProjectSettingsPanel.cs +++ b/Editor/ProjectSettingsPanel.cs @@ -91,10 +91,11 @@ void OnGUI() static string[] _emitterPaths = Array.Empty(); static string _generatorPathToShowEmitters = null; static Dictionary _generatorNameToOutputFileName = new(); - static GUIContent gui_emitterBtn; + // GUI classes cannot be initialized on field definition. + static GUIContent gui_emittersBtn; static GUIContent gui_deleteBtn; - static GUIContent gui_generateBtn; - static GUIContent gui_goGeneratedBtn; + static GUIContent gui_runBtn; + static GUIContent gui_unveilBtn; static GUILayoutOption gui_toggleWidth; static GUILayoutOption gui_buttonWidth; static GUIStyle gui_noBGButtonStyle; @@ -104,11 +105,10 @@ void OnGUI() // to take reference to newly created object, need `ref` chain. static void Wakeup(ref Editor cachedEditor) { - // GUI classes cannot be initialized on field definition. - gui_emitterBtn ??= new(EditorGUIUtility.IconContent("d_icon dropdown")); + gui_emittersBtn ??= new(EditorGUIUtility.IconContent("d_icon dropdown")); gui_deleteBtn ??= new(EditorGUIUtility.IconContent("d_TreeEditor.Trash")); - gui_generateBtn ??= new(EditorGUIUtility.IconContent("PlayButton On"));//d_playLoopOff - gui_goGeneratedBtn ??= new(EditorGUIUtility.IconContent("d_Linked"));//SavePassive/SaveActive/SaveFromPlay/d_pick/ + gui_runBtn ??= new(EditorGUIUtility.IconContent("PlayButton On"));//d_playLoopOff + gui_unveilBtn ??= new(EditorGUIUtility.IconContent("d_Linked"));//SavePassive/SaveActive/SaveFromPlay/d_pick/ gui_toggleWidth ??= GUILayout.Width(16); gui_buttonWidth ??= GUILayout.Width(32); if (gui_noBGButtonStyle == null) @@ -227,7 +227,7 @@ static void DrawGenerator(string filePath, bool showEmitterBtn) } //run - if (GUILayout.Button(gui_generateBtn, gui_buttonWidth)) + if (GUILayout.Button(gui_runBtn, gui_buttonWidth)) { Debug.Log($"[{nameof(UnitySourceGenerator)}] Generator running: {fileName}"); USGUtility.ForceGenerateByName(fileName, false); @@ -238,18 +238,19 @@ static void DrawGenerator(string filePath, bool showEmitterBtn) { EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath(filePath)); } - //emitter?? + + //emitters?? if (showEmitterBtn) { - if (GUILayout.Button(gui_emitterBtn, gui_noBGButtonStyle)) + if (GUILayout.Button(gui_emittersBtn, gui_noBGButtonStyle)) { _emitterPaths = GetEmitters(filePath); } } - //goGenerated?? + //unveil?? else { - if (GUILayout.Button(gui_goGeneratedBtn, gui_noBGButtonStyle)) + if (GUILayout.Button(gui_unveilBtn, gui_noBGButtonStyle)) { EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath( USGEngine.GetGeneratorOutputPath(filePath, _generatorNameToOutputFileName[fileName]))); diff --git a/README.md b/README.md index 709c3a8..34f54c6 100644 --- a/README.md +++ b/README.md @@ -296,7 +296,7 @@ There are utility functions to perform source code generation on build event. USGUtility.ForceGenerateByName(nameof(MinimalGenerator)); // perform code generation by known path. -USGEngine.ProcessFile(assetPath, true, true); // force overwrite all related generators +USGEngine.ProcessFile(assetPath, true, true); // force re-generate all related files ```