public static class KeyMapYamlThe YAML a keymap and a preset are both written in.
Remarks
One reader and one writer for the two files, because they are one format. A preset is exactly what a user's keymap is minus the preset name — which is what lets somebody export their bindings and hand them to a colleague as a preset — so a second copy would be a second thing to keep in step with a format whose whole point is that there is one.
⚠ In this assembly and not in Vixen.Ui.Controls beside KeyMap, and the layering is the whole reason (#650). The keymap's mechanism — three layers, conflicts, contexts, reservation — is what any application with an accelerator has. Where the bindings are kept between runs reaches Vixen.Core.Yaml, which reaches YamlDotNet, and Vixen.Ui.Controls doing the same would put a YAML parser in the dependency closure of every application that has a button. This library already carries it — a DockLayout is YAML for the same reason a keymap is, something a person edits, diffs and checks in — so the format costs an application that has a docking host or a data grid nothing it was not already paying.
⚠ It used to be the editor's, and the reason recorded for that was half right. "A control library would put YAML in every application's closure" is true of Vixen.Ui.Controls and was never true of this assembly, whose project file references Vixen.Core.Yaml by name. A game that keeps its settings in JSON still writes the other half of Overrides and Restore and owes this file nothing.
Only what the user did is written: the preset's name, and the bindings they moved themselves — including a command deliberately unbound, which is an empty chord rather than an omission, because omitting it would mean "use the layer underneath" and the user said the opposite.
Methods (4)
public static string Write(KeyMap keys)The user's overrides and their chosen preset, as YAML.
public static void Read(KeyMap keys, string yaml)Applies a user keymap over the defaults.
public static string Write(KeyMapPreset preset)Writes a preset back out in the format ReadPreset reads.
public static KeyMapPreset ReadPreset(string name, string yaml)Reads a preset from the same YAML a keymap is written in.
Used by (7)
- KeyMapYamlTestsVixen.Ui.Controls.Advanced.Tests
- CommandTestsVixen.Editor.Ui.Tests
- EditorApplicationVixen.Editor.App
- EditorWorkspaceVixen.Editor.Ui
- KeyMapPresetTestsVixen.Editor.Ui.Tests
- KeyMapPresetsVixen.Editor.Ui
- PlatformKeyTestsVixen.Editor.Ui.Tests