diff --git a/Editor/ClusterInspector.cs b/Editor/ClusterInspector.cs index 6ebb721..972c955 100644 --- a/Editor/ClusterInspector.cs +++ b/Editor/ClusterInspector.cs @@ -24,44 +24,7 @@ public class ClusterInspector : Editor { serializedObject.Update(); VisualElement root = new(); - //GraphView graph = CreateInspector(root, cluster); - // root.style.paddingLeft = 0; - // root.style.paddingRight = 0; - // root.style.paddingTop = 0; - // root.style.paddingBottom = 0; - - // root.styleSheets.Add(Resources.Load("GraphStyles")); - - // mainContainer = new() { - // style = { - // height = 450 - // } - // }; - // GraphView graph = new(); - // graph.style.flexGrow = 1; - - // inspectorContainer = new VisualElement { - // name = "inspector" - // }; - - // mainContainer.Add(graph); - // mainContainer.Add(inspectorContainer); - // root.Add(mainContainer); - - // // Run once for initial state (use resolved style width if available) - // float initialWidth = root.layout.width > 0 ? root.layout.width : root.contentRect.width; - // UpdateLayout(initialWidth); - - // // React to size changes of root (or parent if appropriate) - // root.RegisterCallback(evt => { - // UpdateLayout(evt.newRect.width); - // }); - - //graph.SetGraph(null, cluster, cluster.output, inspectorContainer); - - // else - // Debug.LogWarning(" No brain!"); serializedObject.ApplyModifiedProperties(); return root; @@ -98,34 +61,11 @@ public class ClusterInspector : Editor { mainContainer.Add(inspectorContainer); root.Add(mainContainer); - // Run once for initial state (use resolved style width if available) - float initialWidth = root.layout.width > 0 ? root.layout.width : root.contentRect.width; - //UpdateLayout(initialWidth); - - // React to size changes of root (or parent if appropriate) - // root.RegisterCallback(evt => { - // UpdateLayout(evt.newRect.width); - // }); - graph.SetGraph(null, cluster, cluster.output, inspectorContainer); return graph; } - private static void UpdateLayout(float containerWidth) { - // if (containerWidth > 600f) { - // mainContainer.style.flexDirection = FlexDirection.Row; - // inspectorContainer.style.width = 300; // fixed sidebar width - // inspectorContainer.style.flexGrow = 0; - // } - // else { - // mainContainer.style.flexDirection = FlexDirection.Column; - // inspectorContainer.style.width = Length.Percent(100); // full width below - // inspectorContainer.style.flexDirection = FlexDirection.Column; - // inspectorContainer.style.flexGrow = 1; // can set 0 or keep as needed - // } - } - public class GraphView : VisualElement { ClusterPrefab cluster; diff --git a/Editor/NanoBrain_Editor.cs b/Editor/NanoBrain_Editor.cs index 3f4888a..658c02c 100644 --- a/Editor/NanoBrain_Editor.cs +++ b/Editor/NanoBrain_Editor.cs @@ -1,5 +1,4 @@ using UnityEditor; -using UnityEditor.UIElements; using UnityEngine; using UnityEngine.UIElements; @@ -18,7 +17,6 @@ public class NanoBrainComponent_Editor : Editor { if (Application.isPlaying == false) brainProp = serializedObject.FindProperty(nameof(NanoBrain.defaultBrain)); - } public override VisualElement CreateInspectorGUI() { @@ -29,73 +27,11 @@ public class NanoBrainComponent_Editor : Editor { VisualElement root = new(); - //ClusterInspector.GraphView board = ClusterInspector.CreateInspector(root, brain.prefab); - // root.style.paddingLeft = 0; - // root.style.paddingRight = 0; - // root.style.paddingTop = 0; - // root.style.paddingBottom = 0; - - // root.styleSheets.Add(Resources.Load("GraphStyles")); - - // if (Application.isPlaying == false) { - // PropertyField brainField = new(brainProp) { - // label = "Nano Brain" - // }; - // root.Add(brainField); - // } - - // mainContainer = new() { - // name = "main", - // style = { - // height = 450, - // } - // }; - // board = new ClusterInspector.GraphView(); - // board.style.flexGrow = 1; - // mainContainer.Add(board); - - // inspectorContainer = new VisualElement { - // name = "inspector" - // // style = { - // // width = 400, - // // } - // }; - - // mainContainer.Add(inspectorContainer); - // root.Add(mainContainer); - - // // Run once for initial state (use resolved style width if available) - // float initialWidth = root.layout.width > 0 ? root.layout.width : root.contentRect.width; - // UpdateLayout(initialWidth); - - // // React to size changes of root (or parent if appropriate) - // root.RegisterCallback(evt => { - // UpdateLayout(evt.newRect.width); - // }); - - // if (brain != null && board != null) - // board.SetGraph(component.gameObject, brain.prefab, brain.output, inspectorContainer); - // else - // Debug.LogWarning(" No brain!"); if (Application.isPlaying == false) serializedObject.ApplyModifiedProperties(); return root; } - // private void UpdateLayout(float containerWidth) { - // // if (containerWidth > 800f) { - // mainContainer.style.flexDirection = FlexDirection.Row; - // inspectorContainer.style.width = 300; // fixed sidebar width - // inspectorContainer.style.flexGrow = 0; - // // } - // // else { - // // mainContainer.style.flexDirection = FlexDirection.Column; - // // inspectorContainer.style.width = Length.Percent(100); // full width below - // // inspectorContainer.style.flexDirection = FlexDirection.Column; - // // inspectorContainer.style.flexGrow = 1; // can set 0 or keep as needed - // // } - // } - } \ No newline at end of file