# The editor


`build/effects-edit <project>` opens a window with the video on top and its timeline below. It draws on the GPU, so most films play at full frame rate while you work on them.

```bash
$ build/effects-edit projects/spot
```

## Hot reload

The editor watches the project. Saving any `.odin` file (or the voice-over's `timeline.json`) recompiles the project without optimization, which takes about 0.4 s, and swaps the new code in under the playhead: the frame you are looking at redraws with the change. Playback does not restart.

A compile error is shown over the preview, with the compiler's message. The last version that compiled stays loaded until the error is fixed.

Because every frame is computed from the time alone, there is no state to carry over or lose in a reload. That is what makes swapping code mid-playback safe.

## The timeline

From top to bottom: a ruler with the video's [marks](/docs/scenes/#the-video), the scenes, the cues, the sounds, the voice-over's words if there is one, and the waveform of the mix. The audio lane shows the mix, which is also what plays.

- Drag a scene's body to move it, its edges to change where it starts or ends.
- Drag a cue or a sound to move it.
- Everything snaps to the playhead, scene edges, cues, sound starts, marks and voice-over words. Hold `Alt` to drag freely.
- Double-click a scene to loop it.

What you move is written to `timing.json` in the project directory: only the items that differ from the code, by name. The renderer applies the same file, so the film renders the way the editor shows it. Select an item and press `Delete` to return it to the time in code. See [timing that lives outside the code](/docs/scenes/#timing-that-lives-outside-the-code).

There is no undo. `timing.json` is small and readable: keep it in version control and use that.

## Keys

| Key | Does |
| --- | --- |
| `Space` | Play or pause |
| `←` `→` | One frame back or forward (`Shift`: one second) |
| `↑` `↓` | Previous or next scene |
| `Home` `End` | Start or end of the video |
| `L` | Loop the scene under the playhead |
| `R` | Rebuild now |
| `Delete` | Reset the selected scene, cue or sound to its time in code |
| `0` | Zoom the timeline to fit |
| `S` | Save a still of the current frame |
| Wheel | Zoom the timeline (`Shift`: scroll it) |

## Preview and render

The preview draws with Skia's GPU backend, the render with its CPU rasterizer. They are the same drawing code and produce the same picture, with one practical difference: shaders are fast in the preview and slow in the render. A scene that plays smoothly in the editor can still take seconds per frame to render. `effects bench` tells you before you find out the long way.

Scenes can ask whether they are being previewed (the frame state carries a `preview` flag) to skip something expensive while editing; use that sparingly, since it makes the preview lie.

Scrubbing through [footage](/docs/footage/) restarts a decoder on each jump, about 0.1 s each.

## A screenshot of the editor

```bash
$ build/effects-edit projects/spot --shot editor.png --at 2.5
```

opens the editor, waits for the first build, saves a picture of the whole window at that time and exits. It exists for checking the editor itself; for frames of the video use [`effects still`](/docs/cli/#still).
