An abstract generic editor node type for the shader graph blackboard, representing a node that references a BlackboardParameter of type T. It stores a Guid identifier for the parameter and provides GetParameter and TryGetParameter helpers that look up the parameter in the containing ShaderGraphPlus graph.
namespace ShaderGraphPlus;
public abstract class BlackboardNode<T> : ShaderNodePlus, IBlackboardNode where T : BlackboardParameter
{
[Hide, Browsable( false )]
public Guid ParameterIdentifier { get; set; }
protected T GetParameter()
{
if ( Graph is ShaderGraphPlus graph && graph.TryFindParameter<T>( ParameterIdentifier, out var foundParameter ) )
{
return foundParameter;
}
return null;
}
protected bool TryGetParameter( out T parameter )
{
parameter = GetParameter();
return parameter != null;
}
}