Skip to content

Commit 83bca71

Browse files
authored
CHANGE: Individual composite part bindings can now no longer have interactions assigned to them (#746)
1 parent 75eef69 commit 83bca71

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ however, it has to be formatted properly to pass verification tests.
3333
```
3434
* `InputSystem.SetLayoutVariant` has been removed. Layout variants can no longer be set retroactively but must be decided on as part of device creation.
3535
36+
#### Actions
37+
38+
- Individual composite part bindings can now no longer have interactions assigned to them as that never made any sense.
39+
3640
### Added
3741
3842
- Devices can now have more than one usage.

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,16 +532,16 @@ internal CompositeSyntax(InputActionMap map, InputAction action, int compositeIn
532532
m_CompositeIndex = compositeIndex;
533533
}
534534

535-
public CompositeSyntax With(string name, string binding, string interactions = null, string groups = null)
535+
public CompositeSyntax With(string name, string binding, string groups = null)
536536
{
537537
////TODO: check whether non-composite bindings have been added in-between
538538

539539
int bindingIndex;
540540
if (m_Action != null)
541-
bindingIndex = m_Action.AddBinding(path: binding, interactions: interactions, groups: groups)
541+
bindingIndex = m_Action.AddBinding(path: binding, groups: groups)
542542
.m_BindingIndex;
543543
else
544-
bindingIndex = m_ActionMap.AddBinding(path: binding, interactions: interactions, groups: groups)
544+
bindingIndex = m_ActionMap.AddBinding(path: binding, groups: groups)
545545
.m_BindingIndex;
546546

547547
m_ActionMap.m_Bindings[bindingIndex].name = name;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ private void ProcessControlStateChange(int mapIndex, int controlIndex, int bindi
887887
// If we have interactions, let them do all the processing. The presence of an interaction
888888
// essentially bypasses the default phase progression logic of an action.
889889
var interactionCount = bindingStatePtr->interactionCount;
890-
if (interactionCount > 0)
890+
if (interactionCount > 0 && !bindingStatePtr->isPartOfComposite)
891891
{
892892
ProcessInteractions(ref trigger, bindingStatePtr->interactionStartIndex, interactionCount);
893893
}

Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputBindingPropertiesView.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public InputBindingPropertiesView(
4141
m_ControlSchemes = controlSchemes;
4242

4343
var flags = (InputBinding.Flags)bindingProperty.FindPropertyRelative("m_Flags").intValue;
44-
m_IsPartOfComposite = (flags & InputBinding.Flags.PartOfComposite) != 0;
4544
m_IsComposite = (flags & InputBinding.Flags.Composite) != 0;
4645

4746
// Set up control picker for m_Path. Not needed if the binding is a composite.
@@ -287,7 +286,6 @@ private void OnCompositePartAssignmentChanged()
287286
private GUIContent[] m_CompositeTypeOptions;
288287
private string[] m_CompositeTypes;
289288

290-
private readonly bool m_IsPartOfComposite;
291289
private int m_SelectedCompositePart;
292290
private GUIContent[] m_CompositePartOptions;
293291
private string[] m_CompositeParts;

Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/PropertiesViewBase.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ protected PropertiesViewBase(string label, SerializedProperty bindingOrAction, A
1818
if (bindingOrAction == null)
1919
throw new ArgumentNullException(nameof(bindingOrAction));
2020

21+
var flags = (InputBinding.Flags)bindingOrAction.FindPropertyRelative("m_Flags").intValue;
22+
m_IsPartOfComposite = (flags & InputBinding.Flags.PartOfComposite) != 0;
23+
2124
m_InteractionsProperty = bindingOrAction.FindPropertyRelative("m_Interactions");
2225
m_ProcessorsProperty = bindingOrAction.FindPropertyRelative("m_Processors");
2326

@@ -32,8 +35,11 @@ public void OnGUI()
3235
{
3336
EditorGUILayout.BeginVertical();
3437
DrawGeneralGroup();
35-
EditorGUILayout.Space();
36-
DrawInteractionsGroup();
38+
if (!m_IsPartOfComposite)
39+
{
40+
EditorGUILayout.Space();
41+
DrawInteractionsGroup();
42+
}
3743
EditorGUILayout.Space();
3844
DrawProcessorsGroup();
3945
GUILayout.FlexibleSpace();
@@ -104,6 +110,7 @@ private void OnInteractionsModified()
104110
private bool m_GeneralFoldout = true;
105111
private bool m_InteractionsFoldout = true;
106112
private bool m_ProcessorsFoldout = true;
113+
protected readonly bool m_IsPartOfComposite;
107114

108115
private readonly Action<FourCC> m_OnChange;
109116

0 commit comments

Comments
 (0)