Add Settings to Node
Setting Requirements
Properties within your nodes, which you would like to define as setting, must have a public getter and setter. Only the following setting types are currently supported.
int
float
bool
SKColor
enum
Value Setting
You can define value settings by adding the NodeSettingAttribute
to the corresponding property within the node. Lets
say, we would like to create a gain signal node, which amplifies the input signal with a configurable gain and pushes it
to a node output.
[Node(Name = "Gain")]
public class GainNode : NodeBase
{
private float _in;
private float _gain = 1.0f;
[NodeInput]
public float In
{
get => _in;
set
{
_in = value;
OnPropertyChanged(nameof(Out));
}
}
[NodeSetting]
public float Gain
{
get => _gain;
set
{
_gain = value;
OnPropertyChanged(nameof(Out));
}
}
[NodeOutput] public float Out => Gain * In;
public GainNode(IExtensionApi api)
: base(api)
{
}
}
Info
Remember to initialize node setting properties with a reasonable default value.
Enumeration Setting
If your node setting property is an enumeration type, Audectra will automatically create a list of available options from the enumeration from which the user can choose one.