void DrawRenderer(UniversalRenderPipelineAsset rpAsset)
        {
            int selectedRendererOption = m_AdditionalCameraDataRendererProp.intValue;

            EditorGUI.BeginChangeCheck();

            Rect controlRect = EditorGUILayout.GetControlRect(true);

            EditorGUI.BeginProperty(controlRect, Styles.rendererType, m_AdditionalCameraDataRendererProp);

            EditorGUI.showMixedValue = m_AdditionalCameraDataRendererProp.hasMultipleDifferentValues;
            int selectedRenderer = EditorGUI.IntPopup(controlRect, Styles.rendererType, selectedRendererOption, rpAsset.rendererDisplayList, UniversalRenderPipeline.asset.rendererIndexList);

            EditorGUI.EndProperty();
            if (!rpAsset.ValidateRendererDataList())
            {
                EditorGUILayout.HelpBox(Styles.noRendererError, MessageType.Error);
            }
            else if (!rpAsset.ValidateRendererData(selectedRendererOption))
            {
                EditorGUILayout.HelpBox(Styles.missingRendererWarning, MessageType.Warning);
            }

            if (EditorGUI.EndChangeCheck())
            {
                m_AdditionalCameraDataRendererProp.intValue = selectedRenderer;
                m_AdditionalCameraDataSO.ApplyModifiedProperties();
            }
        }
Beispiel #2
0
        void DrawRenderer(UniversalRenderPipelineAsset rpAsset)
        {
            int selectedRendererOption = m_SerializedCamera.renderer.intValue;

            EditorGUI.BeginChangeCheck();

            Rect controlRect = EditorGUILayout.GetControlRect(true);

            EditorGUI.BeginProperty(controlRect, Styles.rendererType, m_SerializedCamera.renderer);

            EditorGUI.showMixedValue = m_SerializedCamera.renderer.hasMultipleDifferentValues;
            int selectedRenderer = EditorGUI.IntPopup(controlRect, Styles.rendererType, selectedRendererOption, rpAsset.rendererDisplayList, UniversalRenderPipeline.asset.rendererIndexList);

            EditorGUI.EndProperty();
            if (!rpAsset.ValidateRendererDataList())
            {
                EditorGUILayout.HelpBox(Styles.noRendererError, MessageType.Error);
            }
            else if (!rpAsset.ValidateRendererData(selectedRendererOption))
            {
                EditorGUILayout.HelpBox(Styles.missingRendererWarning, MessageType.Warning);
                var rect = EditorGUI.IndentedRect(EditorGUILayout.GetControlRect());
                if (GUI.Button(rect, "Select Render Pipeline Asset"))
                {
                    Selection.activeObject = AssetDatabase.LoadAssetAtPath <UniversalRenderPipelineAsset>(AssetDatabase.GetAssetPath(UniversalRenderPipeline.asset));
                }
                GUILayout.Space(5);
            }

            if (EditorGUI.EndChangeCheck())
            {
                m_SerializedCamera.renderer.intValue = selectedRenderer;
                m_SerializedCamera.serializedObject.ApplyModifiedProperties();
            }
        }
Beispiel #3
0
        void DrawGeneralSettings()
        {
            m_GeneralSettingsFoldout.value = EditorGUILayout.BeginFoldoutHeaderGroup(m_GeneralSettingsFoldout.value, Styles.generalSettingsText);
            if (m_GeneralSettingsFoldout.value)
            {
                EditorGUI.indentLevel++;

                EditorGUILayout.Space();
                EditorGUI.indentLevel--;
                m_RendererDataList.DoLayoutList();
                EditorGUI.indentLevel++;

                UniversalRenderPipelineAsset asset = target as UniversalRenderPipelineAsset;
                string unsupportedGraphicsApisMessage;

                if (!asset.ValidateRendererData(-1))
                {
                    EditorGUILayout.HelpBox(Styles.rendererMissingDefaultMessage.text, MessageType.Error, true);
                }
                else if (!asset.ValidateRendererDataList(true))
                {
                    EditorGUILayout.HelpBox(Styles.rendererMissingMessage.text, MessageType.Warning, true);
                }
                else if (!ValidateRendererGraphicsAPIs(asset, out unsupportedGraphicsApisMessage))
                {
                    EditorGUILayout.HelpBox(Styles.rendererUnsupportedAPIMessage.text + unsupportedGraphicsApisMessage, MessageType.Warning, true);
                }

                EditorGUILayout.PropertyField(m_RequireDepthTextureProp, Styles.requireDepthTextureText);
                EditorGUILayout.PropertyField(m_RequireOpaqueTextureProp, Styles.requireOpaqueTextureText);
                EditorGUI.indentLevel++;
                EditorGUI.BeginDisabledGroup(!m_RequireOpaqueTextureProp.boolValue);
                EditorGUILayout.PropertyField(m_OpaqueDownsamplingProp, Styles.opaqueDownsamplingText);
                EditorGUI.EndDisabledGroup();
                EditorGUI.indentLevel--;
                EditorGUILayout.PropertyField(m_SupportsTerrainHolesProp, Styles.supportsTerrainHolesText);
                EditorGUI.indentLevel--;
                EditorGUILayout.Space();
                EditorGUILayout.Space();
            }

            EditorGUILayout.EndFoldoutHeaderGroup();
        }
