Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Use Ctrl + Click to copy a connection from an input to another input. 

Image RemovedImage Added

Insert Node Into Chain

...

Let's first observe the most trivial scenario, adding with a leaf node selected:

Image RemovedImage Added

In this scenario, if the user has the blur node selected and they add a node from the quick add menu, we should expect the new node to be placed to the right of the blur node, with one major grid line of space in between like so:

Image RemovedImage Added

2 - Inserting into existing connections by node.

If the selected node is connected to another node downstream, we should insert the new node in between the connection, without breaking the chain:

Image RemovedImage Added

Inserting a levels node here results in the following:

Image RemovedImage Added


3 - Inserting into existing connections by wire.

...

If the inputs and/or outputs of the inserted node aren't compatible with the selected node or the downstream nodes (if present), then the inserted node is placed at the location of the quick add menu, disconnected from the rest of the graph:

Image RemovedImage Added

If there are multiple input/output options available for the nodes involved, the algorithm will try to find a combination that allows the inserted node to be connected. Below is an example of mutation changing output type from material to map in order to generate a connection with a map-input-only blur node:

Image RemovedImage Added

If there is an existing connection the inserted node will be placed into the chain, but only if the flow isn't broken by the changing of input and output options. Below is what occurs when changing the output type of the selected node to allow a connection with the inserted node would break the existing chain:

Image RemovedImage Added

5 - Multiple outputs.

If we select a node with multiple downstream nodes and add from the quick add menu, we make a single connection (if possible) from the selected node to the inserted node and continue the multiple paths from that node's output. Take the below scenario as an example:

Image Modified

Inserting another blur node here results in the following:

...

If we were to select only a wire from the above multiple outputs however, the inserted node would only connect through that wire. Here is what happens if we inserted the same node but the wire to gradient removal was selected instead of the blur node:

6 - Inserting positions.

A method called GetPlacementLocation() in the NodeGraphOperations.cs file is used to determine where the new node should be placed in the graph. If it If a new node can't be placed next to the selected node (the space is occupied by downstream nodes), then this method will find a space node will be placed above or below the current selection to place the node:.


7 - Multiple selection

If multiple nodes are selected, then the insert location of the new node will depend on one of two cases being satisfied:

...