Merging
Blocks act as synchronous functions with optional metadata in the form of Addons. Blocks don’t know what order they’re run in or what other Blocks exist. They only know to map inputs to output Creations.
At runtime, the create
engine will often need to re-run Blocks continuously as they receive Addons from other Blocks.
Blocks will be re-run whenever other Blocks signal new Addon data to them that they haven’t yet seen.
This allows Blocks to not need any explicit indication of what order to run in.
The steps runPreset
takes internally are:
- Create a queue of Blocks to be run, starting with all defined in the Preset
- For each Block in the queue:
- Get the Creation from the Block, passing any current known Args
- Store that Block’s Creation
- If the Block specified new addons for any other Blocks:
- Add those Blocks to the queue of Blocks to re-run
- Merge all Block Creations together