Bez popisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HDR_Prepper.gizmo 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. set cut_paste_input [stack 0]
  2. version 7.0 v10
  3. push $cut_paste_input
  4. Group {
  5. name HDR_PREPPER
  6. label "\[value lightname]"
  7. selected true
  8. xpos -196
  9. ypos -304
  10. addUserKnob {20 light_ctrls l "Light Controls"}
  11. addUserKnob {26 hdrPrepTag l INVISIBLE +INVISIBLE T "scoping sucks."}
  12. addUserKnob {2 root_path l "Output Folder" t "Choose the root path of where to output the exr's."}
  13. root_path /var/tmp
  14. 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"}
  15. addUserKnob {1 lightname l "Light Name" t "Specify a unique name for this light."}
  16. lightname light1
  17. 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"}
  18. addUserKnob {41 Render -STARTLINE T Write1.Render}
  19. addUserKnob {20 EnvHDRGrp l "Env HDR Output" n 1}
  20. EnvHDRGrp 0
  21. addUserKnob {1 hdrname l "HDR Name" t "Specify a name for the environment HDR."}
  22. hdrname env
  23. addUserKnob {6 KeepInputFormat l "Keep Input Format" t "If checked the output will have the same format like the incoming format." +STARTLINE}
  24. addUserKnob {4 setFormat l "| Format" -STARTLINE M {256x128 512x256 1024x512 2048x1024 4096x2048 8192x4096 custom "" "" ""}}
  25. setFormat 1024x512
  26. 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}
  27. 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}
  28. exponent 40
  29. 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}
  30. addUserKnob {20 endGroup_2 l endGroup n -1}
  31. addUserKnob {26 ""}
  32. addUserKnob {20 lightremoval l "Light Removal Settings" n 1}
  33. 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}
  34. 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}
  35. 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}
  36. FilterErode1_size -10
  37. addUserKnob {7 edge_blur1 l "Edge Blur" t "Blur the edges of the light-crop area." R 0 100}
  38. edge_blur1 10
  39. addUserKnob {6 rough_edge1 l "Rough Edge" t "Break up the edges. Best to be used with higher Edge Blur values." +STARTLINE}
  40. addUserKnob {7 bring_details1 l Details t "Bring back original Details." R 0 100}
  41. bring_details1 3.5
  42. addUserKnob {41 detail_blur1 l "Detail Blur" t "Soften the re-introduced Details." T detailBlur1.size}
  43. addUserKnob {41 useSingleColor l "Fill with constant color" t "Fill in the light area with a solid color." T Switch1.disable}
  44. addUserKnob {41 singleColor l Color t "The color to fill the light area with if \"Use constant color\" is checked." T Grade2.black}
  45. addUserKnob {20 endGroup n -1}
  46. addUserKnob {26 ""}
  47. addUserKnob {20 addCtrls l "Additional Controls" n 1}
  48. addUserKnob {6 output_lightmask l "Output Lights Mask" t "Outputs the masks of the lights into the alpha channel." +STARTLINE}
  49. output_lightmask true
  50. addUserKnob {0 Shuffle4_disable t "Wheter to apply the edge extensions and blurs to the mask or not." -STARTLINE +INVISIBLE}
  51. addUserKnob {20 endGroup_1 l endGroup n -1}
  52. }
  53. BackdropNode {
  54. inputs 0
  55. name BackdropNode1
  56. tile_color 0x565656ff
  57. label details
  58. note_font_size 42
  59. xpos -580
  60. ypos 1059
  61. bdwidth 428
  62. bdheight 279
  63. }
  64. Input {
  65. inputs 0
  66. name Input1
  67. xpos -3
  68. ypos 208
  69. }
  70. Dot {
  71. name Dot39
  72. xpos 31
  73. ypos 309
  74. }
  75. set N7cc55e0 [stack 0]
  76. Dot {
  77. name Dot38
  78. xpos -611
  79. ypos 309
  80. }
  81. Dot {
  82. name Dot37
  83. xpos -611
  84. ypos 2190
  85. }
  86. Input {
  87. inputs 0
  88. name Mask
  89. xpos -276
  90. ypos 692
  91. number 1
  92. }
  93. set N7cd1970 [stack 0]
  94. push $N7cc55e0
  95. Shuffle {
  96. alpha white
  97. name Shuffle1
  98. label "\[value in]"
  99. xpos -3
  100. ypos 368
  101. }
  102. Dot {
  103. name Dot7
  104. xpos 31
  105. ypos 426
  106. }
  107. Dot {
  108. name Dot3
  109. xpos 31
  110. ypos 601
  111. }
  112. set N7ce6cc0 [stack 0]
  113. Crop {
  114. box {250 100 450 300}
  115. name Crop1
  116. xpos -123
  117. ypos 637
  118. }
  119. ChannelMerge {
  120. inputs 2
  121. operation multiply
  122. name ChannelMerge2
  123. xpos -123
  124. ypos 680
  125. }
  126. add_layer {lightmaskOrig lightmaskOrig.red lightmaskOrig.green lightmaskOrig.blue lightmaskOrig.alpha}
  127. Shuffle {
  128. red alpha
  129. green alpha
  130. blue alpha
  131. out lightmaskOrig
  132. name Shuffle3
  133. label "\[value in]"
  134. xpos -123
  135. ypos 730
  136. }
  137. FilterErode {
  138. channels rgba
  139. size {{parent.FilterErode1_size.w} {parent.FilterErode1_size.h}}
  140. name FilterErode1
  141. xpos -123
  142. ypos 772
  143. }
  144. Blur {
  145. channels rgba
  146. size {{parent.edge_blur1}}
  147. name Blur1
  148. label "\[value size]"
  149. xpos -123
  150. ypos 811
  151. }
  152. Dot {
  153. name Dot31
  154. xpos -89
  155. ypos 882
  156. }
  157. set N7d21ce0 [stack 0]
  158. Dot {
  159. name Dot33
  160. xpos -159
  161. ypos 882
  162. }
  163. set N7d25ef0 [stack 0]
  164. FilterErode {
  165. channels rgba
  166. size -12
  167. name FilterErode6
  168. xpos -193
  169. ypos 924
  170. }
  171. push $N7d25ef0
  172. Dot {
  173. name Dot32
  174. xpos -255
  175. ypos 882
  176. }
  177. set N7d33eb0 [stack 0]
  178. Shuffle {
  179. red black
  180. green black
  181. blue black
  182. alpha black
  183. name Shuffle2
  184. label "\[value in]"
  185. xpos -289
  186. ypos 908
  187. }
  188. Noise {
  189. size 10.5
  190. gain 0.46
  191. gamma 0.635
  192. center {1024 778}
  193. name Noise1
  194. xpos -289
  195. ypos 957
  196. }
  197. Dot {
  198. name Dot4
  199. xpos -255
  200. ypos 1018
  201. }
  202. push $N7d21ce0
  203. Merge2 {
  204. inputs 2+1
  205. operation color-dodge
  206. name Merge16
  207. xpos -123
  208. ypos 1014
  209. disable {{!parent.rough_edge1}}
  210. }
  211. Blur {
  212. channels rgba
  213. size 4
  214. name Blur4
  215. label "\[value size]"
  216. xpos -123
  217. ypos 1061
  218. disable {{!parent.rough_edge1}}
  219. }
  220. Dot {
  221. name Dot9
  222. xpos -89
  223. ypos 1597
  224. }
  225. set N7d73970 [stack 0]
  226. Shuffle {
  227. in lightmaskOrig
  228. red alpha
  229. out alpha
  230. name Shuffle4
  231. label "\[value in]"
  232. xpos -123
  233. ypos 1677
  234. disable {{!parent.Shuffle4_disable}}
  235. }
  236. Dot {
  237. name Dot45
  238. xpos -89
  239. ypos 2017
  240. }
  241. push $N7d73970
  242. push $N7d33eb0
  243. Dot {
  244. name Dot2
  245. xpos -331
  246. ypos 882
  247. }
  248. push $N7ce6cc0
  249. Dot {
  250. name Dot1
  251. xpos -441
  252. ypos 601
  253. }
  254. Colorspace {
  255. colorspace_out Cineon
  256. name Colorspace1
  257. label "\[value colorspace_in] >> \[value colorspace_out]"
  258. xpos -475
  259. ypos 1139
  260. }
  261. set N7d91b80 [stack 0]
  262. push $N7d91b80
  263. Blur {
  264. channels rgba
  265. size {{parent.bring_details1}}
  266. name details1
  267. label "\[value size]"
  268. xpos -570
  269. ypos 1187
  270. }
  271. Merge2 {
  272. inputs 2
  273. operation minus
  274. name Merge1
  275. xpos -475
  276. ypos 1233
  277. }
  278. Blur {
  279. channels rgba
  280. size 4
  281. name detailBlur1
  282. label "\[value size]"
  283. xpos -475
  284. ypos 1296
  285. }
  286. Merge2 {
  287. inputs 2
  288. operation mask
  289. name Merge3
  290. xpos -365
  291. ypos 1302
  292. }
  293. push $N7d21ce0
  294. push $N7ce6cc0
  295. ChannelMerge {
  296. inputs 2
  297. operation stencil
  298. name ChannelMerge1
  299. xpos -3
  300. ypos 866
  301. }
  302. Premult {
  303. name Premult1
  304. xpos -3
  305. ypos 1057
  306. }
  307. Blur {
  308. channels rgba
  309. size {65 65}
  310. name Smudge1
  311. label "\[value size]"
  312. xpos -3
  313. ypos 1083
  314. }
  315. Unpremult {
  316. name Unpremult1
  317. xpos -3
  318. ypos 1121
  319. }
  320. Merge2 {
  321. inputs 2
  322. operation plus
  323. name Merge2
  324. xpos -3
  325. ypos 1302
  326. }
  327. Clamp {
  328. channels rgba
  329. maximum 10000
  330. name Clamp2
  331. xpos -3
  332. ypos 1328
  333. }
  334. push $N7ce6cc0
  335. Dot {
  336. name Dot6
  337. xpos 122
  338. ypos 601
  339. }
  340. set N7e10da0 [stack 0]
  341. Grade {
  342. black {0 0 0 0}
  343. multiply 0
  344. name Grade2
  345. xpos 88
  346. ypos 1335
  347. }
  348. Switch {
  349. inputs 2
  350. which 1
  351. name Switch1
  352. label singlecolor
  353. xpos -3
  354. ypos 1407
  355. }
  356. Shuffle {
  357. alpha black
  358. name Shuffle6
  359. label "\[value in]"
  360. xpos -3
  361. ypos 1445
  362. }
  363. Dot {
  364. name Dot5
  365. xpos 31
  366. ypos 1541
  367. }
  368. push $N7cc55e0
  369. Dot {
  370. name Dot10
  371. xpos 213
  372. ypos 309
  373. }
  374. Keymix {
  375. inputs 3
  376. channels rgba
  377. name Keymix1
  378. xpos 179
  379. ypos 1593
  380. }
  381. Grade {
  382. name clamp_blacks
  383. xpos 179
  384. ypos 1894
  385. }
  386. ChannelMerge {
  387. inputs 2
  388. name ChannelMerge4
  389. xpos 179
  390. ypos 2001
  391. }
  392. Clamp {
  393. channels alpha
  394. name Clamp1
  395. xpos 179
  396. ypos 2074
  397. }
  398. ShuffleCopy {
  399. inputs 2
  400. name ShuffleCopy1
  401. selected true
  402. xpos 179
  403. ypos 2186
  404. disable {{parent.output_lightmask x1 1}}
  405. }
  406. Output {
  407. name Output1
  408. xpos 179
  409. ypos 2625
  410. }
  411. push $N7cd1970
  412. push $N7e10da0
  413. Dot {
  414. name Dot8
  415. xpos 327
  416. ypos 601
  417. }
  418. ChannelMerge {
  419. inputs 2
  420. operation multiply
  421. name ChannelMerge3
  422. xpos 293
  423. ypos 680
  424. }
  425. Premult {
  426. name Premult2
  427. xpos 293
  428. ypos 730
  429. }
  430. Crop {
  431. box {{Crop1.box} {Crop1.box} {Crop1.box} {Crop1.box}}
  432. softness {{Crop1.softness}}
  433. reformat true
  434. intersect {{Crop1.intersect}}
  435. crop {{Crop1.crop x1250 0}}
  436. name Crop1_clone1
  437. xpos 293
  438. ypos 756
  439. icon "\[value Crop1.icon]"
  440. bookmark {{Crop1.bookmark}}
  441. }
  442. Write {
  443. channels rgba
  444. file "\[value parent.root_path]/\[value parent.lightname].exr"
  445. colorspace linear
  446. raw true
  447. file_type exr
  448. datatype "32 bit float"
  449. version 4
  450. name Write1
  451. label "\[value write_modules] \[value wm_layer]"
  452. xpos 293
  453. ypos 782
  454. addUserKnob {20 Modules}
  455. addUserKnob {4 write_modules l module M {" " Comp_footage Comp_render Weekly "Weekly Resolution"}}
  456. addUserKnob {1 wm_layer l layer}
  457. 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}
  458. }
  459. end_group