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 bool ChannelSlider(BrushMask m, ref float chanel, Texture icon, bool slider)
        {
            if (icon == null)
            {
                icon = m.getIcon();
            }

            string letter  = m.ToString();
            bool   maskVal = mask.GetFlag(m);

            if (InspectedPainter != null && InspectedPainter.meshEditing && MeshMGMT.MeshTool == VertexColorTool.inst)
            {
                var mat = InspectedPainter.Material;
                if (mat != null)
                {
                    var tag = mat.GetTag(PainterDataAndConfig.vertexColorRole + letter, false, null);
                    if (tag != null && tag.Length > 0)
                    {
                        if (maskVal)
                        {
                            (tag + ":").nl();
                        }
                        else
                        {
                            letter = tag + " ";
                        }
                    }
                }
            }

            bool changed = false;

            if (maskVal ? pegi.Click(icon, 25) : pegi.Click(letter + " disabled"))
            {
                MaskToggle(m);
                changed = true;
            }

            if ((slider) && (mask.GetFlag(m)))
            {
                changed |= pegi.edit(ref chanel, 0, 1);
            }

            pegi.newLine();

            return(changed);
        }