Skip to content

Commit 97b79cf

Browse files
author
Dmytro Ivanov
authored
FIX: Not setting control scheme on composite bindings during pasting (#1604)
1 parent 160bde4 commit 97b79cf

File tree

12 files changed

+58
-10
lines changed

12 files changed

+58
-10
lines changed

Assets/Samples/InGameHints/InGameHintsActions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
4-
// version 1.4.4
4+
// version 1.4.5
55
// from Assets/Samples/InGameHints/InGameHintsActions.inputactions
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if

Assets/Samples/SimpleDemo/SimpleControls.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
4-
// version 1.4.4
4+
// version 1.4.5
55
// from Assets/Samples/SimpleDemo/SimpleControls.inputactions
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if

Assets/Tests/InputSystem/CoreTests_Editor.cs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1758,6 +1758,49 @@ public void Editor_ActionTree_CanCutAndPasteAction_WithControlSchemeFilterActive
17581758
}
17591759
}
17601760

1761+
// https://github.com/Unity-Technologies/InputSystem/pull/1024
1762+
[Test]
1763+
[Category("Editor")]
1764+
public void Editor_ActionTree_CanCopyPasteCompositeBinding_WithControlSchemes()
1765+
{
1766+
var asset = ScriptableObject.CreateInstance<InputActionAsset>();
1767+
var map = asset.AddActionMap("map");
1768+
var action1 = map.AddAction("action1");
1769+
map.AddAction("action2");
1770+
asset.AddControlScheme("scheme1");
1771+
asset.AddControlScheme("scheme2");
1772+
action1.AddCompositeBinding("Axis")
1773+
.With("Positive", "<Keyboard>/a", groups: "scheme1")
1774+
.With("Negative", "<Keyboard>/b", groups: "scheme1");
1775+
1776+
var so = new SerializedObject(asset);
1777+
var tree = new InputActionTreeView(so)
1778+
{
1779+
onBuildTree = () => InputActionTreeView.BuildFullTree(so),
1780+
};
1781+
tree.Reload();
1782+
tree.bindingGroupForNewBindings = "scheme2";
1783+
1784+
using (new EditorHelpers.FakeSystemCopyBuffer())
1785+
{
1786+
tree.SelectItem(tree.FindItemByPropertyPath("m_ActionMaps.Array.data[0].m_Bindings.Array.data[0]"));
1787+
tree.CopySelectedItemsToClipboard();
1788+
tree.SelectItem("map/action2");
1789+
tree.PasteDataFromClipboard();
1790+
1791+
Assert.That(tree.FindItemByPath("map/action2"), Is.Not.Null);
1792+
var c = tree["map/action2"].children;
1793+
Assert.That(c, Has.Count.EqualTo(1));
1794+
Assert.That(c[0], Is.TypeOf<CompositeBindingTreeItem>());
1795+
Assert.That(c[0].As<CompositeBindingTreeItem>().groups, Is.EqualTo(""));
1796+
Assert.That(c[0].children, Has.Count.EqualTo(2));
1797+
Assert.That(c[0].children[0].As<PartOfCompositeBindingTreeItem>().path, Is.EqualTo("<Keyboard>/a"));
1798+
Assert.That(c[0].children[0].As<PartOfCompositeBindingTreeItem>().groups, Is.EqualTo("scheme2"));
1799+
Assert.That(c[0].children[1].As<PartOfCompositeBindingTreeItem>().path, Is.EqualTo("<Keyboard>/b"));
1800+
Assert.That(c[0].children[1].As<PartOfCompositeBindingTreeItem>().groups, Is.EqualTo("scheme2"));
1801+
}
1802+
}
1803+
17611804
[Test]
17621805
[Category("Editor")]
17631806
public void Editor_ActionTree_CanFilterItems()

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
88
Due to package verification, the latest version below is the unpublished version and the date is meaningless.
99
however, it has to be formatted properly to pass verification tests.
1010

11+
## [Unreleased]
12+
13+
### Fixed
14+
- Fixed composite bindings incorrectly getting a control scheme assigned when pasting into input asset editor with a control scheme selected.
15+
1116
## [1.4.4] - 2022-11-01
1217

1318
### Fixed

Packages/com.unity.inputsystem/InputSystem/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public static partial class InputSystem
1515
// Keep this in sync with "Packages/com.unity.inputsystem/package.json".
1616
// NOTE: Unfortunately, System.Version doesn't use semantic versioning so we can't include
1717
// "-preview" suffixes here.
18-
internal const string kAssemblyVersion = "1.4.4";
18+
internal const string kAssemblyVersion = "1.4.5";
1919
internal const string kDocUrl = "https://docs.unity3d.com/Packages/[email protected]";
2020
}
2121
}

Packages/com.unity.inputsystem/InputSystem/Devices/Precompiled/FastKeyboard.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was auto-generated by com.unity.inputsystem:InputLayoutCodeGenerator
4-
// version 1.4.4
4+
// version 1.4.5
55
// from "Keyboard" layout
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if

Packages/com.unity.inputsystem/InputSystem/Devices/Precompiled/FastMouse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was auto-generated by com.unity.inputsystem:InputLayoutCodeGenerator
4-
// version 1.4.4
4+
// version 1.4.5
55
// from "Mouse" layout
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if

Packages/com.unity.inputsystem/InputSystem/Devices/Precompiled/FastTouchscreen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was auto-generated by com.unity.inputsystem:InputLayoutCodeGenerator
4-
// version 1.4.4
4+
// version 1.4.5
55
// from "Touchscreen" layout
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ private SerializedProperty PasteBlock(string tag, string data, SerializedPropert
887887

888888
// If we have a binding group to set for new bindings, overwrite the binding's
889889
// group with it.
890-
if (!string.IsNullOrEmpty(bindingGroupForNewBindings))
890+
if (!string.IsNullOrEmpty(bindingGroupForNewBindings) && tag != k_CompositeBindingTag)
891891
{
892892
InputActionSerializationHelpers.ChangeBinding(property,
893893
groups: bindingGroupForNewBindings);

Packages/com.unity.inputsystem/Tests/TestFixture/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Keep this in sync with "Packages/com.unity.inputsystem/package.json".
55
// NOTE: Unfortunately, System.Version doesn't use semantic versioning so we can't include
66
// "-preview" suffixes here.
7-
[assembly: AssemblyVersion("1.4.4")]
7+
[assembly: AssemblyVersion("1.4.5")]
88
[assembly: InternalsVisibleTo("Unity.InputSystem.Tests.Editor")]
99
[assembly: InternalsVisibleTo("Unity.InputSystem.Tests")]
1010
[assembly: InternalsVisibleTo("Unity.InputSystem.IntegrationTests")]

0 commit comments

Comments
 (0)