void DrawMain()
        {
            m_filterMode = (InlineSamplerFilteringMode)m_owner.EditorGUILayoutEnumPopup(m_filterMode);

            EditorGUILayout.BeginHorizontal();
            m_mainWrapMode.WrapMode    = (InlineSamplerWrapMode)m_owner.EditorGUILayoutEnumPopup(m_mainWrapMode.WrapMode);
            m_mainWrapMode.Coordinates = (InlineSamplerWrapCoordinates)m_owner.EditorGUILayoutEnumPopup(m_mainWrapMode.Coordinates);
            EditorGUILayout.EndHorizontal();
            NodeUtils.DrawNestedPropertyGroup(ref m_visibleWrapsFoldout, AdditionalWrapsStr, DrawAdditionalWrapModes, DrawAddRemoveButtons);
        }
Exemplo n.º 2
0
        public void Draw(UndoParentNode owner, ref List <CustomTagData> currentTags)
        {
            if (m_isLocked)
            {
                return;
            }

            if (m_reanalyzeTags)
            {
                if ((EditorApplication.timeSinceStartup - m_timeSinceReanalyzeCheck) > ReanalizeTreshold)
                {
                    m_reanalyzeTags = false;
                    AnalyzeTags(ref currentTags, true);
                }
            }

            EditorGUI.BeginChangeCheck();
            m_enable = owner.EditorGUILayoutToggle(EnableStr, m_enable);
            if (EditorGUI.EndChangeCheck())
            {
                if (m_enable)
                {
                    AnalyzeTags(ref currentTags, true);
                }
            }
            bool guiEnabled = GUI.enabled;

            GUI.enabled = m_enable;
            EditorGUI.BeginChangeCheck();
            m_currentRenderType = (RenderType)owner.EditorGUILayoutEnumPopup(RenderTypeStr, m_currentRenderType);
            if (EditorGUI.EndChangeCheck())
            {
                currentTags[m_renderTypeIndex].TagValue = m_currentRenderType.ToString();
            }

            EditorGUI.BeginChangeCheck();
            m_currentRenderQueue = (RenderQueue)owner.EditorGUILayoutEnumPopup(RenderQueueStr, m_currentRenderQueue);
            if (EditorGUI.EndChangeCheck())
            {
                currentTags[m_renderQueueIndex].TagValue = m_currentRenderQueue.ToString();
            }
            GUI.enabled = guiEnabled;
        }
Exemplo n.º 3
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.º 4
0
        public void Draw(UndoParentNode owner)
        {
            bool visible = EditorVariablesManager.ExpandedVertexOptions.Value;
            bool enabled = m_isBillboard;

            NodeUtils.DrawPropertyGroup(owner, ref visible, ref m_isBillboard, BillboardTitleStr, () =>
            {
                m_billboardType       = ( BillboardType )owner.EditorGUILayoutEnumPopup(BillboardTypeStr, m_billboardType);
                m_rotationIndependent = owner.EditorGUILayoutToggle(BillboardRotIndStr, m_rotationIndependent);
            });

            EditorVariablesManager.ExpandedVertexOptions.Value = visible;
            if (m_isBillboard != enabled)
            {
                UIUtils.RequestSave();
            }
        }
