Пример #1
0
        public override void OnInspectorGUI()
        {
            base.serializedObject.Update();
            Camera camera = (Camera)this.target;

            this.m_ShowBGColorOptions.target  = (!this.m_ClearFlags.hasMultipleDifferentValues && (camera.clearFlags == CameraClearFlags.Color || camera.clearFlags == CameraClearFlags.Skybox));
            this.m_ShowOrthoOptions.target    = (!this.m_Orthographic.hasMultipleDifferentValues && camera.orthographic);
            this.m_ShowDeferredWarning.target = this.deferredWarningValue;
            EditorGUILayout.PropertyField(this.m_ClearFlags, new GUILayoutOption[0]);
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowBGColorOptions.faded))
            {
                EditorGUILayout.PropertyField(this.m_BackgroundColor, new GUIContent("Background", "Camera clears the screen to this color before rendering."), new GUILayoutOption[0]);
            }
            EditorGUILayout.EndFadeGroup();
            EditorGUILayout.PropertyField(this.m_CullingMask, new GUILayoutOption[0]);
            EditorGUILayout.Space();
            CameraEditor.ProjectionType projectionType = (!this.m_Orthographic.boolValue) ? CameraEditor.ProjectionType.Perspective : CameraEditor.ProjectionType.Orthographic;
            EditorGUI.BeginChangeCheck();
            EditorGUI.showMixedValue = this.m_Orthographic.hasMultipleDifferentValues;
            projectionType           = (CameraEditor.ProjectionType)EditorGUILayout.EnumPopup("Projection", projectionType, new GUILayoutOption[0]);
            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                this.m_Orthographic.boolValue = (projectionType == CameraEditor.ProjectionType.Orthographic);
            }
            if (!this.m_Orthographic.hasMultipleDifferentValues)
            {
                if (EditorGUILayout.BeginFadeGroup(this.m_ShowOrthoOptions.faded))
                {
                    EditorGUILayout.PropertyField(this.m_OrthographicSize, new GUIContent("Size"), new GUILayoutOption[0]);
                }
                EditorGUILayout.EndFadeGroup();
                if (EditorGUILayout.BeginFadeGroup(1f - this.m_ShowOrthoOptions.faded))
                {
                    EditorGUILayout.Slider(this.m_FieldOfView, 1f, 179f, new GUIContent("Field of View"), new GUILayoutOption[0]);
                }
                EditorGUILayout.EndFadeGroup();
            }
            EditorGUILayout.PropertiesField(EditorGUI.s_ClipingPlanesLabel, this.m_NearAndFarClippingPlanes, EditorGUI.s_NearAndFarLabels, 35f, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_NormalizedViewPortRect, this.m_ViewportLabel, new GUILayoutOption[0]);
            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(this.m_Depth, new GUILayoutOption[0]);
            EditorGUILayout.IntPopup(this.m_RenderingPath, CameraEditor.kCameraRenderPaths, CameraEditor.kCameraRenderPathValues, EditorGUIUtility.TempContent("Rendering Path"), new GUILayoutOption[0]);
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowDeferredWarning.faded))
            {
                GUIContent gUIContent = EditorGUIUtility.TextContent("CameraEditor.DeferredProOnly");
                EditorGUILayout.HelpBox(gUIContent.text, MessageType.Warning, false);
            }
            EditorGUILayout.EndFadeGroup();
            EditorGUILayout.PropertyField(this.m_TargetTexture, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_OcclusionCulling, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_HDR, new GUILayoutOption[0]);
            if (Display.MultiDisplayLicense())
            {
                EditorGUILayout.IntPopup(this.m_TargetDisplay, CameraEditor.s_GameDisplays, CameraEditor.s_GameDisplayValues, EditorGUIUtility.TempContent("Target Display"), new GUILayoutOption[0]);
            }
            this.DepthTextureModeGUI();
            this.CommandBufferGUI();
            base.serializedObject.ApplyModifiedProperties();
        }