Beispiel #4
0
        void DrawRenderer()
        {
            int selectedRendererOption;

            if (m_AdditionalCameraDataSO == null)
            {
                selectedRendererOption = -1;
            }
            else
            {
                m_AdditionalCameraDataSO.Update();
                selectedRendererOption = m_AdditionalCameraDataRendererProp.intValue;
            }

            EditorGUI.BeginChangeCheck();

            int selectedRenderer = EditorGUILayout.IntPopup(Styles.rendererType, selectedRendererOption, m_UniversalRenderPipeline.rendererDisplayList, UniversalRenderPipeline.asset.rendererIndexList);

            if (!m_UniversalRenderPipeline.ValidateRendererDataList())
            {
                EditorGUILayout.HelpBox(Styles.noRendererError, MessageType.Error);
            }
            else if (!m_UniversalRenderPipeline.ValidateRendererData(selectedRendererOption))
            {
                EditorGUILayout.HelpBox(Styles.missingRendererWarning, MessageType.Warning);
            }

            if (EditorGUI.EndChangeCheck())
            {
                if (m_AdditionalCameraDataSO == null)
                {
                    m_AdditionalCameraData = Undo.AddComponent <UniversalAdditionalCameraData>(camera.gameObject);
                    init(m_AdditionalCameraData);
                }

                m_AdditionalCameraDataRendererProp.intValue = selectedRenderer;
                m_AdditionalCameraDataSO.ApplyModifiedProperties();
            }
        }
        void DrawAdditionalData()
        {
            bool hasChanged = false;
            bool selectedValueShadows;
            CameraOverrideOption selectedDepthOption;
            CameraOverrideOption selectedOpaqueOption;
            int                 selectedRendererOption;
            LayerMask           selectedVolumeLayerMask;
            Transform           selectedVolumeTrigger;
            bool                selectedRenderPostProcessing;
            AntialiasingMode    selectedAntialiasing;
            AntialiasingQuality selectedAntialiasingQuality;
            bool                selectedStopNaN;
            bool                selectedDithering;

            if (m_AdditionalCameraDataSO == null)
            {
                selectedValueShadows         = true;
                selectedDepthOption          = CameraOverrideOption.UsePipelineSettings;
                selectedOpaqueOption         = CameraOverrideOption.UsePipelineSettings;
                selectedRendererOption       = -1;
                selectedVolumeLayerMask      = 1; // "Default"
                selectedVolumeTrigger        = null;
                selectedRenderPostProcessing = false;
                selectedAntialiasing         = AntialiasingMode.None;
                selectedAntialiasingQuality  = AntialiasingQuality.High;
                selectedStopNaN   = false;
                selectedDithering = false;
            }
            else
            {
                m_AdditionalCameraDataSO.Update();
                selectedValueShadows         = m_AdditionalCameraData.renderShadows;
                selectedDepthOption          = (CameraOverrideOption)m_AdditionalCameraDataRenderDepthProp.intValue;
                selectedOpaqueOption         = (CameraOverrideOption)m_AdditionalCameraDataRenderOpaqueProp.intValue;
                selectedRendererOption       = m_AdditionalCameraDataRendererProp.intValue;
                selectedVolumeLayerMask      = m_AdditionalCameraDataVolumeLayerMask.intValue;
                selectedVolumeTrigger        = (Transform)m_AdditionalCameraDataVolumeTrigger.objectReferenceValue;
                selectedRenderPostProcessing = m_AdditionalCameraDataRenderPostProcessing.boolValue;
                selectedAntialiasing         = (AntialiasingMode)m_AdditionalCameraDataAntialiasing.intValue;
                selectedAntialiasingQuality  = (AntialiasingQuality)m_AdditionalCameraDataAntialiasingQuality.intValue;
                selectedStopNaN   = m_AdditionalCameraDataStopNaN.boolValue;
                selectedDithering = m_AdditionalCameraDataDithering.boolValue;
            }

            hasChanged |= DrawLayerMask(m_AdditionalCameraDataVolumeLayerMask, ref selectedVolumeLayerMask, Styles.volumeLayerMask);
            hasChanged |= DrawObjectField(m_AdditionalCameraDataVolumeTrigger, ref selectedVolumeTrigger, Styles.volumeTrigger);

            if (m_UniversalRenderPipeline != null)
            {
                hasChanged |= DrawBasicIntPopup(m_AdditionalCameraDataRendererProp, ref selectedRendererOption,
                                                Styles.rendererType, m_UniversalRenderPipeline.rendererDisplayList,
                                                m_UniversalRenderPipeline.rendererIndexList);
                if (!m_UniversalRenderPipeline.ValidateRendererDataList())
                {
                    EditorGUILayout.HelpBox(Styles.noRendererError, MessageType.Error);
                }
                else if (!m_UniversalRenderPipeline.ValidateRendererData(selectedRendererOption))
                {
                    EditorGUILayout.HelpBox(Styles.missingRendererWarning, MessageType.Warning);
                }
            }
            else
            {
                EditorGUILayout.HelpBox("Universal RP asset not assigned, assign one in the Graphics Settings.", MessageType.Error);
            }

            // TODO: Fix this for lw/postfx
            bool defaultDrawOfDepthTextureUI = true;

            if (defaultDrawOfDepthTextureUI)
            {
                hasChanged |= DrawIntPopup(m_AdditionalCameraDataRenderDepthProp, ref selectedDepthOption, Styles.requireDepthTexture, Styles.displayedAdditionalDataOptions, Styles.additionalDataOptions);
            }

            hasChanged |= DrawIntPopup(m_AdditionalCameraDataRenderOpaqueProp, ref selectedOpaqueOption, Styles.requireOpaqueTexture, Styles.displayedAdditionalDataOptions, Styles.additionalDataOptions);
            hasChanged |= DrawToggle(m_AdditionalCameraDataRenderShadowsProp, ref selectedValueShadows, Styles.renderingShadows);
            hasChanged |= DrawToggle(m_AdditionalCameraDataRenderPostProcessing, ref selectedRenderPostProcessing, Styles.renderPostProcessing);

            if (selectedRenderPostProcessing)
            {
                EditorGUI.indentLevel++;
                hasChanged |= DrawIntPopup(m_AdditionalCameraDataAntialiasing, ref selectedAntialiasing, Styles.antialiasing, Styles.antialiasingOptions, Styles.antialiasingValues);

                if (selectedAntialiasing == AntialiasingMode.SubpixelMorphologicalAntiAliasing)
                {
                    EditorGUI.indentLevel++;
                    hasChanged |= DrawIntPopup(m_AdditionalCameraDataAntialiasingQuality, ref selectedAntialiasingQuality, Styles.antialiasingQuality, Styles.antialiasingQualityOptions, Styles.antialiasingQualityValues);
                    if (CoreEditorUtils.buildTargets.Contains(GraphicsDeviceType.OpenGLES2))
                    {
                        EditorGUILayout.HelpBox("Sub-pixel Morphological Anti-Aliasing isn't supported on GLES2 platforms.", MessageType.Warning);
                    }
                    EditorGUI.indentLevel--;
                }
                //else if (selectedAntialiasing == AntialiasingMode.TemporalAntialiasing)
                //{
                //    EditorGUILayout.HelpBox("Temporal anti-aliasing is not supported on the Universal Render Pipeline yet.", MessageType.Info);
                //}

                hasChanged |= DrawToggle(m_AdditionalCameraDataStopNaN, ref selectedStopNaN, Styles.stopNaN);
                hasChanged |= DrawToggle(m_AdditionalCameraDataDithering, ref selectedDithering, Styles.dithering);
                EditorGUI.indentLevel--;
            }

            if (hasChanged)
            {
                if (m_AdditionalCameraDataSO == null)
                {
                    m_AdditionalCameraData = Undo.AddComponent <UniversalAdditionalCameraData>(camera.gameObject);
                    init(m_AdditionalCameraData);
                }

                m_AdditionalCameraDataRenderShadowsProp.boolValue        = selectedValueShadows;
                m_AdditionalCameraDataRenderDepthProp.intValue           = (int)selectedDepthOption;
                m_AdditionalCameraDataRenderOpaqueProp.intValue          = (int)selectedOpaqueOption;
                m_AdditionalCameraDataRendererProp.intValue              = (int)selectedRendererOption;
                m_AdditionalCameraDataVolumeLayerMask.intValue           = selectedVolumeLayerMask;
                m_AdditionalCameraDataVolumeTrigger.objectReferenceValue = selectedVolumeTrigger;
                m_AdditionalCameraDataRenderPostProcessing.boolValue     = selectedRenderPostProcessing;
                m_AdditionalCameraDataAntialiasing.intValue              = (int)selectedAntialiasing;
                m_AdditionalCameraDataAntialiasingQuality.intValue       = (int)selectedAntialiasingQuality;
                m_AdditionalCameraDataStopNaN.boolValue   = selectedStopNaN;
                m_AdditionalCameraDataDithering.boolValue = selectedDithering;
                m_AdditionalCameraDataSO.ApplyModifiedProperties();
            }
        }