Vixen
02b45cc4
csharp
public sealed class AssetDrawer

A field naming an asset, with a button that opens a picker and a place to drop one.

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

Remarks

The member holds an AssetId, and this shows a name. Everything stored in a file is a GUID — doc 08's whole identity model — so the drawer is the layer that turns one into something readable, and it asks the project rather than caching a name that a rename would make wrong.

⚠ An AssetReference is the same row, and leaving it out was not a missing nicety. A bare id can only ever name an asset's main object, so what a scene actually stores is a reference — MeshRenderable.Mesh and every material member on every component are that type, not AssetId. The drawer answered for AssetId alone, so all of them fell through to the read-only last resort: the two most-used asset fields in the editor were grey text.

An unresolved GUID shows as Missing (…) with the id, not as empty. An asset that has been deleted out from under a scene is exactly the case a person needs to see, and an empty box says "nothing was ever assigned" — which is a different problem with a different fix.

Fields and properties (3)

  • public const string DropTargetClass

    The class a host puts on the row under a drag it would accept.

  • public const string DropRejectedClass

    The class for a drag over a field that will not take it.

  • public Func<AssetId, string?>? Resolve

    Turns an asset id into what the field says.

Events (1)

  • public Action<InspectorField>? PickRequested

    Raised when the picker button is pressed. The host opens whatever it opens.

Methods (6)

Used by (8)

  • AssetFieldDropVixen.Editor.App
  • AssetPickerVixen.Editor.App
  • AssetPickerTestsVixen.Editor.App.Tests
  • CompositeTestsVixen.Editor.Inspector.Tests
  • DrawerRegistryVixen.Editor.Inspector
  • DrawerTestsVixen.Editor.Inspector.Tests
  • DropIntoFieldTestsVixen.Editor.App.Tests
  • EditorApplicationVixen.Editor.App