Skip to content
Closed
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
4 changes: 3 additions & 1 deletion com.unity.render-pipelines.core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ The version number for this package has increased due to a version update of a r
### Added
- New `IVolumeDebugSettings` interface and `VolumeDebugSettings<T>` class that stores the information for the Volumes Debug Panel.
- Added AMD FidelityFX shaders which were originally in HDRP
- Added support for high performant unsafe (uint only) Radix, Merge and Insertion sort algorithms on CoreUnsafeUtils.
- Added warning on Volumes not supported by the current pipeline.
- Added option to hide not overrided properties on Volume Components.

### Fixed
- Fixed black pixel issue in AMD FidelityFX RCAS implementation
- Fixed a critical issue on android devices & lens flares. Accidentally creating a 16 bit texture was causing gpus not supporting them to fail.
- Fixed the processing of volumes that are not supported to the current pipeline.

## [12.0.0] - 2021-01-11

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,12 @@ public class VolumeComponentEditor
{
class Styles
{
public static GUIContent overrideSettingText { get; } = EditorGUIUtility.TrTextContent("", "Override this setting for this volume.");
public static GUIContent allText { get; } = EditorGUIUtility.TrTextContent("ALL", "Toggle all overrides on. To maximize performances you should only toggle overrides that you actually need.");
public static GUIContent noneText { get; } = EditorGUIUtility.TrTextContent("NONE", "Toggle all overrides off.");
public readonly static GUIContent overrideSettingText = EditorGUIUtility.TrTextContent("", "Override this setting for this volume.");
public readonly static GUIContent allText = EditorGUIUtility.TrTextContent("ALL", "Toggle all overrides on. To maximize performances you should only toggle overrides that you actually need.");
public readonly static GUIContent noneText = EditorGUIUtility.TrTextContent("NONE", "Toggle all overrides off.");

public static string toggleAllText { get; } = L10n.Tr("Toggle All");
public static readonly string toggleAllText = L10n.Tr("Toggle All");
public static readonly string unsuportedFeature = L10n.Tr("This feature is not supported by the current active render pipeline");

public const int overrideCheckboxWidth = 14;
public const int overrideCheckboxOffset = 9;
Expand Down Expand Up @@ -150,6 +151,27 @@ public bool showAdditionalProperties
}
}

EditorPrefBool m_ShowOnlyOverriddenParameters;
internal void SetShowOnlyOverridedParameters(bool value)
{
m_ShowOnlyOverriddenParameters.value = value;
}

internal void InitShowOnlyOverridedParametersPreference()
{
string key = $"UI_Show_Only_Overridden_Parameters_{GetType()}";
m_ShowOnlyOverriddenParameters = new EditorPrefBool(key);
}

/// <summary>
/// Set to true to show only the parameters that are overrided
/// </summary>
public bool showOnlyOverriddenParameters
{
get => m_ShowOnlyOverriddenParameters.value;
set => SetShowOnlyOverridedParameters(value);
}

/// <summary>
/// Start a scope for additional properties.
/// This will handle the highlight of the background when toggled on and off.
Expand Down Expand Up @@ -247,9 +269,10 @@ internal void Init(VolumeComponent target, Editor inspector)
this.target = target;
m_Inspector = inspector;
serializedObject = new SerializedObject(target);
activeProperty = serializedObject.FindProperty("active");
activeProperty = serializedObject.FindProperty("m_Active");

InitAdditionalPropertiesPreference();
InitShowOnlyOverridedParametersPreference();

