Example #1
0
 private void ResetGradientColor()
 {
     s_Gradient = null;
     GradientUtility.Copy(DefaultGradient, m_Gradient);
     Repaint();
     s_NeedBlitGradient = true;
 }
Example #2
0
 public override void OnChangeGradient(Gradient gradient)
 {
     base.OnChangeGradient(gradient);
     m_OutputGradient = new Gradient();
     GradientUtility.Copy(m_Gradient, m_OutputGradient);
     m_ShiftHue = 0;
 }
Example #3
0
        /// <summary>
        /// グラデーションテクスチャをシェーダーに転送
        /// </summary>
        public void BlitGradient()
        {
            if (m_GradationTexture == null)
            {
                return;
            }

            if (s_Gradient != null)
            {
                GradientUtility.Copy(s_Gradient, m_Gradient);
                s_Gradient = null;

                Debug.Log($"use {nameof(s_Gradient)}");
            }
            else
            {
                Debug.Log($"use {nameof(m_Gradient)}");
            }


            for (int i = 0; i < TextureW; i++)
            {
                var color = m_Gradient.Evaluate((float)i / (TextureW - 1));
                m_GradationTexture.SetPixel(i, 0, color);
            }
            m_GradationTexture.Apply();
            m_FxMaterial.SetTexture(m_GradationTexturePropertyID, m_GradationTexture);
            Repaint();
        }
Example #4
0
        public override void DrawPane()
        {
            var defaultBG = GUI.backgroundColor;

            GUI.backgroundColor = ColorRegistry.SubPaneColor;                                            // change color
            EditorGUILayout.BeginVertical(CustomUI.SubLeftPaneBoxStyle, CustomUI.SubLeftPaneBoxOptions); // begin box
            {
                GUI.backgroundColor = defaultBG;                                                         // reset color

                EditorGUILayout.LabelField(TitleContent, CustomUI.LeftPaneTitleLabelStyle, CustomUI.LeftSubPaneTitleLabelOptions);

                EditorGUI.BeginChangeCheck();
                CustomUI.DrawLeftPaneIntSlider(SliderLabelContent, ref m_ShiftHue, MinHue, MaxHue);
                bool changed = EditorGUI.EndChangeCheck();
                if (changed)
                {
                    OnChangeHue();
                }

                EditorGUILayout.BeginHorizontal();
                /// draw buttons
                if (GUILayout.Button(ConfirmButtonContent, CustomUI.SubLeftPaneButtonStyle, CustomUI.SubLeftPaneButtonOptions))
                {
                    m_ShiftHue = 0;
                    GradientUtility.Copy(m_OutputGradient, m_Gradient);  // 現在の出力Gradientをソースにする
                    OnChangeHue();
                }
                if (GUILayout.Button(CancelButtonContent, CustomUI.SubLeftPaneButtonStyle, CustomUI.SubLeftPaneButtonOptions))
                {
                    m_ShiftHue = 0;
                    OnChangeHue();
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();
            GUI.backgroundColor = defaultBG;
        }