예제 #1
0
        public void Draw(UndoParentNode owner, GUIStyle toolbarstyle, bool customBlendAvailable)
        {
            Color cachedColor = GUI.color;

            GUI.color = new Color(cachedColor.r, cachedColor.g, cachedColor.b, 0.5f);
            EditorGUILayout.BeginHorizontal(toolbarstyle);
            GUI.color = cachedColor;
            EditorGUI.BeginChangeCheck();
            m_parentSurface.ContainerGraph.ParentWindow.ExpandedDepth = owner.GUILayoutToggle(m_parentSurface.ContainerGraph.ParentWindow.ExpandedDepth, DepthParametersStr, UIUtils.MenuItemToggleStyle);
            if (EditorGUI.EndChangeCheck())
            {
                EditorPrefs.SetBool("ExpandedDepth", m_parentSurface.ContainerGraph.ParentWindow.ExpandedDepth);
            }
            EditorGUILayout.EndHorizontal();

            if (m_parentSurface.ContainerGraph.ParentWindow.ExpandedDepth)
            {
                cachedColor = GUI.color;
                GUI.color   = new Color(cachedColor.r, cachedColor.g, cachedColor.b, (EditorGUIUtility.isProSkin ? 0.5f : 0.25f));
                EditorGUILayout.BeginVertical(UIUtils.MenuItemBackgroundStyle);
                GUI.color = cachedColor;

                EditorGUI.indentLevel++;
                if (!customBlendAvailable)
                {
                    EditorGUILayout.HelpBox("Depth Writing is only available for Opaque or Custom blend modes", MessageType.Warning);
                }

                EditorGUILayout.Separator();
                EditorGUI.BeginDisabledGroup(!customBlendAvailable);

                m_zWriteMode.EnumTypePopup(ref owner, ZWriteModeStr, ZWriteModeValues);
                m_zTestMode.EnumTypePopup(ref owner, ZTestModeStr, ZTestModeLabels);
                //m_zWriteMode = owner.EditorGUILayoutPopup( ZWriteModeStr, m_zWriteMode, ZWriteModeValues );
                //m_zTestMode = owner.EditorGUILayoutPopup( ZTestModeStr, m_zTestMode, ZTestModeLabels );
                m_offsetEnabled = owner.EditorGUILayoutToggle(OffsetStr, m_offsetEnabled);
                if (m_offsetEnabled)
                {
                    EditorGUI.indentLevel++;
                    m_offsetFactor = owner.EditorGUILayoutFloatField(OffsetFactorStr, m_offsetFactor);
                    m_offsetUnits  = owner.EditorGUILayoutFloatField(OffsetUnitsStr, m_offsetUnits);
                    EditorGUI.indentLevel--;
                }

                m_extraDepthPass = owner.EditorGUILayoutToggle(ExtraDepthPassStr, m_extraDepthPass);
                if (m_extraDepthPass)
                {
                    EditorGUI.indentLevel++;
                    m_extrazTestMode = owner.EditorGUILayoutPopup(DepthZTestStr, m_extrazTestMode, ZTestModeLabels);
                    EditorGUI.indentLevel--;
                }
                EditorGUILayout.Separator();
                EditorGUI.indentLevel--;
                EditorGUI.EndDisabledGroup();
                EditorGUILayout.EndVertical();
            }

            EditorGUI.EndDisabledGroup();
        }
