Class Graph

class Graph

This class represents an InstantTerra graph.

InstantTerra instantTerra = new InstantTerra();  // Start the instance
Project project = instantTerra.GetProject();  // Get the current project
Graph graph = instantTerra.GetProject().GetGraph();  // Get the graph
enum Graph.NodeLocation

This enum represents the location of a node from another node.

Top
TopRight
Right
BottomRight
Bottom
BottomLeft
Left
TopLeft
Int32 GetNodeCount ()
Returns

Number of nodes in the graph.

Returns the number of nodes in the graph.

int nodeCount = graph.GetNodeCount();
List<Node> GetAllNodes ()
Returns

List of nodes.

Returns the list of nodes in the graph.

List<Node> nodes = graph.GetAllNodes();
List<NodeModel> GetNodeModels ()
Returns

List of node models.

Returns the list of node models.

List<NodeModel> nodes = graph.GetNodeModels();
Node AddNode (ApiNodeType nodeType, Int32 positionX, Int32 positionY)
Returns

The created Node.

Creates and returns the node on the graph.

Node newNode = graph.AddNode(ApiNodeType.PerlinNoise, 10, 10);
Node AddNodeFromModel (NodeModel nodeModel, Int32 positionX, Int32 positionY)
Returns

The created Node.

Creates and returns the node from the node model on the graph.

Node newNode = graph.AddNodeFromModel(perlinNodeModel, 10, 10);
Node AddNodeNextTo (ApiNodeType nodeType, Graph.NodeLocation nodeLocation, Node previousNode)
Returns

The created Node.

Creates and returns the node on the graph, next to the specified Node.

Node newNode = graph.AddNodeNextTo(ApiNodeType.PerlinNoise, NodeLocation.Right, previousNode);
Node AddNodeFromModelNextTo (NodeModel nodeModel, Graph.NodeLocation nodeLocation, Node previousNode)
Returns

The created Node.

Creates and returns the node on the graph, next to the specified Node.

Node newNode = graph.AddNodeFromModelNextTo(perlinNodeModel, NodeLocation.Right, previousNode);
Node RemoveNode (Node nodeToRemove)

Removes the Node from the graph.

graph.RemoveNode(nodeToRemove);
Returns

List of links.

Returns the list of links of the node.

List<Link> links = graph.GetNodeLinks(perlinNoiseNode);
Returns

The created link.

Add link between nodes

Link link = graph.AddLink(startNode, startConnector, endNode, endConnector);
Link AddLinkUsingName (Node startNode, String startConnectorName, Node endNode, String endConnectorName)
Returns

The created link.

Add link between nodes

Link link = graph.AddLinkUsingName(startNode, startConnectorName, endNode, endConnectorName);
Returns

true if the link has been removed

Remove a link

graph.RemoveLink(link);
Boolean IsGraphAvailable ()
Returns

True if the graph exists, otherwise False.

Returns the status of the graph.

bool isAvailable = graph.IsGraphAvailable();