Vixen
02b45cc4
csharp
public sealed class OptionalDrawer

A member whose type is Nullable`1: a checkbox that turns the value on, and the inner type's own editor beside it.

Read the guide page for this →

Remarks

Because "unset" and "zero" are different states, and only one of them is visible without this. Every optional member in the engine — a post-process volume's settings are twenty of them — means "I have no opinion" by being null, and a plain number box shows null as 0. That is the worst available answer: it reads as an override to black, to no bloom, to zero saturation. Unreal pairs every one of its post-process properties with a checkbox for exactly this reason.

⚠ Unticking writes null; it does not write a default. The two are indistinguishable in a number box and completely different in a fold — a volume that says "bloom is 0 here" suppresses the glow, and one that says nothing lets the room underneath decide.

⚠ Ticking writes the inner type's default rather than leaving null. Otherwise the box turns on, the editor beside it stays disabled-looking and nothing happens until the user also types a number — a control that appears not to work on first click.

The inner editor is whatever the registry has for the underlying type, so a float? gets the number drawer with its [Range] slider and a Vector3? gets the three-field vector editor. This drawer contributes the checkbox and nothing else, which is what keeps it one file rather than one per optional type.

Methods (4)

  • public OptionalDrawer(DrawerRegistry drawers)

    A member whose type is Nullable`1: a checkbox that turns the value on, and the inner type's own editor beside it.

  • public bool CanDraw(InspectorMember member)

    Whether this drawer can edit a member.

  • public UiElement Build(InspectorField field, UiElement parent)

    Makes the controls, once.

  • public void Show(InspectorField field, UiElement editor)

    Puts the current value into controls that already exist.

Used by (1)

  • DrawerRegistryVixen.Editor.Inspector