Vixen
02b45cc4
csharp
public record class NewAssetKind

One line in Create ▸: what it is called, what it writes, and whether it opens.

Read the guide page for this →

Remarks

⚠ F3: this was a literal tuple array in EditorWorlds. A plugin that introduced an asset type could not put it in Create ▸ at all — the menu was a list in the application of every kind the application knew about, which is the same shape of problem as an editor that hard-references its own features.

Here rather than in Vixen.Editor.App because a contribution has to be declarable by something that does not reference the application — which is every plugin, and every feature assembly once P3 moves the built-ins to the front door.

Fields and properties (8)

  • public string Id

    The command id. Prefix a plugin's with the plugin's own id.

  • public string Title

    What the menu line says.

  • public string Extension

    What the new file is called after the dot, including it.

  • public string DefaultName

    What it is called before the dot, before a number is appended.

  • public string Contents

    What to write into it. Empty is a zero-byte file, which is what a kind whose editor opens an empty one as a sensible new document wants; anything else is a starter document, which a kind read by an importer needs — an empty file that the importer deserialises and validates arrives with a warning beside it rather than as a new asset.

  • public bool Opens

    Whether to open it after creating it, which needs an editor claiming the extension.

  • public int Order

    Where among the lines, low first. Ties keep registration order.

  • public Func<string>? Build

    Produces the contents per file, or to use Contents.

Methods (2)

  • public NewAssetKind(string Id, string Title, string Extension, string DefaultName, string Contents = "", bool Opens = true, int Order = 0)

    One line in Create ▸: what it is called, what it writes, and whether it opens.

  • public string NewContents()

    What to write into a new one.

Used by (3)

  • DeclaredContributionTestsVixen.Editor.App.Tests
  • DeclaredContributionsVixen.Editor.App
  • EditorApplicationVixen.Editor.App