Beispiel #1
0
        public override void OnChannelToolbar(FacePaint fp, FacePaintData fpData)
        {
            FacePaint_LUT_Settings data = fp.GetCustomSettings <FacePaint_LUT_Settings>(this);

            if (!data.useLut)
            {
                return;
            }

            fp.DrawPluginTitle();
            GUILayout.Label("Override", EditorStyles.miniLabel);
            GUILayout.FlexibleSpace();
            if (fp.DrawBtn("R", fp.writeR ? Color.red : Color.white, Color.white))
            {
                data.channel = 0;
            }
            if (fp.DrawBtn("G", fp.writeG ? Color.green : Color.white, Color.white))
            {
                data.channel = 1;
            }
            if (fp.DrawBtn("B", fp.writeB ? new Color(0.5f, 0.5f, 1) : Color.white, Color.white))
            {
                data.channel = 2;
            }
            if (fp.DrawBtn("A", fp.writeA ? Color.gray : Color.white, Color.white))
            {
                data.channel = 3;
            }

            bool r, g, b, a;

            r = g = b = a = false;
            switch (data.channel)
            {
            case 0:
                r = true;
                break;

            case 1:
                g = true;
                break;

            case 2:
                b = true;
                break;

            case 3:
                a = true;
                break;
            }
            fp.SetChannels(r, g, b, a);
        }
Beispiel #2
0
        public override void OnModesToolbar(FacePaint fp, FacePaintData fpData)
        {
            fp.DrawPluginTitle();
            FacePaint_LUT_Settings data = fp.GetCustomSettings <FacePaint_LUT_Settings>(this);

            if (data.lut == null)
            {
                GUILayout.Label("No LUT selected", EditorStyles.miniLabel);
                return;
            }
            data.useLut = fp.ToggleBtn("Use\nLUT", "", data.useLut);
            if (data.useLut)
            {
                Material m = fp.OverrideAssistShader(Shader.Find(ASSIST_SHADER));
                m.SetTexture("_LUT", data.lut);
                int channel = 0;
                if (fp.writeR)
                {
                    channel = 1;
                }
                else if (fp.writeG)
                {
                    channel = 2;
                }
                else if (fp.writeB)
                {
                    channel = 3;
                }
                else if (fp.writeA)
                {
                    channel = 4;
                }
                m.SetInt("_Mask", channel);
            }
            else
            {
                fp.OverrideAssistShader();
            }
        }
Beispiel #3
0
        public override void OnColorToolbar(FacePaint fp, FacePaintData fpData)
        {
            FacePaint_LUT_Settings data = fp.GetCustomSettings <FacePaint_LUT_Settings>(this);

            if (!data.useLut)
            {
                return;
            }
            if (data.lutIsReadable)
            {
                fp.DrawPluginTitle();
                GUILayout.Label("Result ", EditorStyles.miniLabel);
                EditorGUI.DrawRect(
                    EditorGUILayout.GetControlRect(GUILayout.Width(45)),
                    Lookup(data.lut, fp.activeChannel)
                    );
                GUILayout.FlexibleSpace();
            }
            else
            {
                EditorGUILayout.LabelField("!! LUT not readable in import settings", EditorStyles.miniLabel);
            }
        }