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
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ internal Editor inspector
set => m_Inspector = value;
}

/// <summary>
/// Obtains the <see cref="Volume"/> that is being edited from this volume component
/// </summary>
protected Volume volume => inspector?.target as Volume;

List<(GUIContent displayName, int displayOrder, SerializedDataParameter param)> m_Parameters;

static Dictionary<Type, VolumeParameterDrawer> s_ParameterDrawers;
Expand Down
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 @@ -120,6 +120,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed HDRP build issues with DOTS_INSTANCING_ON shader variant.
- Fixed default value of "Distortion Blur" from 1 to 0 according to the doc.
- Fixed Transparent Depth Pre/Post pass by default for the built-in HDRP Hair shader graph.
- Fixed NullReferenceException when opening a Volume Component with a Diffusion Profile with any inspector.

### Changed
- Converted most TGA textures files to TIF to reduce the size of HDRP material samples.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ namespace UnityEditor.Rendering.HighDefinition
sealed class DiffusionProfileOverrideEditor : VolumeComponentEditor
{
SerializedDataParameter m_DiffusionProfiles;
Volume m_Volume;

DiffusionProfileSettingsListUI listUI = new DiffusionProfileSettingsListUI();

Expand All @@ -23,8 +22,6 @@ sealed class DiffusionProfileOverrideEditor : VolumeComponentEditor
public override void OnEnable()
{
var o = new PropertyFetcher<DiffusionProfileOverride>(serializedObject);

m_Volume = (m_Inspector.target as Volume);
m_DiffusionProfiles = Unpack(o.Find(x => x.diffusionProfiles));
}

Expand All @@ -36,7 +33,7 @@ public override void OnInspectorGUI()

// If the volume is null it means that we're editing the component from the asset
// So we can't access the bounds of the volume to fill diffusion profiles used in the volume
if (m_Volume != null && !m_Volume.isGlobal)
if (volume != null && !volume.isGlobal)
{
if (GUILayout.Button("Fill Profile List With Scene Materials"))
FillProfileListWithScene();
Expand All @@ -54,10 +51,10 @@ void DrawDiffusionProfileElement(SerializedProperty element, Rect rect, int inde
void FillProfileListWithScene()
{
var profiles = new HashSet<DiffusionProfileSettings>();
if (m_Volume.isGlobal)
if (volume.isGlobal)
return;

var volumeCollider = m_Volume.GetComponent<Collider>();
var volumeCollider = volume.GetComponent<Collider>();

// Get all mesh renderers that are within the current volume
var diffusionProfiles = new List<DiffusionProfileSettings>();
Expand Down