Skip to content

HDRP - Shutter speed can now be changed by dragging the mouse over the UI label #1110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down