I'm new to Python and I'm coming to it from PHP. Can anyone shed light on why the following snippit from my menu.py doesn't work to add custom entries to the menu in Nuke?
gizmoDir = 'Q:/Nuke_Extras/Plugins/Gizmos'
gizmoList = os.listdir( gizmoDir )
for g in gizmoList:
nuke.menu( 'Nodes' ).addCommand( 'Gizmos/' + os.path.splitext(g)[0], lambda: nuke.createNode(g) )
I get proper menu names for each gizmo from " 'Gizmos/' + os.path.splitext(g)[0] ", but "nuke.createNode(g)" always inserts the last gizmo from "gizmoList"... So I get a menu group that launches the same gizmo from multiple menu entries.
I realize that this is a pretty basic thing to hit the list with, but I haven't had any luck finding a solution online for what (I'm assuming) is a simple error on my part.
Ian Haskin
Sys-Admin, TOPIX
ian@topixfx.com
416-971-7711 x480