diff --git a/Assets/Editor/BuildTiltBrush.cs b/Assets/Editor/BuildTiltBrush.cs index a8af77a93d..a63f6ed928 100644 --- a/Assets/Editor/BuildTiltBrush.cs +++ b/Assets/Editor/BuildTiltBrush.cs @@ -1435,7 +1435,7 @@ static void ShowBrushExportTextures() using (var unused = new TempHookUpSingletons()) { // Set consultUserConfig = false to keep user config from affecting the build output. - TiltBrushManifest manifest = App.Instance.GetMergedManifest(forceExperimental: true); + TiltBrushManifest manifest = App.Instance.ManifestFull; StringBuilder s = new StringBuilder(); foreach (BrushDescriptor desc in manifest.UniqueBrushes()) @@ -1547,7 +1547,7 @@ public static void DoBuild(TiltBuildOptions tiltOptions) // to be run at build-time (ie when nobody has called Start(), Awake()). // TempHookupSingletons() has done just enough initialization to make it happy. // Also set consultUserConfig = false to keep user config from affecting the build output. - TiltBrushManifest manifest = App.Instance.GetMergedManifest(forceExperimental: true); + TiltBrushManifest manifest = App.Instance.ManifestFull; // Some sanity checks { diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index fe583c1ace..54e73264c9 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -10197,7 +10197,7 @@ MonoBehaviour: m_FadeFromBlackDuration: 3 m_QuickLoadHintDelay: 2 m_GpuIntersector: {fileID: 165291219} - m_Manifest: {fileID: 11400000, guid: 0be87170c871bfc4f91119634daa9c79, type: 2} + m_ManifestStandard: {fileID: 11400000, guid: 0be87170c871bfc4f91119634daa9c79, type: 2} m_ManifestExperimental: {fileID: 11400000, guid: 1121701af0c4d7145af70356f0ac2a83, type: 2} m_ZapboxManifest: {fileID: 11400000, guid: 7be45b23483e18347a0170a596bf2867, type: 2} diff --git a/Assets/Scripts/App.cs b/Assets/Scripts/App.cs index a9c522a952..74eb7f7381 100644 --- a/Assets/Scripts/App.cs +++ b/Assets/Scripts/App.cs @@ -23,6 +23,7 @@ using UnityEngine; using Newtonsoft.Json; using TMPro; +using UnityEngine.Serialization; #if USD_SUPPORTED using Unity.Formats.USD; #endif @@ -191,11 +192,22 @@ public static void Log(string msg) [SerializeField] GpuIntersector m_GpuIntersector; - public TiltBrushManifest m_Manifest; - - // Previously Experimental-Mode only + [SerializeField] private TiltBrushManifest m_ManifestStandard; [SerializeField] private TiltBrushManifest m_ManifestExperimental; [SerializeField] private TiltBrushManifest m_ZapboxManifest; + private TiltBrushManifest m_ManifestFull; + + public TiltBrushManifest ManifestFull + { + get + { + if (m_ManifestFull == null) + { + m_ManifestFull = MergeManifests(); + } + return m_ManifestFull; + } + } [SerializeField] private SelectionEffect m_SelectionEffect; @@ -552,8 +564,6 @@ void Awake() gameObject.AddComponent(); } - m_Manifest = GetMergedManifest(); - m_HttpServer = GetComponentInChildren(); if (!Config.IsMobileHardware) { @@ -2205,19 +2215,16 @@ void OnPlaybackComplete() } } - public TiltBrushManifest GetMergedManifest(bool forceExperimental = false) + private TiltBrushManifest MergeManifests() { - var manifest = m_Manifest; - if (Config.IsExperimental || forceExperimental) +#if ZAPBOX_SUPPORTED + var manifest = m_ZapboxManifest; +#else + var manifest = Instantiate(m_ManifestStandard); + if (m_ManifestExperimental != null) { - if (m_ManifestExperimental != null) - { - manifest = Instantiate(m_Manifest); - manifest.AppendFrom(m_ManifestExperimental); - } + manifest.AppendFrom(m_ManifestExperimental); } -#if ZAPBOX_SUPPORTED - manifest = m_ZapboxManifest; #endif return manifest; } diff --git a/Assets/Scripts/BrushCatalog.cs b/Assets/Scripts/BrushCatalog.cs index 86a44c4a2e..13bdfe354a 100644 --- a/Assets/Scripts/BrushCatalog.cs +++ b/Assets/Scripts/BrushCatalog.cs @@ -189,19 +189,22 @@ public void BeginReload() m_GuiBrushList.Clear(); foreach (var brush in m_GuidToBrush.Values) { - if (brush.m_HiddenInGui) + // Some brushes are hardcoded as hidden + if (brush.m_HiddenInGui) continue; + // Always include if experimental mode is on + if (Config.IsExperimental || !App.Instance.IsBrushExperimental(brush)) { - continue; + m_GuiBrushList.Add(brush); } - m_GuiBrushList.Add(brush); } + BrushCatalogChanged?.Invoke(); } public Brush[] GetTagFilteredBrushList() { - List includeTags = App.UserConfig.Brushes.IncludeTags.ToList(); - List excludeTags = App.UserConfig.Brushes.ExcludeTags.ToList(); + List includeTags = App.UserConfig.Brushes.IncludeTags?.ToList(); + List excludeTags = App.UserConfig.Brushes.ExcludeTags?.ToList(); if (includeTags == null || includeTags.Count == 0) { @@ -288,7 +291,7 @@ Brush _FindBrushByDescription(string brushDescription) static private List LoadBrushesInManifest() { List output = new List(); - var manifest = App.Instance.m_Manifest; + var manifest = App.Instance.ManifestFull; foreach (var desc in manifest.Brushes) { if (desc != null) diff --git a/Assets/Scripts/Config.cs b/Assets/Scripts/Config.cs index 67188735c8..567540f5f5 100644 --- a/Assets/Scripts/Config.cs +++ b/Assets/Scripts/Config.cs @@ -113,9 +113,6 @@ private class UserConfigChange // The sdk mode indicates which SDK that we're using to drive the display. public SdkMode m_SdkMode; - // Stores the value of IsExperimental at startup time - [NonSerialized] public bool m_WasExperimentalAtStartup; - // Whether or not to just do an automatic profile and then exit. public bool m_AutoProfile; // How long to wait before starting to profile. @@ -126,7 +123,7 @@ private class UserConfigChange public string[] m_SketchFiles = new string[0]; [NonSerialized] public bool m_QuickLoad = true; - public SecretsConfig.ServiceAuthData GoogleSecrets => Secrets[SecretsConfig.Service.Google]; + public SecretsConfig.ServiceAuthData GoogleSecrets => Secrets?[SecretsConfig.Service.Google]; public SecretsConfig.ServiceAuthData SketchfabSecrets => Secrets[SecretsConfig.Service.Sketchfab]; public SecretsConfig.ServiceAuthData OculusSecrets => Secrets[SecretsConfig.Service.Oculus]; public SecretsConfig.ServiceAuthData OculusMobileSecrets => Secrets[SecretsConfig.Service.OculusMobile]; @@ -531,12 +528,6 @@ public bool GeometryShaderSuppported } } - // Non-Static version of above - public bool GetIsExperimental() - { - return PlayerPrefs.HasKey("ExperimentalMode") && PlayerPrefs.GetInt("ExperimentalMode") == 1; - } - public void SetIsExperimental(bool active) { PlayerPrefs.SetInt("ExperimentalMode", active ? 1 : 0); @@ -547,7 +538,6 @@ public void SetIsExperimental(bool active) void Awake() { m_SingletonState = this; - m_WasExperimentalAtStartup = GetIsExperimental(); #if UNITY_EDITOR if (!string.IsNullOrEmpty(m_FakeCommandLineArgsInEditor)) @@ -581,12 +571,9 @@ void Awake() #endif m_BrushReplacement = new Dictionary(); - if (IsExperimental) + foreach (var brush in m_BrushReplacementMap) { - foreach (var brush in m_BrushReplacementMap) - { - m_BrushReplacement.Add(new Guid(brush.FromGuid), new Guid(brush.ToGuid)); - } + m_BrushReplacement.Add(new Guid(brush.FromGuid), new Guid(brush.ToGuid)); } } diff --git a/Assets/Scripts/EnvironmentCatalog.cs b/Assets/Scripts/EnvironmentCatalog.cs index ffe69c8924..827a4d194a 100644 --- a/Assets/Scripts/EnvironmentCatalog.cs +++ b/Assets/Scripts/EnvironmentCatalog.cs @@ -107,7 +107,7 @@ void Update() static void LoadEnvironmentsInManifest(List output) { - var manifest = App.Instance.m_Manifest; + var manifest = App.Instance.ManifestFull; foreach (var asset in manifest.Environments) { if (asset != null) diff --git a/Assets/Scripts/GUI/AppSettingsPanel.cs b/Assets/Scripts/GUI/AppSettingsPanel.cs index ffe5450a9a..d26c00abcf 100644 --- a/Assets/Scripts/GUI/AppSettingsPanel.cs +++ b/Assets/Scripts/GUI/AppSettingsPanel.cs @@ -24,7 +24,7 @@ public class AppSettingsPanel : BasePanel public override void InitPanel() { base.InitPanel(); - m_ExperimentalModeToggle.IsToggledOn = App.Config.GetIsExperimental(); + m_ExperimentalModeToggle.IsToggledOn = Config.IsExperimental; } public void HandleToggleHandedness() @@ -43,7 +43,6 @@ public void HandleResetFirstUse() public void HandleToggleExperimentalMode(ToggleButton btn) { App.Config.SetIsExperimental(btn.IsToggledOn); - RestartNotification(); } private void RestartNotification() diff --git a/Assets/Scripts/GUI/BrushTypeButton.cs b/Assets/Scripts/GUI/BrushTypeButton.cs index 359b404a0e..dd63934f8b 100644 --- a/Assets/Scripts/GUI/BrushTypeButton.cs +++ b/Assets/Scripts/GUI/BrushTypeButton.cs @@ -114,10 +114,7 @@ public void SetButtonProperties(BrushDescriptor rBrush) VisualizerManager.m_Instance.VisualsRequested); // Play standard click sound if brush doesn't have a custom button sound m_ButtonHasPressedAudio = (rBrush.m_ButtonAudio == null); - if (App.Config.m_WasExperimentalAtStartup) - { - m_ExperimentalIcon.SetActive(App.Instance.IsBrushExperimental(rBrush)); - } + m_ExperimentalIcon.SetActive(App.Instance.IsBrushExperimental(rBrush)); } override protected void OnDescriptionActivated() diff --git a/Assets/Scripts/GUI/LocalePopUpWindow.cs b/Assets/Scripts/GUI/LocalePopUpWindow.cs index f4344858cb..0a907810f1 100644 --- a/Assets/Scripts/GUI/LocalePopUpWindow.cs +++ b/Assets/Scripts/GUI/LocalePopUpWindow.cs @@ -47,7 +47,7 @@ override public void Init(GameObject rParent, string sText) //build list of locale presets we're going to show Locale currentSelectedLocale = LocalizationSettings.SelectedLocale; - m_Locales = App.Instance.m_Manifest.Locales; + m_Locales = App.Instance.ManifestFull.Locales; int iPresetIndex = -1; m_CurrentPresetIdCode = currentSelectedLocale.Identifier.Code; diff --git a/Assets/Scripts/Multiplayer/MultiplayerStrokeSerialization.cs b/Assets/Scripts/Multiplayer/MultiplayerStrokeSerialization.cs index 72a68395fe..be8cf21d71 100644 --- a/Assets/Scripts/Multiplayer/MultiplayerStrokeSerialization.cs +++ b/Assets/Scripts/Multiplayer/MultiplayerStrokeSerialization.cs @@ -94,7 +94,7 @@ public static Guid[] GetBrushGuidsFromManifest() List brushGuids = new List(); // Iterate through each unique brush in the manifest - foreach (BrushDescriptor brush in App.Instance.m_Manifest.UniqueBrushes()) + foreach (BrushDescriptor brush in App.Instance.ManifestFull.UniqueBrushes()) { if (brush != null) { diff --git a/Assets/Scripts/Rendering/IconTextureAtlas.cs b/Assets/Scripts/Rendering/IconTextureAtlas.cs index f0fb2db86b..01520f088f 100644 --- a/Assets/Scripts/Rendering/IconTextureAtlas.cs +++ b/Assets/Scripts/Rendering/IconTextureAtlas.cs @@ -56,7 +56,7 @@ public Material GetAppropriateMaterial(bool activated, bool focus) void AtlasIconTextures() { // Load the appropriate catalog from Resources. - string catalogPath = App.Config.GetIsExperimental() ? m_ExperimentalCatalogPath : m_CatalogPath; + string catalogPath = m_ExperimentalCatalogPath; m_Catalog = Resources.Load(catalogPath); Debug.Assert(m_Catalog != null); diff --git a/Assets/Scripts/UserConfig.cs b/Assets/Scripts/UserConfig.cs index 313c82fdc6..1a811652b8 100644 --- a/Assets/Scripts/UserConfig.cs +++ b/Assets/Scripts/UserConfig.cs @@ -232,14 +232,7 @@ public string[] IncludeTags { if (m_IncludeTags == null) { - if (App.Config.GetIsExperimental()) - { - m_IncludeTags = new[] { "default", "experimental" }; - } - else - { - m_IncludeTags = new[] { "default" }; - } + m_IncludeTags = new[] { "default", "experimental" }; } return m_IncludeTags; } @@ -550,37 +543,34 @@ public Dictionary BrushReplacementMap get { Dictionary results = new Dictionary(); - if (Config.IsExperimental) + if (string.IsNullOrEmpty(BrushReplacements)) { - if (string.IsNullOrEmpty(BrushReplacements)) - { - return results; - } - var replacements = BrushReplacements.Split(','); - foreach (string replacement in replacements) + return results; + } + var replacements = BrushReplacements.Split(','); + foreach (string replacement in replacements) + { + string[] pair = replacement.Split('='); + if (pair.Length == 2) { - string[] pair = replacement.Split('='); - if (pair.Length == 2) + if (pair[0] == "*") { - if (pair[0] == "*") - { - Guid guid = new Guid(pair[1]); - foreach (var brush in App.Instance.m_Manifest.Brushes) - { - results.Add(brush.m_Guid, guid); - } - } - else + Guid guid = new Guid(pair[1]); + foreach (var brush in App.Instance.ManifestFull.Brushes) { - results.Add(new Guid(pair[0]), new Guid(pair[1])); + results.Add(brush.m_Guid, guid); } } else { - OutputWindowScript.Error("BrushReplacement should be of the form:\n" + - "brushguidA=brushguidB,brushguidC=brushguidD"); + results.Add(new Guid(pair[0]), new Guid(pair[1])); } } + else + { + OutputWindowScript.Error("BrushReplacement should be of the form:\n" + + "brushguidA=brushguidB,brushguidC=brushguidD"); + } } return results; } diff --git a/Assets/Settings/Localization/Strings/Strings_en.asset b/Assets/Settings/Localization/Strings/Strings_en.asset index 41b78f32b2..ffe9a7d28e 100644 --- a/Assets/Settings/Localization/Strings/Strings_en.asset +++ b/Assets/Settings/Localization/Strings/Strings_en.asset @@ -3081,7 +3081,7 @@ MonoBehaviour: m_Metadata: m_Items: [] - m_Id: 89093153698373632 - m_Localized: (Restart required) + m_Localized: Less compatibility when exported. See our docs. m_Metadata: m_Items: [] - m_Id: 89093320602312704