Vixen
dd8b0a81
csharp
public sealed class NodePortMember

One of a node's inline port values, as a member the editing pipeline can bind.

Read the guide page for this →

Remarks

The case IEditProvider's own remarks name: "a graph node's ports are described by the node". A port is not a field of anything — its value lives in Values, keyed by the port's name, because that is what survives a save and an undo. No generator describes it and no reflection pass can find it, so before this the only way to edit one was a panel that knew about ports, which is what NodeInspector used to be.

⚠ An InspectorMember rather than a bare IEditMember, and that is the whole point. The narrow contract would have been enough to write a port; it would not have got the port a drawer, a reset button, a tooltip or a row. Deriving from the inspector's descriptor type is what ReflectedMember does for the same reason, and it is what puts a node's ports into the ordinary inspector panel instead of a second one written by hand.

⚠ The lanes are the storage and the value is what a person edits. A port is one to four floats on the node; a row wants a float, a bool, an int or a Vector3. MemberType is the second of those, and the conversion in both directions is here so that every consumer — a drawer, a binding-path, the copy-property command — sees the shape it expects.

Fields and properties (4)

  • public PortDefinition Port

    The port this stands for.

  • public override Type MemberType

    What it holds.

  • public override Type OwnerType

    What it belongs to.

  • public override bool CanWrite

    Whether it can be written at all, condition and read-only flag aside.

Methods (5)

  • public NodePortMember(NodeGraphModel graph, PortDefinition port)

    Describes one input port of a node type.

  • public override object? GetBoxed(object owner)

    Reads it, boxing a value type.

  • public override void SetBoxed(object owner, object? value)
  • public override IEditorCommand CreateSetCommand(IReadOnlyList<object> targets, object? value, EditorDocument? document)

    Builds the undoable command that sets this member across a selection.

  • public static Type TypeOf(PortKind kind)

    What one port's value is worth as a member.

Used by (2)

  • NodePortEditProviderVixen.Editor.NodeGraph
  • PortKindImageTestsVixen.Editor.NodeGraph.Tests