mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-21 09:46:03 +08:00
Made Node.inputs and Node.outputs private. Started introducing instanceInputs and instanceOutputs.
This commit is contained in:
parent
ace1e8ccd8
commit
5f394581d6
@ -118,7 +118,7 @@ public partial class NodeEditorWindow {
|
|||||||
//If a null node is found, return. This can happen if the nodes associated script is deleted. It is currently not possible in Unity to delete a null asset.
|
//If a null node is found, return. This can happen if the nodes associated script is deleted. It is currently not possible in Unity to delete a null asset.
|
||||||
if (node == null) continue;
|
if (node == null) continue;
|
||||||
for (int i = 0; i < node.OutputCount; i++) {
|
for (int i = 0; i < node.OutputCount; i++) {
|
||||||
NodePort output = node.outputs[i];
|
NodePort output = node.GetOutput(i);
|
||||||
|
|
||||||
//Needs cleanup. Null checks are ugly
|
//Needs cleanup. Null checks are ugly
|
||||||
if (!portConnectionPoints.ContainsKey(output)) continue;
|
if (!portConnectionPoints.ContainsKey(output)) continue;
|
||||||
@ -207,7 +207,7 @@ public partial class NodeEditorWindow {
|
|||||||
//Check if we are hovering any of this nodes ports
|
//Check if we are hovering any of this nodes ports
|
||||||
//Check input ports
|
//Check input ports
|
||||||
for (int i = 0; i < node.InputCount; i++) {
|
for (int i = 0; i < node.InputCount; i++) {
|
||||||
NodePort port = node.inputs[i];
|
NodePort port = node.GetInput(i);
|
||||||
//Check if port rect is available
|
//Check if port rect is available
|
||||||
if (!portConnectionPoints.ContainsKey(port)) continue;
|
if (!portConnectionPoints.ContainsKey(port)) continue;
|
||||||
Rect r = GridToWindowRect(portConnectionPoints[port]);
|
Rect r = GridToWindowRect(portConnectionPoints[port]);
|
||||||
@ -215,7 +215,7 @@ public partial class NodeEditorWindow {
|
|||||||
}
|
}
|
||||||
//Check all output ports
|
//Check all output ports
|
||||||
for (int i = 0; i < node.OutputCount; i++) {
|
for (int i = 0; i < node.OutputCount; i++) {
|
||||||
NodePort port = node.outputs[i];
|
NodePort port = node.GetOutput(i);
|
||||||
//Check if port rect is available
|
//Check if port rect is available
|
||||||
if (!portConnectionPoints.ContainsKey(port)) continue;
|
if (!portConnectionPoints.ContainsKey(port)) continue;
|
||||||
Rect r = GridToWindowRect(portConnectionPoints[port]);
|
Rect r = GridToWindowRect(portConnectionPoints[port]);
|
||||||
|
|||||||
@ -19,9 +19,13 @@ public abstract class Node : ScriptableObject {
|
|||||||
/// <summary> Position on the <see cref="NodeGraph"/> </summary>
|
/// <summary> Position on the <see cref="NodeGraph"/> </summary>
|
||||||
[SerializeField] public Vector2 position;
|
[SerializeField] public Vector2 position;
|
||||||
/// <summary> Input <see cref="NodePort"/>s. It is recommended not to modify these at hand. Instead, see <see cref="InputAttribute"/> </summary>
|
/// <summary> Input <see cref="NodePort"/>s. It is recommended not to modify these at hand. Instead, see <see cref="InputAttribute"/> </summary>
|
||||||
[SerializeField] public List<NodePort> inputs = new List<NodePort>();
|
[SerializeField] private List<NodePort> inputs = new List<NodePort>();
|
||||||
/// <summary> Output <see cref="NodePort"/>s. It is recommended not to modify these at hand. Instead, see <see cref="OutputAttribute"/> </summary>
|
/// <summary> Output <see cref="NodePort"/>s. It is recommended not to modify these at hand. Instead, see <see cref="OutputAttribute"/> </summary>
|
||||||
[SerializeField] public List<NodePort> outputs = new List<NodePort>();
|
[SerializeField] private List<NodePort> outputs = new List<NodePort>();
|
||||||
|
/// <summary> Additional instance-specific inputs. </summary>
|
||||||
|
[SerializeField] public List<NodePort> instanceInputs = new List<NodePort>();
|
||||||
|
/// <summary> Additional instance-specific outputs. </summary>
|
||||||
|
[SerializeField] public List<NodePort> instanceOutputs = new List<NodePort>();
|
||||||
|
|
||||||
public int InputCount { get { return inputs.Count; } }
|
public int InputCount { get { return inputs.Count; } }
|
||||||
public int OutputCount { get { return outputs.Count; } }
|
public int OutputCount { get { return outputs.Count; } }
|
||||||
@ -41,6 +45,16 @@ public abstract class Node : ScriptableObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary> Returns input port at index </summary>
|
||||||
|
public NodePort GetInput(int i) {
|
||||||
|
return inputs[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary> Returns output port at index. </summary>
|
||||||
|
public NodePort GetOutput(int i) {
|
||||||
|
return outputs[i];
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary> Returns input or output port which matches fieldName </summary>
|
/// <summary> Returns input or output port which matches fieldName </summary>
|
||||||
public NodePort GetPortByFieldName(string fieldName) {
|
public NodePort GetPortByFieldName(string fieldName) {
|
||||||
NodePort port = GetOutputByFieldName(fieldName);
|
NodePort port = GetOutputByFieldName(fieldName);
|
||||||
@ -48,7 +62,6 @@ public abstract class Node : ScriptableObject {
|
|||||||
else return GetInputByFieldName(fieldName);
|
else return GetInputByFieldName(fieldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary> Returns output port which matches fieldName. Returns null if none found. </summary>
|
/// <summary> Returns output port which matches fieldName. Returns null if none found. </summary>
|
||||||
public NodePort GetOutputByFieldName(string fieldName) {
|
public NodePort GetOutputByFieldName(string fieldName) {
|
||||||
for (int i = 0; i < OutputCount; i++) {
|
for (int i = 0; i < OutputCount; i++) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user