Пример #1
0
        protected void DrawTerrainGUI(MaterialEditor materialEditor)
        {
            // Don't draw the header if we have empty content
            if (enableHeightBlend == null && enableInstancedPerPixelNormal == null && customProperties.Count == 0)
            {
                return;
            }

            using (var header = new MaterialHeaderScope(styles.terrainText, (uint)Expandable.Terrain, materialEditor))
            {
                if (header.expanded)
                {
                    if (enableHeightBlend != null)
                    {
                        materialEditor.ShaderProperty(enableHeightBlend, styles.enableHeightBlend);
                        if (enableHeightBlend.floatValue > 0)
                        {
                            EditorGUI.indentLevel++;
                            materialEditor.ShaderProperty(heightTransition, styles.heightTransition);
                            EditorGUI.indentLevel--;
                        }
                    }
                    if (enableInstancedPerPixelNormal != null)
                    {
                        EditorGUI.BeginDisabledGroup(!materialEditor.IsInstancingEnabled());
                        materialEditor.ShaderProperty(enableInstancedPerPixelNormal, styles.enableInstancedPerPixelNormal);
                        EditorGUI.EndDisabledGroup();
                    }
                    foreach (var prop in customProperties)
                    {
                        materialEditor.ShaderProperty(prop, prop.displayName);
                    }
                }
            }
        }
Пример #2
0
        public override void OnGUI()
        {
            // Disable the block if one of the materials is not transparent:
            if (materials.Any(material => material.GetSurfaceType() != SurfaceType.Transparent))
            {
                return;
            }

            // If refraction model is not enabled in SG, we don't show the section
            var shader = materials[0].shader;

            if (shader.IsShaderGraph())
            {
                var defaultRefractionModel = shader.GetPropertyDefaultFloatValue(shader.FindPropertyIndex(kRefractionModel));
                if (defaultRefractionModel == 0)
                {
                    return;
                }
            }

            using (var header = new MaterialHeaderScope(Styles.header, (uint)m_ExpandableBit, materialEditor))
            {
                if (header.expanded)
                {
                    m_TransparencyBlocks.OnGUI(materialEditor, properties);
                }
            }
        }
Пример #3
0
 public override void OnGUI()
 {
     using (var header = new MaterialHeaderScope(Styles.header, (uint)m_ExpandableBit, materialEditor))
     {
         if (header.expanded)
         {
             DrawAxfSurfaceOptionsGUI();
         }
     }
 }
Пример #4
0
 public override void OnGUI()
 {
     // We're using a subheader here because we know that layering options are only used within layers
     using (var header = new MaterialHeaderScope(Styles.header, (uint)m_ExpandableBit, materialEditor, subHeader: true))
     {
         if (header.expanded)
         {
             DrawLayeringOptionsGUI();
         }
     }
 }
Пример #5
0
        public override void OnGUI()
        {
            bool subHeader = (m_Features & Features.SubHeader) != 0;

            using (var header = new MaterialHeaderScope(Styles.header, (uint)m_ExpandableBit, materialEditor, subHeader: subHeader, colorDot: m_DotColor))
            {
                if (header.expanded)
                {
                    DrawDetailsGUI();
                }
            }
        }
Пример #6
0
        /// <summary>
        /// Renders the properties in the block.
        /// </summary>
        public virtual void OnGUI()
        {
            if (!showSection)
            {
                return;
            }

            using var scope = new MaterialHeaderScope(header, (uint)expandableBit, materialEditor, subHeader: isSubHeader);
            if (scope.expanded)
            {
                OnGUIOpen();
            }
        }
Пример #7
0
 public override void OnGUI()
 {
     for (int layerIndex = 0; layerIndex < layerCount.floatValue; layerIndex++)
     {
         using (var header = new MaterialHeaderScope(Styles.headers[layerIndex], (uint)Styles.layerExpandableBits[layerIndex], materialEditor))
         {
             if (header.expanded)
             {
                 DrawLayerGUI(layerIndex);
             }
         }
     }
 }
        /// <summary>
        /// Renders the properties in the block.
        /// </summary>
        public override void OnGUI()
        {
            bool subHeader = (m_Features & Features.SubHeader) != 0;

            using (var header = new MaterialHeaderScope(Styles.header, (uint)m_ExpandableBit, materialEditor, subHeader: subHeader))
            {
                if (header.expanded)
                {
                    if ((m_Features & Features.Standard) != 0)
                        DrawSurfaceInputsGUI();
                    if ((m_Features & Features.LayerOptions) != 0)
                        DrawLayerOptionsGUI();
                }
            }
        }
        public override void OnGUI()
        {
            // If we don't have tesselation
            if (tessellationMode == null)
            {
                return;
            }

            using (var header = new MaterialHeaderScope(Styles.header, (uint)m_ExpandableBit, materialEditor))
            {
                if (header.expanded)
                {
                    DrawTesselationGUI();
                }
            }
        }
Пример #10
0
        public override void OnGUI()
        {
            // Disable the block if one of the materials is not transparent:
            if (materials.Any(material => material.GetSurfaceType() != SurfaceType.Transparent))
            {
                return;
            }

            using (var header = new MaterialHeaderScope(Styles.header, (uint)m_ExpandableBit, materialEditor))
            {
                if (header.expanded)
                {
                    transparencyBlocks.OnGUI(materialEditor, properties);
                }
            }
        }
Пример #11
0
        public override void OnGUI()
        {
            if (layerUIBlocks == null)
            {
                CreateUIBlockLayers();
            }

            for (int layerIndex = 0; layerIndex < layerCount.floatValue; layerIndex++)
            {
                using (var header = new MaterialHeaderScope(Styles.headers[layerIndex], (uint)Styles.layerExpandableBits[layerIndex], materialEditor, colorDot: kLayerColors[layerIndex]))
                {
                    if (header.expanded)
                    {
                        DrawLayerGUI(layerIndex);
                    }
                }
            }
        }
Пример #12
0
        /// <summary>
        /// Renders the properties in the block.
        /// </summary>
        public override void OnGUI()
        {
            if (layerUIBlocks == null)
            {
                CreateUIBlockLayers();
            }

            var iconSize = EditorGUIUtility.GetIconSize();

            for (int layerIndex = 0; layerIndex < layerCount.floatValue; layerIndex++)
            {
                EditorGUIUtility.SetIconSize(Styles.layerIconSize);
                using (var header = new MaterialHeaderScope(Styles.layers[layerIndex], (uint)Styles.layerExpandableBits[layerIndex], materialEditor))
                {
                    if (header.expanded)
                    {
                        EditorGUIUtility.SetIconSize(iconSize);
                        DrawLayerGUI(layerIndex);
                    }
                }
            }
            EditorGUIUtility.SetIconSize(iconSize);
        }