# Configure Nested Shapes

> Build Feed and PCR Shapes that include other Shapes as slots so a whole room or remote production can be routed as one selection.

Flat Shapes are useful for individual devices and signal groups. Nested Shapes make it possible to route larger operational units, such as an entire room, venue, or remote production, to a facility or production control room (PCR) as one logical selection.

For example, technical staff can model:

- A studio room containing program video, clean video, audio, and data structures.
- A remote production containing several contribution feeds.
- A facility containing compatible ingest or processing structures.
- A PCR containing repeated feed inputs.

An operator can then select `Remote Production 1 → PCR 2` instead of routing every feed and signal separately. Buttons expands that selection through the Nested Shapes and Matching Presets to create the required physical route requests.

**Nested Shapes** let one Shape include another Shape as a slot. Because Shapes are blueprints for Virtual Bundles, a bundle created from this blueprint presents the included structure much like a bundle within a bundle. The existing Virtual Bundle itself is not included. Nested Shapes contribute their routing slots and aggregate handles to the new bundle.

This provides a practical **fan-in and fan-out** model:

- **Fan-in:** a facility or PCR can collect several repeated room or Feed structures under one logical destination bundle.
- **Fan-out:** the same room, Feed, or remote-production structure can be routed to compatible inputs across several facilities or PCR bundles.

Fan-in and fan-out describe how the logical routing structure is organized and reused. They do not imply signal duplication by themselves; the physical routing system must still support every resolved route.

This guide starts with one Feed and one PCR input so the expansion is easy to follow. The same model can then be repeated to represent a complete room or remote production. Keep reverse routing disabled throughout this guide.

## Before you begin

Complete the flat-Shape virtual-routing example first. This example assumes that you already have:

- A flat source Shape created from a physical source bundle.
- A flat destination Shape created from a physical destination bundle.
- A forward-only Matching Preset between those Shapes.
- The physical source and destination bundles used in that example.

This guide reuses the flat Shapes as Nested Shapes and maps the new Virtual Bundles to the relevant physical ports. The previously created Virtual Bundles remain independent resources.

## Plan the Feed and PCR Shapes

The Feed-to-PCR example is the smallest useful form of a larger room-to-facility or remote-production-to-PCR route. Once the model is familiar, the same Nested Shape can be repeated for every feed that belongs to the larger source and destination.

Assume the flat source Shape is named `Source` and contains:

- `Video`
- `Audio 1`
- `Audio 2`

Assume the flat destination Shape is named `Destination` and contains compatible slots.

You will use Nested Shapes to build:

```
Feed
└── Source
    ├── Video
    ├── Audio 1
    └── Audio 2

PCR
└── Feed 1
    ├── Video
    ├── Audio 1
    └── Audio 2
```

`Source` and `Feed 1` use Nested Shapes. The video and audio entries remain their leaf slots.

## Create the Feed Shape

1. Open **Routing → Virtual → Shapes**.
2. Select **+ Shape**. Buttons adds a Shape called **New Shape** to the list straight away and opens it.
3. Set **Label** to `Feed`.
4. Set **Main Direction** to **Src**.
5. Leave **Reverse Slots** off.
6. Select **+** under **Slots**. The list offers slot types and, marked with a cube icon, your existing Shapes.
7. Select the existing flat `Source` Shape to add it as a Nested Shape.
8. Rename its slot if its role in the Feed needs a clearer label.
9. Leave **Incoming Side** and **Outgoing Side** at **Any context** during the initial setup.
10. Select **Save**.

The new slot has the data type **Virtual Shape** and references the `Source` Shape. Its effective direction comes from the Nested Shape.

Buttons uses the referenced structure to expose the Nested Shape's aggregate and leaf handles in the Feed bundle.

## Create a Feed Virtual Bundle

1. Open **Routing → Virtual → Bundles**.
2. Select **+ Bundle**.
3. Set **Label** to `Feed 1`.
4. Select the `Feed` Shape.
5. Select **Create**. `Feed 1` opens.
6. Expand the Nested Shape row.

The bundle detail shows:

- An aggregate for the complete Nested Shape.
- The video and audio leaf slots beneath it.

The aggregate is a logical handle for the applicable slots. It is not an additional physical port or another Virtual Bundle.

## Map Feed 1 to the current physical source bundle

Map the expanded leaf slots directly to the physical ports used by the current source bundle. Map each leaf on its own: the aggregate handle only offers Virtual Bundles, not physical ports.

1. Expand the Nested Shape row in `Feed 1`.
2. On its `Video` leaf, open the route selector on the incoming (left) side.
3. Choose **Physical Ports**, then the connection, the physical source bundle, and its video port. Only ports of a matching type are offered.
4. Repeat this on the incoming side of each audio leaf.
5. Review the staged routes.
6. Select **Execute Routes**.
7. Inspect the routing report.

This operation records mappings from the physical source ports to the leaf handles provided by the Nested Shape. Those mappings form the source edge of later end-to-end routes. You are not attaching the earlier Virtual Bundle to `Feed 1`.

If the source hardware changes later, update these physical mappings. The logical `Feed 1` bundle and anything that routes it can remain unchanged.

## Create the PCR Shape

1. Open **Routing → Virtual → Shapes**.
2. Select **+ Shape**.
3. Set **Label** to `PCR`.
4. Set **Main Direction** to **Dst**.
5. Leave **Reverse Slots** off.
6. Select **+** under **Slots** and select the existing flat `Destination` Shape to add it as a Nested Shape.
7. Rename its slot to `Feed 1`.
8. Select **Save**.

