Ei kuvausta
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.

sb_glow.gizmo 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. #! C:/Program Files/Nuke8.0v5/nuke-8.0.v5.dll -nx
  2. version 8.0 v5
  3. Group {
  4. name sb_Glow
  5. inputs 3
  6. help "Simon Bjork\nAugust 2013\nVersion 1.5\nbjork.simon@gmail.com"
  7. knobChanged "\n\nfrom __future__ import with_statement\n\nn = nuke.thisNode()\nk = nuke.thisKnob()\n\n# Matte type.\nif k.name() == \"glow_matte\":\n kb_knob = n\[\"keyer_blacks\"]\n kw_knob = n\[\"keyer_whites\"]\n\n if n\[\"glow_matte\"].value() == \"luma key\":\n kb_knob.setVisible(True)\n kw_knob.setVisible(True)\n elif n\[\"glow_matte\"].value() == \"matte\":\n kb_knob.setVisible(False)\n kw_knob.setVisible(False)\n\n"
  8. tile_color 0x4d00ffff
  9. note_font Verdana
  10. mapsize {0.1111111111 0.096069869}
  11. addUserKnob {20 sb_glow_tab l "sb Glow"}
  12. addUserKnob {26 divider1 l "" +STARTLINE}
  13. addUserKnob {26 overall_txt l "<b>Overall controls</b>" T " "}
  14. addUserKnob {41 value l colour T Multiply2.value}
  15. addUserKnob {7 overall_intensity l "overall intensity" R 0 2}
  16. overall_intensity 0.2
  17. addUserKnob {26 divider2 l "" +STARTLINE}
  18. addUserKnob {26 luma_txt l "<b>Matte controls</b>" T " "}
  19. addUserKnob {4 glow_matte l "glow matte" M {"luma key" matte}}
  20. addUserKnob {7 keyer_blacks l "keyer blacks"}
  21. keyer_blacks 0.6
  22. addUserKnob {7 keyer_whites l "keyer whites"}
  23. keyer_whites 0.1
  24. addUserKnob {41 size l "soften matte" T soften_matte.size}
  25. addUserKnob {6 show_matte l "view glow matte" +STARTLINE}
  26. addUserKnob {26 divider3 l "" +STARTLINE}
  27. addUserKnob {20 create_new_glow l "create new glow" n 1}
  28. create_new_glow 0
  29. addUserKnob {3 number_of_blurs l "number of blurs" t "Total number of blurs used to create the glow."}
  30. number_of_blurs 5
  31. addUserKnob {7 master_blur_value l "master blur value" t "Size of the widest blur."}
  32. master_blur_value 350
  33. addUserKnob {7 master_intensity l "master blur intensity" t "Contribution of the widest blur."}
  34. master_intensity 0.05
  35. addUserKnob {7 blur_divider l "blur divider" t "blur1 = master blur value\nblur2 = blur1/blur divider\nblur3 = blur2/blur divider\netc"}
  36. blur_divider 2
  37. addUserKnob {7 intensity_increment l "intensity increment" t "Multiply each blurs contribution with this number."}
  38. intensity_increment 2
  39. addUserKnob {26 divider4 l "" +STARTLINE}
  40. addUserKnob {22 create_glow l "create glow" T "from __future__ import with_statement\nimport nuke\nimport re\n\n# sb_glow\n# Simon Bjork\n# March 2013\n# Version 1.4\n# bjork.simon@gmail.com\n\ndef sb_glow():\n\n n = nuke.thisNode()\n\n # Set up base names.\n blurPrefix = 'glow_blur'\n mergePrefix = 'glow_merge'\n dividerPrefix = 'glow_divider'\n nameRE = re.compile('^(%s|%s)' % (blurPrefix, mergePrefix))\n divRE = re.compile(dividerPrefix)\n\n # Remove exsisting glow knobs.\n for name, knob in n.knobs().iteritems():\n if nameRE.search(name) or divRE.search(name):\n n.removeKnob(knob)\n\n # Access nodes inside group:\n with n:\n\n # Deselect all nodes to prevent errors.\n for i in nuke.allNodes():\n i\[\"selected\"].setValue(False)\n\n # Delete exsisting glow nodes.\n for a in nuke.allNodes('Blur') + nuke.allNodes('Merge2'):\n if nameRE.search(a.name()):\n nuke.delete(a)\n\n # Node positions.\n blurX = 750\n blurY = -700\n mergeX = 350\n mergeY = -700\n\n # Move bottom nodes so that they don't interfere with the new nodes.\n bottom_nodes = \[\"BackdropNode1\", \"Multiply2\", \"Plus1\", \"Merge2\", \"Dot12\", \"mask\", \"AddChannels1\", \"Shuffle3\", \"Dot1\", \"OUTPUT\", \"Dot6\", \"matte_to_rgb\", \"Switch2\", \"Multiply3\"]\n\n for j in bottom_nodes:\n node = nuke.toNode(j)\n curr_node_y = node\['ypos'].value()\n node\['ypos'].setValue(int(curr_node_y) + 10000)\n\n # Set up values.\n num_blurs = n\[\"number_of_blurs\"].value()\n blur_value = n\[\"master_blur_value\"].value()\n div_blur = n\[\"blur_divider\"].value()\n intensity_value = n\[\"master_intensity\"].value()\n intensity_increment = n\[\"intensity_increment\"].value()\n\n # Create the glow.\n for i in range(int(num_blurs)):\n\n # Connect the glow to these nodes.\n inp = nuke.toNode(\"black_frame\")\n dot = nuke.toNode(\"sb_glow_dot3\")\n\n # Create blur nodes.\n blurName = '%s%d' % (blurPrefix, i + 100)\n b = nuke.createNode('Blur', 'name %s' % blurName, inpanel=False)\n b\[\"channels\"].setValue(\"rgb\")\n b\[\"size\"].setValue(blur_value)\n b\['xpos'].setValue(blurX)\n b\['ypos'].setValue(blurY) \n b.setInput(0, dot)\n\n # Create blur knobs.\n k = nuke.Link_Knob( blurPrefix + str(i + 1) )\n k.makeLink(str(b\[\"name\"].value()), \"size\" )\n k.setLabel( \"blur\" + str(i + 1) + \" size\" )\n n.addKnob(k)\n\n # Create merge nodes.\n mergeName = '%s%d' % (mergePrefix, i + 100)\n m = nuke.createNode(\"Merge2\", 'name %s' % mergeName, inpanel=False)\n m\[\"operation\"].setValue(\"plus\")\n m\[\"mix\"].setValue(intensity_value)\n m\['xpos'].setValue(mergeX)\n m\['ypos'].setValue(mergeY)\n\n # Create merge knobs.\n e = nuke.Link_Knob( mergePrefix + str(i + 1) )\n e.makeLink(str(m\[\"name\"].value()), \"mix\" )\n e.setLabel( \"intensity\" )\n n.addKnob(e)\n\n # Create separator.\n sep = nuke.Text_Knob(dividerPrefix + str(i + 1),'') \n n.addKnob(sep)\n\n # If it's the first loop.\n if i == 0:\n m.setInput(1, b)\n m.setInput(0, inp)\n m_name = m\[\"name\"].value()\n\n else:\n m.setInput(1, b)\n ol_m = nuke.toNode(str(m_name))\n m.setInput(0, ol_m)\n m_name = m\[\"name\"].value()\n\n # If it's the last loop.\n the_i = int(num_blurs) - 1\n if i == the_i:\n\n # Connect the adjustment nodes.\n theMult = nuke.toNode(\"Multiply2\")\n theMult.setInput(0, m)\n\n # Mesure the offset for exsisting nodes.\n mesurer = theMult\n mesurer_y = mesurer\['ypos'].value()\n calc = mesurer_y - m\['ypos'].value()\n offset = 500\n\n # Set position for all the exsisting nodes at the bottom.\n for k in bottom_nodes:\n node = nuke.toNode(k)\n current_y = node\['ypos'].value()\n node\['ypos'].setValue(current_y - calc + offset)\n\n # Create new values for next loop.\n blur_value = blur_value/div_blur\n intensity_value = intensity_value*intensity_increment\n blurY = blurY + 250\n mergeY = mergeY + 250\n\nsb_glow()" +STARTLINE}
  41. addUserKnob {20 endGroup_create_new_glow l endGroup n -1}
  42. addUserKnob {26 divider5 l "" +STARTLINE}
  43. addUserKnob {20 individual_controls l "individual controls"}
  44. addUserKnob {26 divider6 l "" +STARTLINE}
  45. addUserKnob {41 glow_blur1 l "blur1 size" T glow_blur100.size}
  46. addUserKnob {41 glow_merge1 l intensity T glow_merge100.mix}
  47. addUserKnob {26 glow_divider1 l "" +STARTLINE}
  48. addUserKnob {41 glow_blur2 l "blur2 size" T glow_blur101.size}
  49. addUserKnob {41 glow_merge2 l intensity T glow_merge101.mix}
  50. addUserKnob {26 glow_divider2 l "" +STARTLINE}
  51. addUserKnob {41 glow_blur3 l "blur3 size" T glow_blur102.size}
  52. addUserKnob {41 glow_merge3 l intensity T glow_merge102.mix}
  53. addUserKnob {26 glow_divider3 l "" +STARTLINE}
  54. addUserKnob {41 glow_blur4 l "blur4 size" T glow_blur103.size}
  55. addUserKnob {41 glow_merge4 l intensity T glow_merge103.mix}
  56. addUserKnob {26 glow_divider4 l "" +STARTLINE}
  57. addUserKnob {41 glow_blur5 l "blur5 size" T glow_blur104.size}
  58. addUserKnob {41 glow_merge5 l intensity T glow_merge104.mix}
  59. addUserKnob {26 glow_divider5 l "" +STARTLINE}
  60. }
  61. BackdropNode {
  62. inputs 0
  63. name BackdropNode1
  64. label "glow adjustments"
  65. note_font_size 92
  66. xpos -396
  67. ypos 523
  68. bdwidth 1476
  69. bdheight 1404
  70. }
  71. BackdropNode {
  72. inputs 0
  73. name BackdropNode2
  74. tile_color 0x7171c600
  75. label "glow matte"
  76. note_font_size 92
  77. xpos 1744
  78. ypos -3594
  79. bdwidth 1569
  80. bdheight 1622
  81. }
  82. Input {
  83. inputs 0
  84. name glow_matte
  85. label "input number: \[value number]"
  86. xpos 2874
  87. ypos -3123
  88. number 2
  89. }
  90. AddChannels {
  91. channels {rgba.alpha none none rgba.alpha}
  92. color 1
  93. name AddChannels3
  94. xpos 2874
  95. ypos -2906
  96. disable {{"\[exists parent.input2] ? 1 : 0" i x428 1}}
  97. }
  98. Shuffle {
  99. alpha white
  100. name Shuffle5
  101. xpos 2874
  102. ypos -2739
  103. disable {{"\[exists parent.input2] ? 1 : 0" i x428 1}}
  104. }
  105. Dot {
  106. name Dot7
  107. xpos 2908
  108. ypos -2586
  109. }
  110. Input {
  111. inputs 0
  112. name input
  113. note_font_size 92
  114. xpos -208
  115. ypos -4550
  116. }
  117. Dot {
  118. name Dot4
  119. xpos -174
  120. ypos -4012
  121. }
  122. set N44638e00 [stack 0]
  123. Dot {
  124. name Dot5
  125. xpos 1996
  126. ypos -4012
  127. }
  128. Shuffle {
  129. alpha black
  130. name Shuffle2
  131. xpos 1962
  132. ypos -3417
  133. }
  134. Remove {
  135. operation keep
  136. channels rgb
  137. name Remove1
  138. xpos 1962
  139. ypos -3306
  140. }
  141. Dot {
  142. name Dot10
  143. xpos 1996
  144. ypos -3140
  145. }
  146. set N44639bc0 [stack 0]
  147. Dot {
  148. name Dot2
  149. xpos 2484
  150. ypos -3140
  151. }
  152. Keyer {
  153. operation "luminance key"
  154. range {{keyer_blacks} {keyer_whites} 1 1}
  155. name Keyer1
  156. xpos 2450
  157. ypos -2870
  158. }
  159. Switch {
  160. inputs 2
  161. which {{parent.glow_matte x1 0}}
  162. name Switch1
  163. xpos 2450
  164. ypos -2589
  165. }
  166. Blur {
  167. channels alpha
  168. name soften_matte
  169. xpos 2450
  170. ypos -2464
  171. }
  172. Dot {
  173. name Dot9
  174. xpos 2484
  175. ypos -2352
  176. }
  177. push $N44639bc0
  178. Copy {
  179. inputs 2
  180. from0 rgba.alpha
  181. to0 rgba.alpha
  182. name Copy1
  183. xpos 1962
  184. ypos -2362
  185. }
  186. Premult {
  187. name Premult1
  188. xpos 1962
  189. ypos -2165
  190. }
  191. Dot {
  192. name Dot11
  193. xpos 1996
  194. ypos -1569
  195. }
  196. set N4438b0b0 [stack 0]
  197. Dot {
  198. name Dot8
  199. xpos 2385
  200. ypos -1569
  201. }
  202. Dot {
  203. name Dot6
  204. xpos 2385
  205. ypos 1408
  206. }
  207. Shuffle {
  208. red alpha
  209. green alpha
  210. blue alpha
  211. alpha white
  212. name matte_to_rgb
  213. xpos 164
  214. ypos 1404
  215. }
  216. Input {
  217. inputs 0
  218. name mask
  219. note_font_size 92
  220. xpos 700
  221. ypos 609
  222. number 1
  223. }
  224. AddChannels {
  225. channels {rgba.alpha none none rgba.alpha}
  226. color 1
  227. name AddChannels1
  228. xpos 700
  229. ypos 888
  230. disable {{"\[exists parent.input1] ? 1 : 0" i x428 1}}
  231. }
  232. Shuffle {
  233. alpha white
  234. name Shuffle3
  235. xpos 700
  236. ypos 1010
  237. disable {{"\[exists parent.input1] ? 1 : 0" x428 1}}
  238. }
  239. Dot {
  240. name Dot1
  241. xpos 734
  242. ypos 1119
  243. }
  244. Crop {
  245. inputs 0
  246. box {{"\[exists parent.input0] ? input0.width/2 - (input0.width/2 - input0.bbox.x) : 0"} {"\[exists parent.input0] ? input0.height/2 - (input0.height/2 - input0.bbox.y) : 0"} {"\[exists parent.input0] ? input0.bbox.r : width"} {"\[exists parent.input0] ? input0.bbox.t : height"}}
  247. name black_frame
  248. tile_color 0xff
  249. xpos 350
  250. ypos -1320
  251. }
  252. set N444abd40 [stack 0]
  253. Dot {
  254. name Dot13
  255. xpos 384
  256. ypos -999
  257. }
  258. push $N4438b0b0
  259. Shuffle {
  260. alpha black
  261. name Shuffle1
  262. xpos 1962
  263. ypos -1333
  264. }
  265. CopyBBox {
  266. inputs 2
  267. name CopyBBox1
  268. xpos 1962
  269. ypos -1002
  270. }
  271. Dot {
  272. name sb_glow_dot3
  273. xpos 1996
  274. ypos -755
  275. }
  276. set N444acb00 [stack 0]
  277. Blur {
  278. channels rgb
  279. size 21.875
  280. name glow_blur104
  281. xpos 750
  282. ypos 300
  283. }
  284. push $N444acb00
  285. Blur {
  286. channels rgb
  287. size 43.75
  288. name glow_blur103
  289. xpos 750
  290. ypos 50
  291. }
  292. push $N444acb00
  293. Blur {
  294. channels rgb
  295. size 87.5
  296. name glow_blur102
  297. xpos 750
  298. ypos -200
  299. }
  300. push $N444acb00
  301. Blur {
  302. channels rgb
  303. size 175
  304. name glow_blur101
  305. xpos 750
  306. ypos -450
  307. }
  308. push $N444acb00
  309. Blur {
  310. channels rgb
  311. size 350
  312. name glow_blur100
  313. xpos 750
  314. ypos -700
  315. }
  316. push $N444abd40
  317. Merge2 {
  318. inputs 2
  319. operation plus
  320. mix 0.05
  321. name glow_merge100
  322. xpos 350
  323. ypos -700
  324. }
  325. Merge2 {
  326. inputs 2
  327. operation plus
  328. mix 0.1
  329. name glow_merge101
  330. xpos 350
  331. ypos -450
  332. }
  333. Merge2 {
  334. inputs 2
  335. operation plus
  336. mix 0.2
  337. name glow_merge102
  338. xpos 350
  339. ypos -200
  340. }
  341. Merge2 {
  342. inputs 2
  343. operation plus
  344. mix 0.4
  345. name glow_merge103
  346. xpos 350
  347. ypos 50
  348. }
  349. Merge2 {
  350. inputs 2
  351. operation plus
  352. mix 0.8
  353. name glow_merge104
  354. xpos 350
  355. ypos 300
  356. }
  357. Multiply {
  358. channels rgb
  359. value {0.8 1.5 2.5 1}
  360. name Multiply2
  361. label colour
  362. xpos 350
  363. ypos 800
  364. }
  365. Merge2 {
  366. inputs 2
  367. operation mask
  368. name Merge2
  369. xpos 350
  370. ypos 1116
  371. }
  372. Dot {
  373. name Dot12
  374. xpos 384
  375. ypos 1225
  376. }
  377. Multiply {
  378. value {{overall_intensity}}
  379. name Multiply3
  380. label "overall intensity"
  381. xpos 1
  382. ypos 1210
  383. }
  384. push $N44638e00
  385. Merge2 {
  386. inputs 2
  387. operation plus
  388. Achannels rgb
  389. name Plus1
  390. xpos -208
  391. ypos 1222
  392. }
  393. Switch {
  394. inputs 2
  395. which {{parent.show_matte x1 0}}
  396. name Switch2
  397. label "0 = glow\n1 = glow matte"
  398. xpos -208
  399. ypos 1392
  400. }
  401. Output {
  402. name OUTPUT
  403. note_font_size 92
  404. xpos -208
  405. ypos 1655
  406. }
  407. StickyNote {
  408. inputs 0
  409. name StickyNote3
  410. label "Do not change any of these nodes!\nPython callbacks are based on the names of the nodes."
  411. note_font_size 92
  412. xpos -1245
  413. ypos -4927
  414. }
  415. StickyNote {
  416. inputs 0
  417. name StickyNote1
  418. label glow
  419. note_font_size 92
  420. xpos 959
  421. ypos -1362
  422. }
  423. end_group