예제 #2
0
 public void FloatField(ref UndoParentNode owner, string content)
 {
     if (!m_active)
     {
         EditorGUILayout.BeginHorizontal();
         m_value = owner.EditorGUILayoutFloatField(content, m_value);
         if (GUILayout.Button(UIUtils.FloatIntIconON, UIUtils.FloatIntPickerONOFF, GUILayout.Width(15), GUILayout.Height(15)))
         {
             m_active = !m_active;
         }
         EditorGUILayout.EndHorizontal();
     }
     else
     {
         DrawPicker(ref owner, content);
     }
 }
        public void Draw(UndoParentNode owner)
        {
            if (m_isVisible)
            {
                int lastOption = m_currentOption;
                EditorGUI.BeginChangeCheck();
                switch (m_options.UIWidget)
                {
                case AseOptionsUIWidget.Dropdown:
                {
                    m_currentOption = owner.EditorGUILayoutPopup(m_options.Name, m_currentOption, m_options.DisplayOptions);
                }
                break;

                case AseOptionsUIWidget.Toggle:
                {
                    m_currentOption = owner.EditorGUILayoutToggle(m_options.Name, m_currentOption == 1) ? 1 : 0;
                }
                break;

                case AseOptionsUIWidget.Float:
                {
                    if (m_options.FieldInline)
                    {
                        m_options.FieldValue.FloatField(ref owner, m_options.Name);
                        if (m_options.FieldValue.Active)
                        {
                            m_currentOption = 1;
                        }
                        else
                        {
                            m_currentOption = 0;
                        }
                    }
                    else
                    {
                        m_options.FieldValue.FloatValue = owner.EditorGUILayoutFloatField(m_options.Name, m_options.FieldValue.FloatValue);
                    }
                }
                break;

                case AseOptionsUIWidget.Int:
                {
                    if (m_options.FieldInline)
                    {
                        m_options.FieldValue.IntField(ref owner, m_options.Name);
                        if (m_options.FieldValue.Active)
                        {
                            m_currentOption = 1;
                        }
                        else
                        {
                            m_currentOption = 0;
                        }
                    }
                    else
                    {
                        m_options.FieldValue.FloatValue = owner.EditorGUILayoutIntField(m_options.Name, (int)m_options.FieldValue.FloatValue);
                    }
                }
                break;

                case AseOptionsUIWidget.FloatRange:
                {
                    if (m_options.FieldInline)
                    {
                        m_options.FieldValue.SliderField(ref owner, m_options.Name, m_options.FieldMin, m_options.FieldMax);
                        if (m_options.FieldValue.Active)
                        {
                            m_currentOption = 1;
                        }
                        else
                        {
                            m_currentOption = 0;
                        }
                    }
                    else
                    {
                        m_options.FieldValue.FloatValue = owner.EditorGUILayoutSlider(m_options.Name, m_options.FieldValue.FloatValue, m_options.FieldMin, m_options.FieldMax);
                    }
                }
                break;

                case AseOptionsUIWidget.IntRange:
                {
                    if (m_options.FieldInline)
                    {
                        m_options.FieldValue.IntSlider(ref owner, m_options.Name, (int)m_options.FieldMin, (int)m_options.FieldMax);
                        if (m_options.FieldValue.Active)
                        {
                            m_currentOption = 1;
                        }
                        else
                        {
                            m_currentOption = 0;
                        }
                    }
                    else
                    {
                        m_options.FieldValue.FloatValue = owner.EditorGUILayoutIntSlider(m_options.Name, (int)m_options.FieldValue.FloatValue, (int)m_options.FieldMin, (int)m_options.FieldMax);
                    }
                }
                break;
                }
                if (EditorGUI.EndChangeCheck())
                {
                    if (OnActionPerformedEvt != null)
                    {
                        if (m_invertActionOnDeselection)
                        {
                            OnActionPerformedEvt(false, lastOption != m_options.DisableIdx, this, m_options.ActionsPerOption[lastOption]);
                        }

                        OnActionPerformedEvt(false, false, this, m_options.ActionsPerOption[m_currentOption]);
                    }
                }
            }
        }
