Vixen
02b45cc4
csharp
public sealed class ImporterContributions

Importers something other than this build contributed — a plugin, a project script.

Read the guide page for this →

Remarks

Doc 36 § F8's fix. That finding said "importers are constructed and handed in; there is no registry for a plugin to add to", and the second half was the part that mattered: ImporterRegistry has existed all along, but it is built fresh per run by Create — inside a background task, deliberately, so that the editor and the CLI cannot disagree about the set. A plugin had nothing to add to because every registry it could have reached was about to be thrown away.

⚠ What was needed is a set that outlives a run, which is this, folded in by Create. EditorApplication's own remark said exactly that and named this assembly as where the change belonged; this is that change.

⚠ Process-wide, and unlike EditorRegistry it has to be. The consumers are static factories called from background tasks with no editor to be handed — ProjectWorkspace.Importers(), ContentPipeline, Vixen.Cli — and a per-session registry would reach none of them. What makes that safe is that Add hands back the removal: a plugin's scope disposes it on unload, and a test disposes it in a finally. An editor that shut down without withdrawing its contributions would leave an importer naming a type in an unloaded assembly, which is F8's own trap one level down.

⚠ A contributed importer does not reach an out-of-process compiler worker, and this does not pretend otherwise. Tools/Vixen.AssetCompiler starts workers for crash isolation and each builds its registry from the same Create — but a worker process has not loaded the plugin, so its Default is empty and an asset only that plugin can import fails there. Closing it means the worker loading the same plugin set the coordinator has, which is a change to the worker's start-up and is not this.

Fields and properties (2)

Methods (3)

  • public IDisposable Add(IAssetImporter importer)

    Contributes an importer.

  • public void Clear()

    Forgets everything contributed. For a test that wants a clean process.

  • public ImporterRegistry ApplyTo(ImporterRegistry registry)

    Adds every contribution to a registry.

Used by (7)

  • BuiltInImportersVixen.Editor.Assets
  • EditorApplicationVixen.Editor.App
  • EditorScriptTestsVixen.Editor.Scripts.Tests
  • ImporterContributionTestsVixen.Editor.Assets.Tests
  • OutOfTreePluginTestsVixen.Editor.App.Tests
  • RemovalVixen.Editor.Assets
  • ScriptModuleVixen.Editor.Scripts