コード例 #1
0
 /// <summary>
 /// Removes the connection from NodeInput.
 /// </summary>
 public static void RemoveConnection(NodeInput input)
 {
     NodeEditorCallbacks.IssueOnRemoveConnection(input);
     input.connection.connections.Remove(input);
     input.connection = null;
     NodeEditor.RecalculateFrom(input.body);
 }
コード例 #2
0
        /// <summary>
        /// Applies a connection between the passed NodeOutput and this NodeInput. 'CanApplyConnection' has to be checked before to avoid interferences!
        /// </summary>
        public void ApplyConnection(NodeOutput output)
        {
            if (output == null)
            {
                return;
            }

            if (connection != null)
            {
                NodeEditorCallbacks.IssueOnRemoveConnection(this);
                connection.connections.Remove(this);
            }
            connection = output;
            output.connections.Add(this);

            if (!output.body.calculated)
            {
                NodeEditor.RecalculateFrom(output.body);
            }
            else
            {
                NodeEditor.RecalculateFrom(body);
            }

            output.body.OnAddOutputConnection(output);
            body.OnAddInputConnection(this);
            NodeEditorCallbacks.IssueOnAddConnection(this);
        }
コード例 #3
0
 public void RemoveConnection()
 {
     if (!((UnityEngine.Object)connection == (UnityEngine.Object)null))
     {
         NodeEditorCallbacks.IssueOnRemoveConnection(this);
         connection.connections.Remove(this);
         connection = null;
         NodeEditor.RecalculateFrom(body);
     }
 }
コード例 #4
0
 protected internal void InitBase()
 {
     NodeEditor.RecalculateFrom(this);
     if (!((UnityEngine.Object)NodeEditor.curNodeCanvas == (UnityEngine.Object)null) && NodeEditor.curNodeCanvas.nodes != null)
     {
         if (!NodeEditor.curNodeCanvas.nodes.Contains(this))
         {
             NodeEditor.curNodeCanvas.nodes.Add(this);
         }
         NodeEditor.RepaintClients();
     }
 }
コード例 #5
0
        /// <summary>
        /// Removes the connection from this NodeInput
        /// </summary>
        public void RemoveConnection()
        {
            if (connection == null)
            {
                return;
            }

            NodeEditorCallbacks.IssueOnRemoveConnection(this);
            connection.connections.Remove(this);
            connection = null;

            NodeEditor.RecalculateFrom(body);
        }
コード例 #6
0
        /// <summary>
        /// Init the Node Base after the Node has been created. This includes adding to canvas, and to calculate for the first time
        /// </summary>
        protected virtual void InitBase()
        {
            NodeEditor.RecalculateFrom(this);
            if (!NodeEditor.curNodeCanvas.nodes.Contains(this))
            {
                NodeEditor.curNodeCanvas.nodes.Add(this);
            }
#if UNITY_EDITOR
            if (String.IsNullOrEmpty(name))
            {
                name = UnityEditor.ObjectNames.NicifyVariableName(GetID);
            }
#endif
            NodeEditor.RepaintClients();
        }
コード例 #7
0
        /// <summary>
        /// Applies a connection between output and input. 'CanApplyConnection' has to be checked before
        /// </summary>
        public static void ApplyConnection(NodeOutput output, NodeInput input)
        {
            if (input != null && output != null)
            {
                if (input.connection != null)
                {
                    input.connection.connections.Remove(input);
                }
                input.connection = output;
                output.connections.Add(input);

                NodeEditor.RecalculateFrom(input.body);

                NodeEditorCallbacks.IssueOnAddConnection(input);
            }
        }
コード例 #8
0
 public void ApplyConnection(NodeOutput output)
 {
     if (!((UnityEngine.Object)output == (UnityEngine.Object)null))
     {
         if ((UnityEngine.Object)connection != (UnityEngine.Object)null)
         {
             NodeEditorCallbacks.IssueOnRemoveConnection(this);
             connection.connections.Remove(this);
         }
         connection = output;
         output.connections.Add(this);
         if (!output.body.calculated)
         {
             NodeEditor.RecalculateFrom(output.body);
         }
         else
         {
             NodeEditor.RecalculateFrom(body);
         }
         output.body.OnAddOutputConnection(output);
         body.OnAddInputConnection(this);
         NodeEditorCallbacks.IssueOnAddConnection(this);
     }
 }