internal void RenderLightProbeUsage(int selectionCount, Renderer renderer, bool useMiniStyle, bool lightProbeAllowed)
            {
                using (new EditorGUI.DisabledScope(!lightProbeAllowed))
                {
                    if (lightProbeAllowed)
                    {
                        // LightProbeUsage has non-sequential enum values. Extra care is to be taken.
                        if (useMiniStyle)
                        {
                            EditorGUI.BeginChangeCheck();
                            var newValue = ModuleUI.GUIEnumPopup(m_LightProbeUsageStyle, (LightProbeUsage)m_LightProbeUsage.intValue, m_LightProbeUsage);
                            if (EditorGUI.EndChangeCheck())
                            {
                                m_LightProbeUsage.intValue = (int)(LightProbeUsage)newValue;
                            }
                        }
                        else
                        {
                            Rect r = EditorGUILayout.GetControlRect(true, EditorGUI.kSingleLineHeight, EditorStyles.popup);
                            EditorGUI.BeginProperty(r, m_LightProbeUsageStyle, m_LightProbeUsage);
                            EditorGUI.BeginChangeCheck();
                            var newValue = EditorGUI.EnumPopup(r, m_LightProbeUsageStyle, (LightProbeUsage)m_LightProbeUsage.intValue);
                            if (EditorGUI.EndChangeCheck())
                            {
                                m_LightProbeUsage.intValue = (int)(LightProbeUsage)newValue;
                            }
                            EditorGUI.EndProperty();
                        }

                        if (!m_LightProbeUsage.hasMultipleDifferentValues)
                        {
                            if (m_LightProbeUsage.intValue == (int)LightProbeUsage.UseProxyVolume &&
                                SupportedRenderingFeatures.active.lightProbeProxyVolumes)
                            {
                                EditorGUI.indentLevel++;
                                if (useMiniStyle)
                                {
                                    ModuleUI.GUIObject(m_LightProbeVolumeOverrideStyle, m_LightProbeVolumeOverride);
                                }
                                else
                                {
                                    EditorGUILayout.PropertyField(m_LightProbeVolumeOverride, m_LightProbeVolumeOverrideStyle);
                                }
                                EditorGUI.indentLevel--;
                            }
                            else if (m_LightProbeUsage.intValue == (int)LightProbeUsage.CustomProvided)
                            {
                                EditorGUI.indentLevel++;
                                if (!Application.isPlaying)
                                {
                                    EditorGUILayout.HelpBox(m_LightProbeCustomNote.text, MessageType.Info);
                                }
                                else if (!renderer.HasPropertyBlock())
                                {
                                    EditorGUILayout.HelpBox(m_LightProbeCustomNote.text, MessageType.Error);
                                }
                                EditorGUI.indentLevel--;
                            }
                        }
                    }
                    else
                    {
                        if (useMiniStyle)
                        {
                            ModuleUI.GUIEnumPopup(m_LightProbeUsageStyle, LightProbeUsage.Off, m_LightProbeUsage);
                        }
                        else
                        {
                            EditorGUILayout.EnumPopup(m_LightProbeUsageStyle, LightProbeUsage.Off);
                        }
                    }
                }

                var tree = renderer.GetComponent <Tree>();

                if ((tree != null) && (m_LightProbeUsage.intValue == (int)LightProbeUsage.UseProxyVolume))
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.HelpBox(m_LightProbeVolumeUnsupportedOnTreesNote.text, MessageType.Warning);
                    EditorGUI.indentLevel--;
                }
            }
Exemplo n.º 2
0
            internal void RenderLightProbeUsage(int selectionCount, Renderer renderer, bool useMiniStyle, bool lightProbeAllowed)
            {
                using (new EditorGUI.DisabledScope(!lightProbeAllowed))
                {
                    if (lightProbeAllowed)
                    {
                        if (useMiniStyle)
                        {
                            EditorGUI.BeginChangeCheck();
                            Enum @enum = ModuleUI.GUIEnumPopup(this.m_LightProbeUsageStyle, (LightProbeUsage)this.m_LightProbeUsage.intValue, this.m_LightProbeUsage, new GUILayoutOption[0]);
                            if (EditorGUI.EndChangeCheck())
                            {
                                this.m_LightProbeUsage.intValue = (int)((LightProbeUsage)@enum);
                            }
                        }
                        else
                        {
                            Rect controlRect = EditorGUILayout.GetControlRect(true, 16f, EditorStyles.popup, new GUILayoutOption[0]);
                            EditorGUI.BeginProperty(controlRect, this.m_LightProbeUsageStyle, this.m_LightProbeUsage);
                            EditorGUI.BeginChangeCheck();
                            Enum enum2 = EditorGUI.EnumPopup(controlRect, this.m_LightProbeUsageStyle, (LightProbeUsage)this.m_LightProbeUsage.intValue);
                            if (EditorGUI.EndChangeCheck())
                            {
                                this.m_LightProbeUsage.intValue = (int)((LightProbeUsage)enum2);
                            }
                            EditorGUI.EndProperty();
                        }
                        if (!this.m_LightProbeUsage.hasMultipleDifferentValues)
                        {
                            if (this.m_LightProbeUsage.intValue == 2 && SupportedRenderingFeatures.active.rendererSupportsLightProbeProxyVolumes)
                            {
                                EditorGUI.indentLevel++;
                                if (useMiniStyle)
                                {
                                    ModuleUI.GUIObject(this.m_LightProbeVolumeOverrideStyle, this.m_LightProbeVolumeOverride, new GUILayoutOption[0]);
                                }
                                else
                                {
                                    EditorGUILayout.PropertyField(this.m_LightProbeVolumeOverride, this.m_LightProbeVolumeOverrideStyle, new GUILayoutOption[0]);
                                }
                                EditorGUI.indentLevel--;
                            }
                            else if (this.m_LightProbeUsage.intValue == 4)
                            {
                                EditorGUI.indentLevel++;
                                if (!Application.isPlaying)
                                {
                                    EditorGUILayout.HelpBox(this.m_LightProbeCustomNote.text, MessageType.Info);
                                }
                                else if (!renderer.HasPropertyBlock())
                                {
                                    EditorGUILayout.HelpBox(this.m_LightProbeCustomNote.text, MessageType.Error);
                                }
                                EditorGUI.indentLevel--;
                            }
                        }
                    }
                    else if (useMiniStyle)
                    {
                        ModuleUI.GUIEnumPopup(this.m_LightProbeUsageStyle, LightProbeUsage.Off, this.m_LightProbeUsage, new GUILayoutOption[0]);
                    }
                    else
                    {
                        EditorGUILayout.EnumPopup(this.m_LightProbeUsageStyle, LightProbeUsage.Off, new GUILayoutOption[0]);
                    }
                }
                Tree component = renderer.GetComponent <Tree>();

                if (component != null && this.m_LightProbeUsage.intValue == 2)
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.HelpBox(this.m_LightProbeVolumeUnsupportedOnTreesNote.text, MessageType.Warning);
                    EditorGUI.indentLevel--;
                }
            }