Skip to content
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.core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Added
- Added support for high performant unsafe (uint only) Radix, Merge and Insertion sort algorithms on CoreUnsafeUtils.
- Context menu on Volume Parameters to restore them to their default values.
- Added DebugFrameTiming class that can be used by render pipelines to display CPU/GPU frame timings and bottlenecks in Rendering Debugger.
- Added new DebugUI widget types: ProgressBarValue and ValueTuple
- Added common support code for FSR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ public override bool OnGUI(SerializedDataParameter parameter, GUIContent title)
return false;

var o = parameter.GetObjectRef<ColorParameter>();
value.colorValue = EditorGUILayout.ColorField(title, value.colorValue, o.showEyeDropper, o.showAlpha, o.hdr);

var rect = EditorGUILayout.GetControlRect();
EditorGUI.BeginProperty(rect, title, value);
value.colorValue = EditorGUI.ColorField(rect, title, value.colorValue, o.showEyeDropper, o.showAlpha, o.hdr);
EditorGUI.EndProperty();
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public override bool OnGUI(SerializedDataParameter parameter, GUIContent title)
return false;

var o = parameter.GetObjectRef<MinFloatParameter>();
float v = EditorGUILayout.FloatField(title, value.floatValue);
value.floatValue = Mathf.Max(v, o.min);
EditorGUILayout.PropertyField(value, title);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Float fields do not implement the context menu, just property fields.

value.floatValue = Mathf.Max(value.floatValue, o.min);
return true;
}
}
Expand All @@ -31,8 +31,8 @@ public override bool OnGUI(SerializedDataParameter parameter, GUIContent title)
return false;

var o = parameter.GetObjectRef<NoInterpMinFloatParameter>();
float v = EditorGUILayout.FloatField(title, value.floatValue);
value.floatValue = Mathf.Max(v, o.min);
EditorGUILayout.PropertyField(value, title);
value.floatValue = Mathf.Max(value.floatValue, o.min);
return true;
}
}
Expand All @@ -48,8 +48,8 @@ public override bool OnGUI(SerializedDataParameter parameter, GUIContent title)
return false;

var o = parameter.GetObjectRef<MaxFloatParameter>();
float v = EditorGUILayout.FloatField(title, value.floatValue);
value.floatValue = Mathf.Min(v, o.max);
EditorGUILayout.PropertyField(value, title);
value.floatValue = Mathf.Min(value.floatValue, o.max);
return true;
}
}
Expand All @@ -65,8 +65,8 @@ public override bool OnGUI(SerializedDataParameter parameter, GUIContent title)
return false;

var o = parameter.GetObjectRef<NoInterpMaxFloatParameter>();
float v = EditorGUILayout.FloatField(title, value.floatValue);
value.floatValue = Mathf.Min(v, o.max);
EditorGUILayout.PropertyField(value, title);
value.floatValue = Mathf.Min(value.floatValue, o.max);
return true;
}
}
Expand Down Expand Up @@ -132,10 +132,12 @@ public override bool OnGUI(SerializedDataParameter parameter, GUIContent title)
var sliderRect = new Rect(floatFieldLeft.xMax + kSeparatorWidth - indentOffset, lineRect.y, lineRect.width - labelRect.width - kFloatFieldWidth * 2 - kSeparatorWidth * 2, lineRect.height);
var floatFieldRight = new Rect(sliderRect.xMax + kSeparatorWidth - indentOffset, lineRect.y, kFloatFieldWidth + indentOffset, lineRect.height);

EditorGUI.BeginProperty(lineRect, title, value);
EditorGUI.PrefixLabel(labelRect, title);
v.x = EditorGUI.FloatField(floatFieldLeft, v.x);
EditorGUI.MinMaxSlider(sliderRect, ref v.x, ref v.y, o.min, o.max);
v.y = EditorGUI.FloatField(floatFieldRight, v.y);
EditorGUI.EndProperty();

value.vector2Value = v;
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public override bool OnGUI(SerializedDataParameter parameter, GUIContent title)
return false;

var o = parameter.GetObjectRef<MinIntParameter>();
int v = EditorGUILayout.IntField(title, value.intValue);
value.intValue = Mathf.Max(v, o.min);
EditorGUILayout.PropertyField(value, title);
value.intValue = Mathf.Max(value.intValue, o.min);
return true;
}
}
Expand All @@ -32,8 +32,8 @@ public override bool OnGUI(SerializedDataParameter parameter, GUIContent title)
return false;

var o = parameter.GetObjectRef<NoInterpMinIntParameter>();
int v = EditorGUILayout.IntField(title, value.intValue);
value.intValue = Mathf.Max(v, o.min);
EditorGUILayout.PropertyField(value, title);
value.intValue = Mathf.Max(value.intValue, o.min);
return true;
}
}
Expand All @@ -49,8 +49,8 @@ public override bool OnGUI(SerializedDataParameter parameter, GUIContent title)
return false;

