diff options
| author | yum <yum.food.vr@gmail.com> | 2026-01-12 19:31:54 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2026-01-12 19:31:54 -0800 |
| commit | 6d86c9663bab3ec1ef95ba455dfa7281415b7f44 (patch) | |
| tree | cda255c2dfd0ef2c96334fb7ecf2182d4950086e /Scripts/Fold/Editor/FoldWindow.cs | |
| parent | cbc299f489d6bdc38cce30d74040c54197efe125 (diff) | |
Fold: move from visual programming to fluent builder
Diffstat (limited to 'Scripts/Fold/Editor/FoldWindow.cs')
| -rw-r--r-- | Scripts/Fold/Editor/FoldWindow.cs | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/Scripts/Fold/Editor/FoldWindow.cs b/Scripts/Fold/Editor/FoldWindow.cs deleted file mode 100644 index f0f9b42..0000000 --- a/Scripts/Fold/Editor/FoldWindow.cs +++ /dev/null @@ -1,85 +0,0 @@ -using UnityEditor; -using UnityEngine; -using UnityEngine.UIElements; - -public class FoldWindow : EditorWindow -{ - const string GraphPath = "Assets/FoldGraph.asset"; - - FoldGraphView graphView; - FoldGraph graphAsset; - - [MenuItem("Tools/yum_food/Fold")] - public static void Open() - { - var window = GetWindow<FoldWindow>(); - window.titleContent = new GUIContent("Fold"); - window.Show(); - } - - void OnEnable() - { - graphAsset = LoadOrCreateGraph(); - ConstructGraphView(); - } - - void OnDisable() - { - if (graphView != null) - { - rootVisualElement.Remove(graphView); - graphView.Dispose(); - graphView = null; - } - - AssetDatabase.SaveAssets(); - } - - void OnFocus() - { - // If we lost the graph view for any reason, rebuild it. Otherwise, reload to match the asset on disk. - if (graphView == null) - { - graphAsset = LoadOrCreateGraph(); - ConstructGraphView(); - } - else - { - graphView.Reload(); - } - } - - FoldGraph LoadOrCreateGraph() - { - var asset = AssetDatabase.LoadAssetAtPath<FoldGraph>(GraphPath); - if (asset == null) - { - asset = CreateInstance<FoldGraph>(); - AssetDatabase.CreateAsset(asset, GraphPath); - AssetDatabase.SaveAssets(); - } - - return asset; - } - - void ConstructGraphView() - { - graphView = new FoldGraphView(this, graphAsset) - { - name = "Fold Graph" - }; - - graphView.style.flexGrow = 1f; - graphView.style.width = Length.Percent(100); - graphView.style.height = Length.Percent(100); - rootVisualElement.Add(graphView); - } - - public void ShowNotification(string message) - { - if (string.IsNullOrEmpty(message)) - return; - - ShowNotification(new GUIContent(message)); - } -} |
