hello, I forgot that python script but I'm not sure that answers to my idea: link all knob values from different nodes to one presets pulldown menu. I'll investigate in frank python script
Thanks btw On Wed, Feb 15, 2012 at 3:01 PM, Michael Habenicht <[email protected]> wrote: > Hi, > have a look at Frank's stores: > http://www.nukepedia.com/gizmos/python-scripts/ui/stores/ > > Best regards, > Michael > > ------------------------------------------ > DI (FH) Michael Habenicht > Digital Film Compositor & TD > > http://www.tinitron.de > [email protected] > ------------------------------------------ > > > ----- Original Message ----- > From: [email protected] > To: [email protected] > Date: 15.02.2012 13:50:44 > Subject: [Nuke-python] Presets : Copy/Paste all knobs from selected nodes > > > > Hello, > > > > I'm trying to make "presets" from a selection of nodes contained in a > > backdrop node. > > The presets selection will be a dropdown menu attached to the backdrop. > > > > My idea is to > > 1. ('save preset')export all the knobs values from a nodes selection to a > > .nk file probably the nuke. (e: nuke.nodeCopy("c:/temp.txt")) > > 2. ('load preset')get and paste all values from that file to the exactly > > same nodes selection > > > > I there an easy way/function to get these knob values and replace the > ones > > existing in the dag? > > In the next example, if u double click on the backdrop node, what > function > > can I put in the load button? > > > > > > > > set cut_paste_input [stack 0] > > version 6.2 v2 > > BackdropNode { > > inputs 0 > > name BackdropNode2 > > selected true > > xpos -4319 > > ypos -2006 > > bdwidth 461 > > bdheight 301 > > addUserKnob {20 User} > > addUserKnob {4 Load M {Afternoo Day Night}} > > addUserKnob {22 Refresh -STARTLINE T "pulldown = > > > nuke.thisNode().knobs()\['Load']\nPresets=sorted(os.listdir(\"C:/Presets\"))\na=\[]\nfor > > i in Presets:\n > > a.append(i.split('_')\[1].strip('.nk'))\n\npulldown.setValues(a)\n"} > > addUserKnob {22 LoadPreset l "Load Preset" -STARTLINE} > > addUserKnob {26 ""} > > addUserKnob {22 Save -STARTLINE T "#function to find all nodes inside the > > backdrop\ndef getBackDropInside ( bd ) :\n list = \[]\n left = > > bd\['xpos'].value()\n top = bd\['ypos'].value() + 20\n bd_Width = > > bd\['bdwidth'].value()\n bd_Height = bd\['bdheight'].value()\n right > = > > left + bd_Width - 80\n bottom = top - 20 + bd_Height - 40\n for i in > > nuke.allNodes():\n if i\['xpos'].value() > left and > > i\['xpos'].value() < right and i\['ypos'].value() > top and > > i\['ypos'].value() < bottom:\n list.append( i )\n return > > list\n\n#Copy all knobs value to the specified > > name\n\[n\['selected'].setValue(False) for n in nuke.allNodes() ]\nNodes > = > > getBackDropInside (nuke.thisNode() )\nfor select in > > > Nodes:\n\tselect\['selected'].setValue(True)\n\nPresetRoot=\"c:/Presets/\"\nPresetname=nuke.thisNode()\['PresetName'].value()\nprint > > PresetRoot+Presetname+\".nk\"\nnuke.nodeCopy > > (PresetRoot+\"Preset_\"+Presetname+\".nk\")"} > > addUserKnob {1 PresetName l "" t "the final name will be \"Preset_\" + > > your preset name" -STARTLINE} > > PresetName Night > > } > > push $cut_paste_input > > Rectangle { > > area {512 389 1536 1167} > > name Rectangle1 > > selected true > > xpos -4012 > > ypos -1826 > > } > > Constant { > > inputs 0 > > channels rgb > > color 1 > > name Constant1 > > selected true > > xpos -4227 > > ypos -1940 > > } > > Constant { > > inputs 0 > > channels rgb > > name Constant2 > > selected true > > xpos -4086 > > ypos -1940 > > } > > Merge2 { > > inputs 2+1 > > name Merge1 > > selected true > > xpos -4152 > > ypos -1826 > > } > > > > > > > > > > > > -- > > Denis Tassenoy > > _______________________________________________ > > 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 > -- Denis Tassenoy
_______________________________________________ Nuke-python mailing list [email protected], http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