Exemplo n.º 5
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 = m_commonBlendTypes[m_currentIndex].SourceFactor;
                    m_destFactorRGB   = m_commonBlendTypes[m_currentIndex].DestFactor;
                }
            }
            EditorGUI.BeginDisabledGroup(m_currentIndex == 0);

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

            EditorGUIUtility.labelWidth = 40;

            EditorGUILayout.BeginHorizontal();
            m_sourceFactorRGB = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup(SourceFactorStr, m_sourceFactorRGB);
            EditorGUI.indentLevel--;
            EditorGUIUtility.labelWidth = 25;
            m_destFactorRGB             = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup(DstFactorStr, m_destFactorRGB);
            EditorGUI.indentLevel++;
            EditorGUILayout.EndHorizontal();

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

            EditorGUI.BeginChangeCheck();
            m_blendOpRGB = (AvailableBlendOps)owner.EditorGUILayoutEnumPopup(BlendOpsRGBStr, m_blendOpRGB);
            if (EditorGUI.EndChangeCheck())
            {
                m_blendOpEnabled = m_blendOpRGB != AvailableBlendOps.OFF;
            }

            EditorGUI.EndDisabledGroup();

            //if ( m_currentIndex == 0 )
            //	m_currentAlphaIndex = 0;

            //if ( m_blendOpRGB == AvailableBlendOps.OFF )
            //	m_blendOpAlpha = AvailableBlendOps.OFF;

            // Alpha
            EditorGUILayout.Separator();

            //EditorGUI.BeginDisabledGroup( m_currentAlphaIndex == 0 );
            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_destFactorAlpha   = m_commonBlendTypes[m_currentAlphaIndex].DestFactor;
                }
            }
            //EditorGUI.EndDisabledGroup();
            EditorGUI.BeginDisabledGroup(m_currentAlphaIndex == 0);
            //EditorGUI.BeginDisabledGroup( m_currentAlphaIndex == 0 );

            EditorGUI.BeginChangeCheck();
            cached = EditorGUIUtility.labelWidth;
            EditorGUIUtility.labelWidth = 40;
            EditorGUILayout.BeginHorizontal();
            m_sourceFactorAlpha = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup(SourceFactorStr, m_sourceFactorAlpha);
            EditorGUI.indentLevel--;
            EditorGUIUtility.labelWidth = 25;
            m_destFactorAlpha           = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup(DstFactorStr, m_destFactorAlpha);
            EditorGUI.indentLevel++;
            EditorGUILayout.EndHorizontal();
            EditorGUIUtility.labelWidth = cached;

            if (EditorGUI.EndChangeCheck())
            {
                CheckAlphaIndex();
            }
            m_blendOpAlpha = (AvailableBlendOps)owner.EditorGUILayoutEnumPopup(BlendOpsAlphaStr, m_blendOpAlpha);
            EditorGUI.EndDisabledGroup();
            EditorGUILayout.Separator();
        }
Exemplo n.º 6
0
 public override void Draw(UndoParentNode owner)
 {
     m_cullMode = (CullMode)owner.EditorGUILayoutEnumPopup(CullModeStr, m_cullMode);
 }
Exemplo n.º 7
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();
            }
        }
Exemplo n.º 8
0
        public override void Draw(UndoParentNode owner)
        {
            bool blendModeIsVisible = EditorVariablesManager.ExpandedBlendModeModule.Value;

            NodeUtils.DrawPropertyGroup(ref blendModeIsVisible, BlendModeStr, () =>
            {
                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_destFactorRGB   = m_commonBlendTypes[m_currentRGBIndex].DestFactor;
                        }
                    }
                    EditorGUI.BeginDisabledGroup(m_currentRGBIndex == 0);

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

                    EditorGUILayout.BeginHorizontal();
                    m_sourceFactorRGB = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup(SourceFactorStr, m_sourceFactorRGB);
                    EditorGUI.indentLevel--;
                    EditorGUIUtility.labelWidth = 25;
                    m_destFactorRGB             = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup(DstFactorStr, m_destFactorRGB);
                    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_destFactorAlpha   = m_commonBlendTypes[m_currentAlphaIndex].DestFactor;
                        }
                    }
                    EditorGUI.BeginDisabledGroup(m_currentAlphaIndex == 0);

                    EditorGUI.BeginChangeCheck();
                    cached = EditorGUIUtility.labelWidth;
                    EditorGUIUtility.labelWidth = 40;
                    EditorGUILayout.BeginHorizontal();
                    m_sourceFactorAlpha = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup(SourceFactorStr, m_sourceFactorAlpha);
                    EditorGUI.indentLevel--;
                    EditorGUIUtility.labelWidth = 25;
                    m_destFactorAlpha           = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup(DstFactorStr, m_destFactorAlpha);
                    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);
                    EditorGUILayout.Separator();
                    m_blendOpAlpha = (AvailableBlendOps)owner.EditorGUILayoutEnumPopup(BlendOpsAlphaStr, m_blendOpAlpha);
                }
            });

            EditorVariablesManager.ExpandedBlendModeModule.Value = blendModeIsVisible;
        }
