From c353621672c80619eae120084a490bd63925ce8d Mon Sep 17 00:00:00 2001 From: Julien Ignace Date: Thu, 17 Sep 2020 17:01:48 +0200 Subject: [PATCH 1/4] Fixed an exception thrown when closing the lookdev because there is no active SRP anymore. --- .../Editor/LookDev/DisplayWindow.cs | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/com.unity.render-pipelines.core/Editor/LookDev/DisplayWindow.cs b/com.unity.render-pipelines.core/Editor/LookDev/DisplayWindow.cs index 01d4c7c00e2..04b8d919cd0 100644 --- a/com.unity.render-pipelines.core/Editor/LookDev/DisplayWindow.cs +++ b/com.unity.render-pipelines.core/Editor/LookDev/DisplayWindow.cs @@ -625,6 +625,19 @@ IStyle GetEnvironmentContenairDraggerStyle() } } + void Update() + { + // [case 1245086] Guard in case the SRP asset is set to null (or to a not supported SRP) when the lookdev window is already open + // Note: After an editor reload, we might get a null OnUpdateRequestedInternal and null SRP for a couple of frames, hence the check. + if (!LookDev.supported && OnUpdateRequestedInternal != null) + { + // Print an error and close the Lookdev window (to avoid spamming the console) + Debug.LogError($"LookDev is not supported by this Scriptable Render Pipeline: " + + (RenderPipelineManager.currentPipeline == null ? "No SRP in use" : RenderPipelineManager.currentPipeline.ToString())); + LookDev.Close(); + } + } + void OnGUI() { //Stylesheet @@ -690,17 +703,6 @@ void OnGUI() rootVisualElement.styleSheets.Add(styleSheetLight); } - // [case 1245086] Guard in case the SRP asset is set to null (or to a not supported SRP) when the lookdev window is already open - // Note: After an editor reload, we might get a null OnUpdateRequestedInternal and null SRP for a couple of frames, hence the check. - if (!LookDev.supported && OnUpdateRequestedInternal !=null) - { - // Print an error and close the Lookdev window (to avoid spamming the console) - Debug.LogError($"LookDev is not supported by this Scriptable Render Pipeline: " - + (RenderPipelineManager.currentPipeline == null ? "No SRP in use" : RenderPipelineManager.currentPipeline.ToString())); - LookDev.Close(); - return; - } - OnUpdateRequestedInternal?.Invoke(); } } From 0a38830dbb3266ab53a6da9892ae29b6f8758e05 Mon Sep 17 00:00:00 2001 From: Julien Ignace Date: Thu, 17 Sep 2020 17:02:12 +0200 Subject: [PATCH 2/4] Update changelog --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index c3ae54de7f0..e29700fd697 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -80,6 +80,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed issue with mipmap debug mode not properly resetting full screen mode (and viceversa). - Added unsupported message when using tile debug mode with MSAA. - Fixed SSGI compilation issues on PS4. +- Fixed an exception thrown when closing the look dev because there is no active SRP anymore. ### Changed - Preparation pass for RTSSShadows to be supported by render graph. From 1bb9501da2c212194cdff751a7adf4e5d33ec3ba Mon Sep 17 00:00:00 2001 From: Julien Ignace Date: Fri, 18 Sep 2020 11:06:26 +0200 Subject: [PATCH 3/4] Fixed an issue where entering playmode would close the LookDev window. --- .../Editor/LookDev/DisplayWindow.cs | 2 +- .../Editor/LookDev/LookDev.cs | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/com.unity.render-pipelines.core/Editor/LookDev/DisplayWindow.cs b/com.unity.render-pipelines.core/Editor/LookDev/DisplayWindow.cs index 04b8d919cd0..20a4a5ad363 100644 --- a/com.unity.render-pipelines.core/Editor/LookDev/DisplayWindow.cs +++ b/com.unity.render-pipelines.core/Editor/LookDev/DisplayWindow.cs @@ -239,7 +239,7 @@ void OnEnable() // in case the window where open when last editor session finished. // (Else it will open at start and has nothing to display). if (!LookDev.open) - LookDev.Open(); + LookDev.Initialize(this); titleContent = Style.k_WindowTitleAndIcon; diff --git a/com.unity.render-pipelines.core/Editor/LookDev/LookDev.cs b/com.unity.render-pipelines.core/Editor/LookDev/LookDev.cs index 08f04fb0eda..42064ef6989 100644 --- a/com.unity.render-pipelines.core/Editor/LookDev/LookDev.cs +++ b/com.unity.render-pipelines.core/Editor/LookDev/LookDev.cs @@ -93,10 +93,7 @@ internal static void SaveConfig(string path = lastRenderingDataSavePath) /// Open the LookDev window public static void Open() { - var Window = EditorWindow.GetWindow(); - s_ViewDisplayer = Window; - s_EnvironmentDisplayer = Window; - ConfigureLookDev(reloadWithTemporaryID: false); + EditorWindow.GetWindow(); } /// Close the LookDev window @@ -108,6 +105,14 @@ public static void Close() s_EnvironmentDisplayer = null; } + internal static void Initialize(DisplayWindow window) + { + s_ViewDisplayer = window; + s_EnvironmentDisplayer = window; + open = true; + ConfigureLookDev(reloadWithTemporaryID: false); + } + [Callbacks.DidReloadScripts] static void OnEditorReload() { @@ -158,8 +163,6 @@ static void ConfigureRenderer(bool reloadWithTemporaryID) static void LinkViewDisplayer() { - EditorApplication.playModeStateChanged += state => Close(); - s_ViewDisplayer.OnClosed += () => { s_Compositor?.Dispose(); From c0cd21a2771a20e8a4f13705dfede370d987def7 Mon Sep 17 00:00:00 2001 From: Julien Ignace Date: Fri, 18 Sep 2020 11:06:50 +0200 Subject: [PATCH 4/4] Update changelog --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index e29700fd697..96f3fb876cd 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -81,6 +81,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Added unsupported message when using tile debug mode with MSAA. - Fixed SSGI compilation issues on PS4. - Fixed an exception thrown when closing the look dev because there is no active SRP anymore. +- Fixed an issue where entering playmode would close the LookDev window. ### Changed - Preparation pass for RTSSShadows to be supported by render graph.