public override void Draw(UndoParentNode owner, bool style = true)
 {
     EditorGUI.BeginChangeCheck();
     m_inlineAlphaToMask.CustomDrawer(ref owner, (x) => { m_alphaToMask = owner.EditorGUILayoutToggle(AlphaToMaskStr, m_alphaToMask); }, AlphaToMaskStr);
     if (EditorGUI.EndChangeCheck())
     {
         m_inlineAlphaToMask.IntValue = m_alphaToMask ? 1 : 0;
         m_isDirty = true;
     }
 }
Exemplo n.º 2
0
 public override void Draw(UndoParentNode owner, bool style = true)
 {
     EditorGUI.BeginChangeCheck();
     //m_cullMode = (CullMode)owner.EditorGUILayoutEnumPopup( CullModeStr, m_cullMode );
     m_inlineCullMode.CustomDrawer(ref owner, (x) => { m_cullMode = (CullMode)owner.EditorGUILayoutEnumPopup(CullModeStr, m_cullMode); }, CullModeStr);
     if (EditorGUI.EndChangeCheck())
     {
         m_inlineCullMode.IntValue = (int)m_cullMode;
         m_isDirty = true;
     }
 }
Exemplo n.º 3
0
        public override void Draw(UndoParentNode owner, bool style = true)
        {
            EditorGUI.BeginChangeCheck();
            {
                m_inlineColorMask.CustomDrawer(ref owner, DrawColorMaskControls, ColorMaskContent.text);
            }

            if (EditorGUI.EndChangeCheck())
            {
                m_isDirty = true;
            }
        }
        public override void DrawProperties()
        {
            base.DrawProperties();

            EditorGUI.BeginChangeCheck();
            m_selectedChannelInt = EditorGUILayoutPopup("Channel", m_selectedChannelInt, m_channelTypeStr);
            if (EditorGUI.EndChangeCheck())
            {
                UpdateSampler();
                GeneratePOMfunction();
            }
            EditorGUIUtility.labelWidth = 105;

            //m_minSamples = EditorGUILayoutIntSlider( "Min Samples", m_minSamples, 1, 128 );
            UndoParentNode inst = this;

            m_inlineMinSamples.CustomDrawer(ref inst, (x) => { m_inlineMinSamples.IntValue = EditorGUILayoutIntSlider("Min Samples", m_inlineMinSamples.IntValue, 1, 128); }, "Min Samples");
            //m_maxSamples = EditorGUILayoutIntSlider( "Max Samples", m_maxSamples, 1, 128 );
            m_inlineMaxSamples.CustomDrawer(ref inst, (x) => { m_inlineMaxSamples.IntValue = EditorGUILayoutIntSlider("Max Samples", m_inlineMaxSamples.IntValue, 1, 128); }, "Max Samples");

            EditorGUI.BeginChangeCheck();
            m_sidewallSteps = EditorGUILayoutIntSlider("Sidewall Steps", m_sidewallSteps, 0, 10);
            if (EditorGUI.EndChangeCheck())
            {
                GeneratePOMfunction();
            }


            EditorGUI.BeginDisabledGroup(m_scalePort.IsConnected);
            m_defaultScale = EditorGUILayoutSlider("Default Scale", m_defaultScale, 0, 1);
            EditorGUI.EndDisabledGroup();

            EditorGUI.BeginDisabledGroup(m_refPlanePort.IsConnected);
            m_defaultRefPlane = EditorGUILayoutSlider("Default Ref Plane", m_defaultRefPlane, 0, 1);
            EditorGUI.EndDisabledGroup();
            EditorGUIUtility.labelWidth = m_textLabelWidth;
            EditorGUI.BeginChangeCheck();
            //m_useTextureArray = EditorGUILayoutToggle( "Use Texture Array", m_useTextureArray );
            m_pomTexType = (POMTexTypes)EditorGUILayoutEnumPopup("Texture Type", m_pomTexType);
            if (EditorGUI.EndChangeCheck())
            {
                UpdateIndexPort();
                m_sizeIsDirty = true;
                GeneratePOMfunction();
                //UpdateCurvaturePort();
            }

            if (m_arrayIndexPort.Visible && !m_arrayIndexPort.IsConnected)
            {
                m_arrayIndexPort.FloatInternalData = EditorGUILayoutFloatField("Array Index", m_arrayIndexPort.FloatInternalData);
            }

            //float cached = EditorGUIUtility.labelWidth;
            //EditorGUIUtility.labelWidth = 70;
            m_clipEnds = EditorGUILayoutToggle("Clip Edges", m_clipEnds);
            //EditorGUIUtility.labelWidth = -1;
            //EditorGUIUtility.labelWidth = 100;
            //EditorGUILayout.BeginHorizontal();
            //EditorGUI.BeginDisabledGroup( !m_clipEnds );
            //m_tilling = EditorGUILayout.Vector2Field( string.Empty, m_tilling );
            //EditorGUI.EndDisabledGroup();
            //EditorGUILayout.EndHorizontal();
            //EditorGUIUtility.labelWidth = cached;

            EditorGUI.BeginChangeCheck();
            m_useCurvature = EditorGUILayoutToggle("Clip Silhouette", m_useCurvature);
            if (EditorGUI.EndChangeCheck())
            {
                GeneratePOMfunction();
                UpdateCurvaturePort();
            }

            EditorGUI.BeginDisabledGroup(!(m_useCurvature && !m_curvaturePort.IsConnected));
            m_CurvatureVector = EditorGUILayoutVector2Field(string.Empty, m_CurvatureVector);
            EditorGUI.EndDisabledGroup();

            EditorGUILayout.HelpBox("WARNING:\nTex must be connected to a Texture Object for this node to work\n\nMin and Max samples:\nControl the minimum and maximum number of layers extruded\n\nSidewall Steps:\nThe number of interpolations done to smooth the extrusion result on the side of the layer extrusions, min is used at steep angles while max is used at orthogonal angles\n\n" +
                                    "Ref Plane:\nReference plane lets you adjust the starting reference height, 0 = deepen ground, 1 = raise ground, any value above 0 might cause distortions at higher angles\n\n" +
                                    "Clip Edges:\nThis will clip the ends of your uvs to give a more 3D look at the edges. It'll use the tilling given by your Heightmap input.\n\n" +
                                    "Clip Silhouette:\nTurning this on allows you to use the UV coordinates to clip the effect curvature in U or V axis, useful for cylinders, works best with 'Clip Edges' turned OFF", MessageType.None);
        }
 public void Draw(UndoParentNode owner)
 {
     m_inlineMask.CustomDrawer(ref owner, DrawColorMaskControls, ColorMaskContent.text);
 }
        void DrawBlock(UndoParentNode owner, bool style)
        {
            EditorGUI.BeginChangeCheck();
            {
                var cache = EditorGUIUtility.labelWidth;
                EditorGUIUtility.labelWidth = EditorGUIUtility.labelWidth - 20;

                if (m_blendModeEnabled)
                {
                    // RGB
                    EditorGUI.BeginChangeCheck();
                    m_currentRGBIndex = owner.EditorGUILayoutPopup(BlendModesRGBStr, m_currentRGBIndex, m_commonBlendTypesArr);
                    if (EditorGUI.EndChangeCheck())
                    {
                        if (m_currentRGBIndex > 1)
                        {
                            m_sourceFactorRGB = m_commonBlendTypes[m_currentRGBIndex].SourceFactor;
                            m_sourceFactorRGBInline.IntValue = (int)m_sourceFactorRGB;
                            m_sourceFactorRGBInline.SetInlineNodeValue();

                            m_destFactorRGB = m_commonBlendTypes[m_currentRGBIndex].DestFactor;
                            m_destFactorRGBInline.IntValue = (int)m_destFactorRGB;
                            m_destFactorRGBInline.SetInlineNodeValue();
                        }
                    }
                    EditorGUI.BeginDisabledGroup(m_currentRGBIndex == 0);

                    EditorGUI.BeginChangeCheck();
                    float cached = EditorGUIUtility.labelWidth;
                    if (style)
                    {
                        EditorGUIUtility.labelWidth = 40;
                    }
                    else
                    {
                        EditorGUIUtility.labelWidth = 25;
                    }

                    EditorGUILayout.BeginHorizontal();
                    //m_sourceFactorRGB = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup( SourceFactorStr, m_sourceFactorRGB );
                    m_sourceFactorRGBInline.CustomDrawer(ref owner, (x) => { m_sourceFactorRGB = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(SourceFactorStr, m_sourceFactorRGB); }, SourceFactorStr);
                    if (style)
                    {
                        EditorGUI.indentLevel--;
                        EditorGUIUtility.labelWidth = 25;
                    }
                    //m_destFactorRGB = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup( DstFactorStr, m_destFactorRGB );
                    m_destFactorRGBInline.CustomDrawer(ref owner, (x) => { m_destFactorRGB = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(DstFactorStr, m_destFactorRGB); }, DstFactorStr);
                    if (style)
                    {
                        EditorGUI.indentLevel++;
                    }

                    EditorGUILayout.EndHorizontal();

                    EditorGUIUtility.labelWidth = cached;
                    if (EditorGUI.EndChangeCheck())
                    {
                        CheckRGBIndex();
                    }
                    EditorGUI.EndDisabledGroup();
                }

                if (m_blendOpEnabled)
                {
                    // Both these tests should be removed on a later stage
                    // ASE v154dev004 changed AvailableBlendOps.OFF value from -1 to 0
                    // If importing the new package into an already opened ASE window makes
                    // hotcode to preserve the -1 value on these variables
                    if ((int)m_blendOpRGB == -1)
                    {
                        m_blendOpRGB = AvailableBlendOps.OFF;
                    }

                    //m_blendOpRGB = (AvailableBlendOps)owner.EditorGUILayoutEnumPopup( BlendOpsRGBStr, m_blendOpRGB );
                    m_blendOpRGBInline.CustomDrawer(ref owner, (x) => { m_blendOpRGB = (AvailableBlendOps)x.EditorGUILayoutPopup(BlendOpsRGBStr, (int)m_blendOpRGB, BlendOpsHelper.BlendOpsLabels); }, BlendOpsRGBStr);
                }

                if (m_blendModeEnabled)
                {
                    // Alpha
                    EditorGUILayout.Separator();

                    EditorGUI.BeginChangeCheck();
                    m_currentAlphaIndex = owner.EditorGUILayoutPopup(BlendModesAlphaStr, m_currentAlphaIndex, m_commonBlendTypesArr);
                    if (EditorGUI.EndChangeCheck())
                    {
                        if (m_currentAlphaIndex > 0)
                        {
                            m_sourceFactorAlpha = m_commonBlendTypes[m_currentAlphaIndex].SourceFactor;
                            m_sourceFactorAlphaInline.IntValue = (int)m_sourceFactorAlpha;
                            m_sourceFactorAlphaInline.SetInlineNodeValue();

                            m_destFactorAlpha = m_commonBlendTypes[m_currentAlphaIndex].DestFactor;
                            m_destFactorAlphaInline.IntValue = (int)m_destFactorAlpha;
                            m_destFactorAlphaInline.SetInlineNodeValue();
                        }
                    }
                    EditorGUI.BeginDisabledGroup(m_currentAlphaIndex == 0);

                    EditorGUI.BeginChangeCheck();
                    float cached = EditorGUIUtility.labelWidth;
                    if (style)
                    {
                        EditorGUIUtility.labelWidth = 40;
                    }
                    else
                    {
                        EditorGUIUtility.labelWidth = 25;
                    }
                    EditorGUILayout.BeginHorizontal();
                    //m_sourceFactorAlpha = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup( SourceFactorStr, m_sourceFactorAlpha );
                    m_sourceFactorAlphaInline.CustomDrawer(ref owner, (x) => { m_sourceFactorAlpha = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(SourceFactorStr, m_sourceFactorAlpha); }, SourceFactorStr);
                    if (style)
                    {
                        EditorGUI.indentLevel--;
                        EditorGUIUtility.labelWidth = 25;
                    }
                    //m_destFactorAlpha = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup( DstFactorStr, m_destFactorAlpha );
                    m_destFactorAlphaInline.CustomDrawer(ref owner, (x) => { m_destFactorAlpha = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(DstFactorStr, m_destFactorAlpha); }, DstFactorStr);
                    if (style)
                    {
                        EditorGUI.indentLevel++;
                    }
                    EditorGUILayout.EndHorizontal();
                    EditorGUIUtility.labelWidth = cached;

                    if (EditorGUI.EndChangeCheck())
                    {
                        CheckAlphaIndex();
                    }

                    EditorGUI.EndDisabledGroup();
                    //EditorGUILayout.Separator();
                }

                if (m_blendOpEnabled)
                {
                    if ((int)m_blendOpAlpha == -1)
                    {
                        m_blendOpAlpha = AvailableBlendOps.OFF;
                    }

                    //m_blendOpAlpha = (AvailableBlendOps)owner.EditorGUILayoutEnumPopup( BlendOpsAlphaStr, m_blendOpAlpha );
                    m_blendOpAlphaInline.CustomDrawer(ref owner, (x) => { m_blendOpAlpha = (AvailableBlendOps)x.EditorGUILayoutPopup(BlendOpsAlphaStr, (int)m_blendOpAlpha, BlendOpsHelper.BlendOpsLabels); }, BlendOpsAlphaStr);
                }

                EditorGUIUtility.labelWidth = cache;
            }

            if (EditorGUI.EndChangeCheck())
            {
                m_isDirty = true;
            }
        }