var o = parameter.GetObjectRef<MaxIntParameter>();
int v = EditorGUILayout.IntField(title, value.intValue);
value.intValue = Mathf.Min(v, o.max);
EditorGUILayout.PropertyField(value, title);
value.intValue = Mathf.Min(value.intValue, o.max);
return true;
}
}
Expand All @@ -66,8 +66,8 @@ public override bool OnGUI(SerializedDataParameter parameter, GUIContent title)
return false;

var o = parameter.GetObjectRef<NoInterpMaxIntParameter>();
int v = EditorGUILayout.IntField(title, value.intValue);
value.intValue = Mathf.Min(v, o.max);
EditorGUILayout.PropertyField(value, title);
value.intValue = Mathf.Min(value.intValue, o.max);
return true;
}
}
Expand All @@ -83,8 +83,11 @@ public override bool OnGUI(SerializedDataParameter parameter, GUIContent title)
return false;

var o = parameter.GetObjectRef<ClampedIntParameter>();
EditorGUILayout.IntSlider(value, o.min, o.max, title);
var lineRect = EditorGUILayout.GetControlRect();
EditorGUI.BeginProperty(lineRect, title, value);
EditorGUI.IntSlider(lineRect, value, o.min, o.max, title);
value.intValue = Mathf.Clamp(value.intValue, o.min, o.max);
EditorGUI.EndProperty();
return true;
}
}
Expand All @@ -100,8 +103,11 @@ public override bool OnGUI(SerializedDataParameter parameter, GUIContent title)
return false;

var o = parameter.GetObjectRef<NoInterpClampedIntParameter>();
EditorGUILayout.IntSlider(value, o.min, o.max, title);
var lineRect = EditorGUILayout.GetControlRect();
EditorGUI.BeginProperty(lineRect, title, value);
EditorGUI.IntSlider(lineRect, value, o.min, o.max, title);
value.intValue = Mathf.Clamp(value.intValue, o.min, o.max);
EditorGUI.EndProperty();
return true;
}
}
Expand Down Expand Up @@ -151,9 +157,11 @@ public override bool OnGUI(SerializedDataParameter parameter, GUIContent title)
if (value.propertyType != SerializedPropertyType.LayerMask)
return false;

var lineRect = EditorGUILayout.GetControlRect();
EditorGUI.BeginProperty(lineRect, title, value);
value.intValue = FieldToLayerMask(
EditorGUILayout.MaskField(title, LayerMaskToField(value.intValue), InternalEditorUtility.layers));

EditorGUI.MaskField(lineRect, title, LayerMaskToField(value.intValue), InternalEditorUtility.layers));
EditorGUI.EndProperty();
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ public override bool OnGUI(SerializedDataParameter parameter, GUIContent title)
if (value.propertyType != SerializedPropertyType.ObjectReference)
return false;

TextureParameterHelper.DoObjectField(value, title, typeof(Texture2D), typeof(RenderTexture), validator);
var rect = EditorGUILayout.GetControlRect();
EditorGUI.BeginProperty(rect, title, value);
TextureParameterHelper.DoObjectField(rect, value, title, typeof(Texture2D), typeof(RenderTexture), validator);
EditorGUI.EndProperty();
return true;
}
}
Expand All @@ -132,7 +135,10 @@ public override bool OnGUI(SerializedDataParameter parameter, GUIContent title)
if (value.propertyType != SerializedPropertyType.ObjectReference)
return false;

TextureParameterHelper.DoObjectField(value, title, typeof(Texture3D), typeof(RenderTexture), validator);
var rect = EditorGUILayout.GetControlRect();
EditorGUI.BeginProperty(rect, title, value);
TextureParameterHelper.DoObjectField(rect, value, title, typeof(Texture3D), typeof(RenderTexture), validator);
EditorGUI.EndProperty();
return true;
}
}
Expand All @@ -157,7 +163,10 @@ static internal bool OnGUI(SerializedProperty value, GUIContent title)
if (value.propertyType != SerializedPropertyType.ObjectReference)
return false;

TextureParameterHelper.DoObjectField(value, title, typeof(Cubemap), typeof(RenderTexture), validator);
var rect = EditorGUILayout.GetControlRect();
EditorGUI.BeginProperty(rect, title, value);
TextureParameterHelper.DoObjectField(rect, value, title, typeof(Cubemap), typeof(RenderTexture), validator);
EditorGUI.EndProperty();
return true;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#if UNITY_EDITOR

using System;
using UnityEditor;

namespace UnityEngine.Rendering
{
public partial class VolumeComponent : IApplyRevertPropertyContextMenuItemProvider
{
public bool TryGetRevertMethodForFieldName(SerializedProperty property, out Action<SerializedProperty> revertMethod)
{
revertMethod = property =>
{
var defaultVolumeComponent = VolumeManager.instance.GetDefaultVolumeComponent(property.serializedObject.targetObject.GetType());
Undo.RecordObject(property.serializedObject.targetObject, $"Revert property {property.propertyPath} from {property.serializedObject}");
SerializedObject serializedObject = new SerializedObject(defaultVolumeComponent);
var serializedProperty = serializedObject.FindProperty(property.propertyPath);
property.serializedObject.CopyFromSerializedProperty(serializedProperty);
property.serializedObject.ApplyModifiedProperties();
};

return true;
}

public string GetSourceTerm()
{
return "Property";
}

public bool TryGetApplyMethodForFieldName(SerializedProperty property, out Action<SerializedProperty> applyMethod)
{
applyMethod = null;
return false;
}

public string GetSourceName(Component comp)
{
return string.Empty;
}
}
}
#endif

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Reflection;
using System.Linq;
using System.Reflection;

