Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Packages/com.unity.inputsystem/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ however, it has to be formatted properly to pass verification tests.
- Fixed the TreeView compilation warnings when used with Unity 6.2 beta (ISX-2320)
- Fixed actions being reset when disabling the InputSystemUIInputModule component [ISXB-1493](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1493)
- Fixed a memory leak when disabling and enabling the InputSystemUIInputModule component at runtime [ISXB-1573](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1573)
- Fixed all InputControls being changed at once when you change just one by reverting `2a37caac288ac09bc9122234339dc5df8d3a0ca6`, which was an attempt at fixing [ISXB-1221] that introduced this regression [ISXB-1531] (https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1493)
- Fixed PlayerInput component automatically switching away from the default ActionMap set to 'None'.
- Fixed a console error being shown when targeting visionOS builds in 2022.3.
- Fixed a Tap Interaction issue with analog controls. The Tap interaction would keep re-starting after timeout. [ISXB-627](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-627)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,15 @@
{
if (pathProperty == null)
throw new ArgumentNullException(nameof(pathProperty));
// Update the static pathProperty variable to the most recent serializedProperty.
// See comment on pathProperty for more information.
s_pathProperty = pathProperty;

this.pathProperty = pathProperty;

Check warning on line 34 in Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs#L34

Added line #L34 was not covered by tests
this.onModified = onModified;
m_PickerState = pickerState ?? new InputControlPickerState();
m_PathLabel = label ?? new GUIContent(pathProperty.displayName, pathProperty.GetTooltip());
}

public void Dispose()
{
s_pathProperty = null;
m_PickerDropdown?.Dispose();
}

Expand Down Expand Up @@ -91,10 +89,10 @@
EditorGUILayout.EndHorizontal();
}

//TODO: on next major version remove property argument.
public void OnGUI(Rect rect, GUIContent label = null, SerializedProperty property = null, Action modifiedCallback = null)
{
var pathLabel = label ?? m_PathLabel;
var serializedProperty = property ?? pathProperty;

Check warning on line 95 in Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs#L95

Added line #L95 was not covered by tests

var lineRect = rect;
var labelRect = lineRect;
Expand All @@ -115,7 +113,7 @@
var path = String.Empty;
try
{
path = pathProperty.stringValue;
path = serializedProperty.stringValue;

Check warning on line 116 in Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs#L116

Added line #L116 was not covered by tests
}
catch
{
Expand All @@ -140,8 +138,8 @@
path = EditorGUI.DelayedTextField(bindingTextRect, path);
if (EditorGUI.EndChangeCheck())
{
pathProperty.stringValue = path;
pathProperty.serializedObject.ApplyModifiedProperties();
serializedProperty.stringValue = path;
serializedProperty.serializedObject.ApplyModifiedProperties();

Check warning on line 142 in Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs#L141-L142

Added lines #L141 - L142 were not covered by tests
(modifiedCallback ?? onModified).Invoke();
}
}
Expand All @@ -150,9 +148,9 @@
// Dropdown that shows binding text and allows opening control picker.
if (EditorGUI.DropdownButton(bindingTextRect, new GUIContent(displayName), FocusType.Keyboard))
{
SetExpectedControlLayoutFromAttribute(pathProperty);
SetExpectedControlLayoutFromAttribute(serializedProperty);

Check warning on line 151 in Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs#L151

Added line #L151 was not covered by tests
////TODO: for bindings that are part of composites, use the layout information from the [InputControl] attribute on the field
ShowDropdown(bindingTextRect, modifiedCallback ?? onModified);
ShowDropdown(bindingTextRect, serializedProperty, modifiedCallback ?? onModified);

Check warning on line 153 in Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs#L153

Added line #L153 was not covered by tests
}
}

Expand All @@ -161,7 +159,7 @@
EditorStyles.miniButton);
}

private void ShowDropdown(Rect rect, Action modifiedCallback)
private void ShowDropdown(Rect rect, SerializedProperty serializedProperty, Action modifiedCallback)
{
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
InputActionsEditorSettingsProvider.SetIMGUIDropdownVisible(true, false);
Expand All @@ -172,13 +170,19 @@
m_PickerState,
path =>
{
pathProperty.stringValue = path;
pathProperty.serializedObject.ApplyModifiedProperties();
serializedProperty.stringValue = path;

Check warning on line 173 in Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs#L173

Added line #L173 was not covered by tests
m_PickerState.manualPathEditMode = false;
modifiedCallback();
});
}

m_PickerDropdown.SetPickedCallback(path =>
{
serializedProperty.stringValue = path;
m_PickerState.manualPathEditMode = false;
modifiedCallback();
});

Check warning on line 184 in Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs#L179-L184

Added lines #L179 - L184 were not covered by tests

m_PickerDropdown.SetControlPathsToMatch(m_ControlPathsToMatch);
m_PickerDropdown.SetExpectedControlLayout(m_ExpectedControlLayout);

Expand All @@ -196,16 +200,7 @@
SetExpectedControlLayout(attribute.layout);
}

// This static variable is a hack. Because the editor is rebuilt at unpredictable times with a new serializedObject, we need to keep updating
// this variable with most up to date serializedProperty, so that the picker dropdown can access the correct serializedProperty.
// The picker dropdown is a separate window and does not have access to the changed serializedObject reference.
// This could be removed if the InputControlPathEditor is converted to UITK with a stable, persistent serializedObject backing this editor.
// This property will be shared among multiple asset editor windows.
private static SerializedProperty s_pathProperty { get; set; }

// This property will always return the most recent serializedProperty.
public SerializedProperty pathProperty { get => s_pathProperty;}

public SerializedProperty pathProperty { get; }

Check warning on line 203 in Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs#L203

Added line #L203 was not covered by tests
public Action onModified { get; }

private GUIContent m_PathLabel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
Reload();
}

public void SetPickedCallback(Action<string> action)
{
m_OnPickCallback = action;
}

Check warning on line 64 in Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPickerDropdown.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPickerDropdown.cs#L62-L64

Added lines #L62 - L64 were not covered by tests

protected override void OnDestroy()
{
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
}

EditorGUI.BeginProperty(position, label, property);
m_Editor.OnGUI(position, label, property: null, modifiedCallback: () => property.serializedObject.ApplyModifiedProperties());
m_Editor.OnGUI(position, label, property, () => property.serializedObject.ApplyModifiedProperties());

Check warning on line 47 in Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputControlPathDrawer.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputControlPathDrawer.cs#L47

Added line #L47 was not covered by tests
EditorGUI.EndProperty();
}
}
Expand Down
Loading