VoiceSDKMenu.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * Copyright (c) Meta Platforms, Inc. and affiliates.
  3. * All rights reserved.
  4. *
  5. * Licensed under the Oculus SDK License Agreement (the "License");
  6. * you may not use the Oculus SDK except in compliance with the License,
  7. * which is provided at the time of installation or download, or which
  8. * otherwise accompanies this software in either electronic or hard copy form.
  9. *
  10. * You may obtain a copy of the License at
  11. *
  12. * https://developer.oculus.com/licenses/oculussdk/
  13. *
  14. * Unless required by applicable law or agreed to in writing, the Oculus SDK
  15. * distributed under the License is distributed on an "AS IS" BASIS,
  16. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. * See the License for the specific language governing permissions and
  18. * limitations under the License.
  19. */
  20. using Meta.Voice.VSDKHub;
  21. using UnityEngine;
  22. using UnityEditor;
  23. using Meta.WitAi.Windows;
  24. using Meta.WitAi.Configuration;
  25. using Meta.WitAi.Data.Entities;
  26. using Meta.WitAi.TTS.Editor;
  27. using Meta.WitAi.TTS.Editor.Preload;
  28. using Meta.WitAi.Data.Info;
  29. using Oculus.Voice.Windows;
  30. namespace Oculus.Voice.Utility
  31. {
  32. public static class VoiceSDKMenu
  33. {
  34. #region WINDOWS
  35. [MenuItem("Oculus/Voice SDK/Get Started", false, 1)]
  36. private static void OpenConfigurationWindow()
  37. {
  38. WitWindowUtility.OpenGettingStarted((config) =>
  39. {
  40. VoiceSDKHub.ShowPage(VoiceSDKHub.GetPageId(VoiceHubConstants.PAGE_WIT_CONFIGS));
  41. });
  42. }
  43. [MenuItem("Oculus/Voice SDK/Understanding Viewer", false, 200)]
  44. private static void OpenUnderstandingWindow()
  45. {
  46. WitWindowUtility.OpenUnderstandingWindow();
  47. }
  48. #endregion
  49. #region DRAWERS
  50. [CustomPropertyDrawer(typeof(WitEndpointConfig))]
  51. public class VoiceCustomEndpointPropertyDrawer : WitEndpointConfigDrawer
  52. {
  53. }
  54. [CustomPropertyDrawer(typeof(WitAppInfo))]
  55. public class VoiceCustomApplicationPropertyDrawer : VoiceApplicationDetailProvider
  56. {
  57. }
  58. [CustomPropertyDrawer(typeof(WitIntentInfo))]
  59. public class VoiceCustomIntentPropertyDrawer : WitIntentPropertyDrawer
  60. {
  61. }
  62. [CustomPropertyDrawer(typeof(WitEntityInfo))]
  63. public class VoiceCustomEntityPropertyDrawer : WitEntityPropertyDrawer
  64. {
  65. }
  66. [CustomPropertyDrawer(typeof(WitTraitInfo))]
  67. public class VoiceCustomTraitPropertyDrawer : WitTraitPropertyDrawer
  68. {
  69. }
  70. #endregion
  71. #region Scriptable Objects
  72. [MenuItem("Assets/Create/Voice SDK/Dynamic Entities")]
  73. public static void CreateDynamicEntities()
  74. {
  75. WitDynamicEntitiesData asset =
  76. ScriptableObject.CreateInstance<WitDynamicEntitiesData>();
  77. var path = EditorUtility.SaveFilePanel("Save Dynamic Entity", Application.dataPath,
  78. "DynamicEntities", "asset");
  79. if (!string.IsNullOrEmpty(path))
  80. {
  81. path = "Assets/" + path.Replace(Application.dataPath, "");
  82. AssetDatabase.CreateAsset(asset, path);
  83. AssetDatabase.SaveAssets();
  84. EditorUtility.FocusProjectWindow();
  85. Selection.activeObject = asset;
  86. }
  87. }
  88. #endregion
  89. #region TTS
  90. [MenuItem("Assets/Create/Voice SDK/TTS/Add Default TTS Setup")]
  91. public static void CreateDefaultTTSSetup()
  92. {
  93. TTSEditorUtilities.CreateDefaultSetup();
  94. }
  95. [MenuItem("Assets/Create/Voice SDK/TTS/Add TTS Service to Scene", false, 100)]
  96. public static void CreateTTSService()
  97. {
  98. TTSEditorUtilities.CreateService();
  99. }
  100. [MenuItem("Assets/Create/Voice SDK/TTS/Add TTS Speaker to Scene", false, 100)]
  101. public static void CreateTTSSpeaker()
  102. {
  103. TTSEditorUtilities.CreateSpeaker();
  104. }
  105. [MenuItem("Assets/Create/Voice SDK/TTS/Preload Settings", false, 200)]
  106. public static void CreateTTSPreloadSettings()
  107. {
  108. TTSPreloadUtility.CreatePreloadSettings();
  109. }
  110. #endregion
  111. }
  112. }