Add Input Interaction System to supersede mouse capture system and register custom editor services#3229
Draft
Basewq wants to merge 1 commit into
Draft
Add Input Interaction System to supersede mouse capture system and register custom editor services#3229Basewq wants to merge 1 commit into
Basewq wants to merge 1 commit into
Conversation
…rvice mouse capture system and add ability to register custom editor services.
|
🤖 Draft PR — automatic CI is skipped to save runner minutes.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Details
A simpler take for the ability to extend to the scene editor #3183 (or at least the initial ground work for plugin support).
Change 1:
This is similar to 'mouse capture', but instead of checking
IsMouseAvailable& settingIsControllingMouseto take immediate control, the services submit a request toInputInteractionRequesttoIInputInteractionServicewhich then resolves the winner byInputInteractionTypepriority (and sub-priorityInputInteractionRequest.Order) on its own update.This solves 2 issues:
IInputInteractionobject if it wins the request.InputInteractionTypeenum).Most
*Serviceclasses have minimal changes, ie.TransformationGizmoinheritsIInputInteractiondirectly to keep the code same-ish, whereasEditorGameMaterialHighlightService/EditorGameEntitySelectionServiceshow the usual way to do it. (see Change 3 for details onEditorGameEntityCameraServicechanges).Change 2:
New
StrideAssetsPlugin.RegisterGameServicesmethod. This is more of a dirty hack to just allow developers (ie. me) to register my editor service while we still wait for the formal design of the plugin system.My guess is that the proper solution would be registering tool classes via inheritance/attribute.
Not sure if there's a way to mark this as experimental/use at your own risk? Though there's no real documentation on the current plugin system (which already isn't usable without reflection) so it shouldn't matter?
Change 3:
The original camera code is a bit quirky, so I've keep most of the existing code/behavior in place then worked my 'fixes' around it, but there are some subtle new changes to it.
There are now three 'hard' modes to the camera: FreeLook, Pan, Orbit. When you enter one of the modes, the only way to exit it is by releasing the main button you originally used.
eg. RMB -> FreeLook -> release RMB, MMB -> Pan -> release MMB, Alt + LMB -> Orbit -> release LMB (note that releasing Alt key still keeps you in orbit mode, unlike the original code).
The original code lets you go in and out of any of the modes if you had enough hand dexterity. (Technically there's a 4th "mode", which is just mouse wheel when not in a mode, which I've also kept in).
A nicer cleanup would be to have 3 separate
Interactions for each mode but there might be some code duplication.Also orbit doesn't always seem to work (ie. the pivot position feels wrong), but this is just retained behavior from the original code,
Why this is still in draft mode
Probably need feedback on the proposal.
e.Handled()).InputInteractionSystem&IInputInteractionServicegood enough names?Stride.Engine) There is also the question whether this could be used by non-editor code (unlikely due to how basic and targeted it is for the editor).Possible future extensions (not for this PR)
IInputInteractionService.ForceTerminateActiveInteraction&IInputInteraction.Cancelaren't used in the code.IInputInteractionService.ForceTerminateActiveInteractionmight be usable if we wanted a semi-globalEsckey to cancel in-progress interactions.IInputInteractioncould be driven by a drag gesture.Related Issue
Original issue submission: #3183 (Need ability to extend to the scene editor)
My sync TransformationGizmo update #3186 will be dropped in favor for this, however this does mean the existing entity duplication quirk will persist (ie. Ctrl+drag -> entities generated upfront in one transaction and may freeze if too many entities selected, then a 2nd transaction for the transform update).
This PR obviously doesn't solve the whole plugin system issue, eg.
Del)EditorGameEntitySelectionServiceis targeted for entity selection instead of generalizing it to allowing for things like spline/vertex/etc selection (though this can easily be worked around).Types of changes
Checklist