Exemplo n.º 7
0
        public void Draw(UndoParentNode owner, bool customBlendAvailable)
        {
            m_enabled = customBlendAvailable;

            // RGB
            EditorGUI.BeginChangeCheck();
            m_currentIndex = owner.EditorGUILayoutPopup(BlendModesRGBStr, m_currentIndex, m_commonBlendTypesArr);
            if (EditorGUI.EndChangeCheck())
            {
                if (m_currentIndex > 1)
                {
                    m_sourceFactorRGB.IntValue = (int)m_commonBlendTypes[m_currentIndex].SourceFactor;
                    m_sourceFactorRGB.SetInlineNodeValue();

                    m_destFactorRGB.IntValue = (int)m_commonBlendTypes[m_currentIndex].DestFactor;
                    m_destFactorRGB.SetInlineNodeValue();
                }
            }
            EditorGUI.BeginDisabledGroup(m_currentIndex == 0);

            EditorGUI.BeginChangeCheck();
            float cached = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = 40;

            EditorGUILayout.BeginHorizontal();
            AvailableBlendFactor tempCast = (AvailableBlendFactor)m_sourceFactorRGB.IntValue;

            m_sourceFactorRGB.CustomDrawer(ref owner, (x) => { tempCast = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(SourceFactorStr, tempCast); }, SourceFactorStr);
            m_sourceFactorRGB.IntValue = (int)tempCast;
            EditorGUI.indentLevel--;
            EditorGUIUtility.labelWidth = 25;
            tempCast = (AvailableBlendFactor)m_destFactorRGB.IntValue;
            m_destFactorRGB.CustomDrawer(ref owner, (x) => { tempCast = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(DstFactorStr, tempCast); }, DstFactorStr);
            m_destFactorRGB.IntValue = (int)tempCast;
            EditorGUI.indentLevel++;
            EditorGUILayout.EndHorizontal();

            EditorGUIUtility.labelWidth = cached;
            if (EditorGUI.EndChangeCheck())
            {
                CheckRGBIndex();
            }

            // Both these tests should be removed on a later stage
            // ASE v154dev004 changed AvailableBlendOps.OFF value from -1 to 0
            // If importing the new package into an already opened ASE window makes
            // hotcode to preserve the -1 value on these variables
            if (m_blendOpRGB.FloatValue < 0)
            {
                m_blendOpRGB.FloatValue = 0;
            }

            if (m_blendOpAlpha.FloatValue < 0)
            {
                m_blendOpAlpha.FloatValue = 0;
            }

            EditorGUI.BeginChangeCheck();
            //AvailableBlendOps tempOpCast = (AvailableBlendOps)m_blendOpRGB.IntValue;
            m_blendOpRGB.CustomDrawer(ref owner, (x) => { m_blendOpRGB.IntValue = x.EditorGUILayoutPopup(BlendOpsRGBStr, m_blendOpRGB.IntValue, BlendOpsLabels); }, BlendOpsRGBStr);
            //m_blendOpRGB.IntValue = (int)tempOpCast;
            if (EditorGUI.EndChangeCheck())
            {
                m_blendOpEnabled = (!m_blendOpRGB.Active && m_blendOpRGB.IntValue > -1) || (m_blendOpRGB.Active && m_blendOpRGB.NodeId > -1);//AvailableBlendOps.OFF;
                m_blendOpRGB.SetInlineNodeValue();
            }

            EditorGUI.EndDisabledGroup();

            // Alpha
            EditorGUILayout.Separator();

            EditorGUI.BeginChangeCheck();
            m_currentAlphaIndex = owner.EditorGUILayoutPopup(BlendModesAlphaStr, m_currentAlphaIndex, m_commonBlendTypesArr);
            if (EditorGUI.EndChangeCheck())
            {
                if (m_currentAlphaIndex > 0)
                {
                    m_sourceFactorAlpha.IntValue = (int)m_commonBlendTypes[m_currentAlphaIndex].SourceFactor;
                    m_sourceFactorAlpha.SetInlineNodeValue();

                    m_destFactorAlpha.IntValue = (int)m_commonBlendTypes[m_currentAlphaIndex].DestFactor;
                    m_destFactorAlpha.SetInlineNodeValue();
                }
            }
            EditorGUI.BeginDisabledGroup(m_currentAlphaIndex == 0);

            EditorGUI.BeginChangeCheck();
            cached = EditorGUIUtility.labelWidth;
            EditorGUIUtility.labelWidth = 40;
            EditorGUILayout.BeginHorizontal();
            tempCast = (AvailableBlendFactor)m_sourceFactorAlpha.IntValue;
            m_sourceFactorAlpha.CustomDrawer(ref owner, (x) => { tempCast = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(SourceFactorStr, tempCast); }, SourceFactorStr);
            m_sourceFactorAlpha.IntValue = (int)tempCast;
            EditorGUI.indentLevel--;
            EditorGUIUtility.labelWidth = 25;
            tempCast = (AvailableBlendFactor)m_destFactorAlpha.IntValue;
            m_destFactorAlpha.CustomDrawer(ref owner, (x) => { tempCast = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(DstFactorStr, tempCast); }, DstFactorStr);
            m_destFactorAlpha.IntValue = (int)tempCast;
            EditorGUI.indentLevel++;
            EditorGUILayout.EndHorizontal();
            EditorGUIUtility.labelWidth = cached;

            if (EditorGUI.EndChangeCheck())
            {
                CheckAlphaIndex();
            }
            EditorGUI.BeginChangeCheck();
            //tempOpCast = (AvailableBlendOps)m_blendOpAlpha.IntValue;
            m_blendOpAlpha.CustomDrawer(ref owner, (x) => { m_blendOpAlpha.IntValue = x.EditorGUILayoutPopup(BlendOpsAlphaStr, m_blendOpAlpha.IntValue, BlendOpsLabels); }, BlendOpsAlphaStr);
            //m_blendOpAlpha.IntValue = (int)tempOpCast;
            if (EditorGUI.EndChangeCheck())
            {
                m_blendOpAlpha.SetInlineNodeValue();
            }
            EditorGUI.EndDisabledGroup();
            EditorGUILayout.Separator();
        }
