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 @@ -28,6 +28,7 @@ however, it has to be formatted properly to pass verification tests.
- Fixed Gamepad stick up/down inputs that were not recognized in WebGL. [ISXB-1090](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1090)
- Fixed reenabling the VirtualMouseInput component may sometimes lead to NullReferenceException. [ISXB-1096](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1096)
- Fixed the default button press point not being respected in Editor (as well as some other Touchscreen properties). [ISXB-1152](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1152)
- 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 PlayerInput component automatically switching away from the default ActionMap set to 'None'.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
using UnityEditor.PackageManager.UI;
using UnityEditor.ShortcutManagement;

#if UNITY_6000_2_OR_NEWER
using TreeView = UnityEditor.IMGUI.Controls.TreeView<int>;
using TreeViewState = UnityEditor.IMGUI.Controls.TreeViewState<int>;
#endif
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This using section was the intentional scope of changes, but VS code formatted some code as well behind the scenes - adding some spaces here and there. Initially I thought to revert, but looking through them I liked the changes so why revert? Left them in the end.


////TODO: Add "Revert" button

////TODO: add helpers to very quickly set up certain common configs (e.g. "FPS Controls" in add-action context menu;
Expand Down Expand Up @@ -245,7 +250,7 @@
if (asset == null)
return;

m_ActionAssetManager = new InputActionAssetManager(asset) {onDirtyChanged = OnDirtyChanged};
m_ActionAssetManager = new InputActionAssetManager(asset) { onDirtyChanged = OnDirtyChanged };

Check warning on line 253 in Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs#L253

Added line #L253 was not covered by tests
//m_ActionAssetManager.Initialize(); // TODO No longer needed when using constructor

InitializeTrees();
Expand Down Expand Up @@ -515,7 +520,7 @@
if (m_Toolbar.selectedDeviceRequirement != null)
{
// Single device selected from set of devices in control scheme.
controlPathsToMatch = new[] {m_Toolbar.selectedDeviceRequirement.Value.controlPath};
controlPathsToMatch = new[] { m_Toolbar.selectedDeviceRequirement.Value.controlPath };

Check warning on line 523 in Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs#L523

Added line #L523 was not covered by tests
}
else if (m_Toolbar.selectedControlScheme != null)
{
Expand Down Expand Up @@ -581,14 +586,14 @@
LoadPropertiesForSelection();
}

#if UNITY_INPUT_SYSTEM_INPUT_ACTIONS_EDITOR_AUTO_SAVE_ON_FOCUS_LOST
#if UNITY_INPUT_SYSTEM_INPUT_ACTIONS_EDITOR_AUTO_SAVE_ON_FOCUS_LOST
private void OnLostFocus()
{
if (InputEditorUserSettings.autoSaveInputActionAssets)
m_ActionAssetManager.SaveChangesToAsset();
}

#endif
#endif

private void Apply()
{
Expand All @@ -598,11 +603,11 @@
m_ActionMapsTree.UpdateSerializedObjectDirtyCount();
m_ActionsTree.UpdateSerializedObjectDirtyCount();

#if UNITY_INPUT_SYSTEM_INPUT_ACTIONS_EDITOR_AUTO_SAVE_ON_FOCUS_LOST
#if UNITY_INPUT_SYSTEM_INPUT_ACTIONS_EDITOR_AUTO_SAVE_ON_FOCUS_LOST
// If auto-save should be triggered on focus lost, only mark asset as dirty
m_ActionAssetManager.MarkDirty();
titleContent = m_DirtyTitle;
#else
#else
// If auto-save is active, immediately flush out the changes to disk. Otherwise just
// put us into dirty state.
if (InputEditorUserSettings.autoSaveInputActionAssets)
Expand All @@ -614,7 +619,7 @@
m_ActionAssetManager.MarkDirty();
titleContent = m_DirtyTitle;
}
#endif
#endif
}

private void OnGUI()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
using UnityEngine.InputSystem.Layouts;
using UnityEngine.InputSystem.Utilities;