예제 #4
0
        public void ShowInternalData(UndoParentNode owner, bool useCustomLabel = false, string customLabel = null)
        {
            string label = (useCustomLabel == true && customLabel != null) ? customLabel : m_internalDataPropertyLabel;

            switch (m_dataType)
            {
            case WirePortDataType.OBJECT:
            case WirePortDataType.FLOAT:
            {
                FloatInternalData = owner.EditorGUILayoutFloatField(label, FloatInternalData);
            }
            break;

            case WirePortDataType.FLOAT2:
            {
                Vector2InternalData = owner.EditorGUILayoutVector2Field(label, Vector2InternalData);
            }
            break;

            case WirePortDataType.FLOAT3:
            {
                Vector3InternalData = owner.EditorGUILayoutVector3Field(label, Vector3InternalData);
            }
            break;

            case WirePortDataType.FLOAT4:
            {
                Vector4InternalData = owner.EditorGUILayoutVector4Field(label, Vector4InternalData);
            }
            break;

            case WirePortDataType.FLOAT3x3:
            {
                Matrix4x4 matrix   = Matrix4x4InternalData;
                Vector3   currVec3 = Vector3.zero;
                for (int i = 0; i < 3; i++)
                {
                    Vector4 currVec = matrix.GetRow(i);
                    currVec3.Set(currVec.x, currVec.y, currVec.z);
                    EditorGUI.BeginChangeCheck();
                    currVec3 = owner.EditorGUILayoutVector3Field(label + "[ " + i + " ]", currVec3);
                    if (EditorGUI.EndChangeCheck())
                    {
                        currVec.Set(currVec3.x, currVec3.y, currVec3.z, currVec.w);
                        matrix.SetRow(i, currVec);
                    }
                }
                Matrix4x4InternalData = matrix;
            }
            break;

            case WirePortDataType.FLOAT4x4:
            {
                Matrix4x4 matrix = Matrix4x4InternalData;
                for (int i = 0; i < 4; i++)
                {
                    Vector4 currVec = matrix.GetRow(i);
                    EditorGUI.BeginChangeCheck();
                    currVec = owner.EditorGUILayoutVector4Field(label + "[ " + i + " ]", currVec);
                    if (EditorGUI.EndChangeCheck())
                    {
                        matrix.SetRow(i, currVec);
                    }
                }
                Matrix4x4InternalData = matrix;
            }
            break;

            case WirePortDataType.COLOR:
            {
                ColorInternalData = owner.EditorGUILayoutColorField(label, ColorInternalData);
            }
            break;

            case WirePortDataType.INT:
            {
                IntInternalData = owner.EditorGUILayoutIntField(label, IntInternalData);
            }
            break;
            }
        }