Exemplo n.º 9
0
        void DrawMainBody()
        {
            EditorGUI.BeginChangeCheck();
            {
                EditorGUILayout.Separator();
                int itemCount = m_availableTags.Count;

                if (itemCount == 0)
                {
                    EditorGUILayout.HelpBox("Your list is Empty!\nUse the plus button to add one.", MessageType.Info);
                }

                int   markedToDelete     = -1;
                float originalLabelWidth = EditorGUIUtility.labelWidth;
                for (int i = 0; i < itemCount; i++)
                {
                    m_availableTags[i].TagFoldout = m_currentOwner.EditorGUILayoutFoldout(m_availableTags[i].TagFoldout, string.Format("[{0}] - {1}", i, m_availableTags[i].TagName));
                    if (m_availableTags[i].TagFoldout)
                    {
                        EditorGUI.indentLevel      += 1;
                        EditorGUIUtility.labelWidth = 70;
                        //Tag Name
                        EditorGUI.BeginChangeCheck();
                        m_availableTags[i].TagName = m_currentOwner.EditorGUILayoutTextField(TagNameStr, m_availableTags[i].TagName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            m_availableTags[i].TagName = UIUtils.RemoveShaderInvalidCharacters(m_availableTags[i].TagName);
                            m_tagNameCheckFlag         = true;
                            m_tagNameCheckItemId       = i;
                            m_tagNameCheckTimestamp    = EditorApplication.timeSinceStartup;
                        }

                        //Tag Value
                        switch (m_availableTags[i].SpecialTag)
                        {
                        case TemplateSpecialTags.DisableBatching:
                        {
                            m_availableTags[i].Batching = (DisableBatching)m_currentOwner.EditorGUILayoutEnumPopup(RenderTypeLabelStr, m_availableTags[i].Batching);
                            m_availableTags[i].TagValue = m_availableTags[i].Batching.ToString();
                        }
                        break;

                        case TemplateSpecialTags.RenderType:
                        {
                            m_availableTags[i].RenderType = (RenderType)m_currentOwner.EditorGUILayoutEnumPopup(RenderTypeLabelStr, m_availableTags[i].RenderType);
                            if (m_availableTags[i].RenderType == RenderType.Custom)
                            {
                                m_availableTags[i].TagValue = m_currentOwner.EditorGUILayoutTextField(CustomRenderTypeLabelStr, m_availableTags[i].TagValue);
                            }
                        }
                        break;

                        case TemplateSpecialTags.Queue:
                        {
                            EditorGUI.BeginChangeCheck();
                            m_availableTags[i].RenderQueue       = (RenderQueue)m_currentOwner.EditorGUILayoutEnumPopup(QueueLabelStr, m_availableTags[i].RenderQueue, GUILayout.MinWidth(150));
                            m_availableTags[i].RenderQueueOffset = m_currentOwner.EditorGUILayoutIntField(QueueIndexStr, m_availableTags[i].RenderQueueOffset);
                            if (EditorGUI.EndChangeCheck())
                            {
                                m_availableTags[i].BuildQueueTagValue();
                            }
                        }
                        break;

                        case TemplateSpecialTags.None:
                        {
                            EditorGUI.BeginChangeCheck();
                            m_availableTags[i].TagValue = m_currentOwner.EditorGUILayoutTextField(TagValueStr, m_availableTags[i].TagValue);
                            if (EditorGUI.EndChangeCheck())
                            {
                                m_availableTags[i].TagValue = UIUtils.RemoveShaderInvalidCharacters(m_availableTags[i].TagValue);
                            }
                        }
                        break;
                        }

                        EditorGUIUtility.labelWidth = originalLabelWidth;

                        EditorGUILayout.BeginHorizontal();
                        {
                            GUILayout.Label(" ");
                            // Add new port
                            if (m_currentOwner.GUILayoutButton(string.Empty, UIUtils.PlusStyle, GUILayout.Width(ShaderKeywordButtonLayoutWidth)))
                            {
                                m_availableTags.Insert(i + 1, new CustomTagData());
                                EditorGUI.FocusTextInControl(null);
                            }

                            //Remove port
                            if (m_currentOwner.GUILayoutButton(string.Empty, UIUtils.MinusStyle, GUILayout.Width(ShaderKeywordButtonLayoutWidth)))
                            {
                                markedToDelete = i;
                            }
                        }
                        EditorGUILayout.EndHorizontal();

                        EditorGUI.indentLevel -= 1;
                    }
                }
                if (markedToDelete > -1)
                {
                    if (m_availableTags.Count > markedToDelete)
                    {
                        m_availableTags.RemoveAt(markedToDelete);
                        EditorGUI.FocusTextInControl(null);
                    }
                }
                EditorGUILayout.Separator();
            }
            if (EditorGUI.EndChangeCheck())
            {
                m_isDirty = true;
            }
        }