Skip to content

Commit 3972424

Browse files
committed
Revert "CHANGE: Refactor class conditional guards (#2183)"
This reverts commit f2e8ea5.
1 parent 23e316a commit 3972424

File tree

14 files changed

+73
-122
lines changed

14 files changed

+73
-122
lines changed

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ however, it has to be formatted properly to pass verification tests.
5757

5858
### Changed
5959
- Changed enum value `Key.IMESelected` to obsolete which was not a real key. Please use the ButtonControl `imeSelected`.
60-
- Changed conditional guards inside Plugins/XR so that we don't unnecessarily wrap entire classes. This stops downstream packages from having to also wrap Input System objects with similar conditionals.
6160

6261
### Added
6362
- Added support of F13-F24 keys. [UUM-44328](https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-44328)

Packages/com.unity.inputsystem/Documentation~/filter.yml

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -37,54 +37,3 @@ apiRules:
3737
- exclude:
3838
uidRegex: ^UnityEngine\.InputSystem\.InputSystem\.runInBackground$
3939
type: Member
40-
- exclude:
41-
uidRegex: ^Unity\.XR\.Oculus\.Input(?:\..+)*$
42-
type: Namespace
43-
- exclude:
44-
uidRegex: ^Unity\.XR\.GoogleVr(?:\..+)*$
45-
type: Namespace
46-
- exclude:
47-
uidRegex: ^Unity\.XR\.OpenVR(?:\..+)*$
48-
type: Namespace
49-
- exclude:
50-
uidRegex: ^UnityEngine\.XR\.WindowsMR\.Input(?:\..+)*$
51-
type: Namespace
52-
- exclude:
53-
uidRegex: ^UnityEngine\.InputSystem\.XR\.Haptics(?:\..+)*$
54-
type: Namespace
55-
- exclude:
56-
uidRegex: ^UnityEngine\.InputSystem\.XR\.XRControllerWithRumble$
57-
type: Type
58-
- exclude:
59-
uidRegex: ^UnityEngine\.InputSystem\.XR\.XRControllerWithRumble\..*$
60-
type: Member
61-
- exclude:
62-
uidRegex: ^UnityEngine\.InputSystem\.XR\.XRSupport$
63-
type: Type
64-
- exclude:
65-
uidRegex: ^UnityEngine\.InputSystem\.XR\.XRSupport\..*$
66-
type: Member
67-
- exclude:
68-
uidRegex: ^UnityEngine\.InputSystem\.XR\.FeatureType$
69-
type: Type
70-
- exclude:
71-
uidRegex: ^UnityEngine\.InputSystem\.XR\.UsageHint$
72-
type: Type
73-
- exclude:
74-
uidRegex: ^UnityEngine\.InputSystem\.XR\.XRFeatureDescriptor$
75-
type: Type
76-
- exclude:
77-
uidRegex: ^UnityEngine\.InputSystem\.XR\.XRDeviceDescriptor$
78-
type: Type
79-
- exclude:
80-
uidRegex: ^UnityEngine\.InputSystem\.XR\.Bone$
81-
type: Type
82-
- exclude:
83-
uidRegex: ^UnityEngine\.InputSystem\.XR\.Eyes$
84-
type: Type
85-
- exclude:
86-
uidRegex: ^UnityEngine\.InputSystem\.XR\.BoneControl$
87-
type: Type
88-
- exclude:
89-
uidRegex: ^UnityEngine\.InputSystem\.XR\.EyesControl$
90-
type: Type

Packages/com.unity.inputsystem/InputSystem/Plugins/XR/Devices/GoogleVR.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#if !DISABLE_BUILTIN_INPUT_SYSTEM_GOOGLEVR
1+
// ENABLE_VR is not defined on Game Core but the assembly is available with limited features when the XR module is enabled.
22
// Docs generation is skipped because these are intended to be replaced with the com.unity.xr.googlevr package.
3+
#if UNITY_INPUT_SYSTEM_ENABLE_XR && (ENABLE_VR || UNITY_GAMECORE) && !DISABLE_BUILTIN_INPUT_SYSTEM_GOOGLEVR && !UNITY_FORCE_INPUTSYSTEM_XR_OFF && !PACKAGE_DOCS_GENERATION
34
using UnityEngine.InputSystem.Controls;
45
using UnityEngine.InputSystem.Layouts;
56
using UnityEngine.InputSystem.XR;

