void BuildFromNodes( IEnumerable<INode> nodes, bool insert, Vector2 offset, bool selectNew )

book_4_sparkGenerated
code_blocksInput

Description

The BuildFromNodes method is responsible for constructing a graph view from a collection of nodes. This method allows you to specify whether the nodes should be inserted into the existing graph, apply an offset to their positions, and determine if the newly added nodes should be selected.

Usage

To use the BuildFromNodes method, you need to provide the following parameters:

  • nodes: An IEnumerable<INode> representing the collection of nodes to be added to the graph view.
  • insert: A bool indicating whether the nodes should be inserted into the existing graph (true) or replace the current nodes (false).
  • offset: A Vector2 specifying the offset to apply to the position of each node.
  • selectNew: A bool that determines if the newly added nodes should be selected (true) or not (false).

Example

// Example usage of BuildFromNodes method
var graphView = new GraphView();
var nodes = new List<INode> { node1, node2, node3 };

// Build the graph view from the nodes, inserting them with an offset and selecting the new nodes
graphView.BuildFromNodes(nodes, true, new Vector2(10, 20), true);