-
Notifications
You must be signed in to change notification settings - Fork 333
CHANGE: Update asset InputSystem.inputsettings to use UI Toolkit framework #2393
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
base: develop
Are you sure you want to change the base?
Changes from all commits
6c659ad
46264f4
4a7eb48
55b4cfa
4b8f6a6
57cb44e
2ecfd57
6df94dc
5149b51
794539a
a500b2b
2002822
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |||||
| using System; | ||||||
| using System.IO; | ||||||
| using UnityEditor; | ||||||
| using UnityEngine.UIElements; | ||||||
|
|
||||||
| namespace UnityEngine.InputSystem.Editor | ||||||
| { | ||||||
|
|
@@ -19,7 +20,7 @@ | |||||
| InvalidPath, | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// The dialog was cancelled by the user and the path is invalid. | ||||||
| /// The dialog was canceled by the user and the path is invalid. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
🤖 Helpful? 👍/👎 |
||||||
| /// </summary> | ||||||
| Cancelled, | ||||||
|
|
||||||
|
|
@@ -82,12 +83,22 @@ | |||||
| return asset; | ||||||
| } | ||||||
|
|
||||||
| public static void DrawMakeActiveGui<T>(T current, T target, string targetName, string entity, Action<T> apply, bool allowAssignActive = true) | ||||||
| public static VisualElement CreateMakeActiveGui<T>(T current, T target, string targetName, string entity, Action<T> apply, bool allowAssignActive = true) | ||||||
|
josepmariapujol-unity marked this conversation as resolved.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
| where T : ScriptableObject | ||||||
| { | ||||||
| var container = new VisualElement(); | ||||||
| PopulateMakeActiveGui(container, current, target, entity, apply, allowAssignActive); | ||||||
| return container; | ||||||
| } | ||||||
|
Check warning on line 92 in Packages/com.unity.inputsystem/InputSystem/Editor/InputAssetEditorUtils.cs
|
||||||
|
|
||||||
| private static void PopulateMakeActiveGui<T>(VisualElement container, T current, T target, string entity, Action<T> apply, bool allowAssignActive) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The previous IMGUI implementation re-evaluated Consider implementing a simple poll using 🤖 Helpful? 👍/👎 |
||||||
| where T : ScriptableObject | ||||||
| { | ||||||
| container.Clear(); | ||||||
|
Check warning on line 97 in Packages/com.unity.inputsystem/InputSystem/Editor/InputAssetEditorUtils.cs
|
||||||
|
|
||||||
| if (current == target) | ||||||
| { | ||||||
| EditorGUILayout.HelpBox($"These actions are assigned as the {entity}.", MessageType.Info); | ||||||
| container.Add(new HelpBox($"These actions are assigned as the {entity}.", HelpBoxMessageType.Info)); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
🤖 Helpful? 👍/👎 |
||||||
| return; | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -96,11 +107,21 @@ | |||||
| currentlyActiveAssetsPath = AssetDatabase.GetAssetPath(current); | ||||||
| if (!string.IsNullOrEmpty(currentlyActiveAssetsPath)) | ||||||
| currentlyActiveAssetsPath = $" The actions currently assigned as the {entity} are: {currentlyActiveAssetsPath}. "; | ||||||
| EditorGUILayout.HelpBox($"These actions are not assigned as the {entity} for the Input System. {currentlyActiveAssetsPath??""}", MessageType.Warning); | ||||||
| GUI.enabled = allowAssignActive; | ||||||
| if (GUILayout.Button($"Assign as the {entity}", EditorStyles.miniButton)) | ||||||
|
|
||||||
| container.Add(new HelpBox( | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
| $"These actions are not assigned as the {entity} for the Input System. {currentlyActiveAssetsPath ?? ""}", | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
🤖 Helpful? 👍/👎 |
||||||
| HelpBoxMessageType.Warning)); | ||||||
|
|
||||||
| var assignButton = new Button(() => | ||||||
| { | ||||||
|
Check warning on line 116 in Packages/com.unity.inputsystem/InputSystem/Editor/InputAssetEditorUtils.cs
|
||||||
| apply(target); | ||||||
| GUI.enabled = true; | ||||||
| PopulateMakeActiveGui(container, target, target, entity, apply, allowAssignActive); | ||||||
| }) | ||||||
|
Check warning on line 119 in Packages/com.unity.inputsystem/InputSystem/Editor/InputAssetEditorUtils.cs
|
||||||
| { | ||||||
| text = $"Assign as the {entity}" | ||||||
| }; | ||||||
| assignButton.SetEnabled(allowAssignActive); | ||||||
| container.Add(assignButton); | ||||||
|
Check warning on line 124 in Packages/com.unity.inputsystem/InputSystem/Editor/InputAssetEditorUtils.cs
|
||||||
| } | ||||||
|
|
||||||
| public static bool IsValidFileExtension(string path) | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.