From babfcc18ceb3a30eecdf4d00a4f42ff03ca10b5b Mon Sep 17 00:00:00 2001 From: yum Date: Fri, 2 Jan 2026 03:21:42 -0800 Subject: Fold: simplify code --- Scripts/Fold/Editor/FoldWindow.cs | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) (limited to 'Scripts/Fold/Editor/FoldWindow.cs') 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(); - - var graph = AssetDatabase.LoadAssetAtPath(DefaultGraphPath); + var graph = AssetDatabase.LoadAssetAtPath(GraphPath); if (graph == null) { graph = ScriptableObject.CreateInstance(); - AssetDatabase.CreateAsset(graph, DefaultGraphPath); + AssetDatabase.CreateAsset(graph, GraphPath); AssetDatabase.SaveAssets(); } - graphWindow.InitializeGraph(graph); - - graphWindow.Show(); - return graphWindow; + var w = GetWindow(); + 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 -- cgit v1.2.3