diff options
| author | yum <yum.food.vr@gmail.com> | 2026-01-02 03:21:42 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2026-01-02 03:21:42 -0800 |
| commit | babfcc18ceb3a30eecdf4d00a4f42ff03ca10b5b (patch) | |
| tree | a1ae5451f4e1cc99bc51f06af970d90b2c00f37b /Scripts/Fold/Editor/FoldWindow.cs | |
| parent | 22273213986052c9464a852c7240b106bc22bebb (diff) | |
Fold: simplify code
Diffstat (limited to 'Scripts/Fold/Editor/FoldWindow.cs')
| -rw-r--r-- | Scripts/Fold/Editor/FoldWindow.cs | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/Scripts/Fold/Editor/FoldWindow.cs b/Scripts/Fold/Editor/FoldWindow.cs index 69d7066..270bc2a 100644 --- a/Scripts/Fold/Editor/FoldWindow.cs +++ b/Scripts/Fold/Editor/FoldWindow.cs @@ -4,41 +4,29 @@ using GraphProcessor; public class FoldWindow : BaseGraphWindow { - const string DefaultGraphPath = "Assets/FoldGraph.asset"; + const string GraphPath = "Assets/FoldGraph.asset"; [MenuItem("Tools/yum_food/Fold")] - public static BaseGraphWindow Open() + public static void Open() { - var graphWindow = GetWindow<FoldWindow>(); - - var graph = AssetDatabase.LoadAssetAtPath<FoldGraph>(DefaultGraphPath); + var graph = AssetDatabase.LoadAssetAtPath<FoldGraph>(GraphPath); if (graph == null) { graph = ScriptableObject.CreateInstance<FoldGraph>(); - AssetDatabase.CreateAsset(graph, DefaultGraphPath); + AssetDatabase.CreateAsset(graph, GraphPath); AssetDatabase.SaveAssets(); } - graphWindow.InitializeGraph(graph); - - graphWindow.Show(); - return graphWindow; + var w = GetWindow<FoldWindow>(); + w.InitializeGraph(graph); + w.Show(); } - protected override void OnDestroy() - { - graphView?.Dispose(); - } + protected override void OnDestroy() => graphView?.Dispose(); protected override void InitializeWindow(BaseGraph graph) { titleContent = new GUIContent("Fold"); - - // Create the graph view with our custom view - if (graphView == null) - graphView = new FoldGraphView(this); - - rootView.Add(graphView); + if (graphView == null) rootView.Add(graphView = new FoldGraphView(this)); } -} - +}
\ No newline at end of file |
