Thanks Ben, that worked well!
Had to add a condition to be backward compatible though:
if nuke.NUKE_VERSION_MAJOR >= 9:
    ...
 On 23 Mar 2015 15:11, "Ben Dickson" <ben.dick...@rsp.com.au> wrote:

> I had the same problem and contacted Foundry support about it:
>
>  Nuke 9.0 uses the Qt shortcut system which has a context for when the
>> shortcut is active; the default context is the whole window.  If you
>> set a shortcut that uses the same letter as is used elsewhere (e.g
>> the H or R, G, B and A keys in the viewer) and don't supply a context
>> then there will be 2 shortcuts using the same hotkeys when the focus
>> is over the viewer so when you try to use the shortcut Nuke gets
>> confused and prints the ambiguous shortcut message.
>>
>>
>> The menu.addCommand() function has a new argument in Nuke 9.0 called
>>
> "shortcutContext" to say where the shortcut should run. It has 3
> possible values 0==Window, 1=Application, 2=DAG. So for your example to
> work in Nuke 9.0 it would be
>
>>
>> menubar = nuke.menu('Nuke')
>> m_utils = menubar.addMenu('Temp Utils')
>> m_utils.addCommand("Test", lambda: nuke.message("Beep"), "h",
>> shortcutContext=2)
>>
>
>
>
> On 23/03/15 17:23, Erwan Leroy wrote:
>
>> Hi folks.
>> I'm not sure if we're still supposed to use this mailing list but I'll
>> try my luck.
>>
>> I'm getting ready to update to nuke 9, but I have a very simple/stupid
>> issue arising with one of my most basic python scripts.
>>
>> nuke.menu('Nodes').addCommand( 'Channel/Shuffle',
>> "nuke.createNode('Shuffle')", 'h', icon= 'Shuffle.png')
>>
>> I just assigned a shortcut to the shuffle node. In the nodegraph, no
>> problems, it still creates the node.
>> The issue is in the viewer, when I press H it doesn't fit the height
>> anymore.
>> When I press H on the viewer, nothing happens.
>> It used to work just fine in 7 and 8..
>>
>> Temp fix would be to reassign to a different key, but I got a few people
>> here who got used to that shortcut, and would like to avoid changing it
>> if possible.
>>
>> Documentation still seems to use that way to assign hotkeys.
>>
>> Is that a bug? Or am I doing something wrong?
>>
>> Thanks
>> Erwan
>>
>>
>>
>> _______________________________________________
>> Nuke-python mailing list
>> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>>
>>
> --
> ben dickson
> 2D TD | ben.dick...@rsp.com.au
> rising sun pictures | www.rsp.com.au
> _______________________________________________
> Nuke-python mailing list
> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to