Пример #2
0
 public void DrawProjection()
 {
     CameraEditor.ProjectionType projectionType = (!this.orthographic.boolValue) ? CameraEditor.ProjectionType.Perspective : CameraEditor.ProjectionType.Orthographic;
     EditorGUI.BeginChangeCheck();
     EditorGUI.showMixedValue = this.orthographic.hasMultipleDifferentValues;
     projectionType           = (CameraEditor.ProjectionType)EditorGUILayout.EnumPopup(EditorGUIUtility.TextContent("Projection|How the Camera renders perspective.\n\nChoose Perspective to render objects with perspective.\n\nChoose Orthographic to render objects uniformly, with no sense of perspective."), projectionType, new GUILayoutOption[0]);
     EditorGUI.showMixedValue = false;
     if (EditorGUI.EndChangeCheck())
     {
         this.orthographic.boolValue = (projectionType == CameraEditor.ProjectionType.Orthographic);
     }
     if (!this.orthographic.hasMultipleDifferentValues)
     {
         if (projectionType == CameraEditor.ProjectionType.Orthographic)
         {
             EditorGUILayout.PropertyField(this.orthographicSize, new GUIContent("Size"), new GUILayoutOption[0]);
         }
         else
         {
             EditorGUILayout.Slider(this.fieldOfView, 1f, 179f, EditorGUIUtility.TextContent("Field of View|The width of the Camera’s view angle, measured in degrees along the local Y axis."), new GUILayoutOption[0]);
         }
     }
 }
Пример #3
0
        public override void OnInspectorGUI()
        {
            this.serializedObject.Update();
            Camera target = (Camera)this.target;

            this.m_ShowBGColorOptions.target  = !this.m_ClearFlags.hasMultipleDifferentValues && (target.clearFlags == CameraClearFlags.Color || target.clearFlags == CameraClearFlags.Skybox);
            this.m_ShowOrthoOptions.target    = !this.m_Orthographic.hasMultipleDifferentValues && target.orthographic;
            this.m_ShowTargetEyeOption.target = this.m_TargetEye.intValue != 3 || PlayerSettings.virtualRealitySupported || PlayerSettings.stereoscopic3D;
            EditorGUILayout.PropertyField(this.m_ClearFlags);
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowBGColorOptions.faded))
            {
                EditorGUILayout.PropertyField(this.m_BackgroundColor, new GUIContent("Background", "Camera clears the screen to this color before rendering."), new GUILayoutOption[0]);
            }
            EditorGUILayout.EndFadeGroup();
            EditorGUILayout.PropertyField(this.m_CullingMask);
            EditorGUILayout.Space();
            CameraEditor.ProjectionType projectionType1 = !this.m_Orthographic.boolValue ? CameraEditor.ProjectionType.Perspective : CameraEditor.ProjectionType.Orthographic;
            EditorGUI.BeginChangeCheck();
            EditorGUI.showMixedValue = this.m_Orthographic.hasMultipleDifferentValues;
            CameraEditor.ProjectionType projectionType2 = (CameraEditor.ProjectionType)EditorGUILayout.EnumPopup("Projection", (Enum)projectionType1, new GUILayoutOption[0]);
            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                this.m_Orthographic.boolValue = projectionType2 == CameraEditor.ProjectionType.Orthographic;
            }
            if (!this.m_Orthographic.hasMultipleDifferentValues)
            {
                if (EditorGUILayout.BeginFadeGroup(this.m_ShowOrthoOptions.faded))
                {
                    EditorGUILayout.PropertyField(this.m_OrthographicSize, new GUIContent("Size"), new GUILayoutOption[0]);
                }
                EditorGUILayout.EndFadeGroup();
                if (EditorGUILayout.BeginFadeGroup(1f - this.m_ShowOrthoOptions.faded))
                {
                    EditorGUILayout.Slider(this.m_FieldOfView, 1f, 179f, new GUIContent("Field of View"), new GUILayoutOption[0]);
                }
                EditorGUILayout.EndFadeGroup();
            }
            EditorGUILayout.PropertiesField(EditorGUI.s_ClipingPlanesLabel, this.m_NearAndFarClippingPlanes, EditorGUI.s_NearAndFarLabels, 35f);
            EditorGUILayout.PropertyField(this.m_NormalizedViewPortRect, this.m_ViewportLabel, new GUILayoutOption[0]);
            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(this.m_Depth);
            EditorGUILayout.IntPopup(this.m_RenderingPath, CameraEditor.kCameraRenderPaths, CameraEditor.kCameraRenderPathValues, EditorGUIUtility.TempContent("Rendering Path"), new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_TargetTexture);
            EditorGUILayout.PropertyField(this.m_OcclusionCulling);
            EditorGUILayout.PropertyField(this.m_HDR);
            if (this.m_HDR.boolValue)
            {
                this.DisplayHDRWarnings();
            }
            if (PlayerSettings.stereoscopic3D)
            {
                EditorGUILayout.PropertyField(this.m_StereoSeparation);
                EditorGUILayout.PropertyField(this.m_StereoConvergence);
            }
            if (this.ShouldShowTargetDisplayProperty())
            {
                int intValue = this.m_TargetDisplay.intValue;
                EditorGUILayout.Space();
                EditorGUILayout.IntPopup(this.m_TargetDisplay, DisplayUtility.GetDisplayNames(), DisplayUtility.GetDisplayIndices(), EditorGUIUtility.TempContent("Target Display"), new GUILayoutOption[0]);
                if (intValue != this.m_TargetDisplay.intValue)
                {
                    GameView.RepaintAll();
                }
            }
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowTargetEyeOption.faded))
            {
                EditorGUILayout.IntPopup(this.m_TargetEye, CameraEditor.kTargetEyes, CameraEditor.kTargetEyeValues, EditorGUIUtility.TempContent("Target Eye"), new GUILayoutOption[0]);
            }
            EditorGUILayout.EndFadeGroup();
            this.DepthTextureModeGUI();
            this.CommandBufferGUI();
            this.serializedObject.ApplyModifiedProperties();
        }