Exemplo n.º 8
0
        void DrawBlock(UndoParentNode owner, bool style)
        {
            EditorGUI.BeginChangeCheck();
            {
                if (m_blendModeEnabled)
                {
                    // RGB
                    EditorGUI.BeginChangeCheck();
                    m_currentRGBIndex = owner.EditorGUILayoutPopup(BlendModesRGBStr, m_currentRGBIndex, m_commonBlendTypesArr);
                    if (EditorGUI.EndChangeCheck())
                    {
                        if (m_currentRGBIndex > 1)
                        {
                            m_sourceFactorRGB = m_commonBlendTypes[m_currentRGBIndex].SourceFactor;
                            m_sourceFactorRGBInline.IntValue = (int)m_sourceFactorRGB;
                            m_sourceFactorRGBInline.SetInlineNodeValue();

                            m_destFactorRGB = m_commonBlendTypes[m_currentRGBIndex].DestFactor;
                            m_destFactorRGBInline.IntValue = (int)m_destFactorRGB;
                            m_destFactorRGBInline.SetInlineNodeValue();
                        }
                    }
                    EditorGUI.BeginDisabledGroup(m_currentRGBIndex == 0);

                    EditorGUI.BeginChangeCheck();
                    float cached = EditorGUIUtility.labelWidth;
                    if (style)
                    {
                        EditorGUIUtility.labelWidth = 40;
                    }
                    else
                    {
                        EditorGUIUtility.labelWidth = 25;
                    }

                    EditorGUILayout.BeginHorizontal();
                    //m_sourceFactorRGB = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup( SourceFactorStr, m_sourceFactorRGB );
                    m_sourceFactorRGBInline.CustomDrawer(ref owner, (x) => { m_sourceFactorRGB = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(SourceFactorStr, m_sourceFactorRGB); }, SourceFactorStr);
                    if (style)
                    {
                        EditorGUI.indentLevel--;
                        EditorGUIUtility.labelWidth = 25;
                    }
                    //m_destFactorRGB = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup( DstFactorStr, m_destFactorRGB );
                    m_destFactorRGBInline.CustomDrawer(ref owner, (x) => { m_destFactorRGB = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(DstFactorStr, m_destFactorRGB); }, DstFactorStr);
                    if (style)
                    {
                        EditorGUI.indentLevel++;
                    }

                    EditorGUILayout.EndHorizontal();

                    EditorGUIUtility.labelWidth = cached;
                    if (EditorGUI.EndChangeCheck())
                    {
                        CheckRGBIndex();
                    }

                    EditorGUI.EndDisabledGroup();
                    // Alpha
                    EditorGUILayout.Separator();

                    EditorGUI.BeginChangeCheck();
                    m_currentAlphaIndex = owner.EditorGUILayoutPopup(BlendModesAlphaStr, m_currentAlphaIndex, m_commonBlendTypesArr);
                    if (EditorGUI.EndChangeCheck())
                    {
                        if (m_currentAlphaIndex > 0)
                        {
                            m_sourceFactorAlpha = m_commonBlendTypes[m_currentAlphaIndex].SourceFactor;
                            m_sourceFactorAlphaInline.IntValue = (int)m_sourceFactorAlpha;
                            m_sourceFactorAlphaInline.SetInlineNodeValue();

                            m_destFactorAlpha = m_commonBlendTypes[m_currentAlphaIndex].DestFactor;
                            m_destFactorAlphaInline.IntValue = (int)m_destFactorAlpha;
                            m_destFactorAlphaInline.SetInlineNodeValue();
                        }
                    }
                    EditorGUI.BeginDisabledGroup(m_currentAlphaIndex == 0);

                    EditorGUI.BeginChangeCheck();
                    cached = EditorGUIUtility.labelWidth;
                    if (style)
                    {
                        EditorGUIUtility.labelWidth = 40;
                    }
                    else
                    {
                        EditorGUIUtility.labelWidth = 25;
                    }
                    EditorGUILayout.BeginHorizontal();
                    //m_sourceFactorAlpha = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup( SourceFactorStr, m_sourceFactorAlpha );
                    m_sourceFactorAlphaInline.CustomDrawer(ref owner, (x) => { m_sourceFactorAlpha = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(SourceFactorStr, m_sourceFactorAlpha); }, SourceFactorStr);
                    if (style)
                    {
                        EditorGUI.indentLevel--;
                        EditorGUIUtility.labelWidth = 25;
                    }
                    //m_destFactorAlpha = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup( DstFactorStr, m_destFactorAlpha );
                    m_destFactorAlphaInline.CustomDrawer(ref owner, (x) => { m_destFactorAlpha = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(DstFactorStr, m_destFactorAlpha); }, DstFactorStr);
                    if (style)
                    {
                        EditorGUI.indentLevel++;
                    }
                    EditorGUILayout.EndHorizontal();
                    EditorGUIUtility.labelWidth = cached;

                    if (EditorGUI.EndChangeCheck())
                    {
                        CheckAlphaIndex();
                    }

                    EditorGUI.EndDisabledGroup();
                    EditorGUILayout.Separator();
                }

                if (m_blendOpEnabled)
                {
                    //m_blendOpRGB = (AvailableBlendOps)owner.EditorGUILayoutEnumPopup( BlendOpsRGBStr, m_blendOpRGB );
                    m_blendOpRGBInline.CustomDrawer(ref owner, (x) => { m_blendOpRGB = (AvailableBlendOps)x.EditorGUILayoutEnumPopup(BlendOpsRGBStr, m_blendOpRGB); }, BlendOpsRGBStr);
                    EditorGUILayout.Separator();
                    //m_blendOpAlpha = (AvailableBlendOps)owner.EditorGUILayoutEnumPopup( BlendOpsAlphaStr, m_blendOpAlpha );
                    m_blendOpAlphaInline.CustomDrawer(ref owner, (x) => { m_blendOpAlpha = (AvailableBlendOps)x.EditorGUILayoutEnumPopup(BlendOpsAlphaStr, m_blendOpAlpha); }, BlendOpsAlphaStr);
                }
            }

            if (EditorGUI.EndChangeCheck())
            {
                m_isDirty = true;
            }
        }