To model several inputs, add the same `Destination` Shape several times and label the slots `Feed 1`, `Feed 2`, and so on. Each slot uses the same reusable Nested Shape.

## Create a PCR Virtual Bundle

1. Open **Routing → Virtual → Bundles**.
2. Select **+ Bundle**.
3. Set **Label** to `PCR 1`.
4. Select the `PCR` Shape.
5. Select **Create**. `PCR 1` opens.
6. Expand `Feed 1`.

The bundle exposes an aggregate for the Nested Shape used by `Feed 1`, with its destination leaf slots underneath.

## Map PCR 1 to the current physical destination bundle

<callout color="yellow" title="Warning">
  Mapping a destination leaf to a physical port routes that port straight away. Until something is routed into `PCR 1`, Buttons routes **None** to the physical destination, which replaces whatever it was showing. On a router with a **None / black / silent source** set, that's the input it switches to. Mapping it here also removes it from any other Virtual Bundle it was mapped to, such as the flat destination bundle. Use a destination that's off air, or route a source into `PCR 1` straight afterwards.
</callout>

1. Expand `Feed 1` in the `PCR 1` bundle.
2. On its `Video` leaf, open the route selector on the outgoing (right) side.
3. Choose **Physical Ports**, then the connection, the physical destination bundle, and its video port.
4. Repeat this on the outgoing side of each audio leaf.
5. Review and execute the staged routes.
6. Confirm that the expanded leaves show the expected physical mappings. The routing report lists the physical routes sent to **None** and any mappings removed from other bundles.

These mappings form the destination edge of later end-to-end routes. The PCR routing model is now abstracted from the physical destination. Replacing that hardware requires updating these leaf mappings rather than redesigning the PCR Shape, operator panels, or saved routes that use `PCR 1`.

## Create a Matching Preset for Nested Shapes

Virtual-to-virtual routing between these Shapes uses:

- A Matching Preset between `Feed` and `PCR`.
- The existing forward-only Matching Preset between the `Source` and `Destination` Shapes used as Nested Shapes.

1. Open **Routing → Virtual → Presets**.
2. Create a new Matching Preset.
3. Set **Name** to `Feed to PCR`.
4. Set **Source Shape** to `Feed`.
5. Set **Destination Shape** to `PCR`.
6. Leave **Reverse Routing** off.
7. Select **Create**. Buttons matches the rules automatically.
8. In **Rules**, check that the Feed's `Source` slot connects to the PCR's `Feed 1` slot. If it doesn't, connect them.
9. Check that the rule uses the existing forward-only `Source`-to-`Destination` Matching Preset, shown on the line between them, and select it if not.
10. Select **Save** if you changed anything.

The referenced Matching Preset describes how the video and audio leaves match. `Feed to PCR` can therefore connect the two Nested Shapes without repeating every leaf rule.

## Route Feed 1 to PCR 1

1. Open **Routing → Route**.
2. Select `Feed 1` as the virtual source.
3. Select `PCR 1` as the virtual destination.
4. Check that `Feed to PCR` is selected in the staged bundle row: Buttons picks it when it's the only preset that fits.
5. Open **Preview preset mapping** (the eye icon) and confirm the rule between the Nested Shapes.
6. Select **Take**.
7. Review the routing report and route state: it lists the virtual mappings and a physical route request for each path that reaches a physical port at both ends.

The Matching Preset expands the logical route through:

1. The `Feed` and `PCR` Shapes.
2. Their Nested Shapes.
3. The referenced Matching Preset.
4. The video and audio leaf slots.
5. The physical ports mapped to those leaves.

Buttons follows each completed path from its physical source to its physical destination and creates the physical route request needed for that destination.

## Scale the model to rooms and remote productions

After becoming familiar with the Feed-to-PCR route, repeat the same structure to represent a larger source:

1. Create a Shape such as `Remote Production` or `Studio Room`.
2. Add the `Feed` Shape several times as Nested Shapes, using labels such as `Program`, `Clean`, and `ISO 1` where appropriate.
3. Create a compatible `Facility` or expanded `PCR` Shape with the required destination Feed structures.
4. Create a Matching Preset between the larger Shapes.
5. Add one rule for each corresponding pair of Nested Shapes, referencing the Feed Matching Preset in each rule.
6. Create Virtual Bundles such as `Remote Production 1` and `PCR 2`.
7. Map their leaf slots to the physical source and destination ports at each edge.

Operators can now route the complete remote production or room with one virtual-to-virtual selection. They can still use a Nested Shape aggregate when only one Feed structure should be routed.

This separation is especially useful when rooms, remote units, or PCR assignments change regularly. Operator controls can continue to use stable logical bundles while technical staff update the physical edge mappings behind them.

## When to use Nested Shapes

Use Nested Shapes when:

- The routing model needs clear fan-in or fan-out.
- The same multi-signal structure occurs in several Shapes.
- Operators need an aggregate for the complete reused structure.
- A referenced Matching Preset can express repeated leaf matching once.
- The logical routing structure should remain stable while the mapped physical hardware changes.

Keep a Shape flat when its signals do not form a reusable structure. Additional Nested Shapes add route-expansion and matching behavior that technical staff need to understand before production deployment.
