public bool ChannelSlider(ColorMask inspectedMask, ref Color col, Texture icon = null, bool slider = true) { var changed = false; var channel = inspectedMask.ToColorChannel(); if (icon) { icon.write(alphaBlend: false); } icon = channel.GetIcon(); var label = inspectedMask.ToText(); var channelEnabled = mask.HasFlag(inspectedMask); if (InspectedPainter && InspectedPainter.meshEditing && MeshEditorManager.MeshTool == VertexColorTool.inst) { var mat = InspectedPainter.Material; if (mat) { var tag = mat.Get(inspectedMask.ToString(), ShaderTags.VertexColorRole); if (!tag.IsNullOrEmpty()) { if (channelEnabled) { (tag + ":").nl(); } else { label = tag + " "; } } } } if (channelEnabled ? icon.Click(label) : "{0} channel ignored".F(label).toggleIcon(ref channelEnabled, true).changes(ref changed)) { mask ^= inspectedMask; } if (slider && channelEnabled) { float val = channel.GetValueFrom(col); if (pegi.edit(ref val, 0, 1).nl(ref changed)) { channel.SetValueOn(ref col, val); } } return(changed); }
public static Texture GetIcon(this ColorMask icon) => icon.ToColorChannel().GetIcon();