示例#1
0
        /// <summary> Converts this node to a SerializableNode </summary>
        public SerializableNode ToSerializedNode()
        {
            SerializableNode n = new SerializableNode();

            n.type              = GetType().FullName;
            n.id                = Id;
            n.X                 = WindowRect.xMin;
            n.Y                 = WindowRect.yMin;
            n.Collapsed         = Collapsed;
            n.directInputValues = new float[Sockets.Count];

            for (var i = 0; i < n.directInputValues.Length; i++)
            {
                if (Sockets[i].IsInput())
                {
                    InputSocket inputSocket = (InputSocket)Sockets[i];
                    if (inputSocket.IsInDirectInputMode())
                    {
                        n.directInputValues[i] = inputSocket.GetDirectInputNumber();
                    }
                }
            }

            n.data = JsonUtility.ToJson(this);             // custom node data can be used
            OnSerialization(n);
            return(n);
        }
示例#2
0
 public virtual void OnSerialization(SerializableNode sNode)
 {
     // for overriding: gets called before this Node gets serialized
 }
示例#3
0
 public virtual void OnDeserialization(SerializableNode sNode)
 {
     // for overriding: gets called after this Node has been deserialized
 }