Vixen
02b45cc4
csharp
public sealed class DrawerRegistry

Which drawer edits which member.

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

Remarks

Attributes are asked before types. A float is a numeric field and a float under [Range] is a slider; a Guid is a text box and a Guid under [AssetPicker<Texture>] is a picker. The attribute is the more specific statement about the member, so it wins — and a member with several is matched in the order they were declared, so the answer does not depend on a dictionary's iteration order.

Registration is per instance, and there is a shared default. A plugin adding a drawer for its own type adds it to Default; a test wanting to prove a drawer in isolation makes an empty registry. The alternative — a single static — makes two tests that register drawers for one type unable to run in the same process.

Fields and properties (2)

  • public static DrawerRegistry Default

    The registry the inspector uses unless it is handed another.

  • public IEnumerable<IPropertyDrawer> Drawers

    Every drawer registered, once each, in no particular order.

Methods (9)

  • public void ForType(Type type, IPropertyDrawer drawer)

    Registers a drawer for a value type.

  • public void ForType<T>(IPropertyDrawer drawer)

    Registers a drawer for a value type.

  • public void ForAttribute(Type attribute, IPropertyDrawer drawer)

    Registers a drawer for members carrying an attribute.

  • public void ForAttribute<TAttribute>(IPropertyDrawer drawer) where TAttribute : Attribute

    Registers a drawer for members carrying an attribute.

  • public void Fallback(IPropertyDrawer drawer)

    Registers a drawer consulted when nothing more specific matched.

  • public bool Remove(IPropertyDrawer drawer)

    Takes a drawer out of everything it was registered for.

  • public IPropertyDrawer? Resolve(InspectorMember member)

    The drawer that edits a member.

  • public IPropertyDrawer? Resolve(Type type, InspectorMember member)

    The drawer for a type, asked on a member's behalf.

  • public static DrawerRegistry CreateDefault()

    The built-in drawers, which is what Default starts as.

Used by (16)

  • AssetPickerTestsVixen.Editor.App.Tests
  • ComponentsViewVixen.Editor.App
  • CompositeTestsVixen.Editor.Inspector.Tests
  • DeclaredContributionTestsVixen.Editor.App.Tests
  • DeclaredContributionsVixen.Editor.App
  • DrawerTestsVixen.Editor.Inspector.Tests
  • EditorApplicationVixen.Editor.App
  • InspectorRowsVixen.Editor.Inspector
  • InspectorViewVixen.Editor.Inspector
  • ListDrawerVixen.Editor.Inspector
  • MarkupBindingVixen.Editor.Inspector
  • NestedDrawerVixen.Editor.Inspector
  • OptionalDrawerVixen.Editor.Inspector
  • OutOfTreePluginTestsVixen.Editor.App.Tests
  • PropertyFieldVixen.Editor.Inspector
  • TargetOverrideMatrixVixen.Editor.AssetEditors