Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -581,6 +581,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed flickering of the game/scene view when lookdev is running.
- Fixed issue with reflection probes in realtime time mode with OnEnable baking having wrong lighting with sky set to dynamic (case 1238047).
- Fixed transparent motion vectors not working when in MSAA.
- Fix conflicts with Handles manipulation when performing a Reset in DecalComponent (case 1238833)

### Changed
- Improve MIP selection for decals on Transparents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private void OnEnable()
UpdateMaterialEditor();
foreach (var decalProjector in targets)
{
(decalProjector as DecalProjector).OnMaterialChange += UpdateMaterialEditor;
(decalProjector as DecalProjector).OnMaterialChange += RequireUpdateMaterialEditor;
}

// Fetch serialized properties
Expand All @@ -127,7 +127,7 @@ private void OnDisable()
{
foreach (var decalProjector in targets)
{
(decalProjector as DecalProjector).OnMaterialChange -= UpdateMaterialEditor;
(decalProjector as DecalProjector).OnMaterialChange -= RequireUpdateMaterialEditor;
}
s_Owner = null;
}
Expand All @@ -147,6 +147,10 @@ public Bounds OnGetFrameBounds()
return new Bounds(decalProjector.transform.position, handle.size);
}

private bool m_RequireUpdateMaterialEditor = false;

private void RequireUpdateMaterialEditor() => m_RequireUpdateMaterialEditor = true;

public void UpdateMaterialEditor()
{
int validMaterialsCount = 0;
Expand Down Expand Up @@ -317,41 +321,49 @@ Bounds GetBoundsGetter()

public override void OnInspectorGUI()
{
EditorGUI.BeginChangeCheck();
serializedObject.Update();

EditorGUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
DoInspectorToolbar(k_EditVolumeModes, editVolumeLabels, GetBoundsGetter, this);
if (m_RequireUpdateMaterialEditor)
{
UpdateMaterialEditor();
m_RequireUpdateMaterialEditor = false;
}

//[TODO: add editable pivot. Uncomment this when ready]
//DoInspectorToolbar(k_EditPivotModes, editPivotLabels, GetBoundsGetter, this);
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
EditorGUI.BeginChangeCheck();
{
EditorGUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
DoInspectorToolbar(k_EditVolumeModes, editVolumeLabels, GetBoundsGetter, this);

EditorGUILayout.Space();
//[TODO: add editable pivot. Uncomment this when ready]
//DoInspectorToolbar(k_EditPivotModes, editPivotLabels, GetBoundsGetter, this);
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();

EditorGUILayout.PropertyField(m_Size, k_SizeContent);
EditorGUILayout.PropertyField(m_MaterialProperty, k_MaterialContent);
EditorGUILayout.Space();

EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(m_DrawDistanceProperty, k_DistanceContent);
if (EditorGUI.EndChangeCheck() && m_DrawDistanceProperty.floatValue < 0f)
m_DrawDistanceProperty.floatValue = 0f;
EditorGUILayout.PropertyField(m_Size, k_SizeContent);
EditorGUILayout.PropertyField(m_MaterialProperty, k_MaterialContent);

EditorGUILayout.PropertyField(m_FadeScaleProperty, k_FadeScaleContent);
EditorGUILayout.PropertyField(m_UVScaleProperty, k_UVScaleContent);
EditorGUILayout.PropertyField(m_UVBiasProperty, k_UVBiasContent);
EditorGUILayout.PropertyField(m_FadeFactor, k_FadeFactorContent);
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(m_DrawDistanceProperty, k_DistanceContent);
if (EditorGUI.EndChangeCheck() && m_DrawDistanceProperty.floatValue < 0f)
m_DrawDistanceProperty.floatValue = 0f;

// only display the affects transparent property if material is HDRP/decal
if (showAffectTransparencyHaveMultipleDifferentValue)
{
using (new EditorGUI.DisabledScope(true))
EditorGUILayout.LabelField(EditorGUIUtility.TrTextContent("Multiple material type in selection"));
}
else if (showAffectTransparency)
EditorGUILayout.PropertyField(m_AffectsTransparencyProperty, k_AffectTransparentContent);
EditorGUILayout.PropertyField(m_FadeScaleProperty, k_FadeScaleContent);
EditorGUILayout.PropertyField(m_UVScaleProperty, k_UVScaleContent);
EditorGUILayout.PropertyField(m_UVBiasProperty, k_UVBiasContent);
EditorGUILayout.PropertyField(m_FadeFactor, k_FadeFactorContent);

// only display the affects transparent property if material is HDRP/decal
if (showAffectTransparencyHaveMultipleDifferentValue)
{
using (new EditorGUI.DisabledScope(true))
EditorGUILayout.LabelField(EditorGUIUtility.TrTextContent("Multiple material type in selection"));
}
else if (showAffectTransparency)
EditorGUILayout.PropertyField(m_AffectsTransparencyProperty, k_AffectTransparentContent);
}
if (EditorGUI.EndChangeCheck())
serializedObject.ApplyModifiedProperties();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ internal DecalSystem.DecalHandle Handle
}
}

void OnEnable()
void InitMaterial()
{
if (m_Material == null)
{
Expand All @@ -223,6 +223,13 @@ void OnEnable()
m_Material = null;
#endif
}
}

void Reset() => InitMaterial();

void OnEnable()
{
InitMaterial();

if (m_Handle != null)
{
Expand Down