Skip to content

Add Inputs to Node

While this guide uses a signal node as an example, you can create inputs for render nodes just the same way.

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 easily define a node input property by adding the NodeInputAttribute to the corresponding property within your node.

[SignalNode(Name = "Example")]
public class ExampleNode : SignalNodeBase
{
    [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.

[SignalNode(Name = "Example")]
public class ExampleNode : SignalNodeBase
{
    [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.

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

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

    private void OnTrigger(bool value)
    {
    }
}