Packages/com.unity.inputsystem/InputSystem/Plugins/XR/Devices/Oculus.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#if !DISABLE_BUILTIN_INPUT_SYSTEM_OCULUS
1+
// ENABLE_VR is not defined on Game Core but the assembly is available with limited features when the XR module is enabled.
22
// Docs generation is skipped because these are intended to be replaced with the com.unity.xr.oculus package.
3+
#if UNITY_INPUT_SYSTEM_ENABLE_XR && (ENABLE_VR || UNITY_GAMECORE) && !DISABLE_BUILTIN_INPUT_SYSTEM_OCULUS && !UNITY_FORCE_INPUTSYSTEM_XR_OFF && !PACKAGE_DOCS_GENERATION
34
using UnityEngine.InputSystem;
45
using UnityEngine.InputSystem.Controls;
56
using UnityEngine.InputSystem.Layouts;

Packages/com.unity.inputsystem/InputSystem/Plugins/XR/Devices/OpenVR.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#if !DISABLE_BUILTIN_INPUT_SYSTEM_OPENVR
1+
// ENABLE_VR is not defined on Game Core but the assembly is available with limited features when the XR module is enabled.
22
// Docs generation is skipped because these are intended to be replaced with the com.unity.xr.openvr package.
3+
#if UNITY_INPUT_SYSTEM_ENABLE_XR && (ENABLE_VR || UNITY_GAMECORE) && !DISABLE_BUILTIN_INPUT_SYSTEM_OPENVR && !UNITY_FORCE_INPUTSYSTEM_XR_OFF && !PACKAGE_DOCS_GENERATION
34
using UnityEngine.InputSystem;
45
using UnityEngine.InputSystem.Controls;
56
using UnityEngine.InputSystem.Layouts;

Packages/com.unity.inputsystem/InputSystem/Plugins/XR/Devices/WindowsMR.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#if !DISABLE_BUILTIN_INPUT_SYSTEM_WINDOWSMR
1+
// ENABLE_VR is not defined on Game Core but the assembly is available with limited features when the XR module is enabled.
22
// Docs generation is skipped because these are intended to be replaced with the com.unity.xr.windowsmr package.
3+
#if UNITY_INPUT_SYSTEM_ENABLE_XR && (ENABLE_VR || UNITY_GAMECORE) && !DISABLE_BUILTIN_INPUT_SYSTEM_WINDOWSMR && !UNITY_FORCE_INPUTSYSTEM_XR_OFF && !PACKAGE_DOCS_GENERATION
34
using UnityEngine.InputSystem.Controls;
45
using UnityEngine.InputSystem.Layouts;
56
using UnityEngine.InputSystem.XR;
Lines changed: 39 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,52 @@
1+
// ENABLE_VR is not defined on Game Core but the assembly is available with limited features when the XR module is enabled.
2+
#if UNITY_INPUT_SYSTEM_ENABLE_XR && (ENABLE_VR || UNITY_GAMECORE) && !UNITY_FORCE_INPUTSYSTEM_XR_OFF || PACKAGE_DOCS_GENERATION
13
using UnityEngine.InputSystem.Controls;
24
using UnityEngine.InputSystem.XR.Haptics;
35
using UnityEngine.InputSystem.Layouts;
46
using UnityEngine.XR;
57

