From ace71e99f18933a7e4eba519b8cdef987f640fea Mon Sep 17 00:00:00 2001 From: Julien Ignace Date: Thu, 17 Dec 2020 12:20:18 +0100 Subject: [PATCH 1/2] Fixed an issue when trying to open a look dev env library when Look Dev is not supported. --- .../Editor/LookDev/EnvironmentLibrary.cs | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/com.unity.render-pipelines.core/Editor/LookDev/EnvironmentLibrary.cs b/com.unity.render-pipelines.core/Editor/LookDev/EnvironmentLibrary.cs index 03edd2af2c1..3e84f031b20 100644 --- a/com.unity.render-pipelines.core/Editor/LookDev/EnvironmentLibrary.cs +++ b/com.unity.render-pipelines.core/Editor/LookDev/EnvironmentLibrary.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using UnityEngine.UIElements; using System.IO; +using UnityEditor; using UnityEditor.UIElements; namespace UnityEditor.Rendering.LookDev @@ -117,14 +118,15 @@ public int IndexOf(Environment environment) [CustomEditor(typeof(EnvironmentLibrary))] class EnvironmentLibraryEditor : Editor { - VisualElement root; + VisualElement m_Root; + VisualElement m_OpenButton; public sealed override VisualElement CreateInspectorGUI() { var library = target as EnvironmentLibrary; - root = new VisualElement(); + m_Root = new VisualElement(); - Button open = new Button(() => + m_OpenButton = new Button(() => { if (!LookDev.open) LookDev.Open(); @@ -132,11 +134,22 @@ public sealed override VisualElement CreateInspectorGUI() LookDev.currentEnvironmentDisplayer.Repaint(); }) { - text = "Open in LookDev window" + text = "Open in Look Dev window" }; + m_OpenButton.SetEnabled(LookDev.supported); - root.Add(open); - return root; + m_Root.Add(m_OpenButton); + return m_Root; + } + + void OnEnable() => EditorApplication.update += Update; + void OnDisable() => EditorApplication.update -= Update; + + void Update() + { + // Current SRP can be changed at any time so we need to do this at every update. + if (m_OpenButton != null) + m_OpenButton.SetEnabled(LookDev.supported); } // Don't use ImGUI From c8352149717f3364def12d0f4af770dd4284c84f Mon Sep 17 00:00:00 2001 From: Julien Ignace Date: Thu, 17 Dec 2020 12:20:36 +0100 Subject: [PATCH 2/2] 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 1e2de85461e..010c2c79288 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed a small discrepancy in the marker placement in light intensity sliders (case 1299750) - Fixed issue with VT resolve pass rendergraph errors when opaque and transparent are disabled in frame settings. - Fixed a bug in the sphere-aabb light cluster (case 1294767). +- Fixed an issue when trying to open a look dev env library when Look Dev is not supported. ### Changed - Removed the material pass probe volumes evaluation mode.