Skip to content

Commit d14924b

Browse files
Usages renaming commit
1 parent 3271d82 commit d14924b

File tree

16 files changed

+90
-90
lines changed

16 files changed

+90
-90
lines changed

Assets/QA/Tests/XRDeviceActions/_SharedScripts/Handedness.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ public void Update()
1212
{
1313
var handedness = "";
1414

15-
var leftHand = InputSystem.GetDevice<XRController>(CommonUsages.LeftHand);
16-
var rightHand = InputSystem.GetDevice<XRController>(CommonUsages.RightHand);
15+
var leftHand = InputSystem.GetDevice<XRController>(Usages.LeftHand);
16+
var rightHand = InputSystem.GetDevice<XRController>(Usages.RightHand);
1717

1818
if (leftHand != null)
1919
handedness += "Left ";

Assets/Samples/CustomDeviceUsages/CustomDeviceUsages.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ private static void Initialize()
5252
// The layout override is just a fragment of layout information
5353
// in JSON format.
5454
//
55-
// The key property here is "commonUsages" which tells the system
55+
// The key property here is "usages" which tells the system
5656
// that "Player1" and "Player2" are possible usages applied to devices
5757
// using the given layout ("Gamepad" in our case).
5858
InputSystem.RegisterLayoutOverride(@"
5959
{
6060
""name"" : ""GamepadPlayerUsageTags"",
6161
""extend"" : ""Gamepad"",
62-
""commonUsages"" : [
62+
""usages"" : [
6363
""Player1"", ""Player2""
6464
]
6565
}

Assets/Tests/InputSystem/CoreTests_Actions_Rebinding.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ public void Actions_InteractiveRebinding_IfDeviceHasUsages_UsagesAreAppliedToOve
776776
var action = new InputAction(binding: "<Gamepad>/buttonSouth");
777777

778778
var rightHand = InputSystem.AddDevice<Gamepad>();
779-
InputSystem.SetDeviceUsage(rightHand, CommonUsages.RightHand);
779+
InputSystem.SetDeviceUsage(rightHand, Usages.RightHand);
780780

781781
using (var rebind = new InputActionRebindingExtensions.RebindingOperation().WithAction(action).Start())
782782
{
@@ -1122,8 +1122,8 @@ public void Actions_InteractiveRebinding_IfDeviceHasMultipleUsages_UsagesAreAppl
11221122

11231123
var rightHandVertical = InputSystem.AddDevice<Gamepad>();
11241124

1125-
InputSystem.SetDeviceUsage(rightHandVertical, CommonUsages.RightHand);
1126-
InputSystem.AddDeviceUsage(rightHandVertical, CommonUsages.Vertical);
1125+
InputSystem.SetDeviceUsage(rightHandVertical, Usages.RightHand);
1126+
InputSystem.AddDeviceUsage(rightHandVertical, Usages.Vertical);
11271127

11281128
using (var rebind = new InputActionRebindingExtensions.RebindingOperation().WithAction(action).Start())
11291129
{

Assets/Tests/InputSystem/CoreTests_Devices.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public void Devices_ChangingUsageOfDevice_SendsDeviceChangeNotification()
210210
receivedDeviceChange = c;
211211
};
212212

213-
InputSystem.SetDeviceUsage(device, CommonUsages.LeftHand);
213+
InputSystem.SetDeviceUsage(device, Usages.LeftHand);
214214

215215
Assert.That(receivedDevice, Is.SameAs(device));
216216
Assert.That(receivedDeviceChange, Is.EqualTo(InputDeviceChange.UsageChanged));
@@ -223,7 +223,7 @@ public void Devices_CanFindDeviceByUsage()
223223
InputSystem.AddDevice<Gamepad>();
224224
var device = InputSystem.AddDevice<Keyboard>();
225225

226-
InputSystem.SetDeviceUsage(device, CommonUsages.LeftHand);
226+
InputSystem.SetDeviceUsage(device, Usages.LeftHand);
227227

228228
using (var controls = InputSystem.FindControls("/{LeftHand}"))
229229
{
@@ -292,8 +292,8 @@ public void Devices_CanFindDeviceByMultipleUsages()
292292
InputSystem.AddDevice<Gamepad>();
293293
var device = InputSystem.AddDevice<Gamepad>();
294294

295-
InputSystem.SetDeviceUsage(device, CommonUsages.LeftHand);
296-
InputSystem.AddDeviceUsage(device, CommonUsages.Vertical);
295+
InputSystem.SetDeviceUsage(device, Usages.LeftHand);
296+
InputSystem.AddDeviceUsage(device, Usages.Vertical);
297297

298298
// Device should be found even if the one of the usages is specified
299299
using (var controls = InputSystem.FindControls("/{LeftHand}"))
@@ -328,10 +328,10 @@ public void Devices_CanFindDeviceByMultipleUsages()
328328
public void Devices_CanFindDeviceByUsageAndLayout()
329329
{
330330
var gamepad = InputSystem.AddDevice<Gamepad>();
331-
InputSystem.SetDeviceUsage(gamepad, CommonUsages.LeftHand);
331+
InputSystem.SetDeviceUsage(gamepad, Usages.LeftHand);
332332

333333
var keyboard = InputSystem.AddDevice<Keyboard>();
334-
InputSystem.SetDeviceUsage(keyboard, CommonUsages.LeftHand);
334+
InputSystem.SetDeviceUsage(keyboard, Usages.LeftHand);
335335

336336
using (var controls = InputSystem.FindControls("/<Keyboard>{LeftHand}"))
337337
{
@@ -925,11 +925,11 @@ public void Devices_CanLookUpDeviceByTypeAndUsage()
925925
var rightHand = InputSystem.AddDevice<Gamepad>();
926926
InputSystem.AddDevice<Gamepad>(); // Noise.
927927

928-
InputSystem.SetDeviceUsage(leftHand, CommonUsages.LeftHand);
929-
InputSystem.SetDeviceUsage(rightHand, CommonUsages.RightHand);
928+
InputSystem.SetDeviceUsage(leftHand, Usages.LeftHand);
929+
InputSystem.SetDeviceUsage(rightHand, Usages.RightHand);
930930

931-
Assert.That(InputSystem.GetDevice<Gamepad>(CommonUsages.LeftHand), Is.SameAs(leftHand));
932-
Assert.That(InputSystem.GetDevice<Gamepad>(CommonUsages.RightHand), Is.SameAs(rightHand));
931+
Assert.That(InputSystem.GetDevice<Gamepad>(Usages.LeftHand), Is.SameAs(leftHand));
932+
Assert.That(InputSystem.GetDevice<Gamepad>(Usages.RightHand), Is.SameAs(rightHand));
933933
}
934934

935935
[Test]

Assets/Tests/InputSystem/CoreTests_Editor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,14 @@ public void Editor_DomainReload_CanRestoreDevicesBuiltWithDynamicallyGeneratedLa
217217
public void Editor_DomainReload_PreservesUsagesOnDevices()
218218
{
219219
var device = InputSystem.AddDevice<Gamepad>();
220-
InputSystem.SetDeviceUsage(device, CommonUsages.LeftHand);
220+
InputSystem.SetDeviceUsage(device, Usages.LeftHand);
221221

222222
SimulateDomainReload();
223223

224224
var newDevice = InputSystem.devices[0];
225225

226226
Assert.That(newDevice.usages, Has.Count.EqualTo(1));
227-
Assert.That(newDevice.usages, Has.Exactly(1).EqualTo(CommonUsages.LeftHand));
227+
Assert.That(newDevice.usages, Has.Exactly(1).EqualTo(Usages.LeftHand));
228228
}
229229

230230
// We have code that will automatically query the enabled state of devices on creation

Assets/Tests/InputSystem/CoreTests_Layouts.cs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public void Layouts_CanSetUsagesThroughControlAttribute()
185185
{
186186
var gamepad = InputSystem.AddDevice<Gamepad>();
187187

188-
Assert.That(gamepad.leftStick.usages, Has.Exactly(1).EqualTo(CommonUsages.Primary2DMotion));
188+
Assert.That(gamepad.leftStick.usages, Has.Exactly(1).EqualTo(Usages.Primary2DMotion));
189189
}
190190

191191
[Test]
@@ -460,7 +460,7 @@ public void Layouts_CanSpecifyCommonUsagesForDevices()
460460
{
461461
""name"" : ""DerivedDevice"",
462462
""extend"" : ""BaseDevice"",
463-
""commonUsages"" : [ ""LeftToe"" ]
463+
""usages"" : [ ""LeftToe"" ]
464464
}
465465
";
466466

@@ -469,10 +469,10 @@ public void Layouts_CanSpecifyCommonUsagesForDevices()
469469

470470
var layout = InputSystem.LoadLayout("DerivedDevice");
471471

472-
Assert.That(layout.commonUsages, Has.Count.EqualTo(3));
473-
Assert.That(layout.commonUsages[0], Is.EqualTo(CommonUsages.LeftHand));
474-
Assert.That(layout.commonUsages[1], Is.EqualTo(CommonUsages.RightHand));
475-
Assert.That(layout.commonUsages[2], Is.EqualTo(new InternedString("LeftToe")));
472+
Assert.That(layout.usages, Has.Count.EqualTo(3));
473+
Assert.That(layout.usages[0], Is.EqualTo(Usages.LeftHand));
474+
Assert.That(layout.usages[1], Is.EqualTo(Usages.RightHand));
475+
Assert.That(layout.usages[2], Is.EqualTo(new InternedString("LeftToe")));
476476
}
477477

478478
[Test]
@@ -1084,12 +1084,12 @@ public void Layouts_ApplyingOverride_DoesNotAlterExistingInheritanceHierarchy()
10841084
[Category("Layouts")]
10851085
public void Layouts_CanOverrideCommonUsagesOnExistingLayout()
10861086
{
1087-
// Change all Gamepads to have the common usages "A", "B", and "C".
1087+
// Change all Gamepads to have the usages "A", "B", and "C".
10881088
const string json = @"
10891089
{
10901090
""name"" : ""Overrides"",
10911091
""extend"" : ""Gamepad"",
1092-
""commonUsages"" : [ ""A"", ""B"", ""C"" ]
1092+
""usages"" : [ ""A"", ""B"", ""C"" ]
10931093
}
10941094
";
10951095

@@ -1098,10 +1098,10 @@ public void Layouts_CanOverrideCommonUsagesOnExistingLayout()
10981098
var layout = InputSystem.LoadLayout("Gamepad");
10991099

11001100
Assert.That(layout.appliedOverrides, Is.EquivalentTo(new[] {new InternedString("Overrides")}));
1101-
Assert.That(layout.commonUsages.Count, Is.EqualTo(3));
1102-
Assert.That(layout.commonUsages, Has.Exactly(1).EqualTo(new InternedString("A")));
1103-
Assert.That(layout.commonUsages, Has.Exactly(1).EqualTo(new InternedString("B")));
1104-
Assert.That(layout.commonUsages, Has.Exactly(1).EqualTo(new InternedString("C")));
1101+
Assert.That(layout.usages.Count, Is.EqualTo(3));
1102+
Assert.That(layout.usages, Has.Exactly(1).EqualTo(new InternedString("A")));
1103+
Assert.That(layout.usages, Has.Exactly(1).EqualTo(new InternedString("B")));
1104+
Assert.That(layout.usages, Has.Exactly(1).EqualTo(new InternedString("C")));
11051105

11061106
// Applying the override should not have created a cycle.
11071107
Assert.That(layout.baseLayouts, Does.Not.Contains(new InternedString("Gamepad")));
@@ -2743,37 +2743,37 @@ public void Layouts_CanConfigureDeviceUsages()
27432743
Assert.That(gamepad.usages, Is.Empty);
27442744

27452745
// Set "Vertical" as usage
2746-
InputSystem.SetDeviceUsage(gamepad, CommonUsages.Vertical);
2747-
Assert.That(gamepad.usages, Has.Exactly(1).EqualTo(CommonUsages.Vertical));
2746+
InputSystem.SetDeviceUsage(gamepad, Usages.Vertical);
2747+
Assert.That(gamepad.usages, Has.Exactly(1).EqualTo(Usages.Vertical));
27482748

27492749
// Change usage with "Horizontal"
2750-
InputSystem.SetDeviceUsage(gamepad, CommonUsages.Horizontal);
2751-
Assert.That(gamepad.usages, Has.Exactly(0).EqualTo(CommonUsages.Vertical));
2752-
Assert.That(gamepad.usages, Has.Exactly(1).EqualTo(CommonUsages.Horizontal));
2750+
InputSystem.SetDeviceUsage(gamepad, Usages.Horizontal);
2751+
Assert.That(gamepad.usages, Has.Exactly(0).EqualTo(Usages.Vertical));
2752+
Assert.That(gamepad.usages, Has.Exactly(1).EqualTo(Usages.Horizontal));
27532753

27542754

27552755
// Add "Vertical" to usages
2756-
InputSystem.AddDeviceUsage(gamepad, CommonUsages.Vertical);
2757-
Assert.That(gamepad.usages, Has.Exactly(1).EqualTo(CommonUsages.Vertical));
2758-
Assert.That(gamepad.usages, Has.Exactly(1).EqualTo(CommonUsages.Horizontal));
2756+
InputSystem.AddDeviceUsage(gamepad, Usages.Vertical);
2757+
Assert.That(gamepad.usages, Has.Exactly(1).EqualTo(Usages.Vertical));
2758+
Assert.That(gamepad.usages, Has.Exactly(1).EqualTo(Usages.Horizontal));
27592759

27602760
// Set "Horizontal" as the only one usage
2761-
InputSystem.SetDeviceUsage(gamepad, CommonUsages.Horizontal);
2762-
Assert.That(gamepad.usages, Has.Exactly(0).EqualTo(CommonUsages.Vertical));
2763-
Assert.That(gamepad.usages, Has.Exactly(1).EqualTo(CommonUsages.Horizontal));
2761+
InputSystem.SetDeviceUsage(gamepad, Usages.Horizontal);
2762+
Assert.That(gamepad.usages, Has.Exactly(0).EqualTo(Usages.Vertical));
2763+
Assert.That(gamepad.usages, Has.Exactly(1).EqualTo(Usages.Horizontal));
27642764

27652765
// Try to add "Horizontal" again
2766-
InputSystem.AddDeviceUsage(gamepad, CommonUsages.Horizontal);
2767-
Assert.That(gamepad.usages, Has.Exactly(1).EqualTo(CommonUsages.Horizontal));
2766+
InputSystem.AddDeviceUsage(gamepad, Usages.Horizontal);
2767+
Assert.That(gamepad.usages, Has.Exactly(1).EqualTo(Usages.Horizontal));
27682768

27692769

27702770
// Remove the existed "Horizontal" usage from usages
2771-
InputSystem.AddDeviceUsage(gamepad, CommonUsages.Vertical);
2772-
InputSystem.RemoveDeviceUsage(gamepad, CommonUsages.Horizontal);
2773-
Assert.That(gamepad.usages, Has.Exactly(1).EqualTo(CommonUsages.Vertical));
2774-
Assert.That(gamepad.usages, Has.Exactly(0).EqualTo(CommonUsages.Horizontal));
2771+
InputSystem.AddDeviceUsage(gamepad, Usages.Vertical);
2772+
InputSystem.RemoveDeviceUsage(gamepad, Usages.Horizontal);
2773+
Assert.That(gamepad.usages, Has.Exactly(1).EqualTo(Usages.Vertical));
2774+
Assert.That(gamepad.usages, Has.Exactly(0).EqualTo(Usages.Horizontal));
27752775

2776-
InputSystem.RemoveDeviceUsage(gamepad, CommonUsages.Vertical);
2776+
InputSystem.RemoveDeviceUsage(gamepad, Usages.Vertical);
27772777
Assert.That(gamepad.usages, Is.Empty);
27782778
}
27792779

Assets/Tests/InputSystem/CoreTests_Remoting.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -159,15 +159,15 @@ public void Remote_RemovingDevice_WillRemoveItFromRemotes()
159159
public void Remote_DevicesWithExistingUsage_WillUpdateSendToRemote()
160160
{
161161
var gamepad = InputSystem.AddDevice<Gamepad>();
162-
InputSystem.SetDeviceUsage(gamepad, CommonUsages.LeftHand);
163-
InputSystem.AddDeviceUsage(gamepad, CommonUsages.RightHand);
162+
InputSystem.SetDeviceUsage(gamepad, Usages.LeftHand);
163+
InputSystem.AddDeviceUsage(gamepad, Usages.RightHand);
164164

165165
using (var remote = new FakeRemote())
166166
{
167167
var remoteGamepad = (Gamepad)remote.remoteManager.devices[0];
168168
Assert.That(remoteGamepad.usages, Has.Count.EqualTo(2));
169-
Assert.That(remoteGamepad.usages, Has.Exactly(1).EqualTo(CommonUsages.LeftHand));
170-
Assert.That(remoteGamepad.usages, Has.Exactly(1).EqualTo(CommonUsages.RightHand));
169+
Assert.That(remoteGamepad.usages, Has.Exactly(1).EqualTo(Usages.LeftHand));
170+
Assert.That(remoteGamepad.usages, Has.Exactly(1).EqualTo(Usages.RightHand));
171171
}
172172
}
173173

@@ -182,26 +182,26 @@ public void Remote_SettingUsageOnDevice_WillSendChangeToRemotes()
182182
Assert.That(remoteGamepad.usages, Has.Count.Zero);
183183

184184
// Can Set
185-
InputSystem.SetDeviceUsage(gamepad, CommonUsages.LeftHand);
185+
InputSystem.SetDeviceUsage(gamepad, Usages.LeftHand);
186186
Assert.That(remoteGamepad.usages, Has.Count.EqualTo(1));
187-
Assert.That(remoteGamepad.usages, Has.Exactly(1).EqualTo(CommonUsages.LeftHand));
187+
Assert.That(remoteGamepad.usages, Has.Exactly(1).EqualTo(Usages.LeftHand));
188188

189189
// Can Replace
190-
InputSystem.SetDeviceUsage(gamepad, CommonUsages.RightHand);
190+
InputSystem.SetDeviceUsage(gamepad, Usages.RightHand);
191191
Assert.That(remoteGamepad.usages, Has.Count.EqualTo(1));
192-
Assert.That(remoteGamepad.usages, Has.Exactly(1).EqualTo(CommonUsages.RightHand));
192+
Assert.That(remoteGamepad.usages, Has.Exactly(1).EqualTo(Usages.RightHand));
193193

194194
//Can Clear
195-
InputSystem.RemoveDeviceUsage(gamepad, CommonUsages.LeftHand);
196-
InputSystem.RemoveDeviceUsage(gamepad, CommonUsages.RightHand);
195+
InputSystem.RemoveDeviceUsage(gamepad, Usages.LeftHand);
196+
InputSystem.RemoveDeviceUsage(gamepad, Usages.RightHand);
197197
Assert.That(remoteGamepad.usages, Has.Count.Zero);
198198

199199
//Can Set Multiple
200-
InputSystem.AddDeviceUsage(gamepad, CommonUsages.LeftHand);
201-
InputSystem.AddDeviceUsage(gamepad, CommonUsages.RightHand);
200+
InputSystem.AddDeviceUsage(gamepad, Usages.LeftHand);
201+
InputSystem.AddDeviceUsage(gamepad, Usages.RightHand);
202202
Assert.That(remoteGamepad.usages, Has.Count.EqualTo(2));
203-
Assert.That(remoteGamepad.usages, Has.Exactly(1).EqualTo(CommonUsages.LeftHand));
204-
Assert.That(remoteGamepad.usages, Has.Exactly(1).EqualTo(CommonUsages.RightHand));
203+
Assert.That(remoteGamepad.usages, Has.Exactly(1).EqualTo(Usages.LeftHand));
204+
Assert.That(remoteGamepad.usages, Has.Exactly(1).EqualTo(Usages.RightHand));
205205
}
206206
}
207207

Assets/Tests/InputSystem/Plugins/PlayerInputTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2556,7 +2556,7 @@ public void PlayerInput_WhenOverridingDeviceLayout_LostDeviceShouldBeResolvedAnd
25562556
{
25572557
""name"" : ""GamepadPlayerUsageTags"",
25582558
""extend"" : ""Gamepad"",
2559-
""commonUsages"" : [
2559+
""usages"" : [
25602560
""Player1"", ""Player2""
25612561
]
25622562
}

Assets/Tests/InputSystem/Plugins/XRTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
using UnityEngine.TestTools;
1616
using UnityEngine.XR;
1717

18-
using Usages = UnityEngine.InputSystem.CommonUsages;
18+
using Usages = UnityEngine.InputSystem.Usages;
1919

2020
using InputDeviceRole = UnityEngine.XR.InputDeviceRole;
2121

Packages/com.unity.inputsystem/InputSystem/Actions/InputControlScheme.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ public void Dispose()
907907
/// <remarks>
908908
/// Note that device requirements may require specific controls to be present rather than only requiring
909909
/// the presence of a certain type of device. For example, a requirement with a <see cref="controlPath"/>
910-
/// of "*/{PrimaryAction}" will be satisfied by any device that has a control marked as <see cref="CommonUsages.PrimaryAction"/>.
910+
/// of "*/{PrimaryAction}" will be satisfied by any device that has a control marked as <see cref="Usages.PrimaryAction"/>.
911911
///
912912
/// Requirements are ordered in a list and can combine with their previous requirement in either <see cref="isAND">
913913
/// AND</see> or in <see cref="isOR">OR</see> fashion. The default is for requirements to combine with AND.

0 commit comments

Comments
 (0)