internal SerializedProbeSettings(SerializedProperty root) { this.root = root; type = root.Find((ProbeSettings p) => p.type); mode = root.Find((ProbeSettings p) => p.mode); realtimeMode = root.Find((ProbeSettings p) => p.realtimeMode); lightingMultiplier = root.FindPropertyRelative("lighting.multiplier"); lightingWeight = root.FindPropertyRelative("lighting.weight"); lightingFadeDistance = root.FindPropertyRelative("lighting.fadeDistance"); lightingLightLayer = root.FindPropertyRelative("lighting.lightLayer"); lightingRangeCompressionFactor = root.FindPropertyRelative("lighting.rangeCompressionFactor"); proxyUseInfluenceVolumeAsProxyVolume = root.FindPropertyRelative("proxySettings.useInfluenceVolumeAsProxyVolume"); proxyCapturePositionProxySpace = root.FindPropertyRelative("proxySettings.capturePositionProxySpace"); proxyCaptureRotationProxySpace = root.FindPropertyRelative("proxySettings.captureRotationProxySpace"); proxyMirrorPositionProxySpace = root.FindPropertyRelative("proxySettings.mirrorPositionProxySpace"); proxyMirrorRotationProxySpace = root.FindPropertyRelative("proxySettings.mirrorRotationProxySpace"); resolutionScalable = new SerializedScalableSettingValue(root.Find((ProbeSettings p) => p.resolutionScalable)); roughReflections = root.FindPropertyRelative("roughReflections"); distanceBasedRoughness = root.FindPropertyRelative("distanceBasedRoughness"); frustumFieldOfViewMode = root.FindPropertyRelative("frustum.fieldOfViewMode"); frustumFixedValue = root.FindPropertyRelative("frustum.fixedValue"); frustumViewerScale = root.FindPropertyRelative("frustum.viewerScale"); frustumAutomaticScale = root.FindPropertyRelative("frustum.automaticScale"); cameraSettings = new SerializedCameraSettings(root.Find((ProbeSettings p) => p.cameraSettings)); influence = new SerializedInfluenceVolume(root.Find((ProbeSettings p) => p.influence)); proxy = new SerializedProxyVolume(root.Find((ProbeSettings p) => p.proxy)); }
internal SerializedProbeSettings(SerializedProperty root) { this.root = root; type = root.Find((ProbeSettings p) => p.type); mode = root.Find((ProbeSettings p) => p.mode); realtimeMode = root.Find((ProbeSettings p) => p.realtimeMode); lightingMultiplier = root.FindPropertyRelative("lighting.multiplier"); lightingWeight = root.FindPropertyRelative("lighting.weight"); lightingLightLayer = root.FindPropertyRelative("lighting.lightLayer"); proxyUseInfluenceVolumeAsProxyVolume = root.FindPropertyRelative("proxySettings.useInfluenceVolumeAsProxyVolume"); proxyCapturePositionProxySpace = root.FindPropertyRelative("proxySettings.capturePositionProxySpace"); proxyCaptureRotationProxySpace = root.FindPropertyRelative("proxySettings.captureRotationProxySpace"); proxyMirrorPositionProxySpace = root.FindPropertyRelative("proxySettings.mirrorPositionProxySpace"); proxyMirrorRotationProxySpace = root.FindPropertyRelative("proxySettings.mirrorRotationProxySpace"); frustumFieldOfViewMode = root.FindPropertyRelative("frustum.fieldOfViewMode"); frustumFixedValue = root.FindPropertyRelative("frustum.fixedValue"); frustumViewerScale = root.FindPropertyRelative("frustum.viewerScale"); frustumAutomaticScale = root.FindPropertyRelative("frustum.automaticScale"); cameraSettings = new SerializedCameraSettings(root.Find((ProbeSettings p) => p.camera)); influence = new SerializedInfluenceVolume(root.Find((ProbeSettings p) => p.influence)); proxy = new SerializedProxyVolume(root.Find((ProbeSettings p) => p.proxy)); }
public static void Draw( SerializedCameraSettings serialized, Editor owner, CameraSettingsOverride displayedFields ) { const CameraSettingsFields bufferFields = CameraSettingsFields.bufferClearBackgroundColorHDR | CameraSettingsFields.bufferClearClearDepth | CameraSettingsFields.bufferClearColorMode; const CameraSettingsFields volumesFields = CameraSettingsFields.volumesAnchorOverride | CameraSettingsFields.volumesLayerMask; const CameraSettingsFields cullingFields = CameraSettingsFields.cullingCullingMask | CameraSettingsFields.cullingInvertFaceCulling | CameraSettingsFields.cullingUseOcclusionCulling; const CameraSettingsFields frustumFields = CameraSettingsFields.frustumAspect | CameraSettingsFields.frustumFarClipPlane | CameraSettingsFields.frustumMode | CameraSettingsFields.frustumNearClipPlane | CameraSettingsFields.frustumProjectionMatrix | CameraSettingsFields.frustumFieldOfView; const CameraSettingsFields frustumFarOrNearPlane = CameraSettingsFields.frustumFarClipPlane | CameraSettingsFields.frustumNearClipPlane; if ((displayedFields.camera & bufferFields) != 0) { PropertyFieldWithoutToggle(CameraSettingsFields.bufferClearColorMode, serialized.bufferClearColorMode, Styles.bufferClearColorMode, displayedFields.camera); PropertyFieldWithoutToggle(CameraSettingsFields.bufferClearBackgroundColorHDR, serialized.bufferClearBackgroundColorHDR, Styles.bufferClearBackgroundColorHDR, displayedFields.camera); PropertyFieldWithoutToggle(CameraSettingsFields.bufferClearClearDepth, serialized.bufferClearClearDepth, Styles.bufferClearClearDepth, displayedFields.camera); EditorGUILayout.Space(); } if ((displayedFields.camera & volumesFields) != 0) { PropertyFieldWithoutToggle(CameraSettingsFields.volumesLayerMask, serialized.volumesLayerMask, Styles.volumesLayerMask, displayedFields.camera); PropertyFieldWithoutToggle(CameraSettingsFields.volumesAnchorOverride, serialized.volumesAnchorOverride, Styles.volumesAnchorOverride, displayedFields.camera); EditorGUILayout.Space(); } if ((displayedFields.camera & cullingFields) != 0) { PropertyFieldWithoutToggle(CameraSettingsFields.cullingUseOcclusionCulling, serialized.cullingUseOcclusionCulling, Styles.cullingUseOcclusionCulling, displayedFields.camera); PropertyFieldWithoutToggle(CameraSettingsFields.cullingCullingMask, serialized.cullingCullingMask, Styles.cullingCullingMask, displayedFields.camera); PropertyFieldWithoutToggle(CameraSettingsFields.cullingInvertFaceCulling, serialized.cullingInvertFaceCulling, Styles.cullingInvertFaceCulling, displayedFields.camera); EditorGUILayout.Space(); } if ((displayedFields.camera & frustumFields) != 0) { PropertyFieldWithoutToggle(CameraSettingsFields.frustumAspect, serialized.frustumAspect, Styles.frustumAspect, displayedFields.camera); PropertyFieldWithoutToggle(CameraSettingsFields.frustumFieldOfView, serialized.frustumFieldOfView, Styles.frustumFieldOfView, displayedFields.camera); var areBothDisplayed = displayedFields.camera.HasFlag(frustumFarOrNearPlane); if (areBothDisplayed) { CoreEditorUtils.DrawMultipleFields( Styles.clippingPlanesLabel, new[] { serialized.frustumNearClipPlane, serialized.frustumFarClipPlane }, Styles.clippingPlanes); } else { PropertyFieldWithoutToggle(CameraSettingsFields.frustumFarClipPlane, serialized.frustumFarClipPlane, Styles.frustumFarClipPlane, displayedFields.camera); PropertyFieldWithoutToggle(CameraSettingsFields.frustumNearClipPlane, serialized.frustumNearClipPlane, Styles.frustumNearClipPlane, displayedFields.camera); } // Enforce valid value range serialized.frustumNearClipPlane.floatValue = Mathf.Max(CameraSettings.Frustum.MinNearClipPlane, serialized.frustumNearClipPlane.floatValue); serialized.frustumFarClipPlane.floatValue = Mathf.Max(serialized.frustumNearClipPlane.floatValue + CameraSettings.Frustum.MinFarClipPlane, serialized.frustumFarClipPlane.floatValue); EditorGUILayout.Space(); } PropertyFieldWithoutToggle(CameraSettingsFields.flipYMode, serialized.flipYMode, Styles.flipYMode, displayedFields.camera); PropertyFieldWithoutToggle(CameraSettingsFields.probeLayerMask, serialized.probeLayerMask, Styles.probeLayerMask, displayedFields.camera); PropertyFieldWithoutToggle(CameraSettingsFields.customRenderingSettings, serialized.customRenderingSettings, Styles.customRenderingSettings, displayedFields.camera); if ((displayedFields.camera & CameraSettingsFields.frameSettings) != 0) { //Warning, fullscreenPassThrough have been removed from RenderingPath enum //and replaced with a toggle on the camera. If this script aim to be used //on camera too, add it here. if (serialized.customRenderingSettings.boolValue) { --EditorGUI.indentLevel; //fix alignment issue for Planar Reflection and Reflection probe's FrameSettings // TODO: place it in static cache var drawer = FrameSettingsUI.Inspector(true); drawer.Draw(serialized.frameSettings, owner); ++EditorGUI.indentLevel; } } }
public static void Draw( SerializedCameraSettings serialized, Editor owner, SerializedCameraSettingsOverride @override, CameraSettingsOverride displayedFields, CameraSettingsOverride overridableFields ) { const CameraSettingsFields bufferFields = CameraSettingsFields.bufferClearBackgroundColorHDR | CameraSettingsFields.bufferClearClearDepth | CameraSettingsFields.bufferClearColorMode; const CameraSettingsFields volumesFields = CameraSettingsFields.volumesAnchorOverride | CameraSettingsFields.volumesLayerMask; const CameraSettingsFields cullingFields = CameraSettingsFields.cullingCullingMask | CameraSettingsFields.cullingInvertFaceCulling | CameraSettingsFields.cullingUseOcclusionCulling; const CameraSettingsFields frustumFields = CameraSettingsFields.frustumAspect | CameraSettingsFields.frustumFarClipPlane | CameraSettingsFields.frustumMode | CameraSettingsFields.frustumNearClipPlane | CameraSettingsFields.frustumProjectionMatrix | CameraSettingsFields.frustumFieldOfView; const CameraSettingsFields frustumFarOrNearPlane = CameraSettingsFields.frustumFarClipPlane | CameraSettingsFields.frustumNearClipPlane; if ((displayedFields.camera & bufferFields) != 0) { PropertyFieldWithFlagToggleIfDisplayed(CameraSettingsFields.bufferClearColorMode, serialized.bufferClearColorMode, EditorGUIUtility.TrTextContent("Clear Mode"), @override.camera, displayedFields.camera, overridableFields.camera); PropertyFieldWithFlagToggleIfDisplayed(CameraSettingsFields.bufferClearBackgroundColorHDR, serialized.bufferClearBackgroundColorHDR, EditorGUIUtility.TrTextContent("Background Color"), @override.camera, displayedFields.camera, overridableFields.camera); PropertyFieldWithFlagToggleIfDisplayed(CameraSettingsFields.bufferClearClearDepth, serialized.bufferClearClearDepth, EditorGUIUtility.TrTextContent("Clear Depth"), @override.camera, displayedFields.camera, overridableFields.camera); EditorGUILayout.Space(); } if ((displayedFields.camera & volumesFields) != 0) { PropertyFieldWithFlagToggleIfDisplayed(CameraSettingsFields.volumesLayerMask, serialized.volumesLayerMask, EditorGUIUtility.TrTextContent("Volume Layer Mask"), @override.camera, displayedFields.camera, overridableFields.camera); PropertyFieldWithFlagToggleIfDisplayed(CameraSettingsFields.volumesAnchorOverride, serialized.volumesAnchorOverride, EditorGUIUtility.TrTextContent("Volume Anchor Override"), @override.camera, displayedFields.camera, overridableFields.camera); EditorGUILayout.Space(); } if ((displayedFields.camera & cullingFields) != 0) { PropertyFieldWithFlagToggleIfDisplayed(CameraSettingsFields.cullingUseOcclusionCulling, serialized.cullingUseOcclusionCulling, EditorGUIUtility.TrTextContent("Use Occlusion Culling"), @override.camera, displayedFields.camera, overridableFields.camera); PropertyFieldWithFlagToggleIfDisplayed(CameraSettingsFields.cullingCullingMask, serialized.cullingCullingMask, EditorGUIUtility.TrTextContent("Culling Mask"), @override.camera, displayedFields.camera, overridableFields.camera); PropertyFieldWithFlagToggleIfDisplayed(CameraSettingsFields.cullingInvertFaceCulling, serialized.cullingCullingMask, EditorGUIUtility.TrTextContent("Invert Backface Culling"), @override.camera, displayedFields.camera, overridableFields.camera); EditorGUILayout.Space(); } if ((displayedFields.camera & frustumFields) != 0) { PropertyFieldWithFlagToggleIfDisplayed(CameraSettingsFields.frustumAspect, serialized.frustumAspect, EditorGUIUtility.TrTextContent("Aspect"), @override.camera, displayedFields.camera, overridableFields.camera); PropertyFieldWithFlagToggleIfDisplayed(CameraSettingsFields.frustumFieldOfView, serialized.frustumFieldOfView, EditorGUIUtility.TrTextContent("Field Of View"), @override.camera, displayedFields.camera, overridableFields.camera); var areBothOverrideable = overridableFields.camera.HasFlag(frustumFarOrNearPlane); var areBothNotOverrideable = (overridableFields.camera & frustumFarOrNearPlane) == 0; var areBothDisplayed = displayedFields.camera.HasFlag(frustumFarOrNearPlane); if (areBothDisplayed && (areBothOverrideable || areBothNotOverrideable)) { EditorGUILayout.BeginHorizontal(); if (areBothOverrideable) { GUI.enabled = FlagToggle(frustumFarOrNearPlane, @override.camera); } else { ReserveAndGetFlagToggleRect(); } UnityEditor.Rendering.CoreEditorUtils.DrawMultipleFields( "Clip Planes", new[] { serialized.frustumNearClipPlane, serialized.frustumFarClipPlane }, new[] { EditorGUIUtility.TrTextContent("Near"), EditorGUIUtility.TrTextContent("Far") }); GUI.enabled = true; EditorGUILayout.EndHorizontal(); } else { PropertyFieldWithFlagToggleIfDisplayed(CameraSettingsFields.frustumFarClipPlane, serialized.frustumFarClipPlane, EditorGUIUtility.TrTextContent("Far Clip Plane"), @override.camera, displayedFields.camera, overridableFields.camera); PropertyFieldWithFlagToggleIfDisplayed(CameraSettingsFields.frustumNearClipPlane, serialized.frustumNearClipPlane, EditorGUIUtility.TrTextContent("Near Clip Plane"), @override.camera, displayedFields.camera, overridableFields.camera); } EditorGUILayout.Space(); } PropertyFieldWithFlagToggleIfDisplayed(CameraSettingsFields.flipYMode, serialized.flipYMode, EditorGUIUtility.TrTextContent("Flip Y"), @override.camera, displayedFields.camera, overridableFields.camera); PropertyFieldWithFlagToggleIfDisplayed(CameraSettingsFields.probeLayerMask, serialized.probeLayerMask, EditorGUIUtility.TrTextContent("Probe Layer Mask"), @override.camera, displayedFields.camera, overridableFields.camera); PropertyFieldWithFlagToggleIfDisplayed(CameraSettingsFields.customRenderingSettings, serialized.customRenderingSettings, EditorGUIUtility.TrTextContent("Custom Frame Settings"), @override.camera, displayedFields.camera, overridableFields.camera); if ((displayedFields.camera & CameraSettingsFields.frameSettings) != 0) { //Warning, fullscreenPassThrough have been removed from RenderingPath enum //and replaced with a toggle on the camera. If this script aim to be used //on camera too, add it here. if (serialized.customRenderingSettings.boolValue) { --EditorGUI.indentLevel; //fix alignment issue for Planar Reflection and Reflection probe's FrameSettings // TODO: place it in static cache var drawer = FrameSettingsUI.Inspector(true); drawer.Draw(serialized.frameSettings, owner); ++EditorGUI.indentLevel; } } }