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..28abbc2d4f 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; @@ -127,8 +125,7 @@ public void HandleCanvasReset(ActionButton btn) override protected void RefreshPage() { base.RefreshPage(); - bool passthroughActive = m_CurrentPresetGuid == PASSTHROUGH_GUID; - if (passthroughActive) + if (isPassThroughActive()) { m_PassthroughControls.gameObject.SetActive(true); } @@ -144,8 +141,7 @@ protected void OnFadingToDesiredEnvironment() if (rCurrentPreset != null) { m_CurrentPresetGuid = rCurrentPreset.m_Guid.ToString(); - bool passthroughActive = m_CurrentPresetGuid == PASSTHROUGH_GUID; - if (passthroughActive) + if (isPassThroughActive()) { m_PassthroughControls.gameObject.SetActive(true); m_WorldLockToggle.IsToggledOn = true; @@ -161,6 +157,11 @@ protected void OnFadingToDesiredEnvironment() RefreshPage(); } + private bool isPassThroughActive() + { + return m_Environments.Any(env => env.isPassthrough && env.m_Guid.ToString() == m_CurrentPresetGuid); + } + void OnDestroy() { SceneSettings.m_Instance.FadingToDesiredEnvironment -= OnFadingToDesiredEnvironment; 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()); }