UnityEditor.EditorMaterialUtility.IsBackgroundMaterial C# (CSharp) Method

IsBackgroundMaterial() private method

private IsBackgroundMaterial ( Material material ) : bool
material UnityEngine.Material
return bool
        public static extern bool IsBackgroundMaterial(Material material);
        [MethodImpl(MethodImplOptions.InternalCall)]

Usage Example

示例#1
0
        private void DrawGUI()
        {
            Material material = this.m_SkyboxMaterial.objectReferenceValue as Material;

            this.m_bShowEnvironment = EditorGUILayout.FoldoutTitlebar(this.m_bShowEnvironment, LightingEditor.Styles.env_top, true);
            if (this.m_bShowEnvironment)
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(this.m_SkyboxMaterial, LightingEditor.Styles.env_skybox_mat, new GUILayoutOption[0]);
                if (material && !EditorMaterialUtility.IsBackgroundMaterial(material))
                {
                    EditorGUILayout.HelpBox(LightingEditor.Styles.skyboxWarning.text, MessageType.Warning);
                }
                EditorGUILayout.PropertyField(this.m_Sun, LightingEditor.Styles.env_skybox_sun, new GUILayoutOption[0]);
                EditorGUILayout.Space();
                EditorGUILayout.LabelField(LightingEditor.Styles.env_amb_top, new GUILayoutOption[0]);
                EditorGUI.indentLevel++;
                EditorGUILayout.IntPopup(this.m_AmbientSource, LightingEditor.Styles.kFullAmbientSource, LightingEditor.Styles.kFullAmbientSourceValues, LightingEditor.Styles.env_amb_src, new GUILayoutOption[0]);
                AmbientMode intValue = (AmbientMode)this.m_AmbientSource.intValue;
                if (intValue != AmbientMode.Trilight)
                {
                    if (intValue != AmbientMode.Flat)
                    {
                        if (intValue == AmbientMode.Skybox)
                        {
                            if (material == null)
                            {
                                EditorGUI.BeginChangeCheck();
                                Color colorValue = EditorGUILayout.ColorField(LightingEditor.Styles.ambient, this.m_AmbientSkyColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]);
                                if (EditorGUI.EndChangeCheck())
                                {
                                    this.m_AmbientSkyColor.colorValue = colorValue;
                                }
                            }
                            else
                            {
                                EditorGUILayout.Slider(this.m_AmbientIntensity, 0f, 8f, LightingEditor.Styles.env_amb_int, new GUILayoutOption[0]);
                            }
                        }
                    }
                    else
                    {
                        EditorGUI.BeginChangeCheck();
                        Color colorValue2 = EditorGUILayout.ColorField(LightingEditor.Styles.ambient, this.m_AmbientSkyColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]);
                        if (EditorGUI.EndChangeCheck())
                        {
                            this.m_AmbientSkyColor.colorValue = colorValue2;
                        }
                    }
                }
                else
                {
                    EditorGUI.BeginChangeCheck();
                    Color colorValue3 = EditorGUILayout.ColorField(LightingEditor.Styles.ambientUp, this.m_AmbientSkyColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]);
                    Color colorValue4 = EditorGUILayout.ColorField(LightingEditor.Styles.ambientMid, this.m_AmbientEquatorColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]);
                    Color colorValue5 = EditorGUILayout.ColorField(LightingEditor.Styles.ambientDown, this.m_AmbientGroundColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]);
                    if (EditorGUI.EndChangeCheck())
                    {
                        this.m_AmbientSkyColor.colorValue     = colorValue3;
                        this.m_AmbientEquatorColor.colorValue = colorValue4;
                        this.m_AmbientGroundColor.colorValue  = colorValue5;
                    }
                }
                if (LightModeUtil.Get().IsAnyGIEnabled())
                {
                    int  selectedValue;
                    bool ambientLightingMode = LightModeUtil.Get().GetAmbientLightingMode(out selectedValue);
                    using (new EditorGUI.DisabledScope(!ambientLightingMode))
                    {
                        int[] optionValues = new int[]
                        {
                            0,
                            1
                        };
                        if (ambientLightingMode)
                        {
                            this.m_AmbientLightingMode.intValue = EditorGUILayout.IntPopup(LightingEditor.Styles.AmbientLightingMode, this.m_AmbientLightingMode.intValue, LightingEditor.Styles.AmbientLightingModes, optionValues, new GUILayoutOption[0]);
                        }
                        else
                        {
                            EditorGUILayout.IntPopup(LightingEditor.Styles.AmbientLightingMode, selectedValue, LightingEditor.Styles.AmbientLightingModes, optionValues, new GUILayoutOption[0]);
                        }
                    }
                }
                EditorGUI.indentLevel--;
                EditorGUILayout.Space();
                EditorGUILayout.LabelField(LightingEditor.Styles.env_refl_top, new GUILayoutOption[0]);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(this.m_DefaultReflectionMode, LightingEditor.Styles.env_refl_src, new GUILayoutOption[0]);
                DefaultReflectionMode intValue2 = (DefaultReflectionMode)this.m_DefaultReflectionMode.intValue;
                if (intValue2 != DefaultReflectionMode.FromSkybox)
                {
                    if (intValue2 == DefaultReflectionMode.Custom)
                    {
                        EditorGUILayout.PropertyField(this.m_CustomReflection, LightingEditor.Styles.customReflection, new GUILayoutOption[0]);
                    }
                }
                else
                {
                    EditorGUILayout.IntPopup(this.m_DefaultReflectionResolution, LightingEditor.Styles.defaultReflectionSizes, LightingEditor.Styles.defaultReflectionSizesValues, LightingEditor.Styles.env_refl_res, new GUILayoutOption[]
                    {
                        GUILayout.MinWidth(40f)
                    });
                }
                EditorGUILayout.PropertyField(this.m_ReflectionCompression, LightingEditor.Styles.env_refl_cmp, new GUILayoutOption[0]);
                EditorGUILayout.Slider(this.m_ReflectionIntensity, 0f, 1f, LightingEditor.Styles.env_refl_int, new GUILayoutOption[0]);
                EditorGUILayout.IntSlider(this.m_ReflectionBounces, 1, 5, LightingEditor.Styles.env_refl_bnc, new GUILayoutOption[0]);
                EditorGUI.indentLevel--;
                EditorGUI.indentLevel--;
                EditorGUILayout.Space();
            }
        }
All Usage Examples Of UnityEditor.EditorMaterialUtility::IsBackgroundMaterial