Compare commits

...

2 Commits

Author SHA1 Message Date
Chromium
0c53ac8d18 Added Run order button and fixed a node connection issue 2025-04-27 01:36:14 +01:00
Chromium
4985cf5748 Added Run button 2025-04-27 00:55:14 +01:00
5 changed files with 114 additions and 18 deletions

View File

@ -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<Edge>(connectorListener),
};

View File

@ -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;
}
}

View File

@ -16,7 +16,7 @@ namespace ImageProcessingGraph.Editor
{
[SerializeReference] private List<BaseImageNode> nodes;
[SerializeField] private List<GraphConnection> connections;
[SerializeField] public List<BaseImageNode> runOrder;
[SerializeReference] public List<BaseImageNode> runOrder;
[SerializeField] public List<StickyNote> stickyNotes;
public List<BaseImageNode> Nodes => nodes;

View File

@ -200,7 +200,6 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
});
}
propertyFieldContainer.Add(propertyField);
port.Add(propertyFieldContainer);
}

View File

@ -14,7 +14,6 @@ namespace ImageProcessingGraph.Editor
internal ImageProcessingGraphAsset asset;
private SerializedObject serializedObject;
private ImageProcessingGraphEditorWindow window;
public ImageProcessingGraphEditorWindow Window => window;
public List<ImageProcessingGraphNodeVisual> graphNodes;
@ -24,6 +23,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)
{
this.serializedObject = obeject;
@ -50,14 +54,13 @@ namespace ImageProcessingGraph.Editor
styleSheets.Add(styleSheet);
GridBackground background = new GridBackground();
background.name = "Grid";
Add(background);
background.SendToBack();
CreateButtons();
this.AddManipulator(new ContentDragger());
this.AddManipulator(new SelectionDragger());
this.AddManipulator(new RectangleSelector());
@ -71,6 +74,107 @@ namespace ImageProcessingGraph.Editor
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;