예제 #5
0
        //private int m_orderIndex = 1000;

        public void Draw(UndoParentNode owner, GUIStyle toolbarstyle, Material mat, bool connectedInput)
        {
            Color cachedColor = GUI.color;

            GUI.color = new Color(cachedColor.r, cachedColor.g, cachedColor.b, 0.5f);
            EditorGUILayout.BeginHorizontal(toolbarstyle);
            GUI.color = cachedColor;
            EditorGUI.BeginChangeCheck();
            m_parentSurface.ContainerGraph.ParentWindow.ExpandedTesselation = GUILayout.Toggle(m_parentSurface.ContainerGraph.ParentWindow.ExpandedTesselation, " Tessellation", UIUtils.MenuItemToggleStyle, GUILayout.ExpandWidth(true));
            if (EditorGUI.EndChangeCheck())
            {
                EditorPrefs.SetBool("ExpandedTesselation", m_parentSurface.ContainerGraph.ParentWindow.ExpandedTesselation);
            }

            EditorGUI.BeginChangeCheck();
            m_enabled = owner.EditorGUILayoutToggle(string.Empty, m_enabled, UIUtils.MenuItemEnableStyle, GUILayout.Width(16));
            if (EditorGUI.EndChangeCheck())
            {
                if (m_enabled)
                {
                    UpdateToMaterial(mat, !connectedInput);
                }

                UIUtils.RequestSave();
            }

            EditorGUILayout.EndHorizontal();

            m_enabled = m_enabled || connectedInput;

            if (m_parentSurface.ContainerGraph.ParentWindow.ExpandedTesselation)
            {
                cachedColor = GUI.color;
                GUI.color   = new Color(cachedColor.r, cachedColor.g, cachedColor.b, (EditorGUIUtility.isProSkin ? 0.5f : 0.25f));
                EditorGUILayout.BeginVertical(UIUtils.MenuItemBackgroundStyle);
                GUI.color = cachedColor;

                EditorGUILayout.Separator();
                EditorGUI.BeginDisabledGroup(!m_enabled);

                EditorGUI.indentLevel += 1;

                m_phongEnabled = owner.EditorGUILayoutToggle(PhongEnableContent, m_phongEnabled);
                if (m_phongEnabled)
                {
                    EditorGUI.indentLevel += 1;
                    EditorGUI.BeginChangeCheck();
                    m_phongStrength = owner.EditorGUILayoutSlider(PhongStrengthContent, m_phongStrength, 0.0f, 1.0f);
                    if (EditorGUI.EndChangeCheck() && mat != null)
                    {
                        if (mat.HasProperty(PhongStrengthUniformName))
                        {
                            mat.SetFloat(PhongStrengthUniformName, m_phongStrength);
                        }
                    }

                    EditorGUI.indentLevel -= 1;
                }

                bool guiEnabled = GUI.enabled;
                GUI.enabled = !connectedInput && m_enabled;

                m_tessType = owner.EditorGUILayoutIntPopup(TesselationTypeStr, m_tessType, TesselationTypeLabels, TesselationTypeValues);

                switch (m_tessType)
                {
                case 0:
                {
                    EditorGUI.BeginChangeCheck();
                    m_tessFactor = owner.EditorGUILayoutSlider(TessFactorContent, m_tessFactor, 1, 32);
                    if (EditorGUI.EndChangeCheck() && mat != null)
                    {
                        if (mat.HasProperty(TessUniformName))
                        {
                            mat.SetFloat(TessUniformName, m_tessFactor);
                        }
                    }

                    EditorGUI.BeginChangeCheck();
                    m_tessMinDistance = owner.EditorGUILayoutFloatField(TessMinDistanceContent, m_tessMinDistance);
                    if (EditorGUI.EndChangeCheck() && mat != null)
                    {
                        if (mat.HasProperty(TessMinUniformName))
                        {
                            mat.SetFloat(TessMinUniformName, m_tessMinDistance);
                        }
                    }

                    EditorGUI.BeginChangeCheck();
                    m_tessMaxDistance = owner.EditorGUILayoutFloatField(TessMaxDistanceContent, m_tessMaxDistance);
                    if (EditorGUI.EndChangeCheck() && mat != null)
                    {
                        if (mat.HasProperty(TessMaxUniformName))
                        {
                            mat.SetFloat(TessMaxUniformName, m_tessMaxDistance);
                        }
                    }
                }
                break;

                case 1:
                {
                    EditorGUI.BeginChangeCheck();
                    m_tessFactor = owner.EditorGUILayoutSlider(TessFactorContent, m_tessFactor, 1, 32);
                    if (EditorGUI.EndChangeCheck() && mat != null)
                    {
                        if (mat.HasProperty(TessUniformName))
                        {
                            mat.SetFloat(TessUniformName, m_tessFactor);
                        }
                    }
                }
                break;

                case 2:
                {
                    EditorGUI.BeginChangeCheck();
                    m_tessFactor = owner.EditorGUILayoutSlider(EdgeLengthContent, m_tessFactor, 2, 50);
                    if (EditorGUI.EndChangeCheck() && mat != null)
                    {
                        if (mat.HasProperty(EdgeLengthTessUniformName))
                        {
                            mat.SetFloat(EdgeLengthTessUniformName, m_tessFactor);
                        }
                    }
                }
                break;

                case 3:
                {
                    EditorGUI.BeginChangeCheck();
                    m_tessFactor = owner.EditorGUILayoutSlider(EdgeLengthContent, m_tessFactor, 2, 50);
                    if (EditorGUI.EndChangeCheck() && mat != null)
                    {
                        if (mat.HasProperty(EdgeLengthTessUniformName))
                        {
                            mat.SetFloat(EdgeLengthTessUniformName, m_tessFactor);
                        }
                    }

                    EditorGUI.BeginChangeCheck();
                    m_tessMaxDistance = owner.EditorGUILayoutFloatField(EdgeLengthTessMaxDisplacementContent, m_tessMaxDistance);
                    if (EditorGUI.EndChangeCheck() && mat != null)
                    {
                        if (mat.HasProperty(TessMinUniformName))
                        {
                            mat.SetFloat(TessMinUniformName, m_tessMaxDistance);
                        }
                    }
                }
                break;
                }
                GUI.enabled            = guiEnabled;
                EditorGUI.indentLevel -= 1;
                EditorGUI.EndDisabledGroup();
                EditorGUILayout.Separator();
                EditorGUILayout.EndVertical();
            }
        }
