mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-21 01:36:03 +08:00
Removed GetInput and GetOutput and made inputs and outputs public
This commit is contained in:
parent
2b0cf61435
commit
63808eb6a2
@ -27,14 +27,14 @@ public class NodeEditor {
|
||||
//Inputs
|
||||
GUILayout.BeginVertical();
|
||||
for (int i = 0; i < target.InputCount; i++) {
|
||||
DrawNodePortGUI(target.GetInput(i));
|
||||
DrawNodePortGUI(target.inputs[i]);
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
|
||||
//Outputs
|
||||
GUILayout.BeginVertical();
|
||||
for (int i = 0; i < target.OutputCount; i++) {
|
||||
DrawNodePortGUI(target.GetOutput(i));
|
||||
DrawNodePortGUI(target.outputs[i]);
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
|
||||
|
||||
@ -158,7 +158,7 @@ public partial class NodeEditorWindow {
|
||||
NodePort newHoverPort = null;
|
||||
//Check all input ports
|
||||
for (int i = 0; i < hoveredNode.InputCount; i++) {
|
||||
NodePort port = hoveredNode.GetInput(i);
|
||||
NodePort port = hoveredNode.inputs[i];
|
||||
//Check if port rect is available
|
||||
if (!portConnectionPoints.ContainsKey(port)) continue;
|
||||
Rect r = portConnectionPoints[port];
|
||||
@ -168,7 +168,7 @@ public partial class NodeEditorWindow {
|
||||
}
|
||||
//Check all output ports
|
||||
for (int i = 0; i < hoveredNode.OutputCount; i++) {
|
||||
NodePort port = hoveredNode.GetOutput(i);
|
||||
NodePort port = hoveredNode.outputs[i];
|
||||
//Check if port rect is available
|
||||
if (!portConnectionPoints.ContainsKey(port)) continue;
|
||||
Rect r = portConnectionPoints[port];
|
||||
|
||||
@ -120,7 +120,7 @@ public partial class NodeEditorWindow {
|
||||
public void DrawConnections() {
|
||||
foreach (Node node in graph.nodes) {
|
||||
for (int i = 0; i < node.OutputCount; i++) {
|
||||
NodePort output = node.GetOutput(i);
|
||||
NodePort output = node.outputs[i];
|
||||
|
||||
//Needs cleanup. Null checks are ugly
|
||||
if (!portConnectionPoints.ContainsKey(output)) continue;
|
||||
|
||||
@ -10,10 +10,11 @@ public abstract class Node {
|
||||
/// <summary> Name of the node </summary>
|
||||
[SerializeField] public string name = "";
|
||||
[SerializeField] public NodeGraph graph;
|
||||
|
||||
[SerializeField] private NodePort[] inputs = new NodePort[0];
|
||||
[SerializeField] private NodePort[] outputs = new NodePort[0];
|
||||
[SerializeField] public Rect rect = new Rect(0,0,200,200);
|
||||
/// <summary> Input <see cref="NodePort"/>s. It is recommended not to modify these at hand. Instead, see <see cref="InputAttribute"/> </summary>
|
||||
[SerializeField] public NodePort[] inputs = new NodePort[0];
|
||||
/// <summary> Output <see cref="NodePort"/>s. It is recommended not to modify these at hand. Instead, see <see cref="InputAttribute"/> </summary>
|
||||
[SerializeField] public NodePort[] outputs = new NodePort[0];
|
||||
|
||||
public int InputCount { get { return inputs.Length; } }
|
||||
public int OutputCount { get { return outputs.Length; } }
|
||||
@ -44,14 +45,6 @@ public abstract class Node {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public NodePort GetInput(int portId) {
|
||||
return inputs[portId];
|
||||
}
|
||||
|
||||
public NodePort GetOutput(int portId) {
|
||||
return outputs[portId];
|
||||
}
|
||||
|
||||
public NodePort CreateNodeInput(string name, Type type) {
|
||||
return new NodePort(name, type, this, NodePort.IO.Input);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user