ID 140516 - Python - Assigning a callable to the animation menu doesn't work

Follow

Problem summary
When assigning a callable to a custom entry in the animation menu, it won't be executed when the user picks it from the menu.


This appears to be inconsistent with other menus, for example:


The following works with the 'Viewer' Menu:  ( Add snippet to your menu.py and save it )

def test():

        nuke.message( 'test' )

nuke.menu('Viewer').addCommand( 'test', test )


Yet the following does not work with the 'Animation' menu:  ( Add snippet to your menu.py and save it )

def test():

        nuke.message( 'test' )

nuke.menu('Animation').addCommand( 'test', test )


Customer reported version
Nuke10.5v7


Steps to reproduce


Test 1: 


1)  Add the following to your 'menu.py' file within your .nuke directory and save it:

def test():

        nuke.message( 'test' )

nuke.menu('Animation').addCommand( 'test', test )


2)  Launch Nuke


3)  Go to an animation menu ( right click area within Curve Editor ) and chose 'test'.


Result 1: The message is not displayed within Nuke



Test 2:


1)  Add the following to your 'menu.py' file within your .nuke directory and save it:

def test():

        nuke.message( 'test' )

nuke.menu('Viewer').addCommand( 'test', test )


2)  Launch Nuke


3)  Go to an animation menu ( right click area within Curve Editor ) and chose 'test'.


Result 2: The message box is  displayed within Nuke



Workaround
If you assign the new function as an instance wrapped  as a string, it works as expected for the animation menu:

def test():

        nuke.message( 'test' )

nuke.menu('Animation').addCommand( 'test', 'test()' )


Reproduced by support


This bug has been reproduced in:

Nuke11.1v3 - Windows 7 - Mac10.12 - CentOS6.9

Nuke11.1v1 - Windows 7 - Mac10.12 - CentOS6.9
Nuke11.0v4 - Windows 7 - Mac10.12 - CentOS6.9
Nuke11.0v1 - Windows 7 - Mac10.12 - CentOS6.9
Nuke10.5v7 - Windows 7 - Mac10.12 - CentOS6.9
Nuke10.5v1 - Windows 7
Nuke10.0v6 - Windows 7
Nuke10.0v1 - Windows 7
Nuke9.0v9 - Windows 7
Nuke9.0v1 - Windows 7
Nuke8.0v7 - Windows 7
Nuke7.0v10 - Windows 7 - Mac10.12 - CentOS6.9


Earliest version tested
- This issue appears to be in all versions of the product


Expected behaviour
Adding commands to the 'Animation' window should follow the same process as every other menu


Actual behaviour
The 'Animation' menu does not follow the same process as the other windows.

    We're sorry to hear that

    Please tell us why