From 0aeb891bdecb17bc9761b1f5b7ba87c5ab3c6515 Mon Sep 17 00:00:00 2001 From: jenniferd-unity Date: Thu, 24 Sep 2020 10:44:36 +0200 Subject: [PATCH 1/3] Ensure stylesheet are loaded before applying them on Domain Reload --- .../Editor/LookDev/DisplayWindow.cs | 45 ++++++++++++------- 1 file changed, 30 insertions(+), 15 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..2c5aaab5085 100644 --- a/com.unity.render-pipelines.core/Editor/LookDev/DisplayWindow.cs +++ b/com.unity.render-pipelines.core/Editor/LookDev/DisplayWindow.cs @@ -216,24 +216,42 @@ event Action IViewDisplayer.OnUpdateRequested StyleSheet styleSheet = null; StyleSheet styleSheetLight = null; - void OnEnable() + void ReloadStyleSheets() { - //Stylesheet - // Try to load stylesheet. Timing can be odd while upgrading packages (case 1219692). - // In this case, it will be fixed in OnGUI. Though it can spawn error while reimporting assets. - // Waiting for filter on stylesheet (case 1228706) to remove last error. - if (styleSheet == null || styleSheet.Equals(null)) + if(styleSheet == null || styleSheet.Equals(null)) { styleSheet = AssetDatabase.LoadAssetAtPath(Style.k_uss); - if (styleSheet != null && !styleSheet.Equals(null)) - rootVisualElement.styleSheets.Add(styleSheet); + if(styleSheet == null || styleSheet.Equals(null)) + Debug.LogWarning("[LookDev] Could not load Stylesheet."); } - if (!EditorGUIUtility.isProSkin && styleSheetLight != null && !styleSheetLight.Equals(null)) + + if(!rootVisualElement.styleSheets.Contains(styleSheet)) + rootVisualElement.styleSheets.Add(styleSheet); + + //Additively load Light Skin + if(!EditorGUIUtility.isProSkin) { - styleSheetLight = AssetDatabase.LoadAssetAtPath(Style.k_uss_personal_overload); - if (styleSheetLight != null && !styleSheetLight.Equals(null)) + if(styleSheetLight == null || styleSheetLight.Equals(null)) + { + styleSheetLight = AssetDatabase.LoadAssetAtPath(Style.k_uss_personal_overload); + if(styleSheetLight == null || styleSheetLight.Equals(null)) + Debug.LogWarning("[LookDev] Could not load Light skin."); + + } + + if(!rootVisualElement.styleSheets.Contains(styleSheetLight)) rootVisualElement.styleSheets.Add(styleSheetLight); } + } + + void OnEnable() + { + //Stylesheet + // Try to load stylesheet. Timing can be odd while upgrading packages (case 1219692). + // In this case, it will be fixed in OnGUI. Though it can spawn error while reimporting assets. + // Waiting for filter on stylesheet (case 1228706) to remove last error. + // On Editor Skin change, OnEnable is called and stylesheets need to be reloaded (case 1278802). + ReloadStyleSheets(); //Call the open function to configure LookDev // in case the window where open when last editor session finished. @@ -684,10 +702,7 @@ void OnGUI() else { //deal with missing style when domain reload... - if (!rootVisualElement.styleSheets.Contains(styleSheet)) - rootVisualElement.styleSheets.Add(styleSheet); - if (!EditorGUIUtility.isProSkin && !rootVisualElement.styleSheets.Contains(styleSheetLight)) - rootVisualElement.styleSheets.Add(styleSheetLight); + ReloadStyleSheets(); } // [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 From e476c6328db827e4eef81cf2f74a2cb159eea301 Mon Sep 17 00:00:00 2001 From: Jennifer Roig-Deslandes Date: Thu, 24 Sep 2020 13:02:57 +0200 Subject: [PATCH 2/3] Added changelog description --- 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 518105d4800..558b9d81bdd 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -83,6 +83,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed SSGI compilation issues on PS4. - Fixed "Screen position out of view frustum" error when camera is on exactly the planar reflection probe plane. - Workaround issue that caused objects using eye shader to not be rendered on xbox. +- Fixed Light skin not properly applied on the LookDev when switching from Dark Skin (case 1278802) ### Changed - Preparation pass for RTSSShadows to be supported by render graph. From 389bf83be07b03fc8731650b11a8f7a4a2424dd8 Mon Sep 17 00:00:00 2001 From: Jennifer Roig-Deslandes Date: Thu, 1 Oct 2020 17:28:26 +0200 Subject: [PATCH 3/3] Fix for upgrade package workflow --- .../Editor/LookDev/DisplayWindow.cs | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/com.unity.render-pipelines.core/Editor/LookDev/DisplayWindow.cs b/com.unity.render-pipelines.core/Editor/LookDev/DisplayWindow.cs index 0c2068857cc..9b831a25c67 100644 --- a/com.unity.render-pipelines.core/Editor/LookDev/DisplayWindow.cs +++ b/com.unity.render-pipelines.core/Editor/LookDev/DisplayWindow.cs @@ -222,7 +222,10 @@ void ReloadStyleSheets() { styleSheet = AssetDatabase.LoadAssetAtPath(Style.k_uss); if(styleSheet == null || styleSheet.Equals(null)) - Debug.LogWarning("[LookDev] Could not load Stylesheet."); + { + //Debug.LogWarning("[LookDev] Could not load Stylesheet."); + return; + } } if(!rootVisualElement.styleSheets.Contains(styleSheet)) @@ -235,8 +238,10 @@ void ReloadStyleSheets() { styleSheetLight = AssetDatabase.LoadAssetAtPath(Style.k_uss_personal_overload); if(styleSheetLight == null || styleSheetLight.Equals(null)) - Debug.LogWarning("[LookDev] Could not load Light skin."); - + { + //Debug.LogWarning("[LookDev] Could not load Light skin."); + return; + } } if(!rootVisualElement.styleSheets.Contains(styleSheetLight)) @@ -251,7 +256,8 @@ void OnEnable() // In this case, it will be fixed in OnGUI. Though it can spawn error while reimporting assets. // Waiting for filter on stylesheet (case 1228706) to remove last error. // On Editor Skin change, OnEnable is called and stylesheets need to be reloaded (case 1278802). - ReloadStyleSheets(); + if(EditorApplication.isUpdating) + ReloadStyleSheets(); //Call the open function to configure LookDev // in case the window where open when last editor session finished. @@ -712,11 +718,11 @@ void OnGUI() // rootVisualElement.styleSheets.Add(styleSheetLight); //} } - else - { - //deal with missing style when domain reload... - ReloadStyleSheets(); - } + if(EditorApplication.isUpdating) + return; + + //deal with missing style on domain reload... + ReloadStyleSheets(); OnUpdateRequestedInternal?.Invoke(); }