Problem summaryThe
icon() method within the Python function
nuke.MenuItem() should return the following:
The name of the icon on this menu item as path of the icon
This method works if the object is of type
nuke.MenuItem(). However, it doesn't work if the object is of type
nuke.Menu().
nuke.Menu() inherits
nuke.MenuItem() per the documentation here:
https://learn.foundry.com/nuke/developers/113/pythonreference/nuke.Menu-class.htmlBecause
nuke.Menu() inherits
nuke.MenuItem(), and the
icon() method is explicitly mentioned, it appears to be a bug.
This happens on built-in menu items as well as user-created menu items.
Customer reported version nuke.10.0v6
Customer reported platform windows10
Steps to reproduce1) Open Nuke
2) Within the Script Editor, copy/execute the following:
toolbar = nuke.toolbar("Nodes")
draw_menu = toolbar.menu("Draw")
roto_menu_item = draw_menu.findItem("Roto")
print "Draw icon:", draw_menu.icon()
print "Draw>Roto icon:", roto_menu_item.icon()
Result: Nuke's Script Editor will print the following:
Result: Draw icon:
Draw>Roto icon: Roto.png
WorkaroundUnknown.
Reproduced by supportThis bug has been reproduced in:
Nuke11.3v2- Windows 7 - Mac10.13 - CentOS7
Nuke11.3v1- Windows 7 - Mac10.13 - CentOS7
Nuke11.2v1 - Windows 7
Nuke11.1v1 - Windows 7
Nuke11.0v1 - Windows 7
Nuke10.5v1 - Windows 7
Nuke10.0v1 - Windows 7
Nuke9.0v1 - Windows 7
Nuke8.0v1 - Windows 7 - Mac10.13 - CentOS7
Earliest version tested- This issue no longer appears in this version and has regressed
Expected behaviour Calling nuke.Menu.icon() returns "/path/to/icon"
Actual behaviourCalling nuke.Menu.icon() returns ""