Skip to content

Layouts

Source: Layouts.h

Layouts

class Layouts
src/light/layouts/Layouts.h:22

Inherits: MoonModule

Top-level container for one or more LayoutBase children — it defines the physical light topology of the installation and is shared by every Layer in the Layers container (one [Layouts] describing the physical setup, multiple Layers render into it).

Coordinate iteration is owned by the container, not the layer:forEachCoord walks every enabled child layout's coordinates in registration order, offsetting physical indices so multiple layouts (for example 16 strips making one panel) stitch into a single flat physical address space without overlap. A Layeruses those coordinates to build its LUT. totalLightCount (the sum across enabled children) sizes both the layer buffer and the driver output buffer.

Disabling a layout: disabling a layout child (the enabled toggle) removes its lights from the LUT entirely, and the indices of any layouts after it shift down to close the gap — with two grids of 4 and 2 lights, disabling the first leaves the second at indices 0–1 and totalLightCount drops from 6 to 2. A Scheduler::prepareTree fires so the LUT, layer buffer, and driver output buffer reallocate. Side effect: ArtNet universe assignments shift with the indices — to keep driver-to-fixture mapping stable across enable changes, disable the driver instead of the layout. Disabling the container itself reports zero lights and an empty iteration, the same effect as disabling every child.

Reordering: layout children reorder by drag-and-drop (POST /api/modules/<name>/move with {"to": <index>}), with insert (not swap) semantics — the standard reorderable-list behaviour (Finder, Trello, SortableJS). Order sets the physical index range each layout occupies, which drives ArtNet universe assignment. The same move op applies to every container.

Status: the status slot shows the physical setup it describes — <N> lights · <W>×<H>×<D> — the total light count summed across enabled children (the driver output buffer size) and the physical bounding box (the extent of all light coordinates, the dense render buffer size). For a dense grid the count equals the box volume; for a sparse layout (a sphere shell) the count is smaller than the box, and that gap is the at-a-glance signal that the layout is sparse. An empty setup reports Warning severity. Recomputed on every rebuild, not per tick.

Layouts card

Public Methods

virtual inline constchar * acceptsChildRoles() const override : Comma-separated role names this module accepts as user-added children ("effect,modifier").

inline nrOfLightsType totalLightCount() const : Sum of lightCount across enabled children — sizes the layer buffer and the driver output buffer.

inline void forEachCoord(constCoordSink & sink) const

inline bool hasBlackPixels() const : Whether any enabled child declares dark gaps (black pixels).

virtual inline void prepare() override : Status line: total physical lights + the physical bounding box (the extent of all light coordinates).