예제 #6
0
        public void Draw(UndoParentNode owner, GUIStyle toolbarstyle, Material mat)
        {
            Color cachedColor = GUI.color;

            GUI.color = new Color(cachedColor.r, cachedColor.g, cachedColor.b, 0.5f);
            EditorGUILayout.BeginHorizontal(toolbarstyle);
            GUI.color = cachedColor;
            EditorVariablesManager.OutlineActiveMode.Value = owner.GUILayoutToggle(EditorVariablesManager.OutlineActiveMode.Value, EditorVariablesManager.OutlineActiveMode.LabelName, UIUtils.MenuItemToggleStyle, GUILayout.ExpandWidth(true));
            EditorGUI.BeginChangeCheck();
            m_enabled = owner.EditorGUILayoutToggle(string.Empty, m_enabled, UIUtils.MenuItemEnableStyle, GUILayout.Width(16));
            if (EditorGUI.EndChangeCheck())
            {
                if (m_enabled)
                {
                    UpdateToMaterial(mat);
                }

                UIUtils.RequestSave();
            }
            EditorGUILayout.EndHorizontal();

            if (EditorVariablesManager.OutlineActiveMode.Value)
            {
                cachedColor = GUI.color;
                GUI.color   = new Color(cachedColor.r, cachedColor.g, cachedColor.b, (EditorGUIUtility.isProSkin ? 0.5f : 0.25f));
                EditorGUILayout.BeginVertical(UIUtils.MenuItemBackgroundStyle);
                GUI.color = cachedColor;

                EditorGUILayout.Separator();
                EditorGUI.BeginDisabledGroup(!m_enabled);

                EditorGUI.indentLevel += 1;
                {
                    m_mode = (OutlineMode)owner.EditorGUILayoutEnumPopup(ModePropertyStr, m_mode);

                    EditorGUI.BeginChangeCheck();
                    m_outlineColor = owner.EditorGUILayoutColorField(OutlineColorLabel, m_outlineColor);
                    if (EditorGUI.EndChangeCheck() && mat != null)
                    {
                        if (mat.HasProperty(ColorPropertyName))
                        {
                            mat.SetColor(ColorPropertyName, m_outlineColor);
                        }
                    }

                    EditorGUI.BeginChangeCheck();
                    m_outlineWidth = owner.EditorGUILayoutFloatField(OutlineWidthLabel, m_outlineWidth);
                    if (EditorGUI.EndChangeCheck() && mat != null)
                    {
                        if (mat.HasProperty(WidthPropertyName))
                        {
                            mat.SetFloat(WidthPropertyName, m_outlineWidth);
                        }
                    }

                    m_noFog = owner.EditorGUILayoutToggle(NoFogStr, m_noFog);
                }

                EditorGUI.indentLevel -= 1;
                EditorGUI.EndDisabledGroup();
                EditorGUILayout.Separator();
                EditorGUILayout.EndVertical();
            }
        }