-
Notifications
You must be signed in to change notification settings - Fork 330
UITK drag and drop (ISX-1141) #1831
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
Conversation
…-and-drop # Conflicts: # Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs # Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionMapsView.cs # Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionsTreeView.cs
…-and-drop # Conflicts: # Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionMapsView.cs
Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CopyPasteHelper.cs
Outdated
Show resolved
Hide resolved
|
Added a couple minor things, nothing really to add beyond what Håkan mentioned - I'm always a fan of more comments explaining functions though :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Things I noticed so far:
- I can drop composite bindings into non composite actions (and vice versa) -> after dragging them they jump back to where they were. Expected: block symbol on mouse is shown and you can't drag them there at all
- Undo naming is not user friendly shown as "Modified Actions Maps.Array..." or "Modified x# properties"
Expected: "Moved Action/Binding x" does not need to go into specifics where it was moved, just has to be human readable of what action was done - Unknown steps to error so far but got it when loading the ProjectWideActions test scene (ignore if cause not clear from error message alone):
NullReferenceException: Object reference not set to an instance of an object
UnityEngine.InputSystem.InputActionMap.Disable () (at ./Packages/com.unity.inputsystem/InputSystem/Actions/InputActionMap.cs:559)
UnityEngine.InputSystem.InputActionAsset.Disable () (at ./Packages/com.unity.inputsystem/InputSystem/Actions/InputActionAsset.cs:818)
UnityEngine.InputSystem.InputActionAsset.OnDestroy () (at ./Packages/com.unity.inputsystem/InputSystem/Actions/InputActionAsset.cs:919)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at D:/Gitrepo/unity/Modules/IMGUI/GUIUtility.cs:219)
- I can move an action to its own map and then it dissapears with this error (steps to repro: Create new custom input actions asset with just one action -> move that action to its own map -> it dissapears. Does not seem to repro if the map has more than 1 action):
NullReferenceException: Object reference not set to an instance of an object
UnityEngine.InputSystem.Editor.CopyPasteHelper.IsComposite (UnityEditor.SerializedProperty property) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CopyPasteHelper.cs:26)
UnityEngine.InputSystem.Editor.CopyPasteHelper.PasteBindingOrComposite (UnityEditor.SerializedProperty arrayProperty, System.String json, System.Int32 index, System.String actionName, System.Boolean createCompositeParts) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CopyPasteHelper.cs:263)
UnityEngine.InputSystem.Editor.CopyPasteHelper.PasteAction (UnityEditor.SerializedProperty arrayProperty, System.String jsonToInsert, System.Int32 indexToInsert) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CopyPasteHelper.cs:253)
UnityEngine.InputSystem.Editor.CopyPasteHelper.PasteBlocks (System.String transmission, System.Int32 indexToInsert, UnityEditor.SerializedProperty arrayToInsertInto) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CopyPasteHelper.cs:217)
UnityEngine.InputSystem.Editor.CopyPasteHelper.PasteItems (System.String copyBufferString, System.Int32[] indicesToInsert, UnityEditor.SerializedProperty arrayToInsertInto) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CopyPasteHelper.cs:206)
UnityEngine.InputSystem.Editor.CopyPasteHelper.PasteData (System.String copyBufferString, System.Int32[] indicesToInsert, UnityEditor.SerializedProperty arrayToInsertInto) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CopyPasteHelper.cs:194)
UnityEngine.InputSystem.Editor.CopyPasteHelper.PasteActionsFromClipboard (UnityEngine.InputSystem.Editor.InputActionsEditorState state, System.Boolean addLast, System.Int32 mapIndex) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CopyPasteHelper.cs:179)
UnityEngine.InputSystem.Editor.CopyPasteHelper.PasteActionsOrBindingsFromClipboard (UnityEngine.InputSystem.Editor.InputActionsEditorState state, System.Boolean addLast, System.Int32 mapIndex) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CopyPasteHelper.cs:164)
UnityEngine.InputSystem.Editor.Commands+<>c__DisplayClass12_0.<PasteActionIntoActionMap>b__0 (UnityEngine.InputSystem.Editor.InputActionsEditorState& state) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/Commands.cs:156)
UnityEngine.InputSystem.Editor.StateContainer.Dispatch (UnityEngine.InputSystem.Editor.Command command) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/StateContainer.cs:35)
UnityEngine.InputSystem.Editor.ViewBase`1[TViewState].Dispatch (UnityEngine.InputSystem.Editor.Command command) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ViewBase.cs:78)
UnityEngine.InputSystem.Editor.ActionMapsView.OnDroppedHandler (System.Int32 mapIndex) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionMapsView.cs:75)
UnityEngine.InputSystem.Editor.DropManipulator.OnDragPerformEvent (UnityEngine.UIElements.DragPerformEvent evt) (at ./Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/DropManipulator.cs:47)
UnityEngine.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.UIElements.EventBase evt) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/EventCallback.cs:64)
UnityEngine.UIElements.EventCallbackRegistry+DynamicCallbackList.Invoke (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.VisualElement target) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/EventCallbackRegistry.cs:228)
UnityEngine.UIElements.EventDispatchUtilities.HandleEventAcrossPropagationPath (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.VisualElement target, System.Boolean isCapturingTarget) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/EventDispatchUtilities.cs:150)
UnityEngine.UIElements.EventDispatchUtilities.DispatchToCapturingElementOrElementUnderPointer (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, System.Int32 pointerId, UnityEngine.Vector2 position) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/EventDispatchUtilities.cs:578)
UnityEngine.UIElements.MouseEventBase`1[T].Dispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at D:/Gitrepo/unity/Modules/UIElements/Core/Events/MouseEvents.cs:248)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at D:/Gitrepo/unity/Modules/UIElements/Core/EventDispatcher.cs:336)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at D:/Gitrepo/unity/Modules/UIElements/Core/EventDispatcher.cs:200)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at D:/Gitrepo/unity/Modules/UIElements/Core/Panel.cs:634)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at D:/Gitrepo/unity/Modules/UIElements/Core/UIElementsUtility.cs:511)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at D:/Gitrepo/unity/Modules/UIElements/Core/UIElementsUtility.cs:230)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at D:/Gitrepo/unity/Modules/UIElements/Core/UIElementsUtility.cs:76)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at D:/Gitrepo/unity/Modules/UIElements/Core/UIElementsUtility.cs:30)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at D:/Gitrepo/unity/Modules/IMGUI/GUIUtility.cs:219)
We need to use the Drag and Drop events that are used internally in UITK for the reorderable logic. This is because we rely on the reorderable and append custom (e.g. drag between lists, restricting) implementation. |
I left a comment in the code where to block/discard a drag, currently it's handled with a forced reload of the treeview (that's sometimes a bit delayed what explains the jumping element). I would suggest to open a ticket for this as it's just about visuals.
I would suggest a ticket for this one as well as it's not very urgent neither. |
not clear to me, looks like an problem with the asset itself....
fixed in 2175b70, was actually reproducable on develop as well, seems we missed that somehow |
This comment was marked as outdated.
This comment was marked as outdated.
Unity_2024-02-08_14-09-54.mp4Seems like adding new processors/interactions to an action is broken after reordering it. Probably a selection issue as deselecting and re-selecting it fixes it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is definitely a selection issue. I wonder if the changes on Håkans branch (continue with -> append the selection of the moved item) would fix this easy. Maybe worth checking after a merge. |
Ok added new bug - ISX-1873 |
ekcoh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, added some minor comments which are more food-for-thought.
Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/Commands.cs
Show resolved
Hide resolved
|
|
||
| void OnDroppedHandler(int mapIndex) | ||
| { | ||
| Dispatch(Commands.CutActionsOrBindings()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is likely fine but I would recommend when we do a sequence of commands like this that they are implemented as a single command instead but is the combination of the two underneath. Otherwise this would yield two Undo steps "Cut" and "Paste" which might be confusing for a Drop? Another aspect is that since dispatched, if CutActionsOrBindings() throws, the new state is not propagated and the Paste will execute on the previous state. I think I have seen this in more places so might be that we overlook all places at a later point for exception-safety and Undo convenience.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I think there your implementation of Dispatch(..,continueWith) would be a great solution, I would wait until this is landed and make use of this.
Description
This PR adds Drag & Drop support for the UITK-Editor. Find the ticket here.
Basically it includes reordering and moving of ActionMaps, Actions and Bindings in the Editor.
Changes made
added:
Checklist
Before review:
Changed,Fixed,Addedsections.([case %number%](https://issuetracker.unity3d.com/issues/...)).Area_CanDoX,Area_CanDoX_EvenIfYIsTheCase,Area_WhenIDoX_AndYHappens_ThisIsTheResult.During merge:
NEW: ___.FIX: ___.DOCS: ___.CHANGE: ___.RELEASE: 1.1.0-preview.3.