Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHANGE: Individual composite part bindings can now no longer have int… #746

Merged
merged 1 commit into from Aug 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions Packages/com.unity.inputsystem/CHANGELOG.md
Expand Up @@ -28,6 +28,10 @@ however, it has to be formatted properly to pass verification tests.
```
* `InputSystem.SetLayoutVariant` has been removed. Layout variants can no longer be set retroactively but must be decided on as part of device creation.

#### Actions

- Individual composite part bindings can now no longer have interactions assigned to them as that never made any sense.

### Added

- Devices can now have more than one usage.
Expand Down
Expand Up @@ -532,16 +532,16 @@ internal CompositeSyntax(InputActionMap map, InputAction action, int compositeIn
m_CompositeIndex = compositeIndex;
}

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

int bindingIndex;
if (m_Action != null)
bindingIndex = m_Action.AddBinding(path: binding, interactions: interactions, groups: groups)
bindingIndex = m_Action.AddBinding(path: binding, groups: groups)
.m_BindingIndex;
else
bindingIndex = m_ActionMap.AddBinding(path: binding, interactions: interactions, groups: groups)
bindingIndex = m_ActionMap.AddBinding(path: binding, groups: groups)
.m_BindingIndex;

m_ActionMap.m_Bindings[bindingIndex].name = name;
Expand Down
Expand Up @@ -887,7 +887,7 @@ private void ProcessControlStateChange(int mapIndex, int controlIndex, int bindi
// If we have interactions, let them do all the processing. The presence of an interaction
// essentially bypasses the default phase progression logic of an action.
var interactionCount = bindingStatePtr->interactionCount;
if (interactionCount > 0)
if (interactionCount > 0 && !bindingStatePtr->isPartOfComposite)
{
ProcessInteractions(ref trigger, bindingStatePtr->interactionStartIndex, interactionCount);
}
Expand Down
Expand Up @@ -41,7 +41,6 @@ internal class InputBindingPropertiesView : PropertiesViewBase, IDisposable
m_ControlSchemes = controlSchemes;

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

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

private readonly bool m_IsPartOfComposite;
private int m_SelectedCompositePart;
private GUIContent[] m_CompositePartOptions;
private string[] m_CompositeParts;
Expand Down
Expand Up @@ -18,6 +18,9 @@ protected PropertiesViewBase(string label, SerializedProperty bindingOrAction, A
if (bindingOrAction == null)
throw new ArgumentNullException(nameof(bindingOrAction));

var flags = (InputBinding.Flags)bindingOrAction.FindPropertyRelative("m_Flags").intValue;
m_IsPartOfComposite = (flags & InputBinding.Flags.PartOfComposite) != 0;

m_InteractionsProperty = bindingOrAction.FindPropertyRelative("m_Interactions");
m_ProcessorsProperty = bindingOrAction.FindPropertyRelative("m_Processors");

Expand All @@ -32,8 +35,11 @@ public void OnGUI()
{
EditorGUILayout.BeginVertical();
DrawGeneralGroup();
EditorGUILayout.Space();
DrawInteractionsGroup();
if (!m_IsPartOfComposite)
{
EditorGUILayout.Space();
DrawInteractionsGroup();
}
EditorGUILayout.Space();
DrawProcessorsGroup();
GUILayout.FlexibleSpace();
Expand Down Expand Up @@ -104,6 +110,7 @@ private void OnInteractionsModified()
private bool m_GeneralFoldout = true;
private bool m_InteractionsFoldout = true;
private bool m_ProcessorsFoldout = true;
protected readonly bool m_IsPartOfComposite;

private readonly Action<FourCC> m_OnChange;

Expand Down