From e21398cd19863ccff5afce82783332bf3157883f Mon Sep 17 00:00:00 2001 From: Thor Brigsted Date: Tue, 19 Dec 2017 19:18:35 +0100 Subject: [PATCH] Added Node.ClearInstancePorts Fixed System.Exception --- Scripts/Node.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Scripts/Node.cs b/Scripts/Node.cs index e22b78f..9cc7bb3 100644 --- a/Scripts/Node.cs +++ b/Scripts/Node.cs @@ -84,6 +84,14 @@ namespace XNode { port.ClearConnections(); ports.Remove(port.fieldName); } + + /// Removes all instance ports from the node + [ContextMenu("Clear instance ports")] + public void ClearInstancePorts() { + foreach (NodePort port in InstancePorts) { + RemoveInstancePort(port); + } + } #endregion #region Ports @@ -229,7 +237,7 @@ namespace XNode { this.Clear(); if (keys.Count != values.Count) - throw new System.Exception(string.Format("there are {0} keys and {1} values after deserialization. Make sure that both key and value types are serializable.")); + throw new System.Exception("there are " + keys.Count + " keys and " + values.Count + " values after deserialization. Make sure that both key and value types are serializable."); for (int i = 0; i < keys.Count; i++) this.Add(keys[i], values[i]);