From 6b841990176c2adf4786d5221756be74dbef56ee Mon Sep 17 00:00:00 2001 From: Riccardo Bovo Date: Thu, 19 Dec 2024 15:10:34 +0000 Subject: [PATCH] Remove hardcoded passthrough GUID Replaced PASSTHROUGH_GUID = "e38af599-4575-46ff-a040-459703dbcd36"; with a new property isPassthrough in the environment scriptable object. --- Assets/Resources/Environments/Passthrough/Passthrough.asset | 2 +- Assets/Scripts/Environment.cs | 1 + Assets/Scripts/GUI/LightingPopUpWindow.cs | 4 +--- Assets/Scripts/GUI/MultiplayerPanel.cs | 4 +--- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Assets/Resources/Environments/Passthrough/Passthrough.asset b/Assets/Resources/Environments/Passthrough/Passthrough.asset index 3e70c8f39b..d44d6a7ace 100644 --- a/Assets/Resources/Environments/Passthrough/Passthrough.asset +++ b/Assets/Resources/Environments/Passthrough/Passthrough.asset @@ -14,7 +14,6 @@ MonoBehaviour: m_EditorClassIdentifier: m_Guid: m_storage: e38af599-4575-46ff-a040-459703dbcd36 - m_Description: ENVIRONMENT_PASSTHROUGH m_EnvironmentDescription: m_TableReference: m_TableCollectionName: GUID:c84355079ab3f3e4f8f3812258805f86 @@ -63,6 +62,7 @@ MonoBehaviour: m_WidgetHome: {x: 0, y: 0, z: 0} m_SkyboxColorA: {r: 0, g: 0, b: 0, a: 0} m_SkyboxColorB: {r: 0, g: 0, b: 0, a: 0} + isPassthrough: 1 references: version: 2 RefIds: [] diff --git a/Assets/Scripts/Environment.cs b/Assets/Scripts/Environment.cs index fae21811ef..5b57756971 100644 --- a/Assets/Scripts/Environment.cs +++ b/Assets/Scripts/Environment.cs @@ -175,6 +175,7 @@ public Material m_SkyboxMaterial public Color m_SkyboxColorA; public Color m_SkyboxColorB; + public bool isPassthrough; } } // namespace TiltBrush diff --git a/Assets/Scripts/GUI/LightingPopUpWindow.cs b/Assets/Scripts/GUI/LightingPopUpWindow.cs index b05d5c9324..b95a35678e 100644 --- a/Assets/Scripts/GUI/LightingPopUpWindow.cs +++ b/Assets/Scripts/GUI/LightingPopUpWindow.cs @@ -30,7 +30,6 @@ namespace TiltBrush public class LightingPopUpWindow : PagingPopUpWindow { - private const string PASSTHROUGH_GUID = "e38af599-4575-46ff-a040-459703dbcd36"; private string m_CurrentPresetGuid; [SerializeField] private Transform m_PassthroughControls; @@ -105,8 +104,7 @@ public void RemovePassthrough() { foreach (var env in m_Environments) { - // Passthrough - if (env.m_Guid.ToString() == PASSTHROUGH_GUID) + if (env.isPassthrough) { m_Environments.Remove(env); break; diff --git a/Assets/Scripts/GUI/MultiplayerPanel.cs b/Assets/Scripts/GUI/MultiplayerPanel.cs index 2a0d8ec81b..6c22ce4ca2 100644 --- a/Assets/Scripts/GUI/MultiplayerPanel.cs +++ b/Assets/Scripts/GUI/MultiplayerPanel.cs @@ -298,15 +298,13 @@ private Tuple CheckIfRoomExist() } - // hardoded copied from LightingPopUpWindow - private const string PASSTHROUGH_GUID = "e38af599-4575-46ff-a040-459703dbcd36"; private Tuple CheckIfPassThroughEnvironment() { if (MultiplayerManager.m_Instance != null && MultiplayerManager.m_Instance.State == ConnectionState.IN_LOBBY) { TiltBrush.Environment targetEnvironment = SceneSettings.m_Instance.GetDesiredPreset(); - if (targetEnvironment.m_Guid.ToString() == PASSTHROUGH_GUID) + if (targetEnvironment.isPassthrough) return Tuple.Create(true, m_AlertsPassThroughAcive.GetLocalizedString()); }