Editor/ShaderGraphPlus/ParameterUI.cs
namespace ShaderGraphPlus;
public enum UIType
{
Default,
Slider,
}
public interface IParameterUI
{
/// <summary>
/// Priority of this value in the group
/// </summary>
public int Priority { get; set; }
/// <summary>
/// Primary group
/// </summary>
[InlineEditor( Label = false ), Group( "Group" )]
public UIGroup PrimaryGroup { get; set; }
/// <summary>
/// Group within the primary group
/// </summary>
[InlineEditor( Label = false ), Group( "Sub Group" )]
public UIGroup SecondaryGroup { get; set; }
public string UIGroup => $"{PrimaryGroup.Name},{PrimaryGroup.Priority}/{SecondaryGroup.Name},{SecondaryGroup.Priority}/{Priority}";
}
public struct GenericParameterUI : IParameterUI
{
public int Priority { get; set; }
[InlineEditor( Label = false ), Group( "Group" )]
public UIGroup PrimaryGroup { get; set; }
[InlineEditor( Label = false ), Group( "Sub Group" )]
public UIGroup SecondaryGroup { get; set; }
[JsonIgnore, Hide]
public readonly string UIGroup => $"{PrimaryGroup.Name},{PrimaryGroup.Priority}/{SecondaryGroup.Name},{SecondaryGroup.Priority}/{Priority}";
public GenericParameterUI()
{
}
}
public struct FloatParameterUI : IParameterUI
{
/// <summary>
/// Control type used in the material editor
/// </summary>
public UIType Type { get; set; }
/// <summary>
/// Step amount for sliders
/// </summary>
public float Step { get; set; }
/// <summary>
/// Priority of this value in the group
/// </summary>
public int Priority { get; set; }
/// <summary>
/// Primary group
/// </summary>
[InlineEditor( Label = false ), Group( "Group" )]
public UIGroup PrimaryGroup { get; set; }
/// <summary>
/// Group within the primary group
/// </summary>
[InlineEditor( Label = false ), Group( "Sub Group" )]
public UIGroup SecondaryGroup { get; set; }
[JsonIgnore, Hide]
public readonly string UIGroup => $"{PrimaryGroup.Name},{PrimaryGroup.Priority}/{SecondaryGroup.Name},{SecondaryGroup.Priority}/{Priority}";
public FloatParameterUI()
{
}
}