Skip to content

Add Inputs to Node

Input Requirements

Properties within your nodes, which you would like to define as inputs, must have a public getter and setter.

Value Inputs

This input type might be the most common one. You can define a node input property by adding the NodeInputAttribute to the corresponding property within your node.

[Node(Name = "Example")]
public class ExampleNode : NodeBase
{
    [NodeInput]
    public float In { get; set; }

    public ExampleNode(IExtensionApi api)
        : base(api)
    {
    }
}

While there might not be any constraint on what types you can define as inputs to your nodes, keep in mind, that you can only connect two node ports with the same type.

Trigger Inputs

Trigger node inputs are special bool value inputs that have additional trigger capabilities. They can be connected to any ordinary bool node output port. Simply define a trigger input by adding the TriggerNodeInputAttribute to the corresponding property.

[Node(Name = "Example")]
public class ExampleNode : NodeBase
{
    [TriggerNodeInput(TriggerType.ActiveHigh)]
    public bool In { get; set; }

    public ExampleNode(IExtensionApi api)
        : base(api)
    {
    }
}

You can choose from these available trigger modes:

  • ActiveHigh, trigger is active while connected bool value is high.
  • ActiveLow, trigger is low while connected bool value is low.
  • PositiveEdge, trigger is only active on positive edges (transition from low to high).
  • NegativeEdge, trigger is only active on negative edges (transition from high to low).

You can also define a trigger method which will be called, when the trigger state has changed.

[Node(Name = "Example")]
public class ExampleNode : NodeBase
{
    [TriggerNodeInput(TriggerType.PositiveEdge, TriggerMethod = nameof(OnTrigger))]
    public bool In { get; set; }

    public ExampleNode(IExtensionApi api)
        : base(api)
    {
    }

    private void OnTrigger(bool value)
    {
    }
}