using System;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.Rendering;
#endif
namespace UnityEngine.Rendering.HighDefinition
{
///
/// Settings class that stores the default volume profile for Volume Framework.
///
[Serializable]
[SupportedOnRenderPipeline(typeof(HDRenderPipelineAsset))]
[Categorization.CategoryInfo(Name = "Volume", Order = 0)]
[Categorization.ElementInfo(Order = 0)]
public class HDRPDefaultVolumeProfileSettings : IDefaultVolumeProfileSettings
{
#region Version
internal enum Version : int
{
Initial = 0,
}
[SerializeField][HideInInspector]
Version m_Version;
/// Current version.
public int version => (int)m_Version;
#endregion
[SerializeField]
VolumeProfile m_VolumeProfile;
///
/// The default volume profile asset.
///
public VolumeProfile volumeProfile
{
get => m_VolumeProfile;
set => this.SetValueAndNotify(ref m_VolumeProfile, value);
}
}
#if UNITY_EDITOR
//Overriding "Reset" in menu that is not called at HDRPDefaultVolumeProfileSettings creation such Reset()
struct ResetImplementation : IRenderPipelineGraphicsSettingsContextMenu
{
public void PopulateContextMenu(HDRPDefaultVolumeProfileSettings setting, PropertyDrawer drawer, ref GenericMenu menu)
{
void Reset()
{
if (EditorGraphicsSettings.TryGetRenderPipelineSettingsForPipeline(out var rpgs))
{
RenderPipelineGraphicsSettingsEditorUtility.Rebind(
new HDRPDefaultVolumeProfileSettings() { volumeProfile = VolumeUtils.CopyVolumeProfileFromResourcesToAssets(rpgs.defaultVolumeProfile) },
typeof(HDRenderPipeline)
);
}
}
menu.AddItem(new GUIContent("Reset"), false, Reset);
}
}
#endif
}