Пример #4
0
        public override void OnInspectorGUI()
        {
            base.serializedObject.Update();
            Camera camera = (Camera)base.target;

            this.m_ShowBGColorOptions.target  = (!this.m_ClearFlags.hasMultipleDifferentValues && (camera.clearFlags == CameraClearFlags.Color || camera.clearFlags == CameraClearFlags.Skybox));
            this.m_ShowOrthoOptions.target    = (!this.m_Orthographic.hasMultipleDifferentValues && camera.orthographic);
            this.m_ShowTargetEyeOption.target = (this.m_TargetEye.intValue != 3 || PlayerSettings.virtualRealitySupported);
            EditorGUILayout.PropertyField(this.m_ClearFlags, new GUILayoutOption[0]);
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowBGColorOptions.faded))
            {
                EditorGUILayout.PropertyField(this.m_BackgroundColor, new GUIContent("Background", "Camera clears the screen to this color before rendering."), new GUILayoutOption[0]);
            }
            EditorGUILayout.EndFadeGroup();
            EditorGUILayout.PropertyField(this.m_CullingMask, new GUILayoutOption[0]);
            EditorGUILayout.Space();
            CameraEditor.ProjectionType projectionType = (!this.m_Orthographic.boolValue) ? CameraEditor.ProjectionType.Perspective : CameraEditor.ProjectionType.Orthographic;
            EditorGUI.BeginChangeCheck();
            EditorGUI.showMixedValue = this.m_Orthographic.hasMultipleDifferentValues;
            projectionType           = (CameraEditor.ProjectionType)EditorGUILayout.EnumPopup("Projection", projectionType, new GUILayoutOption[0]);
            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                this.m_Orthographic.boolValue = (projectionType == CameraEditor.ProjectionType.Orthographic);
            }
            if (!this.m_Orthographic.hasMultipleDifferentValues)
            {
                if (EditorGUILayout.BeginFadeGroup(this.m_ShowOrthoOptions.faded))
                {
                    EditorGUILayout.PropertyField(this.m_OrthographicSize, new GUIContent("Size"), new GUILayoutOption[0]);
                }
                EditorGUILayout.EndFadeGroup();
                if (EditorGUILayout.BeginFadeGroup(1f - this.m_ShowOrthoOptions.faded))
                {
                    EditorGUILayout.Slider(this.m_FieldOfView, 1f, 179f, new GUIContent("Field of View"), new GUILayoutOption[0]);
                }
                EditorGUILayout.EndFadeGroup();
            }
            EditorGUILayout.PropertiesField(EditorGUI.s_ClipingPlanesLabel, this.m_NearAndFarClippingPlanes, EditorGUI.s_NearAndFarLabels, 35f, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_NormalizedViewPortRect, this.m_ViewportLabel, new GUILayoutOption[0]);
            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(this.m_Depth, new GUILayoutOption[0]);
            EditorGUILayout.IntPopup(this.m_RenderingPath, CameraEditor.kCameraRenderPaths, CameraEditor.kCameraRenderPathValues, EditorGUIUtility.TempContent("Rendering Path"), new GUILayoutOption[0]);
            if (this.m_ShowOrthoOptions.target && this.wantDeferredRendering)
            {
                EditorGUILayout.HelpBox("Deferred rendering does not work with Orthographic camera, will use Forward.", MessageType.Warning, true);
            }
            EditorGUILayout.PropertyField(this.m_TargetTexture, new GUILayoutOption[0]);
            if (!this.m_TargetTexture.hasMultipleDifferentValues)
            {
                RenderTexture renderTexture = this.m_TargetTexture.objectReferenceValue as RenderTexture;
                if (renderTexture && renderTexture.antiAliasing > 1 && this.wantDeferredRendering)
                {
                    EditorGUILayout.HelpBox("Manual MSAA target set with deferred rendering. This will lead to undefined behavior.", MessageType.Warning, true);
                }
            }
            EditorGUILayout.PropertyField(this.m_OcclusionCulling, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_HDR, EditorGUIUtility.TempContent("Allow HDR"), new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_AllowMSAA, new GUILayoutOption[0]);
            this.DisplayCameraWarnings();
            if (PlayerSettings.virtualRealitySupported)
            {
                EditorGUILayout.PropertyField(this.m_StereoSeparation, new GUILayoutOption[0]);
                EditorGUILayout.PropertyField(this.m_StereoConvergence, new GUILayoutOption[0]);
            }
            if (this.ShouldShowTargetDisplayProperty())
            {
                int intValue = this.m_TargetDisplay.intValue;
                EditorGUILayout.Space();
                EditorGUILayout.IntPopup(this.m_TargetDisplay, DisplayUtility.GetDisplayNames(), DisplayUtility.GetDisplayIndices(), EditorGUIUtility.TempContent("Target Display"), new GUILayoutOption[0]);
                if (intValue != this.m_TargetDisplay.intValue)
                {
                    GameView.RepaintAll();
                }
            }
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowTargetEyeOption.faded))
            {
                EditorGUILayout.IntPopup(this.m_TargetEye, CameraEditor.kTargetEyes, CameraEditor.kTargetEyeValues, EditorGUIUtility.TempContent("Target Eye"), new GUILayoutOption[0]);
            }
            EditorGUILayout.EndFadeGroup();
            this.DepthTextureModeGUI();
            this.CommandBufferGUI();
            base.serializedObject.ApplyModifiedProperties();
        }