68
namespace UnityEngine.InputSystem.XR
79
{
8-
/// <summary>
9-
/// The base type of all XR head mounted displays. This can help organize shared behaviour across all HMDs.
10-
/// </summary>
11-
///
12-
/// <remarks>
13-
///
14-
/// To give your head tracking an extra update before rendering:
15-
/// First, enable before render updates on your Device.
16-
///
17-
/// // JSON
18-
/// {
19-
/// "name" : "MyHMD",
20-
/// "extend" : "HMD",
21-
/// "beforeRender" : "Update"
22-
/// }
23-
///
24-
/// Then, make sure you put extra `StateEvents` for your HMD on the queue right in time before rendering. Also, if your HMD is a combination of non-tracking and tracking controls, you can update just the tracking by sending a delta event instead of a full state event.
25-
///
26-
/// </remarks>
2710
[InputControlLayout(isGenericTypeOfDevice = true, displayName = "XR HMD", canRunInBackground = true)]
2811
public class XRHMD : TrackedDevice
2912
{
3013
/// <summary>
31-
/// Accessor for left eye position.
14+
/// The base type of all XR head mounted displays. This can help organize shared behaviour across all HMDs.
3215
/// </summary>
16+
///
17+
/// <remarks>
18+
///
19+
/// To give your head tracking an extra update before rendering:
20+
/// First, enable before render updates on your Device.
21+
///
22+
/// <sample>
23+
/// <code>
24+
/// // JSON
25+
/// {
26+
/// "name" : "MyHMD",
27+
/// "extend" : "HMD",
28+
/// "beforeRender" : "Update"
29+
/// }
30+
/// </code>
31+
/// </sample>
32+
///
33+
/// Then, make sure you put extra `StateEvents` for your HMD on the queue right in time before rendering. Also, if your HMD is a combination of non-tracking and tracking controls, you can update just the tracking by sending a delta event instead of a full state event.
34+
///
35+
/// </remarks>
36+
3337
[InputControl(noisy = true)]
3438
public Vector3Control leftEyePosition { get; protected set; }
35-
36-
/// <summary>
37-
/// Accessor for left eye rotation.
38-
/// </summary>
3939
[InputControl(noisy = true)]
4040
public QuaternionControl leftEyeRotation { get; protected set; }
41-
42-
/// <summary>
43-
/// Accessor for right eye position.
44-
/// </summary>
4541
[InputControl(noisy = true)]
4642
public Vector3Control rightEyePosition { get; protected set; }
47-
48-
/// <summary>
49-
/// Accessor for right eye rotation.
50-
/// </summary>
5143
[InputControl(noisy = true)]
5244
public QuaternionControl rightEyeRotation { get; protected set; }
53-
54-
/// <summary>
55-
/// Accessor for center eye position.
56-
/// </summary>
5745
[InputControl(noisy = true)]
5846
public Vector3Control centerEyePosition { get; protected set; }
59-
60-
/// <summary>
61-
/// Accessor for center eye rotation.
62-
/// </summary>
6347
[InputControl(noisy = true)]
6448
public QuaternionControl centerEyeRotation { get; protected set; }
6549

66-
/// <summary>
67-
/// Override for FinishSetup().
68-
/// </summary>
6950
protected override void FinishSetup()
7051
{
7152
base.FinishSetup();
@@ -91,12 +72,22 @@ public class XRController : TrackedDevice
9172
/// <remarks>
9273
/// If there is no left hand connected, this will be null.
9374
/// This also matches any currently tracked device that contains the 'LeftHand' device usage.
94-
/// To set up an Action to specifically target
95-
/// the left-hand XR controller:
75+
/// <example>
76+
/// <code>
77+
/// // To set up an Action to specifically target
78+
/// // the left-hand XR controller:
79+
///
9680
/// var action = new InputAction(binding: "/&lt;XRController&gt;{leftHand}/position");
97-
/// To make the left-hand XR controller behave like the right-hand one
81+
/// </code>
82+
/// </example>
83+
///
84+
/// <example>
85+
/// <code>
86+
/// // To make the left-hand XR controller behave like the right-hand one
9887
/// var controller = XRController.leftHand;
9988
/// InputSystem.SetUsage(controller, CommonUsages.RightHand);
89+
/// </code>
90+
/// </example>
10091
/// </remarks>
10192
public static XRController leftHand => InputSystem.GetDevice<XRController>(CommonUsages.LeftHand);
10293

@@ -106,13 +97,10 @@ public class XRController : TrackedDevice
10697
/// <remarks>If there is no left hand connected, this will be null. This also matches any currently tracked device that contains the 'RightHand' device usage.</remarks>
10798
public static XRController rightHand => InputSystem.GetDevice<XRController>(CommonUsages.RightHand);
10899

109-
/// <summary>
110-
/// Override for FinishSetup().
111-
/// </summary>
112100
protected override void FinishSetup()
113101
{
114102
base.FinishSetup();
115-
#if UNITY_INPUT_SYSTEM_ENABLE_XR
103+
116104
var capabilities = description.capabilities;
117105
var deviceDescriptor = XRDeviceDescriptor.FromJson(capabilities);
118106

@@ -123,7 +111,6 @@ protected override void FinishSetup()
123111
else if ((deviceDescriptor.characteristics & InputDeviceCharacteristics.Right) != 0)
124112
InputSystem.SetDeviceUsage(this, CommonUsages.RightHand);
125113
}
126-
#endif
127114
}
128115
}
129116

@@ -132,15 +119,11 @@ protected override void FinishSetup()
132119
/// </summary>
133120
public class XRControllerWithRumble : XRController
134121
{
135-
/// <summary>
136-
/// Sends an impulse command with the given amplitude and duration.
137-
/// </summary>
138-
/// <param name="amplitude"> Amplitude of the impulse.</param>
139-
/// <param name="duration"> Duration of the impulse.</param>
140122
public void SendImpulse(float amplitude, float duration)
141123
{
142124
var command = SendHapticImpulseCommand.Create(0, amplitude, duration);
143125
ExecuteCommand(ref command);
144126
}
145127
}
146128
}
129+
#endif

