From 0f711f0f018820858622716e17ea73b6a7d66590 Mon Sep 17 00:00:00 2001 From: Matt Schoen Date: Sun, 9 Jun 2019 17:10:13 -0700 Subject: [PATCH] Convert ISetTooltipVisibility to IProvides/UsesSetTooltipVisibility --- Editor/TooltipsEditor.cs | 1 + Editor/Unity.Labs.EditorXR.Editor.asmdef | 5 +- Interfaces/Capability.meta | 8 ++ .../Capability/ITooltipPlacement.cs | 2 +- .../Capability/ITooltipPlacement.cs.meta | 0 Interfaces/Entity.meta | 8 ++ .../Entity/ITooltip.cs | 2 +- .../Entity/ITooltip.cs.meta | 0 .../IProvidesSetTooltipVisibility.cs | 32 +++++++ .../IProvidesSetTooltipVisibility.cs.meta | 6 +- .../Subscribers/IUsesSetTooltipVisibility.cs | 95 ++++++++++--------- .../IUsesSetTooltipVisibility.cs.meta | 12 +++ Runtime/Menus/MainMenu/MainMenu.cs | 1 + .../Menus/MainMenu/Scripts/MainMenuButton.cs | 1 + .../MainMenu/Scripts/MainMenuItemAttribute.cs | 1 + .../RadialMenu/Scripts/RadialMenuSlot.cs | 8 +- .../Menus/RadialMenu/Scripts/RadialMenuUI.cs | 1 + .../ToolsMenuButton/ToolsMenuButton.cs | 8 +- .../Actions/ActionMenuItemAttribute.cs | 7 +- Runtime/Scripts/Data/ActionMenuData.cs | 4 +- .../Scripts/Modules/TooltipModule/Tooltip.cs | 3 +- .../Modules/TooltipModule/TooltipModule.cs | 22 +++-- Runtime/Scripts/Proxies/AffordanceTooltip.cs | 3 +- .../Proxies/AffordanceTooltipPlacement.cs | 3 +- Runtime/Scripts/Proxies/ProxyNode.cs | 8 +- Runtime/Scripts/Proxies/TwoHandedProxyBase.cs | 8 +- Runtime/Scripts/UI/TooltipData.cs | 1 + Runtime/Tools/SelectionTool/SelectionTool.cs | 3 +- .../ListItems/InspectorPropertyItem.cs | 1 + 29 files changed, 183 insertions(+), 71 deletions(-) create mode 100644 Interfaces/Capability.meta rename {Runtime/Scripts/Interfaces => Interfaces}/Capability/ITooltipPlacement.cs (93%) rename {Runtime/Scripts/Interfaces => Interfaces}/Capability/ITooltipPlacement.cs.meta (100%) create mode 100644 Interfaces/Entity.meta rename {Runtime/Scripts/Interfaces => Interfaces}/Entity/ITooltip.cs (85%) rename {Runtime/Scripts/Interfaces => Interfaces}/Entity/ITooltip.cs.meta (100%) create mode 100644 Interfaces/Providers/IProvidesSetTooltipVisibility.cs rename Runtime/Scripts/Interfaces/FunctionalityInjection/ISetTooltipVisibility.cs.meta => Interfaces/Providers/IProvidesSetTooltipVisibility.cs.meta (69%) rename Runtime/Scripts/Interfaces/FunctionalityInjection/ISetTooltipVisibility.cs => Interfaces/Subscribers/IUsesSetTooltipVisibility.cs (60%) create mode 100644 Interfaces/Subscribers/IUsesSetTooltipVisibility.cs.meta diff --git a/Editor/TooltipsEditor.cs b/Editor/TooltipsEditor.cs index e7d346bf1..5d8c910b4 100644 --- a/Editor/TooltipsEditor.cs +++ b/Editor/TooltipsEditor.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Reflection; +using Unity.Labs.EditorXR.Interfaces; using Unity.Labs.Utils; using UnityEngine; diff --git a/Editor/Unity.Labs.EditorXR.Editor.asmdef b/Editor/Unity.Labs.EditorXR.Editor.asmdef index dffb8923c..15381a240 100644 --- a/Editor/Unity.Labs.EditorXR.Editor.asmdef +++ b/Editor/Unity.Labs.EditorXR.Editor.asmdef @@ -3,7 +3,8 @@ "references": [ "Unity.Labs.EditorXR", "Unity.TextMeshPro", - "Unity.Labs.Utils" + "Unity.Labs.Utils", + "Unity.Labs.EditorXR.Interfaces" ], "optionalUnityReferences": [], "includePlatforms": [ @@ -15,4 +16,4 @@ "precompiledReferences": [], "autoReferenced": true, "defineConstraints": [] -} +} \ No newline at end of file diff --git a/Interfaces/Capability.meta b/Interfaces/Capability.meta new file mode 100644 index 000000000..9fa4f6e59 --- /dev/null +++ b/Interfaces/Capability.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1f5e804cd09f7ee41ad7fa7c56ab5427 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/Interfaces/Capability/ITooltipPlacement.cs b/Interfaces/Capability/ITooltipPlacement.cs similarity index 93% rename from Runtime/Scripts/Interfaces/Capability/ITooltipPlacement.cs rename to Interfaces/Capability/ITooltipPlacement.cs index 3a7c2c422..40211da8a 100644 --- a/Runtime/Scripts/Interfaces/Capability/ITooltipPlacement.cs +++ b/Interfaces/Capability/ITooltipPlacement.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace UnityEditor.Experimental.EditorVR +namespace Unity.Labs.EditorXR.Interfaces { /// /// Decorates classes that provide positioning information for tooltips diff --git a/Runtime/Scripts/Interfaces/Capability/ITooltipPlacement.cs.meta b/Interfaces/Capability/ITooltipPlacement.cs.meta similarity index 100% rename from Runtime/Scripts/Interfaces/Capability/ITooltipPlacement.cs.meta rename to Interfaces/Capability/ITooltipPlacement.cs.meta diff --git a/Interfaces/Entity.meta b/Interfaces/Entity.meta new file mode 100644 index 000000000..a50a8cef1 --- /dev/null +++ b/Interfaces/Entity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e5bace250db20ef48ae4d88dc785b481 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/Interfaces/Entity/ITooltip.cs b/Interfaces/Entity/ITooltip.cs similarity index 85% rename from Runtime/Scripts/Interfaces/Entity/ITooltip.cs rename to Interfaces/Entity/ITooltip.cs index 4c74c987a..9c9708868 100644 --- a/Runtime/Scripts/Interfaces/Entity/ITooltip.cs +++ b/Interfaces/Entity/ITooltip.cs @@ -1,4 +1,4 @@ -namespace UnityEditor.Experimental.EditorVR +namespace Unity.Labs.EditorXR.Interfaces { /// /// Decorates classes which can specify tool tip information diff --git a/Runtime/Scripts/Interfaces/Entity/ITooltip.cs.meta b/Interfaces/Entity/ITooltip.cs.meta similarity index 100% rename from Runtime/Scripts/Interfaces/Entity/ITooltip.cs.meta rename to Interfaces/Entity/ITooltip.cs.meta diff --git a/Interfaces/Providers/IProvidesSetTooltipVisibility.cs b/Interfaces/Providers/IProvidesSetTooltipVisibility.cs new file mode 100644 index 000000000..f90bea8f9 --- /dev/null +++ b/Interfaces/Providers/IProvidesSetTooltipVisibility.cs @@ -0,0 +1,32 @@ +using System; +using Unity.Labs.ModuleLoader; + +namespace Unity.Labs.EditorXR.Interfaces +{ + /// + /// Provide access to tooltip visibility + /// + public interface IProvidesSetTooltipVisibility : IFunctionalityProvider + { + /// + /// Show a Tooltip. Calling ShowTooltip on an ITooltip that was just shown will update its placement and timing + /// + /// The tooltip to show + /// Whether the tooltip should stay visible regardless of raycasts + /// If the tooltip is shown persistently, and duration is less than 0, hide after the + /// duration, in seconds. If duration greater than 0, placement is updated but timing is not affected. If + /// duration is exactly 0, tooltip stays visible until explicitly hidden + /// (Optional) The ITooltipPlacement object used to place the tooltip. If no placement + /// is specified, we assume the ITooltip is a component and use its own Transform + /// (Optional) Called as soon as the tooltip becomes visible + void ShowTooltip(ITooltip tooltip, bool persistent = false, float duration = 0f, + ITooltipPlacement placement = null, Action becameVisible = null); + + /// + /// Hide the given Tooltip + /// + /// The tooltip to hide + /// Whether to hide the tooltip if it was shown with the persistent argument set to true + void HideTooltip(ITooltip tooltip, bool persistent = false); + } +} diff --git a/Runtime/Scripts/Interfaces/FunctionalityInjection/ISetTooltipVisibility.cs.meta b/Interfaces/Providers/IProvidesSetTooltipVisibility.cs.meta similarity index 69% rename from Runtime/Scripts/Interfaces/FunctionalityInjection/ISetTooltipVisibility.cs.meta rename to Interfaces/Providers/IProvidesSetTooltipVisibility.cs.meta index 5dfef8529..06d407a17 100644 --- a/Runtime/Scripts/Interfaces/FunctionalityInjection/ISetTooltipVisibility.cs.meta +++ b/Interfaces/Providers/IProvidesSetTooltipVisibility.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: f291a11d2c36de84393fb0e0b029d71d -timeCreated: 1484675711 -licenseType: Pro +guid: 4e9ad50aae34ce54dbe91e0c578ab273 +timeCreated: 1501022830 +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Runtime/Scripts/Interfaces/FunctionalityInjection/ISetTooltipVisibility.cs b/Interfaces/Subscribers/IUsesSetTooltipVisibility.cs similarity index 60% rename from Runtime/Scripts/Interfaces/FunctionalityInjection/ISetTooltipVisibility.cs rename to Interfaces/Subscribers/IUsesSetTooltipVisibility.cs index 9ccda3888..3eee8ec82 100644 --- a/Runtime/Scripts/Interfaces/FunctionalityInjection/ISetTooltipVisibility.cs +++ b/Interfaces/Subscribers/IUsesSetTooltipVisibility.cs @@ -1,47 +1,48 @@ -using System; - -namespace UnityEditor.Experimental.EditorVR -{ - /// - /// Provides access to the ability to show or hide a Tooltip - /// - public interface ISetTooltipVisibility - { - } - - public static class ISetTooltipVisibilityMethods - { - internal delegate void ShowTooltipDelegate(ITooltip tooltip, bool persistent = false, float duration = 0f, - ITooltipPlacement placement = null, Action becameVisible = null); - - internal static ShowTooltipDelegate showTooltip { get; set; } - internal static Action hideTooltip { get; set; } - - /// - /// Show a Tooltip. Calling ShowTooltip on an ITooltip that was just shown will update its placement and timing - /// - /// The tooltip to show - /// Whether the tooltip should stay visible regardless of raycasts - /// If the tooltip is shown persistently, and duration is less than 0, hide after the - /// duration, in seconds. If duration greater than 0, placement is updated but timing is not affected. If - /// duration is exactly 0, tooltip stays visible until explicitly hidden - /// (Optional) The ITooltipPlacement object used to place the tooltip. If no placement - /// is specified, we assume the ITooltip is a component and use its own Transform - /// (Optional) Called as soon as the tooltip becomes visible - public static void ShowTooltip(this ISetTooltipVisibility obj, ITooltip tooltip, bool persistent = false, - float duration = 0f, ITooltipPlacement placement = null, Action becameVisible = null) - { - showTooltip(tooltip, persistent, duration, placement, becameVisible); - } - - /// - /// Hide the given Tooltip - /// - /// The tooltip to hide - /// Whether to hide the tooltip if it was shown with the persistent argument set to true - public static void HideTooltip(this ISetTooltipVisibility obj, ITooltip tooltip, bool persistent = false) - { - hideTooltip(tooltip, persistent); - } - } -} +using System; +using Unity.Labs.ModuleLoader; + +namespace Unity.Labs.EditorXR.Interfaces +{ + /// + /// Gives decorated class control of tooltip visibility + /// + public interface IUsesSetTooltipVisibility : IFunctionalitySubscriber + { + } + + public static class UsesSetTooltipVisibilityMethods + { + /// + /// Show a Tooltip. Calling ShowTooltip on an ITooltip that was just shown will update its placement and timing + /// + /// The functionality user + /// The tooltip to show + /// Whether the tooltip should stay visible regardless of raycasts + /// If the tooltip is shown persistently, and duration is less than 0, hide after the + /// duration, in seconds. If duration greater than 0, placement is updated but timing is not affected. If + /// duration is exactly 0, tooltip stays visible until explicitly hidden + /// (Optional) The ITooltipPlacement object used to place the tooltip. If no placement + /// is specified, we assume the ITooltip is a component and use its own Transform + /// (Optional) Called as soon as the tooltip becomes visible + public static void ShowTooltip(this IUsesSetTooltipVisibility user, ITooltip tooltip, bool persistent = false, + float duration = 0f, ITooltipPlacement placement = null, Action becameVisible = null) + { +#if !FI_AUTOFILL + user.provider.ShowTooltip(tooltip, persistent, duration, placement, becameVisible); +#endif + } + + /// + /// Hide the given Tooltip + /// + /// The functionality user + /// The tooltip to hide + /// Whether to hide the tooltip if it was shown with the persistent argument set to true + public static void HideTooltip(this IUsesSetTooltipVisibility user, ITooltip tooltip, bool persistent = false) + { +#if !FI_AUTOFILL + user.provider.ShowTooltip(tooltip, persistent); +#endif + } + } +} diff --git a/Interfaces/Subscribers/IUsesSetTooltipVisibility.cs.meta b/Interfaces/Subscribers/IUsesSetTooltipVisibility.cs.meta new file mode 100644 index 000000000..e7d35d282 --- /dev/null +++ b/Interfaces/Subscribers/IUsesSetTooltipVisibility.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d6a57ff56a391ee4f92217d5df35ef2f +timeCreated: 1501022830 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Menus/MainMenu/MainMenu.cs b/Runtime/Menus/MainMenu/MainMenu.cs index 9285dfcb6..d5a2627f8 100644 --- a/Runtime/Menus/MainMenu/MainMenu.cs +++ b/Runtime/Menus/MainMenu/MainMenu.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Unity.Labs.EditorXR.Interfaces; using Unity.Labs.Utils; using UnityEditor.Experimental.EditorVR.Core; using UnityEditor.Experimental.EditorVR.Proxies; diff --git a/Runtime/Menus/MainMenu/Scripts/MainMenuButton.cs b/Runtime/Menus/MainMenu/Scripts/MainMenuButton.cs index 8ba422643..c657805c0 100644 --- a/Runtime/Menus/MainMenu/Scripts/MainMenuButton.cs +++ b/Runtime/Menus/MainMenu/Scripts/MainMenuButton.cs @@ -1,4 +1,5 @@ using System; +using Unity.Labs.EditorXR.Interfaces; using UnityEditor.Experimental.EditorVR.Modules; using UnityEngine; using UnityEngine.Events; diff --git a/Runtime/Menus/MainMenu/Scripts/MainMenuItemAttribute.cs b/Runtime/Menus/MainMenu/Scripts/MainMenuItemAttribute.cs index 3e102e4e8..0f6073de3 100644 --- a/Runtime/Menus/MainMenu/Scripts/MainMenuItemAttribute.cs +++ b/Runtime/Menus/MainMenu/Scripts/MainMenuItemAttribute.cs @@ -1,4 +1,5 @@ using System; +using Unity.Labs.EditorXR.Interfaces; namespace UnityEditor.Experimental.EditorVR { diff --git a/Runtime/Menus/RadialMenu/Scripts/RadialMenuSlot.cs b/Runtime/Menus/RadialMenu/Scripts/RadialMenuSlot.cs index 7c3b07e14..9d151da3a 100644 --- a/Runtime/Menus/RadialMenu/Scripts/RadialMenuSlot.cs +++ b/Runtime/Menus/RadialMenu/Scripts/RadialMenuSlot.cs @@ -1,5 +1,7 @@ using System; using System.Collections; +using Unity.Labs.EditorXR.Interfaces; +using Unity.Labs.ModuleLoader; using Unity.Labs.Utils; using UnityEditor.Experimental.EditorVR.Extensions; using UnityEditor.Experimental.EditorVR.Helpers; @@ -9,7 +11,7 @@ namespace UnityEditor.Experimental.EditorVR.Menus { - sealed class RadialMenuSlot : MonoBehaviour, ISetTooltipVisibility, ITooltip, ITooltipPlacement, IRayEnterHandler, IRayExitHandler + sealed class RadialMenuSlot : MonoBehaviour, IUsesSetTooltipVisibility, ITooltip, ITooltipPlacement, IRayEnterHandler, IRayExitHandler { static readonly Vector3 k_HiddenLocalScale = new Vector3(1f, 0f, 1f); const float k_IconHighlightedLocalYOffset = 0.006f; @@ -237,6 +239,10 @@ public Sprite icon public event Action hovered; +#if !FI_AUTOFILL + IProvidesSetTooltipVisibility IFunctionalitySubscriber.provider { get; set; } +#endif + void Awake() { m_MaskMaterial = MaterialUtils.GetMaterialClone(m_MaskRenderer); diff --git a/Runtime/Menus/RadialMenu/Scripts/RadialMenuUI.cs b/Runtime/Menus/RadialMenu/Scripts/RadialMenuUI.cs index ad14e0750..4d0c27a85 100644 --- a/Runtime/Menus/RadialMenu/Scripts/RadialMenuUI.cs +++ b/Runtime/Menus/RadialMenu/Scripts/RadialMenuUI.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using System.Linq; +using Unity.Labs.EditorXR.Interfaces; using UnityEditor.Experimental.EditorVR.Extensions; using UnityEditor.Experimental.EditorVR.Utilities; using UnityEngine; diff --git a/Runtime/Menus/ToolsMenu/ToolsMenuButton/ToolsMenuButton.cs b/Runtime/Menus/ToolsMenu/ToolsMenuButton/ToolsMenuButton.cs index fc5b4ee7e..324115803 100644 --- a/Runtime/Menus/ToolsMenu/ToolsMenuButton/ToolsMenuButton.cs +++ b/Runtime/Menus/ToolsMenu/ToolsMenuButton/ToolsMenuButton.cs @@ -1,6 +1,8 @@ using System; using System.Collections; using System.Text; +using Unity.Labs.EditorXR.Interfaces; +using Unity.Labs.ModuleLoader; using Unity.Labs.Utils; using UnityEditor.Experimental.EditorVR.Extensions; using UnityEditor.Experimental.EditorVR.Helpers; @@ -11,7 +13,7 @@ namespace UnityEditor.Experimental.EditorVR.Menus { - sealed class ToolsMenuButton : MonoBehaviour, IToolsMenuButton, ITooltip, ITooltipPlacement, ISetTooltipVisibility + sealed class ToolsMenuButton : MonoBehaviour, IToolsMenuButton, ITooltip, ITooltipPlacement, IUsesSetTooltipVisibility { static Color s_FrameOpaqueColor; @@ -432,6 +434,10 @@ public Vector3 primaryUIContentContainerLocalScale public event Action hovered; +#if !FI_AUTOFILL + IProvidesSetTooltipVisibility IFunctionalitySubscriber.provider { get; set; } +#endif + void Awake() { m_OriginalLocalPosition = transform.localPosition; diff --git a/Runtime/Scripts/Actions/ActionMenuItemAttribute.cs b/Runtime/Scripts/Actions/ActionMenuItemAttribute.cs index 7a5d54bcb..4bc231d9f 100644 --- a/Runtime/Scripts/Actions/ActionMenuItemAttribute.cs +++ b/Runtime/Scripts/Actions/ActionMenuItemAttribute.cs @@ -1,9 +1,12 @@ -namespace UnityEditor.Experimental.EditorVR +using System; +using Unity.Labs.EditorXR.Interfaces; + +namespace UnityEditor.Experimental.EditorVR { /// /// Attribute used to tag Action classes in order to be added to VR menus /// - public class ActionMenuItemAttribute : System.Attribute, ITooltip + public class ActionMenuItemAttribute : Attribute, ITooltip { internal const string DefaultActionSectionName = "DefaultActions"; internal string name; diff --git a/Runtime/Scripts/Data/ActionMenuData.cs b/Runtime/Scripts/Data/ActionMenuData.cs index c9cdb88d0..bff45d723 100644 --- a/Runtime/Scripts/Data/ActionMenuData.cs +++ b/Runtime/Scripts/Data/ActionMenuData.cs @@ -1,4 +1,6 @@ -namespace UnityEditor.Experimental.EditorVR +using Unity.Labs.EditorXR.Interfaces; + +namespace UnityEditor.Experimental.EditorVR { /// /// Used for passing action data for menu purposes diff --git a/Runtime/Scripts/Modules/TooltipModule/Tooltip.cs b/Runtime/Scripts/Modules/TooltipModule/Tooltip.cs index d19c01d4a..b2c866e2f 100644 --- a/Runtime/Scripts/Modules/TooltipModule/Tooltip.cs +++ b/Runtime/Scripts/Modules/TooltipModule/Tooltip.cs @@ -1,4 +1,5 @@ -using UnityEngine; +using Unity.Labs.EditorXR.Interfaces; +using UnityEngine; namespace UnityEditor.Experimental.EditorVR.UI { diff --git a/Runtime/Scripts/Modules/TooltipModule/TooltipModule.cs b/Runtime/Scripts/Modules/TooltipModule/TooltipModule.cs index 50d9eb81b..2924d83b3 100644 --- a/Runtime/Scripts/Modules/TooltipModule/TooltipModule.cs +++ b/Runtime/Scripts/Modules/TooltipModule/TooltipModule.cs @@ -10,7 +10,7 @@ namespace UnityEditor.Experimental.EditorVR.Modules { sealed class TooltipModule : ScriptableSettings, IInitializableModule, IModuleBehaviorCallbacks, - IModuleDependency, IUsesViewerScale + IModuleDependency, IUsesViewerScale, IProvidesSetTooltipVisibility { class TooltipData { @@ -101,9 +101,6 @@ public void ConnectDependency(MultipleRayInputModule dependency) public void LoadModule() { m_TooltipScale = m_TooltipPrefab.transform.localScale; - - ISetTooltipVisibilityMethods.showTooltip = ShowTooltip; - ISetTooltipVisibilityMethods.hideTooltip = HideTooltip; } public void UnloadModule() { } @@ -313,7 +310,7 @@ void OnRayExited(GameObject gameObject, RayEventData eventData) } } - void ShowTooltip(ITooltip tooltip, bool persistent = false, float duration = 0f, ITooltipPlacement placementOverride = null, Action becameVisible = null) + public void ShowTooltip(ITooltip tooltip, bool persistent = false, float duration = 0f, ITooltipPlacement placementOverride = null, Action becameVisible = null) { if (!IsValidTooltip(tooltip)) return; @@ -394,7 +391,7 @@ static bool IsValidTooltip(ITooltip tooltip) return !string.IsNullOrEmpty(tooltip.tooltipText); } - void HideTooltip(ITooltip tooltip, bool persistent = false) + public void HideTooltip(ITooltip tooltip, bool persistent = false) { TooltipData tooltipData; if (m_Tooltips.TryGetValue(tooltip, out tooltipData)) @@ -483,5 +480,18 @@ public void OnBehaviorStart() { } public void OnBehaviorDisable() { } public void OnBehaviorDestroy() { } + + public void LoadProvider() { } + + public void ConnectSubscriber(object obj) + { +#if !FI_AUTOFILL + var visibilitySubscriber = obj as IFunctionalitySubscriber; + if (visibilitySubscriber != null) + visibilitySubscriber.provider = this; +#endif + } + + public void UnloadProvider() { } } } diff --git a/Runtime/Scripts/Proxies/AffordanceTooltip.cs b/Runtime/Scripts/Proxies/AffordanceTooltip.cs index 2d319c3bc..d625945b2 100644 --- a/Runtime/Scripts/Proxies/AffordanceTooltip.cs +++ b/Runtime/Scripts/Proxies/AffordanceTooltip.cs @@ -1,4 +1,5 @@ -using UnityEngine; +using Unity.Labs.EditorXR.Interfaces; +using UnityEngine; namespace UnityEditor.Experimental.EditorVR.Proxies { diff --git a/Runtime/Scripts/Proxies/AffordanceTooltipPlacement.cs b/Runtime/Scripts/Proxies/AffordanceTooltipPlacement.cs index 87d16cb0d..52ceccee6 100644 --- a/Runtime/Scripts/Proxies/AffordanceTooltipPlacement.cs +++ b/Runtime/Scripts/Proxies/AffordanceTooltipPlacement.cs @@ -1,4 +1,5 @@ -using Unity.Labs.Utils.GUI; +using Unity.Labs.EditorXR.Interfaces; +using Unity.Labs.Utils.GUI; using UnityEngine; namespace UnityEditor.Experimental.EditorVR.Proxies diff --git a/Runtime/Scripts/Proxies/ProxyNode.cs b/Runtime/Scripts/Proxies/ProxyNode.cs index 139113df5..0269f1342 100644 --- a/Runtime/Scripts/Proxies/ProxyNode.cs +++ b/Runtime/Scripts/Proxies/ProxyNode.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; using System.Linq; +using Unity.Labs.EditorXR.Interfaces; +using Unity.Labs.ModuleLoader; using Unity.Labs.Utils; using UnityEditor.Experimental.EditorVR.Core; using UnityEditor.Experimental.EditorVR.Utilities; @@ -12,7 +14,7 @@ namespace UnityEditor.Experimental.EditorVR.Proxies using VisibilityControlType = ProxyAffordanceMap.VisibilityControlType; using VRControl = VRInputDevice.VRControl; - class ProxyNode : MonoBehaviour, ISetTooltipVisibility, ISetHighlight, IConnectInterfaces + class ProxyNode : MonoBehaviour, IUsesSetTooltipVisibility, ISetHighlight, IConnectInterfaces { class AffordanceData { @@ -409,6 +411,10 @@ public void OnDestroy() /// public Transform fieldGrabOrigin { get { return m_FieldGrabOrigin; } } +#if !FI_AUTOFILL + IProvidesSetTooltipVisibility IFunctionalitySubscriber.provider { get; set; } +#endif + void Awake() { // Don't allow setup if affordances are invalid diff --git a/Runtime/Scripts/Proxies/TwoHandedProxyBase.cs b/Runtime/Scripts/Proxies/TwoHandedProxyBase.cs index 3237aeff0..b3b01cfcb 100644 --- a/Runtime/Scripts/Proxies/TwoHandedProxyBase.cs +++ b/Runtime/Scripts/Proxies/TwoHandedProxyBase.cs @@ -1,6 +1,8 @@ using System; using System.Collections; using System.Collections.Generic; +using Unity.Labs.EditorXR.Interfaces; +using Unity.Labs.ModuleLoader; using UnityEditor.Experimental.EditorVR.Core; using UnityEditor.Experimental.EditorVR.Helpers; using UnityEditor.Experimental.EditorVR.Input; @@ -25,7 +27,7 @@ public enum FacingDirection Bottom = 1 << 5 } - abstract class TwoHandedProxyBase : MonoBehaviour, IProxy, IFeedbackReceiver, ISetTooltipVisibility, ISetHighlight, ISerializePreferences + abstract class TwoHandedProxyBase : MonoBehaviour, IProxy, IFeedbackReceiver, IUsesSetTooltipVisibility, ISetHighlight, ISerializePreferences { [SerializeField] protected GameObject m_LeftHandProxyPrefab; @@ -112,6 +114,10 @@ public virtual bool hidden public Dictionary previewOrigins { get; set; } public Dictionary fieldGrabOrigins { get; set; } +#if !FI_AUTOFILL + IProvidesSetTooltipVisibility IFunctionalitySubscriber.provider { get; set; } +#endif + public void FakeActivate() { m_FakeActive = true; diff --git a/Runtime/Scripts/UI/TooltipData.cs b/Runtime/Scripts/UI/TooltipData.cs index ac44960cc..4b81bad23 100644 --- a/Runtime/Scripts/UI/TooltipData.cs +++ b/Runtime/Scripts/UI/TooltipData.cs @@ -1,3 +1,4 @@ +using Unity.Labs.EditorXR.Interfaces; using UnityEngine; namespace UnityEditor.Experimental.EditorVR.UI diff --git a/Runtime/Tools/SelectionTool/SelectionTool.cs b/Runtime/Tools/SelectionTool/SelectionTool.cs index ea2eeeda6..da64221c5 100644 --- a/Runtime/Tools/SelectionTool/SelectionTool.cs +++ b/Runtime/Tools/SelectionTool/SelectionTool.cs @@ -18,7 +18,7 @@ namespace UnityEditor.Experimental.EditorVR.Tools sealed class SelectionTool : MonoBehaviour, ITool, IUsesRayOrigin, IUsesRaycastResults, ICustomActionMap, ISetHighlight, ISelectObject, ISetManipulatorsVisible, IIsHoveringOverUI, IUsesDirectSelection, ILinkedObject, ICanGrabObject, IGetManipulatorDragState, IUsesNode, IGetRayVisibility, IIsMainMenuVisible, IIsInMiniWorld, - IRayToNode, IGetDefaultRayColor, ISetDefaultRayColor, ITooltip, ITooltipPlacement, ISetTooltipVisibility, + IRayToNode, IGetDefaultRayColor, ISetDefaultRayColor, ITooltip, ITooltipPlacement, IUsesSetTooltipVisibility, IUsesDeviceType, IMenuIcon, IUsesPointer, IRayVisibilitySettings, IUsesViewerScale, ICheckBounds, ISettingsMenuItemProvider, ISerializePreferences, IStandardIgnoreList, IBlockUIInteraction, IRequestFeedback, IGetVRPlayerObjects @@ -158,6 +158,7 @@ public GameObject settingsMenuItemInstance #if !FI_AUTOFILL IProvidesRaycastResults IFunctionalitySubscriber.provider { get; set; } IProvidesViewerScale IFunctionalitySubscriber.provider { get; set; } + IProvidesSetTooltipVisibility IFunctionalitySubscriber.provider { get; set; } #endif // Local method use only -- created here to reduce garbage collection diff --git a/Runtime/Workspaces/InspectorWorkspace/Scripts/ListItems/InspectorPropertyItem.cs b/Runtime/Workspaces/InspectorWorkspace/Scripts/ListItems/InspectorPropertyItem.cs index 6864c7edb..9fe6d5582 100644 --- a/Runtime/Workspaces/InspectorWorkspace/Scripts/ListItems/InspectorPropertyItem.cs +++ b/Runtime/Workspaces/InspectorWorkspace/Scripts/ListItems/InspectorPropertyItem.cs @@ -1,5 +1,6 @@ using System; using TMPro; +using Unity.Labs.EditorXR.Interfaces; using UnityEditor.Experimental.EditorVR.Data; using UnityEngine;