Vixen
feb85697
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 StringId Title

    What the menu line says, as a declaration a translator sees (#1284). The editor switches language live, so the record carries the id rather than the text: a string here was frozen at whatever language was in use when the kind registered.

  • 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, StringId 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 (22)

  • ContentLibraryVixen.Editor.App
  • ContentLibraryTestsVixen.Editor.App.Tests
  • CreateMenuTestsVixen.Editor.App.Tests
  • DeclaredVixen.Editor.Terrain
  • DeclaredContributionTestsVixen.Editor.App.Tests
  • DeclaredContributionsVixen.Editor.App
  • DeclaredParityTestsVixen.Editor.App.Tests
  • EditorApplicationVixen.Editor.App
  • EditorWriteEchoTestsVixen.Editor.App.Tests
  • ExpiredRefusalTestsVixen.Editor.App.Tests
  • IContentLibraryVixen.Editor.Assets
  • LibraryModuleVixen.Editor.App
  • LibraryModuleTestsVixen.Editor.App.Tests
  • LibraryQuestionsVixen.Editor.App
  • ModuleReachTestsVixen.Editor.App.Tests
  • TerrainModuleReachTestsVixen.Editor.App.Tests
  • TexturingClaimTestsVixen.Editor.Texturing.Tests
  • TexturingCollectionTestsVixen.Editor.Texturing.Tests
  • TexturingModuleVixen.Editor.Texturing
  • TexturingModuleReachTestsVixen.Editor.App.Tests
  • TexturingModuleTestsVixen.Editor.Texturing.Tests
  • WaterModuleVixen.Editor.Water