Vixen
02b45cc4
csharp
public sealed class InputActionsDocument

A .vxinput, open for editing.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Doc 11 calls this "doc 11's own gap": the whole action model exists and no editor does. The reader and the writer are Vixen.Input's and are shared with the source generator, so this document does not know the file format at all — it holds an InputActionAssetData and asks InputActionAssetWriter to spell it. That is what makes the file an editor writes and the file the compiler reads the same file by construction.

⚠ Every edit replaces the whole document, and that is the natural shape here rather than a shortcut. InputActionAssetData and everything under it are immutable records: there is no "set this binding's path", only a new record with a new path. So an edit is a replacement, one command holds the before and the after, and undo is an assignment. The tree is small — an action map is tens of records — and the alternative would be a mutable editor-side mirror of a model that deliberately is not one.

⚠ The diagnostics from reading are kept and shown. A .vxinput with one unusable binding still yields every other action — that is the reader's own contract — so opening one has to say what it dropped rather than silently presenting a document that will not round-trip.

Fields and properties (4)

  • public const string Extension

    What an action asset is written as.

  • public string AssetPath

    Where the file is, absolute.

  • public InputActionAssetData Actions

    The document.

  • public IReadOnlyList<InputAssetDiagnostic> LoadDiagnostics

    What reading the file had to say.

Events (1)

Methods (15)

  • public InputActionsDocument(EditorProject project, AssetId asset, string path)

    Opens an action asset.

  • public void Replace(string name, InputActionAssetData asset)

    Replaces the document, undoably.

  • public void AddMap(string map)

    Adds an action map, undoably.

  • public void RemoveMap(string map)

    Removes an action map, undoably.

  • public void AddAction(string map, string action)

    Adds an action to a map, undoably.

  • public void RemoveAction(string map, string action)

    Removes an action, undoably.

  • public void EditAction(string name, string map, string action, Func<InputActionData, InputActionData> change)

    Replaces one action, undoably.

  • public void AddBinding(string map, string action, InputBindingData binding)

    Adds a binding to an action, undoably.

  • public void RemoveBinding(string map, string action, int index)

    Removes a binding by its position, undoably.

  • public void SetBinding(string name, string map, string action, int index, InputBindingData binding)

    Replaces one binding by its position, undoably.

  • public void AddScheme(string scheme)

    Adds a control scheme, undoably.

  • public void RemoveScheme(string scheme)

    Removes a control scheme, undoably.

  • public void EditScheme(string scheme, Func<InputControlSchemeData, InputControlSchemeData> change)

    Replaces one control scheme, undoably.

  • public string ToText()

    The document as it would be written, without writing it.

  • protected override void SaveCore()

    Writes the document back to wherever it came from.

Used by (5)

  • AnimationGraphDocumentVixen.Editor.AssetEditors
  • AudioMixerDocumentVixen.Editor.AssetEditors
  • AuthoringTestsVixen.Editor.AssetEditors.Tests
  • InputActionsEditorFactoryVixen.Editor.AssetEditors
  • InputActionsViewVixen.Editor.AssetEditors