m_AdditionalPropertiesAnimation = new AnimFloat(0, Repaint)
{
Expand Down Expand Up @@ -337,8 +360,18 @@ internal void OnInternalInspectorGUI()
serializedObject.Update();
using (new EditorGUILayout.VerticalScope())
{
TopRowFields();
OnInspectorGUI();
if (!target.supportedOnCurrentPipeline)
{
EditorGUILayout.HelpBox(Styles.unsuportedFeature, MessageType.Warning, true);
}
else
{
TopRowFields();
}

using (new EditorGUI.DisabledScope(!target.supportedOnCurrentPipeline))
OnInspectorGUI();

EditorGUILayout.Space();
}
serializedObject.ApplyModifiedProperties();
Expand Down Expand Up @@ -557,6 +590,9 @@ protected bool PropertyField(SerializedDataParameter property, GUIContent title)
/// <param name="title">A custom label and/or tooltip.</param>
private bool DrawPropertyField(SerializedDataParameter property, GUIContent title)
{
if (!property.overrideState.boolValue && showOnlyOverriddenParameters)
return false;

using (var scope = new OverridablePropertyScope(property, title, this))
{
if (!scope.displayed)
Expand Down Expand Up @@ -628,6 +664,9 @@ private bool DrawEmbeddedField(SerializedDataParameter property, GUIContent titl
/// <param name="property">The property to draw the override checkbox for</param>
protected void DrawOverrideCheckbox(SerializedDataParameter property)
{
if (!target.supportedOnCurrentPipeline)
return;

// Create a rect the height + vspacing of the property that is being overriden
float height = EditorGUI.GetPropertyHeight(property.value) + EditorGUIUtility.standardVerticalSpacing;
var overrideRect = GUILayoutUtility.GetRect(Styles.allText, CoreEditorStyles.miniLabelButton, GUILayout.Height(height), GUILayout.Width(Styles.overrideCheckboxWidth + Styles.overrideCheckboxOffset), GUILayout.ExpandWidth(false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ namespace UnityEditor.Rendering
/// </example>
public sealed class VolumeComponentListEditor
{
class Styles
{
public static readonly string noSRPInUse = L10n.Tr("No SRP in Use");
}

/// <summary>
/// A direct reference to the <see cref="VolumeProfile"/> this editor displays.
/// </summary>
Expand Down Expand Up @@ -89,6 +94,9 @@ public void Init(VolumeProfile asset, SerializedObject serializedObject)
Assert.IsNotNull(asset);
Assert.IsNotNull(serializedObject);

// Make sure that the volumes are being updated
asset.UpdateIsSupportedOnCurrentPipeline();

this.asset = asset;
m_SerializedObject = serializedObject;
m_ComponentsProperty = serializedObject.Find((VolumeProfile x) => x.components);
Expand Down Expand Up @@ -246,7 +254,7 @@ public void OnGUI()

if (displayContent)
{
using (new EditorGUI.DisabledScope(!editor.activeProperty.boolValue))
using (new EditorGUI.DisabledScope(!editor.activeProperty.boolValue && !editor.target.supportedOnCurrentPipeline))
editor.OnInternalInspectorGUI();
}
}
Expand Down Expand Up @@ -308,7 +316,8 @@ void OnContextClick(Vector2 position, VolumeComponentEditor targetEditor, int id
menu.AddItem(EditorGUIUtility.TrTextContent("Show Additional Properties"), targetEditor.showAdditionalProperties, () => targetEditor.showAdditionalProperties ^= true);
else
menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Show Additional Properties"));
menu.AddItem(EditorGUIUtility.TrTextContent("Show All Additional Properties..."), false, () => CoreRenderPipelinePreferences.Open());
menu.AddItem(EditorGUIUtility.TrTextContent("Show Only Overridden Parameters"), targetEditor.showOnlyOverriddenParameters, () => targetEditor.showOnlyOverriddenParameters = !targetEditor.showOnlyOverriddenParameters);
menu.AddItem(EditorGUIUtility.TrTextContent("Open Core Render Pipeline Preferences..."), false, () => CoreRenderPipelinePreferences.Open());

menu.AddSeparator(string.Empty);
menu.AddItem(EditorGUIUtility.TrTextContent("Copy Settings"), false, () => CopySettings(targetComponent));
Expand Down
7 changes: 7 additions & 0 deletions com.unity.render-pipelines.core/Editor/Volume/VolumeEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ private static void EnableAllOverrides(MenuCommand command)

public override void OnInspectorGUI()
{
var currentPipeline = RenderPipelineManager.currentPipeline;
if (currentPipeline == null)
{
EditorGUILayout.HelpBox("No SRP in use", MessageType.Warning, true);
return;
}

serializedObject.Update();

Rect lineRect = EditorGUILayout.GetControlRect();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.ObjectModel;
using System.Reflection;
using System.Linq;
using UnityEngine.Serialization;

namespace UnityEngine.Rendering
{
Expand Down Expand Up @@ -109,11 +110,21 @@ public Indent(int relativeAmount = 1)
=> this.relativeAmount = relativeAmount;
}

[SerializeField]
[FormerlySerializedAs("active")]
private bool m_Active = true;

internal bool supportedOnCurrentPipeline { get; set; } = true;

/// <summary>
/// The active state of the set of parameters defined in this class. You can use this to
/// quickly turn on or off all the overrides at once.
/// </summary>
public bool active = true;
public bool active
{
get => m_Active && supportedOnCurrentPipeline;
set => m_Active = value;
}

/// <summary>
/// The name displayed in the component header. If you do not set a name, Unity generates one from
Expand Down
45 changes: 45 additions & 0 deletions com.unity.render-pipelines.core/Runtime/Volume/VolumeProfile.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine.Assertions;

namespace UnityEngine.Rendering
Expand Down Expand Up @@ -30,6 +32,40 @@ void OnEnable()
// harmless and happens because Unity does a redraw of the editor (and thus the current
// frame) before the recompilation step.
components.RemoveAll(x => x == null);

// Subscribe to the changes performed on the current pipeline to know which Volume Components are supported on the current pipeline
RenderPipelineManager.activeRenderPipelineTypeChanged += UpdateIsSupportedOnCurrentPipeline;
UpdateIsSupportedOnCurrentPipeline();
}

private void OnDisable()
{
RenderPipelineManager.activeRenderPipelineTypeChanged -= UpdateIsSupportedOnCurrentPipeline;
}

internal void UpdateIsSupportedOnCurrentPipeline()
{
var currentPipeline = RenderPipelineManager.currentPipeline;
if (currentPipeline != null)
{
var currentPipelineType = currentPipeline.GetType();
foreach (var component in components)
{
SetIsSupportedOnPipeline(component, currentPipelineType);
}
}
}

void SetIsSupportedOnPipeline(VolumeComponent component, Type renderPipelineType)
{
bool supportedOnCurrentPipeline = true;

// Get the supported pipelines for the volume component
if (component.GetType().GetCustomAttribute(typeof(VolumeComponentMenuForRenderPipeline), false) is VolumeComponentMenuForRenderPipeline supportedOn)
{
supportedOnCurrentPipeline = supportedOn.pipelineTypes.Contains(renderPipelineType);
}
component.supportedOnCurrentPipeline = supportedOnCurrentPipeline;
}

/// <summary>
Expand Down Expand Up @@ -80,7 +116,16 @@ public VolumeComponent Add(Type type, bool overrides = false)
component.name = type.Name;
#endif
component.SetAllOverridesTo(overrides);

var currentPipeline = RenderPipelineManager.currentPipeline;
if (currentPipeline != null)
{
var currentPipelineType = currentPipeline.GetType();
SetIsSupportedOnPipeline(component, currentPipeline.GetType());
}

components.Add(component);

isDirty = true;
return component;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ public override void OnInspectorGUI()
// If we have switched to custom quality from a preset, then load the last custom quality settings the user has used in this volume
if (prevQualityLevel != k_CustomQuality)
{
QualitySettingsBlob history = null;
s_CustomSettingsHistory.TryGetValue(serializedObject.targetObject, out history);
s_CustomSettingsHistory.TryGetValue(serializedObject.targetObject, out QualitySettingsBlob history);
if (history != null)
{
LoadSettingsFromObject(history);
Expand All @@ -180,14 +179,12 @@ public override void OnInspectorGUI()
else
{
// If we are going to use a quality preset, then load the preset values so they are reflected in the UI
var pipeline = (HDRenderPipeline)RenderPipelineManager.currentPipeline;
if (pipeline != null)
if (RenderPipelineManager.currentPipeline is HDRenderPipeline pipeline)
{
// If we switch from a custom quality level, then save these values so we can re-use them if teh user switches back
if (prevQualityLevel == k_CustomQuality)
{
QualitySettingsBlob history = null;
s_CustomSettingsHistory.TryGetValue(serializedObject.targetObject, out history);
s_CustomSettingsHistory.TryGetValue(serializedObject.targetObject, out QualitySettingsBlob history);
if (history != null)
{
SaveCustomQualitySettingsAsObject(history);
Expand Down