In the first part, you can actually remove the s variable, its not even used....
Sent from my iPhone On 2012-07-26, at 5:44 PM, "Hugo Léveillé" <[email protected]> wrote: > The code: > > s = nuke.selectedNodes() > all_class = set([ n.Class() for n in nuke.selectedNodes() ]) #I use a set to > remove duplicate > menu = nuke.thisNode()['menu'] > menu.setValues(list(all_class)) > > Then , to drive another pulldown, you would need to drive it with a > knobchanged callback. The knobchanged will trigger an action everytime the > specified knob is changed. So for exemple, if you want to show a message box > everytime "Blur" is selected in the menu, just run this script while the noop > is selected: > > s = nuke.selectedNode() > s['knobChanged'].setValue(''' > if nuke.thisNode()['menu'].value() == "Blur" and nuke.thisKnob().name() == > "menu": > nuke.message("Blur is selected!") > ''') > > > > The node: > > set cut_paste_input [stack 0] > version 6.3 v4 > push $cut_paste_input > NoOp { > name NoOp1 > knobChanged "\n\nif nuke.thisNode()\['menu'].value() == \"Blur\" and > nuke.thisKnob().name() == \"menu\":\n nuke.message(\"Blur is > selected!\")\n\n" > selected true > xpos -103 > ypos -106 > addUserKnob {20 User} > addUserKnob {22 Go T "s = nuke.selectedNodes()\nall_class = set(\[ n.Class() > for n in nuke.selectedNodes() ])\nmenu = > nuke.thisNode()\['menu']\nmenu.setValues(list(all_class))" +STARTLINE} > addUserKnob {4 menu M {Grade NoOp ColorCorrect Transform Blur}} > menu Blur > } > > > > Hope this helps > > > > On Thu, Jul 26, 2012, at 14:57, ae.branton wrote: >> Hey me again... sorry, trying to learn. >> >> i was wondering if there is a way to drive a pull down choice menu with >> python. For instance lets say i add a pulldown choice box to a noop, and >> leave it blank. >> Then i have a python script button that looks at the selected nodes, gets >> their class, then lists the node class as an option in the pulldown menu. >> Then when you select a node class another pulldown menu lists all available >> knobs on that node. >> and so on. Is this possible? >> _______________________________________________ >> Nuke-python mailing list >> [email protected], http://forums.thefoundry.co.uk/ >> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > > > -- > Hugo Léveillé > TD Compositing, Vision Globale > [email protected] > _______________________________________________ > Nuke-python mailing list > [email protected], http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________ Nuke-python mailing list [email protected], http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