Packages/com.unity.inputsystem/InputSystem/Plugins/XR/Haptics/BufferedRumble.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// ENABLE_VR is not defined on Game Core but the assembly is available with limited features when the XR module is enabled.
2+
#if UNITY_INPUT_SYSTEM_ENABLE_XR && (ENABLE_VR || UNITY_GAMECORE) || PACKAGE_DOCS_GENERATION
13
namespace UnityEngine.InputSystem.XR.Haptics
24
{
35
public struct BufferedRumble
@@ -24,3 +26,4 @@ public void EnqueueRumble(byte[] samples)
2426
}
2527
}
2628
}
29+
#endif

Packages/com.unity.inputsystem/InputSystem/Plugins/XR/Haptics/GetCurrentHapticStateCommand.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// ENABLE_VR is not defined on Game Core but the assembly is available with limited features when the XR module is enabled.
2+
#if UNITY_INPUT_SYSTEM_ENABLE_XR && (ENABLE_VR || UNITY_GAMECORE) || PACKAGE_DOCS_GENERATION
13
using System.Runtime.InteropServices;
24
using UnityEngine.InputSystem.LowLevel;
35
using UnityEngine.InputSystem.Utilities;
@@ -45,3 +47,4 @@ public static GetCurrentHapticStateCommand Create()
4547
}
4648
}
4749
}
50+
#endif

Packages/com.unity.inputsystem/InputSystem/Plugins/XR/Haptics/GetHapticCapabilitiesCommand.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// ENABLE_VR is not defined on Game Core but the assembly is available with limited features when the XR module is enabled.
2+
#if UNITY_INPUT_SYSTEM_ENABLE_XR && (ENABLE_VR || UNITY_GAMECORE) || PACKAGE_DOCS_GENERATION
13
using System.Runtime.InteropServices;
24
using UnityEngine.InputSystem.LowLevel;
35
using UnityEngine.InputSystem.Utilities;
@@ -154,3 +156,4 @@ public static GetHapticCapabilitiesCommand Create()
154156
}
155157
}
156158
}
159+
#endif

0 commit comments

Comments
 (0)