Exemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            if (_isInitialized.value.boolValue == false)
            {
                _bloomIntensity.value.floatValue        = 1f;
                _bloomIntensity.overrideState.boolValue = true;

                _lensSurfaceDirtIntensity.value.floatValue               = 2.5f;
                _lensSurfaceDirtIntensity.overrideState.boolValue        = true;
                _lensSurfaceDiffractionIntensity.value.floatValue        = 2f;
                _lensSurfaceDiffractionIntensity.overrideState.boolValue = true;

                _lensFlareGhostIntensity.value.floatValue        = 1.0f;
                _lensFlareGhostIntensity.overrideState.boolValue = true;
                _lensFlareHaloIntensity.value.floatValue         = 1.0f;
                _lensFlareHaloIntensity.overrideState.boolValue  = true;

                _glareSample0Intensity.value.floatValue        = 1.0f;
                _glareSample0Intensity.overrideState.boolValue = true;
                _glareSample1Intensity.value.floatValue        = 1.0f;
                _glareSample1Intensity.overrideState.boolValue = true;
                _glareSample2Intensity.value.floatValue        = 1.0f;
                _glareSample2Intensity.overrideState.boolValue = true;
                _glareSample3Intensity.value.floatValue        = 1.0f;
                _glareSample3Intensity.overrideState.boolValue = true;

                _isInitialized.value.boolValue = true;
            }

            EditorHelper.VerticalSpace();

            EditorHelper.EditorUIContent.IsNotSupportedWarning();
            EditorHelper.EditorUIContent.XRUnityVersionWarning();
            if (_workflow.value.enumValueIndex == 1)
            {
                EditorHelper.EditorUIContent.SelectiveWorkflowDeprecated();
            }

            if (EditorHelper.HandleBehavior(_showEditorMainBehavior.value.serializedObject.targetObject, EditorHelper.EditorUIContent.mainTitle, "", _showEditorMainBehavior.value, null))
            {
                PropertyField(_allowGeometryShaders, Tooltips.allowGeometryShaders);
                PropertyField(_allowComputeShaders, Tooltips.allowComputeShaders);
                PropertyField(_renderPriority, Tooltips.renderPriority);
                PropertyField(_debugView, Tooltips.debugView);
                PropertyField(_quality, Tooltips.quality);
                PropertyField(_antiFlickerMode, Tooltips.antiFlickerMode);
                PropertyField(_workflow, Tooltips.workflow);
                EditorHelper.EditorUIContent.SelectiveWorkflowVRWarning((Workflow)_workflow.value.enumValueIndex);
                if (_workflow.value.enumValueIndex == 1)
                {
                    PropertyField(_selectiveRenderLayerMask, Tooltips.selectiveRenderLayerMask);
                }
                PropertyField(_anamorphicRatio, Tooltips.anamorphicRatio);
                PropertyField(_lumaScale, Tooltips.lumaScale);
                if (_renderPriority.value.enumValueIndex != 2 && _workflow.value.enumValueIndex != 2)
                {
                    PropertyField(_blooming, Tooltips.blooming);
                }
                EditorHelper.VerticalSpace();
            }

            if (EditorHelper.HandleBehavior(_showEditorBloomBehavior.value.serializedObject.targetObject, EditorHelper.EditorUIContent.bloomTitle, "", _showEditorBloomBehavior.value, null))
            {
                if (_workflow.value.enumValueIndex == 0)
                {
                    PropertyField(_bloomThreshold, Tooltips.bloomThreshold);
                }
                PropertyField(_bloomScattering, Tooltips.bloomScattering);
                PropertyField(_bloomIntensity, Tooltips.bloomIntensity);
                _bloomIntensity.value.floatValue = Mathf.Max(0, _bloomIntensity.value.floatValue);

                EditorHelper.VerticalSpace();
            }

            if (EditorHelper.HandleBehavior(_showEditorLensSurfaceBehavior.value.serializedObject.targetObject, EditorHelper.EditorUIContent.lensSurfaceTitle, "", _showEditorLensSurfaceBehavior.value, _allowLensSurface.value))
            {
                using (new EditorGUI.DisabledScope(!_allowLensSurface.value.boolValue))
                {
                    EditorHelper.DrawHeader(EditorHelper.EditorUIContent.dirtTitle);
                    PropertyField(_lensSurfaceDirtTexture, Tooltips.lensSurfaceDirtTexture);
                    PropertyField(_lensSurfaceDirtIntensity, Tooltips.lensSurfaceDirtIntensity);
                    _lensSurfaceDirtIntensity.value.floatValue = Mathf.Max(0, _lensSurfaceDirtIntensity.value.floatValue);
                    EditorGUILayout.Space();
                    EditorHelper.DrawHeader(EditorHelper.EditorUIContent.diffractionTitle);
                    PropertyField(_lensSurfaceDiffractionTexture, Tooltips.lensSurfaceDiffractionTexture);
                    PropertyField(_lensSurfaceDiffractionIntensity, Tooltips.lensSurfaceDiffractionIntensity);
                    _lensSurfaceDiffractionIntensity.value.floatValue = Mathf.Max(0, _lensSurfaceDiffractionIntensity.value.floatValue);
                }
                EditorHelper.VerticalSpace();
            }

            if (Compatibility.CheckLensFlareFeatureSupport() && _quality.value.intValue <= 4)
            {
                if (EditorHelper.HandleBehavior(_showEditorLensFlareBehavior.value.serializedObject.targetObject, EditorHelper.EditorUIContent.lensFlareTitle, "", _showEditorLensFlareBehavior.value, _allowLensFlare.value))
                {
                    using (new EditorGUI.DisabledScope(!_allowLensFlare.value.boolValue))
                    {
                        PropertyField(_lensFlareStyle, Tooltips.lensFlareStyle);
                        if (_workflow.value.enumValueIndex == 0)
                        {
                            PropertyField(_lensFlareThreshold, Tooltips.lensFlareThreshold);
                        }
                        PropertyField(_lensFlareScattering, Tooltips.lensFlareScattering);
                        PropertyField(_lensFlareColorRamp, Tooltips.lensFlareColorRamp);
                        PropertyField(_lensFlareChromaticAberration, Tooltips.lensFlareChromaticAberration);

                        EditorGUILayout.Space();
                        EditorHelper.DrawHeader(EditorHelper.EditorUIContent.ghostsTitle);
                        if (_lensFlareStyle.value.enumValueIndex == 0)
                        {
                            PropertyField(_lensFlareGhostFade, Tooltips.lensFlareGhostFade);
                            PropertyField(_lensFlareGhostCount, Tooltips.lensFlareGhostCount);
                            PropertyField(_lensFlareGhostDispersal, Tooltips.lensFlareGhostDispersal);
                        }
                        PropertyField(_lensFlareGhostIntensity, Tooltips.lensFlareGhostIntensity);
                        _lensFlareGhostIntensity.value.floatValue = Mathf.Max(0, _lensFlareGhostIntensity.value.floatValue);

                        EditorGUILayout.Space();
                        EditorHelper.DrawHeader(EditorHelper.EditorUIContent.haloTitle);
                        if (_lensFlareStyle.value.enumValueIndex == 0)
                        {
                            PropertyField(_lensFlareHaloFade, Tooltips.lensFlareHaloFade);
                            PropertyField(_lensFlareHaloSize, Tooltips.lensFlareHaloSize);
                        }
                        PropertyField(_lensFlareHaloIntensity, Tooltips.lensFlareHaloIntensity);
                        _lensFlareHaloIntensity.value.floatValue = Mathf.Max(0, _lensFlareHaloIntensity.value.floatValue);
                    }
                    EditorHelper.VerticalSpace();
                }
            }
            else
            {
                EditorHelper.DrawSplitter();
                EditorHelper.EditorUIContent.LensFlareFeatureNotSupportedWarning();
            }

            if (Compatibility.CheckGlareFeatureSupport() && _quality.value.intValue <= 4)
            {
                if (EditorHelper.HandleBehavior(_showEditorGlareBehavior.value.serializedObject.targetObject, EditorHelper.EditorUIContent.glareTitle, "", _showEditorGlareBehavior.value, _allowGlare.value))
                {
                    using (new EditorGUI.DisabledScope(!_allowGlare.value.boolValue))
                    {
                        PropertyField(_glareStyle, Tooltips.glareStyle);
                        if (_workflow.value.enumValueIndex == 0)
                        {
                            PropertyField(_glareThreshold, Tooltips.glareThreshold);
                        }
                        if (_glareStyle.value.enumValueIndex == 0)
                        {
                            PropertyField(_glareStreaks, Tooltips.glareStreaks);
                        }
                        PropertyField(_glareBlend, Tooltips.glareBlend);
                        PropertyField(_glareAngle, Tooltips.glareAngle);
                        PropertyField(_glareScattering, Tooltips.glareScattering);
                        PropertyField(_glareIntensity, Tooltips.glareIntensity);
                        _glareScattering.value.floatValue = Mathf.Max(0, _glareScattering.value.floatValue);
                        _glareIntensity.value.floatValue  = Mathf.Max(0, _glareIntensity.value.floatValue);

                        if (_glareStyle.value.enumValueIndex == 0)
                        {
                            EditorGUILayout.Space();
                            EditorHelper.DrawHeader(EditorHelper.EditorUIContent.sample0Title);
                            PropertyField(_glareSample0Scattering, Tooltips.glareSample0Scattering);
                            PropertyField(_glareSample0Angle, Tooltips.glareSample0Angle);
                            PropertyField(_glareSample0Offset, Tooltips.glareSample0Offset);
                            PropertyField(_glareSample0Intensity, Tooltips.glareSample0Intensity);
                            _glareSample0Intensity.value.floatValue = Mathf.Max(0, _glareSample0Intensity.value.floatValue);

                            if (_glareStreaks.value.intValue >= 2)
                            {
                                EditorGUILayout.Space();
                                EditorHelper.DrawHeader(EditorHelper.EditorUIContent.sample1Title);
                                PropertyField(_glareSample1Scattering, Tooltips.glareSample1Scattering);
                                PropertyField(_glareSample1Angle, Tooltips.glareSample1Angle);
                                PropertyField(_glareSample1Offset, Tooltips.glareSample1Offset);
                                PropertyField(_glareSample1Intensity, Tooltips.glareSample1Intensity);
                                _glareSample1Intensity.value.floatValue = Mathf.Max(0, _glareSample1Intensity.value.floatValue);
                            }

                            if (_glareStreaks.value.intValue >= 3)
                            {
                                EditorGUILayout.Space();
                                EditorHelper.DrawHeader(EditorHelper.EditorUIContent.sample2Title);
                                PropertyField(_glareSample2Scattering, Tooltips.glareSample2Scattering);
                                PropertyField(_glareSample2Angle, Tooltips.glareSample2Angle);
                                PropertyField(_glareSample2Offset, Tooltips.glareSample2Offset);
                                PropertyField(_glareSample2Intensity, Tooltips.glareSample2Intensity);
                                _glareSample2Intensity.value.floatValue = Mathf.Max(0, _glareSample2Intensity.value.floatValue);
                            }

                            if (_glareStreaks.value.intValue >= 4)
                            {
                                EditorGUILayout.Space();
                                EditorHelper.DrawHeader(EditorHelper.EditorUIContent.sample3Title);
                                PropertyField(_glareSample3Scattering, Tooltips.glareSample3Scattering);
                                PropertyField(_glareSample3Angle, Tooltips.glareSample3Angle);
                                PropertyField(_glareSample3Offset, Tooltips.glareSample3Offset);
                                PropertyField(_glareSample3Intensity, Tooltips.glareSample3Intensity);
                                _glareSample3Intensity.value.floatValue = Mathf.Max(0, _glareSample3Intensity.value.floatValue);
                            }
                        }
                    }
                }
                EditorHelper.VerticalSpace();
            }
            else
            {
                EditorHelper.DrawSplitter();
                EditorHelper.EditorUIContent.GlareFeatureNotSupportedWarning();
            }
            EditorHelper.DrawSplitter();

            serializedObject.ApplyModifiedProperties();
        }