Share

Mapped Connections

Mapped connections facilitate graph authoring by streamlining operations on arrays. This feature was introduced in MCG 2018.

Basics

A mapped connection applies an operator or a compound to every item in an array. In the example below, the goal is to multiply the vectors contained in the array by a scalar value of 100.0.

To achieve this, we simply connect the array of vectors into the Multiply Vector's input.

The mapped connection above is equivalent to iterating over the items of the array with a For Each node, and applying a function to each item. See here for more information on functions.

Conditions

A mapped connection is possible if all the conditions below are met.

Note:

In the conditions listed below, you may replace the type Vector3 with any other basic, non-array type: Integer, Boolean, Float, Matrix, Mesh, Spline, Face, Pair, Triple, etc. Mapped connections on nested arrays are not supported, and instead require the use of the For Each operator.

  1. Given an Array[Vector3], the node's input connector must be compatible with the Vector3 type: either Vector3 or Any.

  2. The node cannot output an array by default.

  3. The node is not the Pair or Triple construction operator.

  4. The node is not a Caching or a Core > Control Flow operator.

  5. The node is not a specific Pass Through operator (ex: Pass Through Vector). To use a pass-through node in a mapped connection, use the generic Pass Through Any or Pass Through Array operators.

Combine

You can apply a mapped connection using one or more input arrays. If the input arrays are not the same length, the length of the resulting array will match the length of the shortest input array.

Here is an example of a mapped connection with four input arrays. Mapped connections work best when the input arrays are aligned (i.e. they have the same number of items).

Pairs and Triples

A mapped connection can be used on the Pair Item 1, Pair Item 2, Triple Item 1, Triple Item 2, or Triple Item 3 operators to extract the contents of each pair (or triple) contained in the array.

Conversion

A mapped connection can be used with a conversion operator to convert the items of the array into the desired type.

Example

The graph below illustrates the use of mapped connections to create a stack of cubes.

Was this information helpful?