Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Help Wanted Scene zooming via Shift+Tab - How to prevent Shortcut propagation?

Discussion in 'World Building' started by Rowlan, Sep 6, 2021.

  1. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    2,019
    I toyed around with MiniMap & Overview & Shortcuts yesterday. It ended up being windows like tab management via clutch shortcut. However I couldn't figure out how to prevent the propagation of shift+tab.

    Is there some way to consume that keyboard combination? Also, does anyone have use for that combination in scene view? I think it's obsolete and could come in handy if Unity would implement something like this on their own. It's nothing professional like how other tools do it, just 300 lines of code, see attachment.

    Looks like this:



    Here's what I use:

    * shift + tab to go into overview (kind of like windows alt+tab)
    * keep shift + tab pressed and move mouse to see mini thumbnails
    * release to go to the position or right mouse button to cancel

    The problem with which I need help: When you look at the top right search bar it keeps on flickering. Basically this piece of code from the attached file:

    Code (CSharp):
    1.         [ClutchShortcutAttribute("SceneNav/ZoomInOut", null, KeyCode.Tab, ShortcutModifiers.Shift)]
    2.         public static void ShortcutTest(ShortcutArguments args)
    3.         {
    4.             if (args.stage == ShortcutStage.Begin && zoomStage == ZoomStage.None)
    5.             {
    6.                 StartZoom();
    7.             }
    8.             else if (args.stage == ShortcutStage.End && zoomStage == ZoomStage.Out)
    9.             {
    10.                 StopZoom();
    11.             }
    12.         }
    Tagging @gabrielw_unity because of your work on the upcoming tooling system. Plus we do need access to the shortcut interface so that we can implement our own context :)
     

    Attached Files:

    mgear likes this.
  2. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,333
    My guess is that the flickering issue is _because_ you're using the "Shift"+"Tab" keys to begin with. These keys are often handled in a special way, especially in the old system, by the editor for shortcuts, and that code is almost certainly still around to handle focusing between controls (in this case, Shift+Tab is likely hardcoded somewhere where the searchbox gets control in the next update, despite you trying to steal its focus).

    I may be wrong (please correct me if I am), but I'm not entirely certain you _can_ 'consume' these special (system-level) shortcuts which are handled in this hardcoded way (since these kinds of actions have always been weird when involving system-level modifier keys), but I'm not sure whether that has been changed/updated in recent versions or not.

    Sorry for not being able to give you a better answer.
     
  3. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    2,019
    Thanks. I thought I could catch/consume all events. I didn't think of it being a system issue, but that's a good point. I'll ask one of the Unity devs, they have insight to the source.
     
    awesomedata likes this.
  4. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,333
    Please let me know if you hear something. I'd like to know what you find out.


    Btw, cool zoom setup! -- I really like the workflow/key combo setup too. I had something like this planned for Snapcam -- at least before I realized how wonky workflows/workspaces were in Unity (especially when a lot of Assets are installed and/or overlap in a project). That said, as an alternative for your current setup, for now, why not Shift+Alt or something to show the zoom magnifier and use right or middle-click to zoom in -- or does Tab actually take you there in your setup? -- Either way, it looks pretty nifty. Nice job man. :)
     
    Rowlan likes this.
unityunity