1
0
mirror of https://github.com/Siccity/xNode.git synced 2025-12-20 09:16:01 +08:00

Added overload for RemoveInstancePort. Removed return bool.

This commit is contained in:
Thor 2017-12-19 10:42:48 +01:00
parent 66de07e1a7
commit 247482d555

View File

@ -72,12 +72,17 @@ namespace XNode {
return port; return port;
} }
public bool RemoveInstancePort(string fieldName) { /// <summary> Remove an instance port from the node </summary>
NodePort port = GetPort(fieldName); public void RemoveInstancePort(string fieldName) {
if (port == null || port.IsStatic) return false; RemoveInstancePort(GetPort(fieldName));
}
/// <summary> Remove an instance port from the node </summary>
public void RemoveInstancePort(NodePort port) {
if (port == null) throw new ArgumentNullException("port");
else if (port.IsStatic) throw new ArgumentException("cannot remove static port");
port.ClearConnections(); port.ClearConnections();
ports.Remove(fieldName); ports.Remove(port.fieldName);
return true;
} }
#endregion #endregion