Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
 public virtual void OnSerialization(SerializableNode sNode)
 {
     // for overriding: gets called before this Node gets serialized
 }
Ejemplo n.º 3
0
 public virtual void OnDeserialization(SerializableNode sNode)
 {
     // for overriding: gets called after this Node has been deserialized
 }