Example #1
0
      public void Validate()
      {
          if (nodes == null)
          {
              nodes = new List <Node> ();
          }
          for (int nodeCnt = 0; nodeCnt < nodes.Count; nodeCnt++)
          {
              Node node = nodes[nodeCnt];
              if (node == null)
              {
                  nodes.RemoveAt(nodeCnt);
                  nodeCnt--;
                  continue;
              }
              for (int knobCnt = 0; knobCnt < node.nodeKnobs.Count; knobCnt++)
              {
                  NodeKnob nodeKnob = node.nodeKnobs[knobCnt];
                  if (nodeKnob == null)
                  {
                      node.nodeKnobs.RemoveAt(knobCnt);
                      knobCnt--;
                      continue;
                  }

                  if (nodeKnob is NodeInput)
                  {
                      NodeInput input = nodeKnob as NodeInput;
                      if (input.connection != null && input.connection.body == null)
                      {
                          input.connection = null;
                      }
                  }
                  else if (nodeKnob is NodeOutput)
                  {
                      NodeOutput output = nodeKnob as NodeOutput;
                      for (int conCnt = 0; conCnt < output.connections.Count; conCnt++)
                      {
                          NodeInput con = output.connections[conCnt];
                          if (con == null || con.body == null)
                          {
                              output.connections.RemoveAt(conCnt);
                              conCnt--;
                          }
                      }
                  }
              }
          }

          if (editorStates == null)
          {
              editorStates = new NodeEditorState[0];
          }
          editorStates = editorStates.Where((NodeEditorState state) => state != null).ToArray();
          foreach (NodeEditorState state in editorStates)
          {
              if (!nodes.Contains(state.selectedNode))
              {
                  state.selectedNode = null;
              }
          }
      }
Example #2
0
 public NodeInput CreateInput(string inputName, string inputType, NodeSide nodeSide, float sidePosition)
 {
     return(NodeInput.Create(this, inputName, inputType, nodeSide, sidePosition));
 }
Example #3
0
 public NodeInput CreateInput(string inputName, string inputType, NodeSide nodeSide)
 {
     return(NodeInput.Create(this, inputName, inputType, nodeSide));
 }
Example #4
0
 protected internal virtual void OnAddInputConnection(NodeInput input)
 {
 }
 public virtual void OnRemoveConnection(NodeInput input)
 {
 }
 public virtual void OnAddConnection(NodeInput input)
 {
 }