namespace UnityEngine.Rendering
{
Expand Down Expand Up @@ -92,7 +92,7 @@ public sealed class VolumeComponentDeprecated : Attribute
/// </code>
/// </example>
[Serializable]
public class VolumeComponent : ScriptableObject
public partial class VolumeComponent : ScriptableObject
{
/// <summary>
/// Local attribute for VolumeComponent fields only.
Expand Down Expand Up @@ -146,7 +146,10 @@ internal static void FindParameters(object o, List<VolumeParameter> parameters,
if (field.FieldType.IsSubclassOf(typeof(VolumeParameter)))
{
if (filter?.Invoke(field) ?? true)
parameters.Add((VolumeParameter)field.GetValue(o));
{
VolumeParameter volumeParameter = (VolumeParameter)field.GetValue(o);
parameters.Add(volumeParameter);
}
}
else if (!field.FieldType.IsArray && field.FieldType.IsClass)
FindParameters(field.GetValue(o), parameters, filter);
Expand Down
11 changes: 11 additions & 0 deletions com.unity.render-pipelines.core/Runtime/Volume/VolumeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ public IEnumerable<Type> baseComponentTypes
// would be error-prone)
readonly List<VolumeComponent> m_ComponentsDefaultState;

internal VolumeComponent GetDefaultVolumeComponent(Type volumeComponentType)
{
foreach (VolumeComponent component in m_ComponentsDefaultState)
{
if (component.GetType() == volumeComponentType)
return component;
}

return null;
}

// Recycled list used for volume traversal
readonly List<Collider> m_TempColliders;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,11 @@ public override bool OnGUI(SerializedDataParameter parameter, GUIContent title)
float max = o.normalized ? 100f : o.representationDistance;
float modifiableValue = value.floatValue * max;
EditorGUI.BeginChangeCheck();
modifiableValue = EditorGUILayout.Slider(title, modifiableValue, 0f, max);

var lineRect = EditorGUILayout.GetControlRect();
EditorGUI.BeginProperty(lineRect, title, value);
modifiableValue = EditorGUI.Slider(lineRect, title, modifiableValue, 0f, max);
EditorGUI.EndProperty();
if (EditorGUI.EndChangeCheck())
{
modifiableValue /= max;
Expand All @@ -214,7 +218,10 @@ public override bool OnGUI(SerializedDataParameter parameter, GUIContent title)
float max = o.normalized ? 100f : o.representationDistance;
float modifiableValue = value.floatValue * max;
EditorGUI.BeginChangeCheck();
modifiableValue = EditorGUILayout.Slider(title, modifiableValue, 0f, max);
var lineRect = EditorGUILayout.GetControlRect();
EditorGUI.BeginProperty(lineRect, title, value);
modifiableValue = EditorGUI.Slider(lineRect, title, modifiableValue, 0f, max);
EditorGUI.EndProperty();
if (EditorGUI.EndChangeCheck())
value.floatValue = Mathf.Clamp01(modifiableValue / max);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,13 @@ protected void CommonSkySettingsGUI()
{
if (scope.displayed)
{
var rect = EditorGUILayout.GetControlRect();
EditorGUI.BeginProperty(rect, m_SkyIntensityModeLabel, m_IntensityMode.value);
if (m_EnableLuxIntensityMode)
m_IntensityMode.value.intValue = EditorGUILayout.IntPopup(m_SkyIntensityModeLabel, (int)m_IntensityMode.value.intValue, m_IntensityModes, m_IntensityModeValues);
m_IntensityMode.value.intValue = EditorGUI.IntPopup(rect, m_SkyIntensityModeLabel, (int)m_IntensityMode.value.intValue, m_IntensityModes, m_IntensityModeValues);
else
m_IntensityMode.value.intValue = EditorGUILayout.IntPopup(m_SkyIntensityModeLabel, (int)m_IntensityMode.value.intValue, m_IntensityModesNoLux, m_IntensityModeValuesNoLux);
m_IntensityMode.value.intValue = EditorGUI.IntPopup(rect, m_SkyIntensityModeLabel, (int)m_IntensityMode.value.intValue, m_IntensityModesNoLux, m_IntensityModeValuesNoLux);
EditorGUI.EndProperty();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public int sampleCount
}

[SerializeField, FormerlySerializedAs("sampleCount")]
private NoInterpClampedIntParameter m_SampleCount = new NoInterpClampedIntParameter(8, 4, 64);
private NoInterpClampedIntParameter m_SampleCount = new NoInterpClampedIntParameter(10, 4, 64);

ContactShadows()
{
Expand Down