Skip to content

Find the appropriate default frame settings per editor (case 1247631) #1129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed issue with light layers bigger than 8 (and above the supported range).
- Fixed issue with culling layer mask of area light's emissive mesh
- Fixed errors when switching area light to disk shape while an area emissive mesh was displayed.
- Fixed default frame settings MSAA toggle for reflection probes (case 1247631)
- Fixed the transparent SSR dependency not being properly disabled according to the asset dependencies (1260271).
- Fixed issue with completely black AO on double sided materials when normal mode is set to None.
- Fixed UI drawing of the quaternion (1251235)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface IHDProbeEditor
bool showChromeGizmo { get; set; }
}

abstract class HDProbeEditor<TProvider, TSerialized> : Editor, IHDProbeEditor
abstract class HDProbeEditor<TProvider, TSerialized> : Editor, IHDProbeEditor, IDefaultFrameSettingsType
where TProvider : struct, HDProbeUI.IProbeUISettingsProvider, InfluenceVolumeUI.IInfluenceUISettingsProvider
where TSerialized : SerializedHDProbe
{
Expand Down Expand Up @@ -142,5 +142,10 @@ static Func<float> ComputeCapturePointPreviewSizeGetter()
}
internal static float capturePointPreviewSize
{ get { return s_CapturePointPreviewSizeGetter(); } }

public FrameSettingsRenderType GetFrameSettingsType()
=> GetTarget(target).mode == ProbeSettings.Mode.Realtime
? FrameSettingsRenderType.RealtimeReflection
: FrameSettingsRenderType.CustomOrBakedReflection;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,27 @@ public static SettingsProvider CreateSettingsProvider()
keywords = SettingsProvider.GetSearchKeywordsFromGUIContentProperties<HDRenderPipelineUI.Styles.GeneralSection>()
.Concat(SettingsProvider.GetSearchKeywordsFromGUIContentProperties<DefaultSettingsPanelIMGUI.Styles>())
.Concat(OverridableFrameSettingsArea.frameSettingsKeywords).ToArray(),
guiHandler = s_IMGUIImpl.OnGUI,
guiHandler = s_IMGUIImpl.DoGUI,
};
}

class DefaultSettingsPanelIMGUI
{
// A wrapper for CoreEditorDrawers
class CoreEditorDrawerEditorWrapper : Editor, IDefaultFrameSettingsType
{
public FrameSettingsRenderType GetFrameSettingsType()
{
switch (HDRenderPipelineUI.selectedFrameSettings)
{
case HDRenderPipelineUI.SelectedFrameSettings.Camera: return FrameSettingsRenderType.Camera;
case HDRenderPipelineUI.SelectedFrameSettings.RealtimeReflection: return FrameSettingsRenderType.RealtimeReflection;
case HDRenderPipelineUI.SelectedFrameSettings.BakedOrCustomReflection: return FrameSettingsRenderType.CustomOrBakedReflection;
}
throw new Exception("unreachable");
}
}

public class Styles
{
public const int labelWidth = 220;
Expand All @@ -47,8 +62,9 @@ public class Styles
ReorderableList m_BeforePostProcessCustomPostProcesses;
ReorderableList m_AfterPostProcessCustomPostProcesses;
int m_CurrentVolumeProfileInstanceID;
private Editor m_Cache;

public void OnGUI(string searchContext)
public void DoGUI(string searchContext)
{
m_ScrollViewPosition = GUILayout.BeginScrollView(m_ScrollViewPosition, EditorStyles.largeLabel);
Draw_GeneralSettings();
Expand Down Expand Up @@ -278,7 +294,9 @@ void Draw_DefaultFrameSettings()
var serializedObject = new SerializedObject(hdrpAsset);
var serializedHDRPAsset = new SerializedHDRenderPipelineAsset(serializedObject);

HDRenderPipelineUI.FrameSettingsSection.Draw(serializedHDRPAsset, null);
Editor.CreateCachedEditor(hdrpAsset, typeof(CoreEditorDrawerEditorWrapper), ref m_Cache);

HDRenderPipelineUI.FrameSettingsSection.Draw(serializedHDRPAsset, m_Cache);
serializedObject.ApplyModifiedProperties();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ public static MaterialQualityMode Into(this MaterialQuality quality)
}
}

interface IDefaultFrameSettingsType
{
FrameSettingsRenderType GetFrameSettingsType();
}

partial class FrameSettingsUI
{
enum Expandable
Expand Down Expand Up @@ -131,14 +136,9 @@ static HDRenderPipelineAsset GetHDRPAssetFor(Editor owner)
static FrameSettings GetDefaultFrameSettingsFor(Editor owner)
{
HDRenderPipelineAsset hdrpAsset = GetHDRPAssetFor(owner);
if (owner is IHDProbeEditor)
{
if ((owner as IHDProbeEditor).GetTarget(owner.target).mode == ProbeSettings.Mode.Realtime)
return hdrpAsset.GetDefaultFrameSettings(FrameSettingsRenderType.RealtimeReflection);
else
return hdrpAsset.GetDefaultFrameSettings(FrameSettingsRenderType.CustomOrBakedReflection);
}
return hdrpAsset.GetDefaultFrameSettings(FrameSettingsRenderType.Camera);
return owner is IDefaultFrameSettingsType getType
? hdrpAsset.GetDefaultFrameSettings(getType.GetFrameSettingsType())
: hdrpAsset.GetDefaultFrameSettings(FrameSettingsRenderType.Camera);
}

static void Drawer_SectionRenderingSettings(SerializedFrameSettings serialized, Editor owner, bool withOverride)
Expand Down