--- name: vvvv-fileformat description: "Describes the .vl XML file format used by vvvv gamma — document structure, element hierarchy, ID system (base62 GUIDs), NodeReference/Choice patterns, Pins, Pads (IOBoxes), Links, ProcessDefinition/Fragment lifecycle, regions (If/ForEach/Cache), type definitions, TypeAnnotations, and property serialization. Use when generating, parsing, or modifying .vl files programmatically, or when understanding the structure of vvvv patches at the XML level." license: CC-BY-SA-4.0 compatibility: Designed for coding AI agents assisting with vvvv gamma development metadata: author: Kopffarben version: "1.0" --- # VL File Format (.vl) ## Overview A `.vl` file is an XML document encoding a visual dataflow program for vvvv gamma. Key elements: - **Document** — root element, contains dependencies and one top-level Patch - **Patch** — container for visual elements (Nodes, Pads, Links, Canvases) - **Node** — operation calls, type definitions, or regions - **Pin** — input/output on a Node (defined at definition site) - **Pad** — visual data element (IOBox) for displaying/editing values - **Link** — connects two endpoints by referencing their IDs - **Canvas** — visual grouping container (no logical scope) - **ProcessDefinition** — lifecycle definition (Create, Update) via Fragments - **Slot** — state field within a type definition ## XML Root and Namespaces ```xml ``` | Prefix | URI | Purpose | |--------|-----|---------| | `p` | `property` | **Required.** Complex properties as child elements (``) | | `r` | `reflection` | Optional. Only when using `r:IsNull="true"` for explicit null values | Root attributes: `Id` (base62 GUID), `LanguageVersion` (e.g. `"2024.6.0"`), `Version` (always `"0.128"`). ## ID System Every element has a unique `Id` — a **22-character base62-encoded GUID** using `[0-9A-Za-z]`. All IDs must be unique within the document. Generate via `GUIDEncoders.GuidTobase62(Guid.NewGuid())`. Link `Ids` attribute: comma-separated `"sourceId,sinkId"` (output first, input second). ## Element Hierarchy ``` Document ├── NugetDependency (0..n) ├── DocumentDependency (0..n) ├── PlatformDependency (0..n) └── Patch (exactly 1, top-level) ├── Canvas (DefaultCategory, CanvasType="FullCategory") └── Node (Name="Application") └── Patch (inner) ├── Canvas (CanvasType="Group") │ ├── Node (operation calls) │ ├── Pad (IOBoxes) │ └── ... ├── Patch (Name="Create") ├── Patch (Name="Update") ├── ProcessDefinition │ ├── Fragment → Create patch │ └── Fragment → Update patch └── Link (0..n) ``` **Critical**: Dependencies are direct children of `Document`, NOT inside `Patch`. ## Dependencies ```xml ``` Almost every document needs `VL.CoreLib`. Use `IsForward="true"` to re-export types to consumers. ## NodeReference System (Choices) The `` property defines what a Node IS. It contains `` elements that identify the target symbol. ### Operation Call ```xml ``` - First Choice: `Kind="NodeFlag"` with `Fixed="true"` (shape indicator) - Second Choice: `ProcessAppFlag` (stateful) or `OperationCallFlag` (stateless) ### Type Definitions ```xml ``` ### Regions ```xml ``` Regions use `StatefulRegion` as the FIRST Choice (not `NodeFlag`). Use `ApplicationStatefulRegion` for If/ForEach or `ProcessStatefulRegion` for Cache. ## Node Element ```xml ... ``` Key attributes: `Id`, `Name`, `Bounds` (`"X,Y"` or `"X,Y,W,H"`), `Summary`, `Tags`. ## Pin Element ```xml ``` Kind values: `InputPin`, `OutputPin`, `StateInputPin`, `StateOutputPin`, `ApplyPin`. Visibility: `Visible` (default), `Optional`, `OnCreateDefault`, `Hidden`. ## Pad Element (IOBox) ```xml ``` Note the lowercase `i` in `isIOBox`. Common types: `Boolean`, `Int32`, `Float32`, `Float64`, `String`, `Vector2`, `Vector3`. ### Comment Pad ```xml 14 Comment ``` ## Link Element ```xml ``` `Ids` format: `"sourceId,sinkId"` — output first, input second. Use `IsFeedback="true"` for feedback loops, `IsHidden="true"` for reference links. ## ProcessDefinition and Fragments ```xml ``` Fragment `Patch` attribute references a sibling `` element's `Id`. ## Regions Regions use 4-value Bounds (`"X,Y,W,H"`) and have ControlPoints at borders: ```xml ``` Region patch names: If uses `Then`/`Else`, ForEach uses `Create`/`Update`/`Dispose`, Cache uses `Create`/`Update`. ## TypeAnnotation ```xml ``` ## Slot Element (State Fields) ```xml 0.5 ``` ## Complete Minimal Example ```xml ``` ## Validation Rules 1. All IDs must be unique (22-char base62 GUIDs) 2. `xmlns:p="property"` must be on `Document` 3. `Version="0.128"` always required 4. Fragment `Patch` must reference existing sibling Patch IDs 5. Link `Ids`: exactly `"sourceId,sinkId"` — output first 6. `CanvasType="FullCategory"` only for root canvas 7. Every document needs `VL.CoreLib` dependency 8. Application node is the entry point (Name="Application", ContainerDefinition) 9. Element names are case-sensitive (`Patch` not `patch`) 10. `isIOBox` uses lowercase `i` 11. Dependencies are children of `Document`, not `Patch` ## Common Mistakes - Forgetting `xmlns:p="property"` namespace declaration - Putting dependencies inside `Patch` instead of `Document` - Reversed Link direction (first ID must be source/output) - Missing ProcessDefinition for process/class type definitions - Wrong Bounds format (use commas, no spaces: `"100,200,65,19"`) - Using `IsIOBox` instead of `isIOBox` For the complete element reference with all attributes, Choice kinds, and serialization details, see [format-reference.md](format-reference.md). For layout conventions, spacing, positioning, and visual organization best practices, see [best-practices.md](best-practices.md).