Exemplo n.º 9
0
        public void Draw(UndoParentNode owner, bool customBlendAvailable)
        {
            m_enabled = customBlendAvailable;

            // RGB
            EditorGUI.BeginChangeCheck();
            m_currentIndex = owner.EditorGUILayoutPopup(BlendModesRGBStr, m_currentIndex, m_commonBlendTypesArr);
            if (EditorGUI.EndChangeCheck())
            {
                if (m_currentIndex > 1)
                {
                    m_sourceFactorRGB.IntValue = (int)m_commonBlendTypes[m_currentIndex].SourceFactor;
                    m_sourceFactorRGB.SetInlineNodeValue();

                    m_destFactorRGB.IntValue = (int)m_commonBlendTypes[m_currentIndex].DestFactor;
                    m_destFactorRGB.SetInlineNodeValue();
                }
            }
            EditorGUI.BeginDisabledGroup(m_currentIndex == 0);

            EditorGUI.BeginChangeCheck();
            float cached = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = 40;

            EditorGUILayout.BeginHorizontal();
            AvailableBlendFactor tempCast = (AvailableBlendFactor)m_sourceFactorRGB.IntValue;

            m_sourceFactorRGB.CustomDrawer(ref owner, (x) => { tempCast = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(SourceFactorStr, tempCast); }, SourceFactorStr);
            m_sourceFactorRGB.IntValue = (int)tempCast;
            EditorGUI.indentLevel--;
            EditorGUIUtility.labelWidth = 25;
            tempCast = (AvailableBlendFactor)m_destFactorRGB.IntValue;
            m_destFactorRGB.CustomDrawer(ref owner, (x) => { tempCast = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(DstFactorStr, tempCast); }, DstFactorStr);
            m_destFactorRGB.IntValue = (int)tempCast;
            EditorGUI.indentLevel++;
            EditorGUILayout.EndHorizontal();

            EditorGUIUtility.labelWidth = cached;
            if (EditorGUI.EndChangeCheck())
            {
                CheckRGBIndex();
            }

            EditorGUI.BeginChangeCheck();
            AvailableBlendOps tempOpCast = (AvailableBlendOps)m_blendOpRGB.IntValue;

            m_blendOpRGB.CustomDrawer(ref owner, (x) => { tempOpCast = (AvailableBlendOps)x.EditorGUILayoutEnumPopup(BlendOpsRGBStr, tempOpCast); }, BlendOpsRGBStr);
            m_blendOpRGB.IntValue = (int)tempOpCast;
            if (EditorGUI.EndChangeCheck())
            {
                m_blendOpEnabled = (!m_blendOpRGB.Active && m_blendOpRGB.IntValue > -1) || (m_blendOpRGB.Active && m_blendOpRGB.NodeId > -1);                    //AvailableBlendOps.OFF;
                m_blendOpRGB.SetInlineNodeValue();
            }

            EditorGUI.EndDisabledGroup();

            // Alpha
            EditorGUILayout.Separator();

            EditorGUI.BeginChangeCheck();
            m_currentAlphaIndex = owner.EditorGUILayoutPopup(BlendModesAlphaStr, m_currentAlphaIndex, m_commonBlendTypesArr);
            if (EditorGUI.EndChangeCheck())
            {
                if (m_currentAlphaIndex > 0)
                {
                    m_sourceFactorAlpha.IntValue = (int)m_commonBlendTypes[m_currentAlphaIndex].SourceFactor;
                    m_sourceFactorAlpha.SetInlineNodeValue();

                    m_destFactorAlpha.IntValue = (int)m_commonBlendTypes[m_currentAlphaIndex].DestFactor;
                    m_destFactorAlpha.SetInlineNodeValue();
                }
            }
            EditorGUI.BeginDisabledGroup(m_currentAlphaIndex == 0);

            EditorGUI.BeginChangeCheck();
            cached = EditorGUIUtility.labelWidth;
            EditorGUIUtility.labelWidth = 40;
            EditorGUILayout.BeginHorizontal();
            tempCast = (AvailableBlendFactor)m_sourceFactorAlpha.IntValue;
            m_sourceFactorAlpha.CustomDrawer(ref owner, (x) => { tempCast = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(SourceFactorStr, tempCast); }, SourceFactorStr);
            m_sourceFactorAlpha.IntValue = (int)tempCast;
            EditorGUI.indentLevel--;
            EditorGUIUtility.labelWidth = 25;
            tempCast = (AvailableBlendFactor)m_destFactorAlpha.IntValue;
            m_destFactorAlpha.CustomDrawer(ref owner, (x) => { tempCast = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup(DstFactorStr, tempCast); }, DstFactorStr);
            m_destFactorAlpha.IntValue = (int)tempCast;
            EditorGUI.indentLevel++;
            EditorGUILayout.EndHorizontal();
            EditorGUIUtility.labelWidth = cached;

            if (EditorGUI.EndChangeCheck())
            {
                CheckAlphaIndex();
            }
            EditorGUI.BeginChangeCheck();
            tempOpCast = (AvailableBlendOps)m_blendOpAlpha.IntValue;
            m_blendOpAlpha.CustomDrawer(ref owner, (x) => { tempOpCast = (AvailableBlendOps)x.EditorGUILayoutEnumPopup(BlendOpsAlphaStr, tempOpCast); }, BlendOpsAlphaStr);
            m_blendOpAlpha.IntValue = (int)tempOpCast;
            if (EditorGUI.EndChangeCheck())
            {
                m_blendOpAlpha.SetInlineNodeValue();
            }
            EditorGUI.EndDisabledGroup();
            EditorGUILayout.Separator();
        }