diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index cf64167a758..c15c475ca09 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -882,6 +882,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - The `CustomPassLoadCameraColor` and `CustomPassSampleCameraColor` functions now returns the correct color buffer when used in after post process instead of the color pyramid (which didn't had post processes). - PBR Sky now doesn't go black when going below sea level, but it instead freezes calculation as if on the horizon. - Fixed an issue with quality setting foldouts not opening when clicking on them (1253088). +- Shutter speed can now be changed by dragging the mouse over the UI label (case 1245007). ## [7.1.1] - 2019-09-05 diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Drawers.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Drawers.cs index b87477783d0..e78b29b0d24 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Drawers.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Drawers.cs @@ -359,43 +359,33 @@ static void Drawer_PhysicalCamera(SerializedHDCamera p, Editor owner) const int k_UnitMenuWidth = 80; const int k_OffsetPerIndent = 15; const int k_LabelFieldSeparator = 2; - float indentOffset = EditorGUI.indentLevel * k_OffsetPerIndent; + const int k_Offset = 1; int oldIndentLevel = EditorGUI.indentLevel; - - var lineRect = EditorGUILayout.GetControlRect(); - var labelRect = new Rect(lineRect.x, lineRect.y, EditorGUIUtility.labelWidth, lineRect.height); - var fieldRect = new Rect(labelRect.xMax + k_LabelFieldSeparator, lineRect.y, lineRect.width - labelRect.width - k_UnitMenuWidth - k_LabelFieldSeparator * 2, lineRect.height); - var unitMenu = new Rect(fieldRect.xMax + k_LabelFieldSeparator, lineRect.y, k_UnitMenuWidth, lineRect.height); - - //We cannot had the shutterSpeedState as this is not a serialized property but a global edition mode. - //This imply that it will never go bold nor can be reverted in prefab overrides - EditorGUI.BeginProperty(labelRect, shutterSpeedContent, p.shutterSpeed); - EditorGUI.LabelField(labelRect, shutterSpeedContent); - EditorGUI.EndProperty(); + + // Don't take into account the indentLevel when rendering the units field EditorGUI.indentLevel = 0; + var lineRect = EditorGUILayout.GetControlRect(); + var fieldRect = new Rect(k_OffsetPerIndent + k_LabelFieldSeparator + k_Offset, lineRect.y, lineRect.width - k_UnitMenuWidth, lineRect.height); + var unitMenu = new Rect(fieldRect.xMax + k_LabelFieldSeparator, lineRect.y, k_UnitMenuWidth - k_LabelFieldSeparator, lineRect.height); + + // We cannot had the shutterSpeedState as this is not a serialized property but a global edition mode. + // This imply that it will never go bold nor can be reverted in prefab overrides + m_ShutterSpeedState.value = (ShutterSpeedUnit)EditorGUI.Popup(unitMenu, (int)m_ShutterSpeedState.value, k_ShutterSpeedUnitNames); - - float previousShutterSpeed = p.shutterSpeed.floatValue; - if (previousShutterSpeed > 0f && m_ShutterSpeedState.value == ShutterSpeedUnit.OneOverSecond) - previousShutterSpeed = 1f / previousShutterSpeed; - + // Reset the indent level + EditorGUI.indentLevel = oldIndentLevel; + EditorGUI.BeginProperty(fieldRect, shutterSpeedContent, p.shutterSpeed); { - EditorGUI.BeginChangeCheck(); - var newShutterSpeed = EditorGUI.FloatField(fieldRect, previousShutterSpeed); - if (EditorGUI.EndChangeCheck()) - { - if (newShutterSpeed <= 0f) - p.shutterSpeed.floatValue = 0f; - else if (m_ShutterSpeedState.value == ShutterSpeedUnit.OneOverSecond) - p.shutterSpeed.floatValue = 1f / newShutterSpeed; - else - p.shutterSpeed.floatValue = newShutterSpeed; - } + // if we we use (1 / second) units, then change the value for the display and then revert it back + if (m_ShutterSpeedState.value == ShutterSpeedUnit.OneOverSecond && p.shutterSpeed.floatValue > 0) + p.shutterSpeed.floatValue = 1.0f / p.shutterSpeed.floatValue; + EditorGUI.PropertyField(fieldRect, p.shutterSpeed, shutterSpeedContent); + if (m_ShutterSpeedState.value == ShutterSpeedUnit.OneOverSecond && p.shutterSpeed.floatValue > 0) + p.shutterSpeed.floatValue = 1.0f / p.shutterSpeed.floatValue; } EditorGUI.EndProperty(); - EditorGUI.indentLevel = oldIndentLevel; using (var horizontal = new EditorGUILayout.HorizontalScope()) using (var propertyScope = new EditorGUI.PropertyScope(horizontal.rect, gateFitContent, cam.gateFit))