Shortcut key(s) for a plugin(s)
-
(trying ruby again.....)
At the end of a SU plugin you can specify in which menu a plugin should show up.
Is this code enough to also let it show up the 'Shortcut' list, ... to then assign a key to it? -
I have never heard this being done before but if it was possible that would be really cool!
Something tells me is not possible but I hope I am wrong!
-
@unknownuser said:
....Something tells me is not possible but I hope I am wrong!
Many (if not all) plugins appear in the shortcut list. So it is possible.
Select something and then open the list (menu Window > Preferences > Shortcuts > see under 'Plugins'..... (select one and assign))I just need to know whether to search for extra code or not.
-
It is possible to force a shortcut... using convoluted coding [PC registry hacking !] BUT you should never force a shortcut-key on a user as it can mess up their own personalized setup.
IF a tool has a 'menu entry' [either a native-tool OR one made by a 3rd-party plugin] then it will be available for you to add a shortcut key manually - Preferences > Shortcuts > Filter [to find it by name]... assign key-combo...
The one thing to remember is that if this tool's item only shows if some specific kind of selection preexist [for example the native 'Reverse' only appears in the context-menu if the current selection includes at least one Face]... then you will need to have that kind of selection in effect BEFORE you open Preferences, and then that tool's item will be included in the list of shortcut-able commands...Of course once you have a set of shortcuts set as you prefer then, you can export them into a preferences.dat file, and then import that file into another SketchUp version or SketchUp on another computer... That way you can 'take your shortcuts with you'... If you shortcut to a plugin command not available in that Sketchup version it does nothing.
-
This is great didn't know you could manually assign shortcut keys to plugins!
Maybe running a web dialog on the background when SketchUp starts so that if user press specific keys it activates the tool that way. Have not tested this but maybe its a solution.
Again thanks!
-
@tig said:
.....BUT you should never force a shortcut-key on a user as it can mess up their own personalized setup.
Thank you TIG. By no means I'm not trying to force anything upon anyone. (hell breaks loose if I do)
But I have seen where some code "directs" the availability of a plugin to one menu or the other. I think I can do so too. (first for myself, and if useful, for others to use).
But my question is: does that plugin then automatically also appear in the shortcut list, to assign a key to it? (user's choise!) Of course with the appopriate preselection in SU's geometry, if needed. I guess your answer to this was 'Yes', from your quote below. Right?@tig said:
....IF a tool has a 'menu entry' [either a native-tool OR one made by a 3rd-party plugin] then it will be available for you to add a shortcut key manually - Preferences > Shortcuts > Filter [to find it by name]... assign key-combo...
-
Gerrit, you mean like my Vertex Tools? Where it offers a set of Move, Rotate and Scale tools for vertex editing? If so, I'm currently working on a module where plugins can register commands that duplicate existing SU functions with a validation proc. If the validation proc returns true (for isntance when vertex mode is activated) then the custom tool is activated - if not the native tool is used.
Project is on GitHub: https://github.com/thomthom/SketchUpProxyCommands
Mind you, it's a WIP! I want it tested more before I say good to go.
-
Hi Gerrit,
yes, what TIG said is the case, SketchUp takes all menu items from all menus (not only Plugins menu) and allows the user to assign a shortcut for them.If your question was about contextual menu items that are only displayed or activateable under certain conditions (with a
validation_proc
) then I think the shortcut can only be assigned at the moment when the menu item is enabled (ie. the condition fullfilled, for example selection). All context menu items also appear in Edit → Entity → …. -
@thomthom said:
Gerrit, you mean like my Vertex Tools? Where it offers a set of Move, Rotate and Scale tools for vertex editing? .......
Thank you Thomas. No, I meant the most basic thing where, once a plugin is loaded at startup of SketchUp, the plugin is right available in the menu where you let it appear.
And at the same time the plugin can (from thereof) also be reached if you assign a shortcut key to it.
I wasn't sure whether "placing in the list" was done automaticaly or if you need to have some extra code in the plugin for the list.Example: I place plugin "AAA" in the folder. Looking at the code I see that "AAA" will show up in menu say "Draw". Looking at the shortcut list I can see that I can assign its use to a key.
In my case I don't want to use my plugin through any menu but (say lazy as I am) by hitting a key. As it seems SU handles most of that for me. As long as I let it appear in a menu and than find it in the list of shortcuts for assigning it.
Thank you Aerilius, for confirming TIG's answer.
The idea I have (and have had for a long time) is simple and takes all you writers about two minutes to write. I just want to put this together myself, as simple as the idea is. Otherwise I'll never learn.
Advertisement