With the new Plugin:CreatePluginAction function, your plugins can create actions.
These actions can be bound to keyboard shortcuts, or added to the Quick Access Toolbar, like any other action in Studio.
This provides our plugin developers with a more “correct” way to provide hotkey access to their plugins. Relying on the UserInputService to detect hotkeys might lead to collisions with other plugins (they may be trolling for same keys) or, worse, might collide with an existing “native” keyboard shortcut, in which case the key combo might be consumed before being passed through to UserInputService.
Great! Would love to see right-click context menu integration at some point too (with a filter for which items to add entries for, e.g, add on BaseParts or LuaSourceContainers context menus for targeted plugin actions)
Correct me if I’m wrong, but a potential problem I see with this feature is that the keyboard shortcuts are always active, while plugins have a concept of activation and deactivation. A lot of plugins, like building plugins, probably wouldn’t want their shortcuts to be active unless the plugin is active, and might want to allow other plugins to make use of the same shortcuts when the plugin isn’t activated.
Using UserInputService for this sort of thing is still sort of less than ideal since then it will only pick up shortcuts when the 3D view is focused. Maybe a new property on PluginAction could solve this problem:
RequiresActivated - Keybind only works when the corresponding plugin is activated. Additionally, multiple actions with RequiresActivated could share the same shortcut if they are from different plugins. Only the activated plugin would receive the trigger event, or none if no plugins are activated.
Aside from sharing keybinds, is there a reason you can’t just check plugin:IsActivated() or plugin:IsActivatedWithExclusiveMouse() to check whether you should ignore the PluginAction event or not? If not, we might just be able to allow actions to return pass/sink.
The biggest thing is the shared keybinds for me. I’m thinking about plugins that use keys like 1, 2, 3, etc. I use these keys in a few of my own plugins, so as it is right now I couldn’t convert all of them to use plugin actions.
i like this feature, but i have some complaints about the specific implementation
for one, there’s no way to group actions based on plugins. if the users of a plugin i make want bind or change hotkeys, they’re going to have to know the name of each action, search for it, and bind it themselves. this is less than ideal in a lot of cases, and it would be much better if actions in the Customize Shortcuts menu could be better organized to make it easier to access the actions of specific plugins.
i also think that it’s important developers be able to set certain default keybinds, i suggest going with a system similar to what evaera suggested:
with a system like this, plugin developers could still set default keybinds for their plugins while avoiding collisions with other plugins
Thanks very much for this enhancement! This was the very first problem I ran into when I started downloading plugins that use plugin guis – there’s no way to give them focus from the keyboard.
Unfortunately, I can’t speak as a developer yet, as I haven’t made a gui that would benefit much from keyboard hotkeys.
@WhoBloxedWho plz update script finder.
I think grouping shortcuts in the shortcuts menu would be sweet. Good suggestion, @crossStarCross
Most shortcuts in the settings included an icon on the left to help identify the shortcut. Is this something that could be included in the creation of the plugin action?