mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-20 01:06:01 +08:00
UPGRADE NOTICE: Renamed 'instance ports' to 'dynamic ports'.
To upgrade, simply rename all your method calls involving instance ports eg. 'AddInstanceOutput' to the dynamic port equivalent eg. 'AddDynamicOutput' There is no functional difference. The community just agreed this was a more fitting name for the feature.
This commit is contained in:
parent
65162d553e
commit
c3e85a9f82
@ -37,10 +37,10 @@ namespace XNodeEditor {
|
||||
NodeEditorGUILayout.PropertyField(iterator, true);
|
||||
}
|
||||
|
||||
// Iterate through instance ports and draw them in the order in which they are serialized
|
||||
foreach (XNode.NodePort instancePort in target.InstancePorts) {
|
||||
if (NodeEditorGUILayout.IsInstancePortListPort(instancePort)) continue;
|
||||
NodeEditorGUILayout.PortField(instancePort);
|
||||
// Iterate through dynamic ports and draw them in the order in which they are serialized
|
||||
foreach (XNode.NodePort dynamicPort in target.DynamicPorts) {
|
||||
if (NodeEditorGUILayout.IsDynamicPortListPort(dynamicPort)) continue;
|
||||
NodeEditorGUILayout.PortField(dynamicPort);
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
@ -50,14 +50,14 @@ namespace XNodeEditor {
|
||||
// Get data from [Input] attribute
|
||||
XNode.Node.ShowBackingValue showBacking = XNode.Node.ShowBackingValue.Unconnected;
|
||||
XNode.Node.InputAttribute inputAttribute;
|
||||
bool instancePortList = false;
|
||||
bool dynamicPortList = false;
|
||||
if (NodeEditorUtilities.GetCachedAttrib(port.node.GetType(), property.name, out inputAttribute)) {
|
||||
instancePortList = inputAttribute.instancePortList;
|
||||
dynamicPortList = inputAttribute.dynamicPortList;
|
||||
showBacking = inputAttribute.backingValue;
|
||||
}
|
||||
|
||||
//Call GUILayout.Space if Space attribute is set and we are NOT drawing a PropertyField
|
||||
bool useLayoutSpace = instancePortList ||
|
||||
bool useLayoutSpace = dynamicPortList ||
|
||||
showBacking == XNode.Node.ShowBackingValue.Never ||
|
||||
(showBacking == XNode.Node.ShowBackingValue.Unconnected && port.IsConnected);
|
||||
if (spacePadding > 0 && useLayoutSpace) {
|
||||
@ -65,10 +65,10 @@ namespace XNodeEditor {
|
||||
spacePadding = 0;
|
||||
}
|
||||
|
||||
if (instancePortList) {
|
||||
if (dynamicPortList) {
|
||||
Type type = GetType(property);
|
||||
XNode.Node.ConnectionType connectionType = inputAttribute != null ? inputAttribute.connectionType : XNode.Node.ConnectionType.Multiple;
|
||||
InstancePortList(property.name, type, property.serializedObject, port.direction, connectionType);
|
||||
DynamicPortList(property.name, type, property.serializedObject, port.direction, connectionType);
|
||||
return;
|
||||
}
|
||||
switch (showBacking) {
|
||||
@ -95,14 +95,14 @@ namespace XNodeEditor {
|
||||
// Get data from [Output] attribute
|
||||
XNode.Node.ShowBackingValue showBacking = XNode.Node.ShowBackingValue.Unconnected;
|
||||
XNode.Node.OutputAttribute outputAttribute;
|
||||
bool instancePortList = false;
|
||||
bool dynamicPortList = false;
|
||||
if (NodeEditorUtilities.GetCachedAttrib(port.node.GetType(), property.name, out outputAttribute)) {
|
||||
instancePortList = outputAttribute.instancePortList;
|
||||
dynamicPortList = outputAttribute.dynamicPortList;
|
||||
showBacking = outputAttribute.backingValue;
|
||||
}
|
||||
|
||||
//Call GUILayout.Space if Space attribute is set and we are NOT drawing a PropertyField
|
||||
bool useLayoutSpace = instancePortList ||
|
||||
bool useLayoutSpace = dynamicPortList ||
|
||||
showBacking == XNode.Node.ShowBackingValue.Never ||
|
||||
(showBacking == XNode.Node.ShowBackingValue.Unconnected && port.IsConnected);
|
||||
if (spacePadding > 0 && useLayoutSpace) {
|
||||
@ -110,10 +110,10 @@ namespace XNodeEditor {
|
||||
spacePadding = 0;
|
||||
}
|
||||
|
||||
if (instancePortList) {
|
||||
if (dynamicPortList) {
|
||||
Type type = GetType(property);
|
||||
XNode.Node.ConnectionType connectionType = outputAttribute != null ? outputAttribute.connectionType : XNode.Node.ConnectionType.Multiple;
|
||||
InstancePortList(property.name, type, property.serializedObject, port.direction, connectionType);
|
||||
DynamicPortList(property.name, type, property.serializedObject, port.direction, connectionType);
|
||||
return;
|
||||
}
|
||||
switch (showBacking) {
|
||||
@ -254,8 +254,8 @@ namespace XNodeEditor {
|
||||
GUI.color = col;
|
||||
}
|
||||
|
||||
/// <summary> Is this port part of an InstancePortList? </summary>
|
||||
public static bool IsInstancePortListPort(XNode.NodePort port) {
|
||||
/// <summary> Is this port part of a DynamicPortList? </summary>
|
||||
public static bool IsDynamicPortListPort(XNode.NodePort port) {
|
||||
string[] parts = port.fieldName.Split(' ');
|
||||
if (parts.Length != 2) return false;
|
||||
Dictionary<string, ReorderableList> cache;
|
||||
@ -266,16 +266,16 @@ namespace XNodeEditor {
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary> Draw an editable list of instance ports. Port names are named as "[fieldName] [index]" </summary>
|
||||
/// <summary> Draw an editable list of dynamic ports. Port names are named as "[fieldName] [index]" </summary>
|
||||
/// <param name="fieldName">Supply a list for editable values</param>
|
||||
/// <param name="type">Value type of added instance ports</param>
|
||||
/// <param name="type">Value type of added dynamic ports</param>
|
||||
/// <param name="serializedObject">The serializedObject of the node</param>
|
||||
/// <param name="connectionType">Connection type of added instance ports</param>
|
||||
/// <param name="connectionType">Connection type of added dynamic ports</param>
|
||||
/// <param name="onCreation">Called on the list on creation. Use this if you want to customize the created ReorderableList</param>
|
||||
public static void InstancePortList(string fieldName, Type type, SerializedObject serializedObject, XNode.NodePort.IO io, XNode.Node.ConnectionType connectionType = XNode.Node.ConnectionType.Multiple, XNode.Node.TypeConstraint typeConstraint = XNode.Node.TypeConstraint.None, Action<ReorderableList> onCreation = null) {
|
||||
public static void DynamicPortList(string fieldName, Type type, SerializedObject serializedObject, XNode.NodePort.IO io, XNode.Node.ConnectionType connectionType = XNode.Node.ConnectionType.Multiple, XNode.Node.TypeConstraint typeConstraint = XNode.Node.TypeConstraint.None, Action<ReorderableList> onCreation = null) {
|
||||
XNode.Node node = serializedObject.targetObject as XNode.Node;
|
||||
|
||||
var indexedPorts = node.InstancePorts.Select(x => {
|
||||
var indexedPorts = node.DynamicPorts.Select(x => {
|
||||
string[] split = x.fieldName.Split(' ');
|
||||
if (split != null && split.Length == 2 && split[0] == fieldName) {
|
||||
int i = -1;
|
||||
@ -285,7 +285,7 @@ namespace XNodeEditor {
|
||||
}
|
||||
return new { index = -1, port = (XNode.NodePort) null };
|
||||
});
|
||||
List<XNode.NodePort> instancePorts = indexedPorts.OrderBy(x => x.index).Select(x => x.port).ToList();
|
||||
List<XNode.NodePort> dynamicPorts = indexedPorts.OrderBy(x => x.index).Select(x => x.port).ToList();
|
||||
|
||||
ReorderableList list = null;
|
||||
Dictionary<string, ReorderableList> rlc;
|
||||
@ -295,18 +295,18 @@ namespace XNodeEditor {
|
||||
// If a ReorderableList isn't cached for this array, do so.
|
||||
if (list == null) {
|
||||
SerializedProperty arrayData = serializedObject.FindProperty(fieldName);
|
||||
list = CreateReorderableList(fieldName, instancePorts, arrayData, type, serializedObject, io, connectionType, typeConstraint, onCreation);
|
||||
list = CreateReorderableList(fieldName, dynamicPorts, arrayData, type, serializedObject, io, connectionType, typeConstraint, onCreation);
|
||||
if (reorderableListCache.TryGetValue(serializedObject.targetObject, out rlc)) rlc.Add(fieldName, list);
|
||||
else reorderableListCache.Add(serializedObject.targetObject, new Dictionary<string, ReorderableList>() { { fieldName, list } });
|
||||
}
|
||||
list.list = instancePorts;
|
||||
list.list = dynamicPorts;
|
||||
list.DoLayoutList();
|
||||
}
|
||||
|
||||
private static ReorderableList CreateReorderableList(string fieldName, List<XNode.NodePort> instancePorts, SerializedProperty arrayData, Type type, SerializedObject serializedObject, XNode.NodePort.IO io, XNode.Node.ConnectionType connectionType, XNode.Node.TypeConstraint typeConstraint, Action<ReorderableList> onCreation) {
|
||||
private static ReorderableList CreateReorderableList(string fieldName, List<XNode.NodePort> dynamicPorts, SerializedProperty arrayData, Type type, SerializedObject serializedObject, XNode.NodePort.IO io, XNode.Node.ConnectionType connectionType, XNode.Node.TypeConstraint typeConstraint, Action<ReorderableList> onCreation) {
|
||||
bool hasArrayData = arrayData != null && arrayData.isArray;
|
||||
XNode.Node node = serializedObject.targetObject as XNode.Node;
|
||||
ReorderableList list = new ReorderableList(instancePorts, null, true, true, true, true);
|
||||
ReorderableList list = new ReorderableList(dynamicPorts, null, true, true, true, true);
|
||||
string label = arrayData != null ? arrayData.displayName : ObjectNames.NicifyVariableName(fieldName);
|
||||
|
||||
list.drawElementCallback =
|
||||
@ -387,13 +387,13 @@ namespace XNodeEditor {
|
||||
};
|
||||
list.onAddCallback =
|
||||
(ReorderableList rl) => {
|
||||
// Add instance port postfixed with an index number
|
||||
// Add dynamic port postfixed with an index number
|
||||
string newName = fieldName + " 0";
|
||||
int i = 0;
|
||||
while (node.HasPort(newName)) newName = fieldName + " " + (++i);
|
||||
|
||||
if (io == XNode.NodePort.IO.Output) node.AddInstanceOutput(type, connectionType, XNode.Node.TypeConstraint.None, newName);
|
||||
else node.AddInstanceInput(type, connectionType, typeConstraint, newName);
|
||||
if (io == XNode.NodePort.IO.Output) node.AddDynamicOutput(type, connectionType, XNode.Node.TypeConstraint.None, newName);
|
||||
else node.AddDynamicInput(type, connectionType, typeConstraint, newName);
|
||||
serializedObject.Update();
|
||||
EditorUtility.SetDirty(node);
|
||||
if (hasArrayData) {
|
||||
@ -404,7 +404,7 @@ namespace XNodeEditor {
|
||||
list.onRemoveCallback =
|
||||
(ReorderableList rl) => {
|
||||
|
||||
var indexedPorts = node.InstancePorts.Select(x => {
|
||||
var indexedPorts = node.DynamicPorts.Select(x => {
|
||||
string[] split = x.fieldName.Split(' ');
|
||||
if (split != null && split.Length == 2 && split[0] == fieldName) {
|
||||
int i = -1;
|
||||
@ -414,37 +414,37 @@ namespace XNodeEditor {
|
||||
}
|
||||
return new { index = -1, port = (XNode.NodePort) null };
|
||||
});
|
||||
instancePorts = indexedPorts.OrderBy(x => x.index).Select(x => x.port).ToList();
|
||||
dynamicPorts = indexedPorts.OrderBy(x => x.index).Select(x => x.port).ToList();
|
||||
|
||||
int index = rl.index;
|
||||
|
||||
if (instancePorts.Count > index) {
|
||||
if (dynamicPorts.Count > index) {
|
||||
// Clear the removed ports connections
|
||||
instancePorts[index].ClearConnections();
|
||||
dynamicPorts[index].ClearConnections();
|
||||
// Move following connections one step up to replace the missing connection
|
||||
for (int k = index + 1; k < instancePorts.Count(); k++) {
|
||||
for (int j = 0; j < instancePorts[k].ConnectionCount; j++) {
|
||||
XNode.NodePort other = instancePorts[k].GetConnection(j);
|
||||
instancePorts[k].Disconnect(other);
|
||||
instancePorts[k - 1].Connect(other);
|
||||
for (int k = index + 1; k < dynamicPorts.Count(); k++) {
|
||||
for (int j = 0; j < dynamicPorts[k].ConnectionCount; j++) {
|
||||
XNode.NodePort other = dynamicPorts[k].GetConnection(j);
|
||||
dynamicPorts[k].Disconnect(other);
|
||||
dynamicPorts[k - 1].Connect(other);
|
||||
}
|
||||
}
|
||||
// Remove the last instance port, to avoid messing up the indexing
|
||||
node.RemoveInstancePort(instancePorts[instancePorts.Count() - 1].fieldName);
|
||||
// Remove the last dynamic port, to avoid messing up the indexing
|
||||
node.RemoveDynamicPort(dynamicPorts[dynamicPorts.Count() - 1].fieldName);
|
||||
serializedObject.Update();
|
||||
EditorUtility.SetDirty(node);
|
||||
} else {
|
||||
Debug.LogWarning("InstancePorts[" + index + "] out of range. Length was " + instancePorts.Count + ". Skipping.");
|
||||
Debug.LogWarning("DynamicPorts[" + index + "] out of range. Length was " + dynamicPorts.Count + ". Skipping.");
|
||||
}
|
||||
|
||||
if (hasArrayData) {
|
||||
arrayData.DeleteArrayElementAtIndex(index);
|
||||
// Error handling. If the following happens too often, file a bug report at https://github.com/Siccity/xNode/issues
|
||||
if (instancePorts.Count <= arrayData.arraySize) {
|
||||
while (instancePorts.Count <= arrayData.arraySize) {
|
||||
if (dynamicPorts.Count <= arrayData.arraySize) {
|
||||
while (dynamicPorts.Count <= arrayData.arraySize) {
|
||||
arrayData.DeleteArrayElementAtIndex(arrayData.arraySize - 1);
|
||||
}
|
||||
UnityEngine.Debug.LogWarning("Array size exceeded instance ports size. Excess items removed.");
|
||||
UnityEngine.Debug.LogWarning("Array size exceeded dynamic ports size. Excess items removed.");
|
||||
}
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
serializedObject.Update();
|
||||
@ -452,18 +452,18 @@ namespace XNodeEditor {
|
||||
};
|
||||
|
||||
if (hasArrayData) {
|
||||
int instancePortCount = instancePorts.Count;
|
||||
while (instancePortCount < arrayData.arraySize) {
|
||||
// Add instance port postfixed with an index number
|
||||
int dynamicPortCount = dynamicPorts.Count;
|
||||
while (dynamicPortCount < arrayData.arraySize) {
|
||||
// Add dynamic port postfixed with an index number
|
||||
string newName = arrayData.name + " 0";
|
||||
int i = 0;
|
||||
while (node.HasPort(newName)) newName = arrayData.name + " " + (++i);
|
||||
if (io == XNode.NodePort.IO.Output) node.AddInstanceOutput(type, connectionType, typeConstraint, newName);
|
||||
else node.AddInstanceInput(type, connectionType, typeConstraint, newName);
|
||||
if (io == XNode.NodePort.IO.Output) node.AddDynamicOutput(type, connectionType, typeConstraint, newName);
|
||||
else node.AddDynamicInput(type, connectionType, typeConstraint, newName);
|
||||
EditorUtility.SetDirty(node);
|
||||
instancePortCount++;
|
||||
dynamicPortCount++;
|
||||
}
|
||||
while (arrayData.arraySize < instancePortCount) {
|
||||
while (arrayData.arraySize < dynamicPortCount) {
|
||||
arrayData.InsertArrayElementAtIndex(arrayData.arraySize);
|
||||
}
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
@ -57,12 +57,12 @@ namespace XNode {
|
||||
public IEnumerable<NodePort> Outputs { get { foreach (NodePort port in Ports) { if (port.IsOutput) yield return port; } } }
|
||||
/// <summary> Iterate over all inputs on this node. </summary>
|
||||
public IEnumerable<NodePort> Inputs { get { foreach (NodePort port in Ports) { if (port.IsInput) yield return port; } } }
|
||||
/// <summary> Iterate over all instane ports on this node. </summary>
|
||||
public IEnumerable<NodePort> InstancePorts { get { foreach (NodePort port in Ports) { if (port.IsDynamic) yield return port; } } }
|
||||
/// <summary> Iterate over all instance outputs on this node. </summary>
|
||||
public IEnumerable<NodePort> InstanceOutputs { get { foreach (NodePort port in Ports) { if (port.IsDynamic && port.IsOutput) yield return port; } } }
|
||||
/// <summary> Iterate over all instance inputs on this node. </summary>
|
||||
public IEnumerable<NodePort> InstanceInputs { get { foreach (NodePort port in Ports) { if (port.IsDynamic && port.IsInput) yield return port; } } }
|
||||
/// <summary> Iterate over all dynamic ports on this node. </summary>
|
||||
public IEnumerable<NodePort> DynamicPorts { get { foreach (NodePort port in Ports) { if (port.IsDynamic) yield return port; } } }
|
||||
/// <summary> Iterate over all dynamic outputs on this node. </summary>
|
||||
public IEnumerable<NodePort> DynamicOutputs { get { foreach (NodePort port in Ports) { if (port.IsDynamic && port.IsOutput) yield return port; } } }
|
||||
/// <summary> Iterate over all dynamic inputs on this node. </summary>
|
||||
public IEnumerable<NodePort> DynamicInputs { get { foreach (NodePort port in Ports) { if (port.IsDynamic && port.IsInput) yield return port; } } }
|
||||
/// <summary> Parent <see cref="NodeGraph"/> </summary>
|
||||
[SerializeField] public NodeGraph graph;
|
||||
/// <summary> Position on the <see cref="NodeGraph"/> </summary>
|
||||
@ -97,25 +97,25 @@ namespace XNode {
|
||||
/// <summary> Convenience function. </summary>
|
||||
/// <seealso cref="AddInstancePort"/>
|
||||
/// <seealso cref="AddInstanceOutput"/>
|
||||
public NodePort AddInstanceInput(Type type, Node.ConnectionType connectionType = Node.ConnectionType.Multiple, Node.TypeConstraint typeConstraint = TypeConstraint.None, string fieldName = null) {
|
||||
return AddInstancePort(type, NodePort.IO.Input, connectionType, typeConstraint, fieldName);
|
||||
public NodePort AddDynamicInput(Type type, Node.ConnectionType connectionType = Node.ConnectionType.Multiple, Node.TypeConstraint typeConstraint = TypeConstraint.None, string fieldName = null) {
|
||||
return AddDynamicPort(type, NodePort.IO.Input, connectionType, typeConstraint, fieldName);
|
||||
}
|
||||
|
||||
/// <summary> Convenience function. </summary>
|
||||
/// <seealso cref="AddInstancePort"/>
|
||||
/// <seealso cref="AddInstanceInput"/>
|
||||
public NodePort AddInstanceOutput(Type type, Node.ConnectionType connectionType = Node.ConnectionType.Multiple, Node.TypeConstraint typeConstraint = TypeConstraint.None, string fieldName = null) {
|
||||
return AddInstancePort(type, NodePort.IO.Output, connectionType, typeConstraint, fieldName);
|
||||
public NodePort AddDynamicOutput(Type type, Node.ConnectionType connectionType = Node.ConnectionType.Multiple, Node.TypeConstraint typeConstraint = TypeConstraint.None, string fieldName = null) {
|
||||
return AddDynamicPort(type, NodePort.IO.Output, connectionType, typeConstraint, fieldName);
|
||||
}
|
||||
|
||||
/// <summary> Add a dynamic, serialized port to this node. </summary>
|
||||
/// <seealso cref="AddInstanceInput"/>
|
||||
/// <seealso cref="AddInstanceOutput"/>
|
||||
private NodePort AddInstancePort(Type type, NodePort.IO direction, Node.ConnectionType connectionType = Node.ConnectionType.Multiple, Node.TypeConstraint typeConstraint = TypeConstraint.None, string fieldName = null) {
|
||||
/// <seealso cref="AddDynamicInput"/>
|
||||
/// <seealso cref="AddDynamicOutput"/>
|
||||
private NodePort AddDynamicPort(Type type, NodePort.IO direction, Node.ConnectionType connectionType = Node.ConnectionType.Multiple, Node.TypeConstraint typeConstraint = TypeConstraint.None, string fieldName = null) {
|
||||
if (fieldName == null) {
|
||||
fieldName = "instanceInput_0";
|
||||
fieldName = "dynamicInput_0";
|
||||
int i = 0;
|
||||
while (HasPort(fieldName)) fieldName = "instanceInput_" + (++i);
|
||||
while (HasPort(fieldName)) fieldName = "dynamicInput_" + (++i);
|
||||
} else if (HasPort(fieldName)) {
|
||||
Debug.LogWarning("Port '" + fieldName + "' already exists in " + name, this);
|
||||
return ports[fieldName];
|
||||
@ -125,27 +125,27 @@ namespace XNode {
|
||||
return port;
|
||||
}
|
||||
|
||||
/// <summary> Remove an instance port from the node </summary>
|
||||
public void RemoveInstancePort(string fieldName) {
|
||||
NodePort instancePort = GetPort(fieldName);
|
||||
if (instancePort == null) throw new ArgumentException("port " + fieldName + " doesn't exist");
|
||||
RemoveInstancePort(GetPort(fieldName));
|
||||
/// <summary> Remove an dynamic port from the node </summary>
|
||||
public void RemoveDynamicPort(string fieldName) {
|
||||
NodePort dynamicPort = GetPort(fieldName);
|
||||
if (dynamicPort == null) throw new ArgumentException("port " + fieldName + " doesn't exist");
|
||||
RemoveDynamicPort(GetPort(fieldName));
|
||||
}
|
||||
|
||||
/// <summary> Remove an instance port from the node </summary>
|
||||
public void RemoveInstancePort(NodePort port) {
|
||||
/// <summary> Remove an dynamic port from the node </summary>
|
||||
public void RemoveDynamicPort(NodePort port) {
|
||||
if (port == null) throw new ArgumentNullException("port");
|
||||
else if (port.IsStatic) throw new ArgumentException("cannot remove static port");
|
||||
port.ClearConnections();
|
||||
ports.Remove(port.fieldName);
|
||||
}
|
||||
|
||||
/// <summary> Removes all instance ports from the node </summary>
|
||||
[ContextMenu("Clear Instance Ports")]
|
||||
public void ClearInstancePorts() {
|
||||
List<NodePort> instancePorts = new List<NodePort>(InstancePorts);
|
||||
foreach (NodePort port in instancePorts) {
|
||||
RemoveInstancePort(port);
|
||||
/// <summary> Removes all dynamic ports from the node </summary>
|
||||
[ContextMenu("Clear Dynamic Ports")]
|
||||
public void ClearDynamicPorts() {
|
||||
List<NodePort> dynamicPorts = new List<NodePort>(DynamicPorts);
|
||||
foreach (NodePort port in dynamicPorts) {
|
||||
RemoveDynamicPort(port);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@ -223,18 +223,18 @@ namespace XNode {
|
||||
public class InputAttribute : Attribute {
|
||||
public ShowBackingValue backingValue;
|
||||
public ConnectionType connectionType;
|
||||
public bool instancePortList;
|
||||
public bool dynamicPortList;
|
||||
public TypeConstraint typeConstraint;
|
||||
|
||||
/// <summary> Mark a serializable field as an input port. You can access this through <see cref="GetInputPort(string)"/> </summary>
|
||||
/// <param name="backingValue">Should we display the backing value for this port as an editor field? </param>
|
||||
/// <param name="connectionType">Should we allow multiple connections? </param>
|
||||
/// <param name="typeConstraint">Constrains which input connections can be made to this port </param>
|
||||
/// <param name="instancePortList">If true, will display a reorderable list of inputs instead of a single port. Will automatically add and display values for lists and arrays </param>
|
||||
public InputAttribute(ShowBackingValue backingValue = ShowBackingValue.Unconnected, ConnectionType connectionType = ConnectionType.Multiple, TypeConstraint typeConstraint = TypeConstraint.None, bool instancePortList = false) {
|
||||
/// <param name="dynamicPortList">If true, will display a reorderable list of inputs instead of a single port. Will automatically add and display values for lists and arrays </param>
|
||||
public InputAttribute(ShowBackingValue backingValue = ShowBackingValue.Unconnected, ConnectionType connectionType = ConnectionType.Multiple, TypeConstraint typeConstraint = TypeConstraint.None, bool dynamicPortList = false) {
|
||||
this.backingValue = backingValue;
|
||||
this.connectionType = connectionType;
|
||||
this.instancePortList = instancePortList;
|
||||
this.dynamicPortList = dynamicPortList;
|
||||
this.typeConstraint = typeConstraint;
|
||||
}
|
||||
}
|
||||
@ -244,16 +244,16 @@ namespace XNode {
|
||||
public class OutputAttribute : Attribute {
|
||||
public ShowBackingValue backingValue;
|
||||
public ConnectionType connectionType;
|
||||
public bool instancePortList;
|
||||
public bool dynamicPortList;
|
||||
|
||||
/// <summary> Mark a serializable field as an output port. You can access this through <see cref="GetOutputPort(string)"/> </summary>
|
||||
/// <param name="backingValue">Should we display the backing value for this port as an editor field? </param>
|
||||
/// <param name="connectionType">Should we allow multiple connections? </param>
|
||||
/// <param name="instancePortList">If true, will display a reorderable list of outputs instead of a single port. Will automatically add and display values for lists and arrays </param>
|
||||
public OutputAttribute(ShowBackingValue backingValue = ShowBackingValue.Never, ConnectionType connectionType = ConnectionType.Multiple, bool instancePortList = false) {
|
||||
/// <param name="dynamicPortList">If true, will display a reorderable list of outputs instead of a single port. Will automatically add and display values for lists and arrays </param>
|
||||
public OutputAttribute(ShowBackingValue backingValue = ShowBackingValue.Never, ConnectionType connectionType = ConnectionType.Multiple, bool dynamicPortList = false) {
|
||||
this.backingValue = backingValue;
|
||||
this.connectionType = connectionType;
|
||||
this.instancePortList = instancePortList;
|
||||
this.dynamicPortList = dynamicPortList;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user