// Set useMiniStyle to true to use smaller UI styles,
            // like in particle system modules UI.
            //
            // The code does branches right now on that instead of just
            // picking one or another style, since there are no UI
            // functions, like EditorGUILayout.ObjectField that would take
            // a style parameter :(
            internal void OnGUI(UnityEngine.Object[] selection, Renderer renderer, bool useMiniStyle)
            {
                int  selectionCount          = 1;
                bool isDeferredRenderingPath = SceneView.IsUsingDeferredRenderingPath();
                bool isDeferredReflections   = isDeferredRenderingPath && (UnityEngine.Rendering.GraphicsSettings.GetShaderMode(BuiltinShaderType.DeferredReflections) != BuiltinShaderMode.Disabled);
                bool areLightProbesAllowed   = true;

                if (selection != null)
                {
                    foreach (UnityEngine.Object obj in selection)
                    {
                        if (LightProbes.AreLightProbesAllowed((Renderer)obj) == false)
                        {
                            areLightProbesAllowed = false;
                            break;
                        }
                    }

                    selectionCount = selection.Length;
                }

                RenderLightProbeUsage(selectionCount, renderer, useMiniStyle, areLightProbesAllowed);

                RenderLightProbeProxyVolumeWarningNote(renderer, selectionCount);

                RenderReflectionProbeUsage(useMiniStyle, isDeferredRenderingPath, isDeferredReflections);

                // anchor field - light probes and reflection probes share the same anchor
                bool needsProbeAnchorField = RenderProbeAnchor(useMiniStyle);

                if (needsProbeAnchorField)
                {
                    bool useReflectionProbes = !m_ReflectionProbeUsage.hasMultipleDifferentValues && (ReflectionProbeUsage)m_ReflectionProbeUsage.intValue != ReflectionProbeUsage.Off;

                    if (useReflectionProbes)
                    {
                        if (!isDeferredReflections)
                        {
                            renderer.GetClosestReflectionProbes(m_BlendInfo);
                            ShowClosestReflectionProbes(m_BlendInfo);
                        }
                    }
                }

                bool receivesShadow = !m_ReceiveShadows.hasMultipleDifferentValues && m_ReceiveShadows.boolValue;

                if ((isDeferredRenderingPath && receivesShadow) || (isDeferredReflections && needsProbeAnchorField))
                {
                    EditorGUILayout.HelpBox(m_DeferredNote.text, MessageType.Info);
                }
            }
예제 #2
0
            internal void OnGUI(UnityEngine.Object[] selection, Renderer renderer, bool useMiniStyle)
            {
                int  selectionCount    = 1;
                bool flag              = SceneView.IsUsingDeferredRenderingPath();
                bool flag2             = flag && GraphicsSettings.GetShaderMode(BuiltinShaderType.DeferredReflections) != BuiltinShaderMode.Disabled;
                bool lightProbeAllowed = true;

                if (selection != null)
                {
                    for (int i = 0; i < selection.Length; i++)
                    {
                        UnityEngine.Object @object = selection[i];
                        if (!LightProbes.AreLightProbesAllowed((Renderer)@object))
                        {
                            lightProbeAllowed = false;
                            break;
                        }
                    }
                    selectionCount = selection.Length;
                }
                this.RenderLightProbeUsage(selectionCount, renderer, useMiniStyle, lightProbeAllowed);
                this.RenderLightProbeProxyVolumeWarningNote(renderer, selectionCount);
                this.RenderReflectionProbeUsage(useMiniStyle, flag, flag2);
                bool flag3 = this.RenderProbeAnchor(useMiniStyle);

                if (flag3)
                {
                    bool flag4 = !this.m_ReflectionProbeUsage.hasMultipleDifferentValues && this.m_ReflectionProbeUsage.intValue != 0;
                    if (flag4)
                    {
                        if (!flag2)
                        {
                            renderer.GetClosestReflectionProbes(this.m_BlendInfo);
                            RendererEditorBase.Probes.ShowClosestReflectionProbes(this.m_BlendInfo);
                        }
                    }
                }
                bool flag5 = !this.m_ReceiveShadows.hasMultipleDifferentValues && this.m_ReceiveShadows.boolValue;

                if ((flag && flag5) || (flag2 && flag3))
                {
                    EditorGUILayout.HelpBox(this.m_DeferredNote.text, MessageType.Info);
                }
            }
예제 #3
0
 internal void RenderLightProbeProxyVolumeWarningNote(Renderer renderer, int selectionCount)
 {
     if (this.IsUsingLightProbeProxyVolume(selectionCount))
     {
         if (LightProbeProxyVolume.isFeatureSupported && SupportedRenderingFeatures.active.rendererSupportsLightProbeProxyVolumes)
         {
             LightProbeProxyVolume component = renderer.GetComponent <LightProbeProxyVolume>();
             bool flag = renderer.lightProbeProxyVolumeOverride == null || renderer.lightProbeProxyVolumeOverride.GetComponent <LightProbeProxyVolume>() == null;
             if (component == null && flag && LightProbes.AreLightProbesAllowed(renderer))
             {
                 EditorGUILayout.HelpBox(this.m_LightProbeVolumeNote.text, MessageType.Warning);
             }
         }
         else
         {
             EditorGUILayout.HelpBox(this.m_LightProbeVolumeUnsupportedNote.text, MessageType.Warning);
         }
     }
 }
 internal void RenderLightProbeProxyVolumeWarningNote(Renderer renderer, int selectionCount)
 {
     if (IsUsingLightProbeProxyVolume(selectionCount))
     {
         if (LightProbeProxyVolume.isFeatureSupported && SupportedRenderingFeatures.active.lightProbeProxyVolumes)
         {
             LightProbeProxyVolume lightProbeProxyVol = renderer.GetComponent <LightProbeProxyVolume>();
             bool invalidProxyVolumeOverride          = (renderer.lightProbeProxyVolumeOverride == null) ||
                                                        (renderer.lightProbeProxyVolumeOverride.GetComponent <LightProbeProxyVolume>() == null);
             if (lightProbeProxyVol == null && invalidProxyVolumeOverride && LightProbes.AreLightProbesAllowed(renderer))
             {
                 EditorGUILayout.HelpBox(m_LightProbeVolumeNote.text, MessageType.Warning);
             }
         }
         else
         {
             EditorGUILayout.HelpBox(m_LightProbeVolumeUnsupportedNote.text, MessageType.Warning);
         }
     }
 }