diff --git a/Editor/Scripts/Editor/Data Types/IPTPort.cs b/Editor/Scripts/Editor/Data Types/IPTPort.cs index e835880..9e93b40 100644 --- a/Editor/Scripts/Editor/Data Types/IPTPort.cs +++ b/Editor/Scripts/Editor/Data Types/IPTPort.cs @@ -14,7 +14,7 @@ namespace ImageProcessingGraph.Editor public static IPTPort Create(IEdgeConnectorListener connectorListener, bool isInput, Type type) { var port = new IPTPort(Orientation.Horizontal, isInput ? Direction.Input : Direction.Output, - Capacity.Multi, type) + isInput ? Capacity.Single : Capacity.Multi, type) { m_EdgeConnector = new EdgeConnector(connectorListener), }; diff --git a/Editor/Scripts/Editor/Data Types/IPT_Preferences.cs b/Editor/Scripts/Editor/Data Types/IPT_Preferences.cs index bcae272..ee85115 100644 --- a/Editor/Scripts/Editor/Data Types/IPT_Preferences.cs +++ b/Editor/Scripts/Editor/Data Types/IPT_Preferences.cs @@ -3,16 +3,9 @@ using UnityEngine; namespace ImageProcessingGraph.Editor { - #if true - [CreateAssetMenu(menuName = "PreferenceCreate")] - #endif public class IPT_Preferences : ScriptableObject { - [Header("Grid Settings")] - public float thickLines; - public float spacing; - public Color gridBackgroundColour; - public Color lineColour; + public bool debugMode = false; } } diff --git a/Editor/Scripts/Editor/ImageProcessingGraphAsset.cs b/Editor/Scripts/Editor/ImageProcessingGraphAsset.cs index 388d7a0..176b7b7 100644 --- a/Editor/Scripts/Editor/ImageProcessingGraphAsset.cs +++ b/Editor/Scripts/Editor/ImageProcessingGraphAsset.cs @@ -16,7 +16,7 @@ namespace ImageProcessingGraph.Editor { [SerializeReference] private List nodes; [SerializeField] private List connections; - [SerializeField] public List runOrder; + [SerializeReference] public List runOrder; [SerializeField] public List stickyNotes; public List Nodes => nodes; diff --git a/Editor/Scripts/Editor/Windows/ImageProcessingGraphViewWindow.cs b/Editor/Scripts/Editor/Windows/ImageProcessingGraphViewWindow.cs index fe897fe..dca7f0a 100644 --- a/Editor/Scripts/Editor/Windows/ImageProcessingGraphViewWindow.cs +++ b/Editor/Scripts/Editor/Windows/ImageProcessingGraphViewWindow.cs @@ -14,7 +14,6 @@ namespace ImageProcessingGraph.Editor internal ImageProcessingGraphAsset asset; private SerializedObject serializedObject; private ImageProcessingGraphEditorWindow window; - public ImageProcessingGraphEditorWindow Window => window; public List graphNodes; @@ -23,6 +22,11 @@ namespace ImageProcessingGraph.Editor internal ImageProcessingGraphSearchProvider searchProvider; internal ImageProcessingGraphEdgeConnectorListener edgeConnectorListener; + + private bool isDropdownEnabled = false; + + private Button debugModeButton; + private Button outputRunOrder; public ImageProcessingGraphViewWindow(SerializedObject obeject, ImageProcessingGraphEditorWindow window) { @@ -50,36 +54,13 @@ namespace ImageProcessingGraph.Editor styleSheets.Add(styleSheet); GridBackground background = new GridBackground(); - background.name = "Grid"; - - Button runButton = new Button(); - runButton.text = "Run"; - -// Set the size of the button (width and height) - runButton.style.width = 100; // Width in pixels - runButton.style.height = 40; // Height in pixels - -// Position the button at the top-left corner - runButton.style.position = Position.Absolute; // Make sure it's positioned absolutely - runButton.style.top = 10; // Top 10 pixels from the top - runButton.style.left = 10; // Left 10 pixels from the left edge - -// On click, execute the function - runButton.clicked += () => - { - asset.RunGraph(); - }; - -// Add the button to the UI - Add(runButton); - Add(background); background.SendToBack(); - - - - + + CreateButtons(); + + this.AddManipulator(new ContentDragger()); this.AddManipulator(new SelectionDragger()); this.AddManipulator(new RectangleSelector()); @@ -92,7 +73,108 @@ namespace ImageProcessingGraph.Editor graphViewChanged += OnGraphViewChanged; Undo.undoRedoEvent += UndoEvent; } - + + private void CreateButtons() + { + #region Run Button + Button runButton = new Button + { + text = "Run", + style = + { + width = 100, + height = 40, + position = Position.Absolute, + top = 10, + left = 10 + } + }; + + runButton.clicked += () => + { + asset.RunGraph(); + }; + + Add(runButton); + #endregion + +#if false + debugModeButton = new Button + { + text = "Debug Mode", + style = + { + width = 120, + height = 40, + position = Position.Absolute, + top = 55, + right = 10 + } + }; + + debugModeButton.clicked += () => + { + + }; +#endif + + outputRunOrder = new Button + { + text = "Recalculate Run Order", + style = + { + width = 120, + height = 40, + position = Position.Absolute, + top = 55, + right = 10, + fontSize = 9 + } + }; + + outputRunOrder.clicked += () => + { + asset.runOrder = asset.GetExecutionOrder(asset.Nodes, asset.Connections); + }; + + + Button dropdownButton = new Button + { + text = "Options", + style = + { + width = 120, + height = 40, + position = Position.Absolute, + top = 10, + right = 10 + } + }; + + dropdownButton.clicked+= () => + { + if (!isDropdownEnabled) + { +#if false + Add(debugModeButton); +#endif + Add(outputRunOrder); + } + else + { +#if false + Remove(debugModeButton); +#endif + Remove(outputRunOrder); + } + + isDropdownEnabled = !isDropdownEnabled; + }; + + + Add(dropdownButton); + } + private ImageProcessingGraphNodeVisual GetNode(string NodeID) { ImageProcessingGraphNodeVisual node = null;