set cut_paste_input [stack 0] version 7.0 v10 push $cut_paste_input Group { name HDR_PREPPER label "\[value lightname]" selected true xpos -196 ypos -304 addUserKnob {20 light_ctrls l "Light Controls"} addUserKnob {26 hdrPrepTag l INVISIBLE +INVISIBLE T "scoping sucks."} addUserKnob {2 root_path l "Output Folder" t "Choose the root path of where to output the exr's."} root_path /var/tmp addUserKnob {22 setAllFolders l "Set all to this folder" t "Set all other HDRPreppers' output folders in this script to the path from this node." -STARTLINE T "n = nuke.thisNode()\nout = n\['root_path'].value()\nallGroupNodes = nuke.allNodes('Group', group = nuke.root())\n\nfor i in allGroupNodes:\n if i.knob('hdrPrepTag'):\n i\['root_path'].setValue(out) \n"} addUserKnob {1 lightname l "Light Name" t "Specify a unique name for this light."} lightname light1 addUserKnob {22 setNameForSel l "Set selected to this name" t "All other HDR_PREPPERs that you select in the nodegraph will have the same light name like this one (numbered consecutively)." -STARTLINE T "n = nuke.thisNode()\nwith nuke.root():\n sel = nuke.selectedNodes()\n\n#increase nummer list by number of HDR Preppers\n num=\[]\n for i in sel:\n if i.knob('hdrPrepTag'):\n num.append(i)\n\n num=len(num)\n\n name = n\['lightname'].getValue()\n base=name\[:-1]\n last=name\[-1]\n\n allGroupNodes = nuke.allNodes('Group', group = nuke.root())\n \n if sel == \[]:\n raise ValueError, 'No Nodes selected. Make sure to select other HDR_PREPPER Nodes.'\n else:\n pass\n\n#Set count to end number if there is one \n if last.isdigit() == True:\n count = int(last)\n else:\n count = 1\n\n#Set count one number higher than original name if its not included in the selection\n if not n in sel:\n count = count + 1\n\n#Set last number to \"1\" on this node if it doesnt have a number at the end\n\n if last.isdigit() == False:\n n\['lightname'].setValue(name + str(1)) \n else:\n pass\n\n while (count < num+1): \n for i in allGroupNodes:\n if i in sel:\n if i.knob('hdrPrepTag'):\n if last.isdigit() == False:\n newname=name + str(count)\n else:\n newname=base + str(count) \n i\['lightname'].setValue(newname) \n count = count + 1\n"} addUserKnob {41 Render -STARTLINE T Write1.Render} addUserKnob {20 EnvHDRGrp l "Env HDR Output" n 1} EnvHDRGrp 0 addUserKnob {1 hdrname l "HDR Name" t "Specify a name for the environment HDR."} hdrname env addUserKnob {6 KeepInputFormat l "Keep Input Format" t "If checked the output will have the same format like the incoming format." +STARTLINE} addUserKnob {4 setFormat l "| Format" -STARTLINE M {256x128 512x256 1024x512 2048x1024 4096x2048 8192x4096 custom "" "" ""}} setFormat 1024x512 addUserKnob {6 envConvolve l "EnvConvolve (c) Michael Garrett" t "Convolve the output. You must have the EnvConvolve gizmo installed, otherwhise it won't work." +STARTLINE} addUserKnob {7 exponent l "| exp" t "Set the environment convolution exponent. 1 represents a diffuse surface. Higher values exponentially increase specularity/glossiness." -STARTLINE R 1 100} exponent 40 addUserKnob {22 createOut l "Create Env Output" T "sel = nuke.thisNode()\nformat = sel\['setFormat'].getValue()\n\nwith nuke.root():\n #create Reformat\n if sel\['KeepInputFormat'].value() == False:\n ref=nuke.nodes.Reformat()\n ref.setInput(0,sel)\n if format == 0:\n try:\n Latlong256\n except:\n Latlong256=nuke.addFormat('256 128 1')\n ref\['format'].setValue(Latlong256)\n \n if format == 1:\n try:\n Latlong512\n except:\n Latlong512=nuke.addFormat('512 256 1')\n ref\['format'].setValue(Latlong512)\n \n if format == 2:\n try:\n Latlong1k\n except:\n Latlong1k=nuke.addFormat('1024 512 1')\n ref\['format'].setValue(Latlong1k)\n \n if format == 3:\n try:\n Latlong2k\n except:\n Latlong2k=nuke.addFormat('2048 1024 1')\n ref\['format'].setValue(Latlong2k)\n \n if format == 4:\n try:\n Latlong4k\n except:\n Latlong4k=nuke.addFormat('4096 2048 1')\n ref\['format'].setValue(Latlong4k)\n \n if format == 5:\n try:\n Latlong8k\n except:\n Latlong8k=nuke.addFormat('8192 4096 1')\n ref\['format'].setValue(Latlong8k)\n\n if format == 6:\n customRes = nuke.getInput('Custom Resolution:', '128x64')\n if not 'x' in customRes:\n raise ValueError, 'Make sure to use a proper format (Width x Height). For example 1024x512'\n\n else:\n reslist = customRes.split('x')\n cRes = str(reslist\[0] + ' ' + reslist\[1] + ' 1')\n LatlongCustom=nuke.addFormat(cRes)\n ref\['format'].setValue(LatlongCustom)\n\n #create EnvConvolve\n if sel\['envConvolve'].value() == True: \n conv=nuke.nodes.EnvConvolve()\n if sel\['KeepInputFormat'].value() == False:\n conv.setInput(0,ref)\n else:\n conv.setInput(0,sel)\n exp=sel\['exponent'].getValue()\n conv\['phexp'].setValue(exp)\n conv\['label'].setValue('exp: \[value phexp]') \n \n\n #create Write Node\n wr=nuke.nodes.Write()\n if sel\['KeepInputFormat'].value() == False:\n if sel\['envConvolve'].value() == False:\n wr.setInput(0,ref)\n else:\n wr.setInput(0,conv)\n else:\n if sel\['envConvolve'].value() == False:\n wr.setInput(0,sel)\n else:\n wr.setInput(0,conv)\n\n wr\['channels'].setValue('rgba')\n outPath=sel\['root_path'].value()\n outName=sel\['hdrname'].value()\n wr\['file'].setValue(outPath + '/' + outName + '.exr')\n wr\['file_type'].setValue('exr')\n wr\['datatype'].setValue('32 bit float')\n" +STARTLINE} addUserKnob {20 endGroup_2 l endGroup n -1} addUserKnob {26 ""} addUserKnob {20 lightremoval l "Light Removal Settings" n 1} addUserKnob {41 area1 l Area t "Wrap this box tightly around the light source. This will define the output size of the extracted light." T Crop1.box} addUserKnob {41 size l "Edge Smudge" t "Control the amount of edge pixels sucked into the light-crop area. Increase this value if holes appear." T Smudge1.size} addUserKnob {14 FilterErode1_size l "Edge Extend" t "Extend the edges around the crop area to clean more of the surrounding pixels" R -100 100} FilterErode1_size -10 addUserKnob {7 edge_blur1 l "Edge Blur" t "Blur the edges of the light-crop area." R 0 100} edge_blur1 10 addUserKnob {6 rough_edge1 l "Rough Edge" t "Break up the edges. Best to be used with higher Edge Blur values." +STARTLINE} addUserKnob {7 bring_details1 l Details t "Bring back original Details." R 0 100} bring_details1 3.5 addUserKnob {41 detail_blur1 l "Detail Blur" t "Soften the re-introduced Details." T detailBlur1.size} addUserKnob {41 useSingleColor l "Fill with constant color" t "Fill in the light area with a solid color." T Switch1.disable} addUserKnob {41 singleColor l Color t "The color to fill the light area with if \"Use constant color\" is checked." T Grade2.black} addUserKnob {20 endGroup n -1} addUserKnob {26 ""} addUserKnob {20 addCtrls l "Additional Controls" n 1} addUserKnob {6 output_lightmask l "Output Lights Mask" t "Outputs the masks of the lights into the alpha channel." +STARTLINE} output_lightmask true addUserKnob {0 Shuffle4_disable t "Wheter to apply the edge extensions and blurs to the mask or not." -STARTLINE +INVISIBLE} addUserKnob {20 endGroup_1 l endGroup n -1} } BackdropNode { inputs 0 name BackdropNode1 tile_color 0x565656ff label details note_font_size 42 xpos -580 ypos 1059 bdwidth 428 bdheight 279 } Input { inputs 0 name Input1 xpos -3 ypos 208 } Dot { name Dot39 xpos 31 ypos 309 } set N7cc55e0 [stack 0] Dot { name Dot38 xpos -611 ypos 309 } Dot { name Dot37 xpos -611 ypos 2190 } Input { inputs 0 name Mask xpos -276 ypos 692 number 1 } set N7cd1970 [stack 0] push $N7cc55e0 Shuffle { alpha white name Shuffle1 label "\[value in]" xpos -3 ypos 368 } Dot { name Dot7 xpos 31 ypos 426 } Dot { name Dot3 xpos 31 ypos 601 } set N7ce6cc0 [stack 0] Crop { box {250 100 450 300} name Crop1 xpos -123 ypos 637 } ChannelMerge { inputs 2 operation multiply name ChannelMerge2 xpos -123 ypos 680 } add_layer {lightmaskOrig lightmaskOrig.red lightmaskOrig.green lightmaskOrig.blue lightmaskOrig.alpha} Shuffle { red alpha green alpha blue alpha out lightmaskOrig name Shuffle3 label "\[value in]" xpos -123 ypos 730 } FilterErode { channels rgba size {{parent.FilterErode1_size.w} {parent.FilterErode1_size.h}} name FilterErode1 xpos -123 ypos 772 } Blur { channels rgba size {{parent.edge_blur1}} name Blur1 label "\[value size]" xpos -123 ypos 811 } Dot { name Dot31 xpos -89 ypos 882 } set N7d21ce0 [stack 0] Dot { name Dot33 xpos -159 ypos 882 } set N7d25ef0 [stack 0] FilterErode { channels rgba size -12 name FilterErode6 xpos -193 ypos 924 } push $N7d25ef0 Dot { name Dot32 xpos -255 ypos 882 } set N7d33eb0 [stack 0] Shuffle { red black green black blue black alpha black name Shuffle2 label "\[value in]" xpos -289 ypos 908 } Noise { size 10.5 gain 0.46 gamma 0.635 center {1024 778} name Noise1 xpos -289 ypos 957 } Dot { name Dot4 xpos -255 ypos 1018 } push $N7d21ce0 Merge2 { inputs 2+1 operation color-dodge name Merge16 xpos -123 ypos 1014 disable {{!parent.rough_edge1}} } Blur { channels rgba size 4 name Blur4 label "\[value size]" xpos -123 ypos 1061 disable {{!parent.rough_edge1}} } Dot { name Dot9 xpos -89 ypos 1597 } set N7d73970 [stack 0] Shuffle { in lightmaskOrig red alpha out alpha name Shuffle4 label "\[value in]" xpos -123 ypos 1677 disable {{!parent.Shuffle4_disable}} } Dot { name Dot45 xpos -89 ypos 2017 } push $N7d73970 push $N7d33eb0 Dot { name Dot2 xpos -331 ypos 882 } push $N7ce6cc0 Dot { name Dot1 xpos -441 ypos 601 } Colorspace { colorspace_out Cineon name Colorspace1 label "\[value colorspace_in] >> \[value colorspace_out]" xpos -475 ypos 1139 } set N7d91b80 [stack 0] push $N7d91b80 Blur { channels rgba size {{parent.bring_details1}} name details1 label "\[value size]" xpos -570 ypos 1187 } Merge2 { inputs 2 operation minus name Merge1 xpos -475 ypos 1233 } Blur { channels rgba size 4 name detailBlur1 label "\[value size]" xpos -475 ypos 1296 } Merge2 { inputs 2 operation mask name Merge3 xpos -365 ypos 1302 } push $N7d21ce0 push $N7ce6cc0 ChannelMerge { inputs 2 operation stencil name ChannelMerge1 xpos -3 ypos 866 } Premult { name Premult1 xpos -3 ypos 1057 } Blur { channels rgba size {65 65} name Smudge1 label "\[value size]" xpos -3 ypos 1083 } Unpremult { name Unpremult1 xpos -3 ypos 1121 } Merge2 { inputs 2 operation plus name Merge2 xpos -3 ypos 1302 } Clamp { channels rgba maximum 10000 name Clamp2 xpos -3 ypos 1328 } push $N7ce6cc0 Dot { name Dot6 xpos 122 ypos 601 } set N7e10da0 [stack 0] Grade { black {0 0 0 0} multiply 0 name Grade2 xpos 88 ypos 1335 } Switch { inputs 2 which 1 name Switch1 label singlecolor xpos -3 ypos 1407 } Shuffle { alpha black name Shuffle6 label "\[value in]" xpos -3 ypos 1445 } Dot { name Dot5 xpos 31 ypos 1541 } push $N7cc55e0 Dot { name Dot10 xpos 213 ypos 309 } Keymix { inputs 3 channels rgba name Keymix1 xpos 179 ypos 1593 } Grade { name clamp_blacks xpos 179 ypos 1894 } ChannelMerge { inputs 2 name ChannelMerge4 xpos 179 ypos 2001 } Clamp { channels alpha name Clamp1 xpos 179 ypos 2074 } ShuffleCopy { inputs 2 name ShuffleCopy1 selected true xpos 179 ypos 2186 disable {{parent.output_lightmask x1 1}} } Output { name Output1 xpos 179 ypos 2625 } push $N7cd1970 push $N7e10da0 Dot { name Dot8 xpos 327 ypos 601 } ChannelMerge { inputs 2 operation multiply name ChannelMerge3 xpos 293 ypos 680 } Premult { name Premult2 xpos 293 ypos 730 } Crop { box {{Crop1.box} {Crop1.box} {Crop1.box} {Crop1.box}} softness {{Crop1.softness}} reformat true intersect {{Crop1.intersect}} crop {{Crop1.crop x1250 0}} name Crop1_clone1 xpos 293 ypos 756 icon "\[value Crop1.icon]" bookmark {{Crop1.bookmark}} } Write { channels rgba file "\[value parent.root_path]/\[value parent.lightname].exr" colorspace linear raw true file_type exr datatype "32 bit float" version 4 name Write1 label "\[value write_modules] \[value wm_layer]" xpos 293 ypos 782 addUserKnob {20 Modules} addUserKnob {4 write_modules l module M {" " Comp_footage Comp_render Weekly "Weekly Resolution"}} addUserKnob {1 wm_layer l layer} addUserKnob {22 trixter_update_me +INVISIBLE T "try:\n import tx_nuke.write_modules as wm\n wm.update_node(nuke.thisNode())\nexcept: pass" +STARTLINE} } end_group