Found the bit of code I wrote years ago to do this. Far from the ideal and
certainly fugly, but it used to work. Not sure it still works though :)

def shortcutUsage( new_shortcut ):

    """
    shotcutUsage( new_shortcut )

    Checks if a given shortcut is already in use by Nuke.

    :param new_shortcut: String. A string representing the shortcut.
    :return: Returns the menu/function assignment of a given shortcut if
it's already in use
    """

    raw_shortcuts = [ s for s in nuke.hotkeys().split('\n') ]
    used_shortcuts = {}

    for sc in raw_shortcuts:
        sc_dict = sc.split('\t')
        if len( sc_dict ) > 1 and sc_dict[-1]:
            menu_item = sc_dict[0].strip(' ')
            shortcut  = sc_dict[-1]
            used_shortcuts[menu_item] = shortcut

    if new_shortcut in used_shortcuts.values():
        return [k for k, v in used_shortcuts.iteritems() if v ==
new_shortcut][0]


Cheers,
Diogo


On Thu, Aug 22, 2013 at 4:53 PM, Elias Ericsson Rydberg <
elias.ericsson.rydb...@gmail.com> wrote:

> I guess it would be possible to list all commands hotkeys in some way
> through python? As far as I know nuke usually uses lower case characters as
> hotkeys, therefore I usually assign upper case ones to my gizmos and
> scripts. Before assigning I simply test if the hotkey does anything.
>
> But If wanted to satisfy your question I would have to feed python with
> abcd.../ABCD... and another round with Ctrl+abcd.../ABCD...
>
> But as far as I know there isn't a way to have python return a node or
> function from such input. Maybe there is some workaround to do this. But
> then again, you could probably just as well use the hotkey cheat-sheet that
> used to be available on nukepedia.
>
> Cheers,
> Elias
>
> 22 aug 2013 kl. 18:44 skrev "Diogo Girondi" <diogogiro...@gmail.com>:
>
>  I have done a hack here to check if a certain hotkey collides with a
> existent one. But I don't have this code at hand now.
>
> Cheers,
> Diogo
>
>
> On Thu, Aug 22, 2013 at 1:13 PM, Ari Rubenstein 
> <a...@blueskystudios.com>wrote:
>
>> Is there a way to identify which hotKeys are Not in use in Nuke ?
>>
>> thx,
>>
>> --
>> Ari Rubenstein
>> Lead Compositor
>> www.blueskystudios.com
>>
>>
> _______________________________________________
> Nuke-users mailing list
> Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>
>
> _______________________________________________
> Nuke-users mailing list
> Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>
_______________________________________________
Nuke-users mailing list
Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

Reply via email to