Exemple #1
0
        public bool ChannelSlider(BrushMask inspectedMask, ref Color col, Texture icon, bool slider)
        {
            var changed = false;

            var channel = inspectedMask.ToColorChannel();

            if (!icon)
            {
                icon = channel.GetIcon();
            }

            var label          = inspectedMask.ToText();
            var channelEnabled = mask.HasFlag(inspectedMask);

            if (InspectedPainter && InspectedPainter.meshEditing && MeshMGMT.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);
        }
Exemple #2
0
 public static Texture GetIcon(this BrushMask icon) => icon.ToColorChannel().GetIcon();