public record class AssetPreviewWhat draws the thumbnail for a kind of file the built-in decoders cannot read.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Doc 36 § D4's AddPreview row, on P2's terms. A contribution kind is a record in the assembly that owns it and Add``1 is the whole surface; there is no method on PluginContext for this and deliberately is not.
⚠ Asked before the built-in decoders rather than after them. The row in doc 36 says "asks ImageDecoders and falls back", and a registry consulted only on the fallback path could never override the answer for an extension a built-in decoder also claims — which is exactly what a plugin owning its own .png-shaped format needs. Ties are broken by Order and then by registration order.
⚠ Render runs on a pool thread, and it is resolved on the frame thread. A decode is tens of milliseconds and there are hundreds of them, so the work cannot be on the frame thread; but the delegate belongs to a plugin that can be unloaded, so which delegate a file uses is decided while the registry is being read and not two seconds later inside the task.
⚠ Returning is ordinary and is not an error. A file being written by another program, a truncated download, an extension that lies about its contents: the answer is the type glyph, which is what the grid draws for everything with no picture. A contributor that threw would take the editor down from a thread nobody is watching.
Fields and properties (3)
public string ExtensionThe file extension, with its dot, matched without regard to case.
public Func<string, AssetPreviewImage?> RenderGiven the file's absolute path, its picture — or .
public int OrderWhich of two contributors for one extension is asked first; lower goes first.
Methods (1)
public AssetPreview(string Extension, Func<string, AssetPreviewImage?> Render)What draws the thumbnail for a kind of file the built-in decoders cannot read.
Used by (2)
- AssetPreviewContributionTestsVixen.Editor.App.Tests
- ThumbnailCacheVixen.Editor.App