#if UNITY_6000_2_OR_NEWER
using TreeView = UnityEditor.IMGUI.Controls.TreeView<int>;
using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem<int>;
using TreeViewState = UnityEditor.IMGUI.Controls.TreeViewState<int>;
#endif

// The action tree view illustrates one of the weaknesses of Unity's editing model. While operating directly
// on serialized data does have a number of advantages (the built-in undo system being one of them), making the
// persistence model equivalent to the edit model doesn't work well. Serialized data will be laid out for persistence,
Expand Down Expand Up @@ -90,15 +96,15 @@
public static TreeViewItem BuildWithJustActionMapsFromAsset(SerializedObject assetObject)
{
Debug.Assert(assetObject != null, "Asset object cannot be null");
var root = new ActionMapListItem {id = 0, depth = -1};
var root = new ActionMapListItem { id = 0, depth = -1 };
ActionMapTreeItem.AddActionMapsFromAssetTo(root, assetObject);
return root;
}

public static TreeViewItem BuildFullTree(SerializedObject assetObject)
{
Debug.Assert(assetObject != null, "Asset object cannot be null");
var root = new TreeViewItem {id = 0, depth = -1};
var root = new TreeViewItem { id = 0, depth = -1 };
ActionMapTreeItem.AddActionMapsFromAssetTo(root, assetObject);
if (root.hasChildren)
foreach (var child in root.children)
Expand Down Expand Up @@ -368,7 +374,7 @@
public void SelectFirstToplevelItem()
{
if (rootItem.children.Any())
SetSelection(new[] {rootItem.children[0].id}, TreeViewSelectionOptions.FireSelectionChanged);
SetSelection(new[] { rootItem.children[0].id }, TreeViewSelectionOptions.FireSelectionChanged);

Check warning on line 377 in Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionTreeView.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionTreeView.cs#L377

Added line #L377 was not covered by tests
}

protected override void SelectionChanged(IList<int> selectedIds)
Expand Down Expand Up @@ -739,7 +745,7 @@
// Split buffer into transmissions and then into transmission blocks. Each transmission is an item subtree
// meant to be pasted as a whole and each transmission block is a single chunk of serialized data.
foreach (var transmission in copyBufferString.Substring(k_CopyPasteMarker.Length)
.Split(new[] {k_EndOfTransmission}, StringSplitOptions.RemoveEmptyEntries))
.Split(new[] { k_EndOfTransmission }, StringSplitOptions.RemoveEmptyEntries))
{
foreach (var location in locations)
PasteBlocks(transmission, location, assignNewIDs, newItemPropertyPaths);
Expand Down Expand Up @@ -768,7 +774,7 @@
{
Debug.Assert(location.item != null, "Should have drop target");

var blocks = transmission.Split(new[] {k_EndOfTransmissionBlock},
var blocks = transmission.Split(new[] { k_EndOfTransmissionBlock },
StringSplitOptions.RemoveEmptyEntries);
if (blocks.Length < 1)
return;
Expand Down Expand Up @@ -1630,17 +1636,17 @@

public static FilterCriterion ByName(string name)
{
return new FilterCriterion {text = name, type = Type.ByName};
return new FilterCriterion { text = name, type = Type.ByName };
}

public static FilterCriterion ByBindingGroup(string group)
{
return new FilterCriterion {text = group, type = Type.ByBindingGroup};
return new FilterCriterion { text = group, type = Type.ByBindingGroup };
}

public static FilterCriterion ByDeviceLayout(string layout)
{
return new FilterCriterion {text = layout, type = Type.ByDeviceLayout};
return new FilterCriterion { text = layout, type = Type.ByDeviceLayout };
}

public static List<FilterCriterion> FromString(string criteria)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
using UnityEditor.IMGUI.Controls;
using UnityEngine.InputSystem.Utilities;

#if UNITY_6000_2_OR_NEWER
using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem<int>;
#endif

////TODO: sync expanded state of SerializedProperties to expanded state of tree (will help preserving expansion in inspector)

////REVIEW: would be great to align all "[device]" parts of binding strings neatly in a column
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
using UnityEngine.InputSystem.Users;
using UnityEngine.InputSystem.Utilities;

#if UNITY_6000_2_OR_NEWER
using TreeView = UnityEditor.IMGUI.Controls.TreeView<int>;
using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem<int>;
using TreeViewState = UnityEditor.IMGUI.Controls.TreeViewState<int>;
#endif

////FIXME: Generate proper IDs for the individual tree view items; the current sequential numbering scheme just causes lots of
//// weird expansion/collapsing to happen.

Expand Down Expand Up @@ -275,7 +281,8 @@
var profilerName = ProfilerDriver.GetConnectionIdentifier(profiler);
var isConnected = ProfilerDriver.connectedProfiler == profiler;
if (enabled)
menu.AddItem(new GUIContent(profilerName), isConnected, () => {
menu.AddItem(new GUIContent(profilerName), isConnected, () =>
{

Check warning on line 285 in Packages/com.unity.inputsystem/InputSystem/Editor/Debugger/InputDebuggerWindow.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/Debugger/InputDebuggerWindow.cs#L284-L285

Added lines #L284 - L285 were not covered by tests
ProfilerDriver.connectedProfiler = profiler;
EnableRemoteDevices();
});
Expand All @@ -291,7 +298,8 @@

var url = "device://" + device.id;
var isConnected = ProfilerDriver.connectedProfiler == 0xFEEE && ProfilerDriver.directConnectionUrl == url;
menu.AddItem(new GUIContent(device.name), isConnected, () => {
menu.AddItem(new GUIContent(device.name), isConnected, () =>
{

Check warning on line 302 in Packages/com.unity.inputsystem/InputSystem/Editor/Debugger/InputDebuggerWindow.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/Debugger/InputDebuggerWindow.cs#L301-L302

Added lines #L301 - L302 were not covered by tests
ProfilerDriver.DirectURLConnect(url);
EnableRemoteDevices();
});
Expand Down Expand Up @@ -961,7 +969,7 @@
{
var control = state.controls[controlStartIndex + n];
var interactions =
StringHelpers.Join(new[] {binding.effectiveInteractions, action.interactions}, ",");
StringHelpers.Join(new[] { binding.effectiveInteractions, action.interactions }, ",");

var text = control.path;
if (!string.IsNullOrEmpty(interactions))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
using UnityEngine.InputSystem.LowLevel;
using UnityEngine.InputSystem.Utilities;

#if UNITY_6000_2_OR_NEWER
using TreeViewState = UnityEditor.IMGUI.Controls.TreeViewState<int>;
#endif

////TODO: allow selecting events and saving out only the selected ones

////TODO: add the ability for the debugger to just generate input on the device according to the controls it finds; good for testing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
using UnityEngine.InputSystem.LowLevel;
using Unity.Profiling;

#if UNITY_6000_2_OR_NEWER
using TreeView = UnityEditor.IMGUI.Controls.TreeView<int>;
using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem<int>;
using TreeViewState = UnityEditor.IMGUI.Controls.TreeViewState<int>;
#endif

////TODO: make control values editable (create state events from UI and pump them into the system)

////TODO: show processors attached to controls
Expand Down Expand Up @@ -99,20 +105,20 @@ private static MultiColumnHeaderState CreateHeaderState(int numValueColumns)
headerContent = new GUIContent("Type")
};
columns[(int)ColumnId.Format] =
new MultiColumnHeaderState.Column {headerContent = new GUIContent("Format")};
new MultiColumnHeaderState.Column { headerContent = new GUIContent("Format") };
columns[(int)ColumnId.Offset] =
new MultiColumnHeaderState.Column {headerContent = new GUIContent("Offset")};
new MultiColumnHeaderState.Column { headerContent = new GUIContent("Offset") };
columns[(int)ColumnId.Bit] =
new MultiColumnHeaderState.Column {width = 40, headerContent = new GUIContent("Bit")};
new MultiColumnHeaderState.Column { width = 40, headerContent = new GUIContent("Bit") };
columns[(int)ColumnId.Size] =
new MultiColumnHeaderState.Column {headerContent = new GUIContent("Size (Bits)")};
new MultiColumnHeaderState.Column { headerContent = new GUIContent("Size (Bits)") };
columns[(int)ColumnId.Optimized] =
new MultiColumnHeaderState.Column {headerContent = new GUIContent("Optimized")};
new MultiColumnHeaderState.Column { headerContent = new GUIContent("Optimized") };

if (numValueColumns == 1)
{
columns[(int)ColumnId.Value] =
new MultiColumnHeaderState.Column {width = 120, headerContent = new GUIContent("Value")};
new MultiColumnHeaderState.Column { width = 120, headerContent = new GUIContent("Value") };
}
else
{
Expand Down Expand Up @@ -151,7 +157,7 @@ protected override TreeViewItem BuildRoot()
return new TreeViewItem
{
id = 0,
children = new List<TreeViewItem> {rootItem},
children = new List<TreeViewItem> { rootItem },
depth = -1
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
using UnityEditor;
using Unity.Profiling;

#if UNITY_6000_2_OR_NEWER
using TreeView = UnityEditor.IMGUI.Controls.TreeView<int>;
using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem<int>;
using TreeViewState = UnityEditor.IMGUI.Controls.TreeViewState<int>;
#endif

////FIXME: this performs horribly; the constant rebuilding on every single event makes the debug view super slow when device is noisy

////TODO: add information about which update type + update count an event came through in
Expand Down Expand Up @@ -271,7 +277,7 @@
else if (eventPtr.IsA<TextEvent>())
{
var textEventPtr = TextEvent.From(eventPtr);
GUI.Label(cellRect, $"Character='{(char) textEventPtr->character}'");
GUI.Label(cellRect, $"Character='{(char)textEventPtr->character}'");

Check warning on line 280 in Packages/com.unity.inputsystem/InputSystem/Editor/Internal/InputEventTreeView.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/Internal/InputEventTreeView.cs#L280

Added line #L280 was not covered by tests
}
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
using UnityEditor.IMGUI.Controls;
using UnityEngine.InputSystem.LowLevel;

#if UNITY_6000_2_OR_NEWER
using TreeViewState = UnityEditor.IMGUI.Controls.TreeViewState<int>;
#endif

////TODO: add ability to single-step through events

////TODO: annotate raw memory view with control offset and ranges (probably easiest to put the control tree and raw memory view side by side)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
using System;
using UnityEditor.IMGUI.Controls;

#if UNITY_6000_2_OR_NEWER
using TreeView = UnityEditor.IMGUI.Controls.TreeView<int>;
using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem<int>;
#endif

namespace UnityEngine.InputSystem.Editor
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
using UnityEditor;
using UnityEditor.IMGUI.Controls;

#if UNITY_6000_2_OR_NEWER
using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem<int>;
#endif

namespace UnityEngine.InputSystem.Editor
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
using UnityEditor;
using UnityEditor.IMGUI.Controls;

#if UNITY_6000_2_OR_NEWER
using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem<int>;
#endif

namespace UnityEngine.InputSystem.Editor
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
using UnityEditor;
using UnityEditor.IMGUI.Controls;

#if UNITY_6000_2_OR_NEWER
using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem<int>;
#endif

namespace UnityEngine.InputSystem.Editor
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
using UnityEngine.InputSystem.Layouts;
using UnityEngine.InputSystem.LowLevel;

#if UNITY_6000_2_OR_NEWER
using TreeView = UnityEditor.IMGUI.Controls.TreeView<int>;
using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem<int>;
using TreeViewState = UnityEditor.IMGUI.Controls.TreeViewState<int>;
#endif

////TODO: use two columns for treeview and separate name and value

namespace UnityEngine.InputSystem.HID.Editor
Expand Down