Nessuna descrizione
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.

Cryptomatte.gizmo 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. #
  2. # Copyright (c) 2014, 2015, 2016, 2017 Psyop Media Company, LLC
  3. # See license.txt
  4. #
  5. version 7.0 v1
  6. #! C:/Temp/psyop_cache/apps/nuke/win64/10.0v6/nuke-10.0.6.dll -nx
  7. Gizmo {
  8. addUserKnob {20 cryptomatte l "Psyop Cryptomatte"}
  9. addUserKnob {36 pickerAdd l "Picker Add" t "Key objects to add to the Matte List here. " +STARTLINE +DO_NOT_WRITE}
  10. pickerAdd {0 0 0 0 0 0 0 0}
  11. addUserKnob {26 pickerAddLabel l "Picker Add" -STARTLINE T " "}
  12. addUserKnob {36 pickerRemove l "Picker Remove" t "Key objects to remove from the Matte List here. " +STARTLINE +DO_NOT_WRITE}
  13. pickerRemove {0 0 0 0 0 0 0 0}
  14. addUserKnob {26 pickerRemoveLabel l "Picker Remove" -STARTLINE T " "}
  15. addUserKnob {26 ""}
  16. addUserKnob {6 previewEnabled l "Preview" +STARTLINE}
  17. previewEnabled true
  18. addUserKnob {4 previewMode l "" t "Choose how Cryptomatte will visualize keyable regions." -STARTLINE M {Colors Edges None ""}}
  19. addUserKnob {6 matteOnly l "Matte Only" t "Extracted matte is copied to RGB channels as well. This disables keying. " +STARTLINE}
  20. addUserKnob {6 singleSelection l "Single Selection" t "Picker only selects matte at a time, rather than selecting a list. " -STARTLINE}
  21. addUserKnob {6 RemoveChannels l "Remove Channels" t "Removes all non-RGBA channels for the output. This will leave the downstream cleaner. " -STARTLINE}
  22. addUserKnob {26 ""}
  23. addUserKnob {41 matteOutput l "Matte Output" t "Set the channel(s) the matte will write to in \"Matte Only\" mode. For example, you can use this to store the matte in a custom channel called \"Matte\" and use it for color-correction downstream." T ShuffleCopy_embedMask.out}
  24. addUserKnob {6 unpremultiply l Unpremultiply -STARTLINE}
  25. addUserKnob {1 matteList l "Matte List" t "The list of names the mattes are built from. Color picking values with the color fields above works by populating this field. "}
  26. addUserKnob {22 clear l Clear t "Clears the selection in this Gizmo" T "try: \n import cryptomatte_utilities as cu\n cu.clear_cryptomatte_gizmo(nuke.thisNode())\nexcept Exception, err:\n import traceback\n nuke.message('''Unable to run Cryptomatte Gizmo update script. This script is necessary for the Cryptomatte system to work properly. Please check with Pipeline that the Cryptomatte python plugin is available on this project. \n\nError Traceback (send this to Pipeline): \n\n%s''' % traceback.format_exc())" +STARTLINE}
  27. addUserKnob {22 forceUpdate l "Force Update" t "Updates the Gizmo based on which channels are available in the input. \n\nThis happens automatically when input changes, when loading the nuke script, or when a new gizmo is created. This is how it deals with differently named channels in the different Cryptomatte layers, and different depths that it's possible to render at. " -STARTLINE T "try: \n import cryptomatte_utilities as cu\nexcept Exception, err:\n import traceback\n nuke.message('''Unable to run Cryptomatte Gizmo update script. This script is necessary for the Cryptomatte system to work properly. \n\nError Traceback: \n\n%s''' % traceback.format_exc())"}
  28. addUserKnob {6 stopAutoUpdate l "Stop Auto Update" t "Stops the automatic update of this copy of the Gizmo." -STARTLINE}
  29. addUserKnob {26 ""}
  30. addUserKnob {4 cryptoLayerChoice l "Layer Selection" t "Choose which Cryptomatte layer to key." M {" " ""} +DO_NOT_WRITE}
  31. addUserKnob {1 cryptoLayer l INVISIBLE t "Internal storage of selection between multiple cryptomattes." -STARTLINE +INVISIBLE}
  32. addUserKnob {1 metadataCache l INVISIBLE t "Internal storage of selection between multiple cryptomatte metadata keys." -STARTLINE +INVISIBLE +DO_NOT_WRITE}
  33. addUserKnob {6 cryptoLayerLock l "Lock Layer Selection" t "Stops the automatic update of the layer selection." -STARTLINE}
  34. addUserKnob {41 expression l "Keyer Expression" t "The built expression. This knob is set automatically and is only left exposed as information for the user. " T Expression_key.expr0}
  35. addUserKnob {20 Advanced}
  36. addUserKnob {36 ColorKey l "" t "Key an object here to check its name. It will not effect your mattes. " -STARTLINE +HIDDEN}
  37. ColorKey {0 0 0 0 0 0 0 0}
  38. addUserKnob {6 ColorKey_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
  39. addUserKnob {26 ColorKeyLabel l "Name Checker" -STARTLINE T " " +HIDDEN}
  40. addUserKnob {1 keyedName l "Keyed Name" t "This field is for information only." +HIDDEN}
  41. addUserKnob {26 "" +HIDDEN}
  42. addUserKnob {26 cryptomatteVersion l "Cryptomatte Version" T 1.2.8 +DO_NOT_WRITE}
  43. addUserKnob {22 troubleshoot l "Troubleshoot" +STARTLINE
  44. t "'Force Update All' will run 'Force Update' on all Cryptomatte gizmos in the Nuke script. 'Force Update' orders the gizmos to re-configure themselves based on available metadata, Cryptomatte depth, and the matte list. This updates all aspects of thier operation, from the preview modes to the extraction expression. Usually these updates occur automatically on certain actions, such as 'keying' the image, changing layer selection, or reconnecting images. However if changes occur upstream of the gizmos that require manually invoked updates, 'Force Update' and 'Force Update All' may be used. "
  45. T "
  46. try:
  47. import cryptomatte_utilities as cu
  48. cu.troubleshoot_gizmo(nuke.thisNode())
  49. except ImportError, err:
  50. nuke.message('''Could not import cryptomatte_utilities.py, the python files are not available. \n\nError Traceback: \n\n%s''' % traceback.format_exc())
  51. except Exception, err:
  52. import traceback
  53. nuke.message('''Something went wrong. If you would like to report this, please the text in this window: \n\nError Traceback: \n\n%s''' % traceback.format_exc())
  54. "}
  55. addUserKnob {26 ""}
  56. addUserKnob {22 decryptomatte l "Decryptomatte (Replace with Expression)" +STARTLINE
  57. t "Replaces this gizmo with an expression node that does the extraction. This will replicate the matte extraction, but not the preview modes. "
  58. T "
  59. try:
  60. import cryptomatte_utilities as cu
  61. cu.decryptomatte_button(nuke.thisNode())
  62. except Exception, err:
  63. import traceback
  64. nuke.message('''Unable to run a Cryptomatte script. This script is necessary for the Cryptomatte system to work properly. \n\nError Traceback: \n\n%s''' % traceback.format_exc())
  65. "}
  66. addUserKnob {22 unloadManifest l "Unload Manifest (Extract all Mattes)" +STARTLINE
  67. t "Unload Manifest will create a separate gizmo for every named matte in the Cryptomatte manifest. This can potentially be thousands of nodes, though if the number is high a warning will be displayed before creating them. "
  68. T "
  69. try:
  70. import cryptomatte_utilities as cu
  71. cu.unload_manifest(nuke.thisNode())
  72. except Exception, err:
  73. import traceback
  74. nuke.message('''Unable to run a Cryptomatte script. This script is necessary for the Cryptomatte system to work properly. \n\nError Traceback: \n\n%s''' % traceback.format_exc())
  75. "}
  76. addUserKnob {22 forceUpdateAll l "Force Update All (Update all Gizmos)" +STARTLINE
  77. t "'Force Update All' will run 'Force Update' on all Cryptomatte gizmos in the Nuke script. 'Force Update' orders the gizmos to re-configure themselves based on available metadata, Cryptomatte depth, and the matte list. This updates all aspects of thier operation, from the preview modes to the extraction expression. Usually these updates occur automatically on certain actions, such as 'keying' the image, changing layer selection, or reconnecting images. However if changes occur upstream of the gizmos that require manually invoked updates, 'Force Update' and 'Force Update All' may be used. "
  78. T "
  79. try:
  80. import cryptomatte_utilities as cu
  81. cu.update_all_cryptomatte_gizmos()
  82. except Exception, err:
  83. import traceback
  84. nuke.message('''Unable to run Cryptomatte Gizmo update script. This script is necessary for the Cryptomatte system to work properly. \n\nError Traceback: \n\n%s''' % traceback.format_exc())
  85. "}
  86. addUserKnob {41 previewExpression0 l INVISIBLE +INVISIBLE T Expression_preview.expr0}
  87. addUserKnob {41 previewExpression1 l INVISIBLE +INVISIBLE T Expression_preview.expr1}
  88. addUserKnob {41 previewExpression2 l INVISIBLE +INVISIBLE T Expression_preview.expr2}
  89. addUserKnob {41 previewExpression3 l INVISIBLE +INVISIBLE T Expression_preview.expr3}
  90. addUserKnob {11 previewChannel +HIDDEN}
  91. previewChannel none
  92. addUserKnob {11 in00 +HIDDEN}
  93. addUserKnob {11 in01 +HIDDEN}
  94. addUserKnob {11 in02 +HIDDEN}
  95. addUserKnob {11 in03 +HIDDEN}
  96. addUserKnob {11 in04 +HIDDEN}
  97. addUserKnob {11 in05 +HIDDEN}
  98. addUserKnob {11 in06 +HIDDEN}
  99. addUserKnob {11 in07 +HIDDEN}
  100. addUserKnob {11 in08 +HIDDEN}
  101. addUserKnob {11 in09 +HIDDEN}
  102. addUserKnob {11 in10 +HIDDEN}
  103. addUserKnob {11 in11 +HIDDEN}
  104. addUserKnob {26 "" +HIDDEN}
  105. }
  106. Input {
  107. inputs 0
  108. name Input1
  109. xpos -1361
  110. ypos -499
  111. }
  112. Dot {
  113. name Dot4
  114. xpos -1327
  115. ypos -439
  116. }
  117. set N13c4bc00 [stack 0]
  118. Dot {
  119. name Dot15
  120. xpos -1093
  121. ypos -439
  122. }
  123. set N13c4b800 [stack 0]
  124. Dot {
  125. name Dot1
  126. xpos -960
  127. ypos -439
  128. }
  129. Shuffle {
  130. red black
  131. green black
  132. blue black
  133. name Shuffle_blackRGB
  134. xpos -994
  135. ypos -398
  136. }
  137. Expression {
  138. channel1 none
  139. channel2 none
  140. channel3 none
  141. name Expression_key
  142. xpos -994
  143. ypos -372
  144. }
  145. Unpremult {
  146. channels {rgba.red -rgba.green -rgba.blue none}
  147. name Unpremult_matte
  148. xpos -994
  149. ypos -340
  150. disable {{!parent.unpremultiply}}
  151. }
  152. set N13c4a400 [stack 0]
  153. Dot {
  154. name Dot11
  155. xpos -960
  156. ypos -142
  157. }
  158. set N13c4a000 [stack 0]
  159. Dot {
  160. name Dot2
  161. xpos -960
  162. ypos -65
  163. }
  164. push $N13c4a000
  165. push $N13c4bc00
  166. Dot {
  167. name Dot8
  168. xpos -1327
  169. ypos -395
  170. }
  171. set N12b01800 [stack 0]
  172. Dot {
  173. name Dot9
  174. xpos -1227
  175. ypos -395
  176. }
  177. Remove {
  178. operation keep
  179. channels rgba
  180. name Remove_channels
  181. xpos -1261
  182. ypos -360
  183. }
  184. push $N12b01800
  185. Switch {
  186. inputs 2
  187. which {{parent.RemoveChannels}}
  188. name Switch_removeChannels
  189. xpos -1361
  190. ypos -312
  191. }
  192. Dot {
  193. name Dot17
  194. xpos -1327
  195. ypos -235
  196. }
  197. set N12b00c00 [stack 0]
  198. Dot {
  199. name Dot10
  200. xpos -1327
  201. ypos -193
  202. }
  203. set N12b00800 [stack 0]
  204. ShuffleCopy {
  205. inputs 2
  206. red red
  207. green red
  208. blue red
  209. alpha red
  210. name ShuffleCopy_matteOnly
  211. xpos -1361
  212. ypos -146
  213. }
  214. Dot {
  215. name Dot16
  216. xpos -1327
  217. ypos -91
  218. }
  219. push $N13c4a400
  220. push $N13c4b800
  221. Shuffle {
  222. alpha black
  223. name Shuffle_blackAlpha
  224. xpos -1127
  225. ypos -394
  226. }
  227. Expression {
  228. name Expression_preview
  229. xpos -1127
  230. ypos -368
  231. }
  232. Grade {
  233. inputs 1+1
  234. channels {rgba.red rgba.green -rgba.blue none}
  235. multiply 0
  236. add 1
  237. black_clamp false
  238. maskChannelMask rgba.red
  239. name Grade_selection
  240. xpos -1127
  241. ypos -340
  242. }
  243. Grade {
  244. channels {-rgba.red rgba.green rgba.blue none}
  245. multiply 0
  246. add 1
  247. black_clamp false
  248. maskChannelInput rgba.alpha
  249. name Grade_highlight
  250. xpos -1127
  251. ypos -302
  252. }
  253. push $N12b00c00
  254. ShuffleCopy {
  255. inputs 2
  256. red red
  257. green green
  258. blue blue
  259. alpha alpha2
  260. name ShuffleCopy_restoreAlpha
  261. xpos -1127
  262. ypos -239
  263. }
  264. push $N12b00800
  265. Switch {
  266. inputs 2
  267. which {{parent.previewEnabled}}
  268. name Switch_preview
  269. xpos -1127
  270. ypos -197
  271. }
  272. Switch {
  273. inputs 2
  274. which {{parent.matteOnly}}
  275. name Switch_matteOnly
  276. xpos -1127
  277. ypos -95
  278. }
  279. ShuffleCopy {
  280. inputs 2
  281. red red
  282. green red
  283. blue red
  284. alpha red
  285. out alpha
  286. name ShuffleCopy_embedMask
  287. xpos -1127
  288. ypos -69
  289. }
  290. Output {
  291. name Output
  292. xpos -1127
  293. ypos -21
  294. }
  295. end_group