diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ede0349 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/.idea/ + +/test/ diff --git a/homeworks/lesson5/script_update.py b/homeworks/lesson5/script_update.py new file mode 100644 index 0000000..4a81fa5 --- /dev/null +++ b/homeworks/lesson5/script_update.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# .@FileName:script_update +# @Date....:2020-04-04 20:49 +# ..:XingLian +import re +import nuke +import nukescripts + +# 获取工程名称 +script_name = nuke.scriptName() +# 匹配是否存在版本号,如果不存在,另存为版本1,并进行升级操作 +if not re.search(script_name, r'.?_v/d*.nk$'): + print re.search(script_name, r'.?_v/d*.nk$') + new_script_name = script_name[::-1].replace('kn.', 'kn.100v_', 1)[::-1] + print new_script_name + nuke.scriptSaveAs(new_script_name) +nukescripts.script_and_write_nodes_version_up() \ No newline at end of file diff --git a/homeworks/week_5/user_A/gizmos/A_ChannelManager/AP_gizmos/AP.png b/homeworks/week_5/user_A/gizmos/A_ChannelManager/AP_gizmos/AP.png new file mode 100644 index 0000000..4bce145 Binary files /dev/null and b/homeworks/week_5/user_A/gizmos/A_ChannelManager/AP_gizmos/AP.png differ diff --git a/homeworks/week_5/user_A/gizmos/A_ChannelManager/AP_gizmos/A_ChannelManager.gizmo b/homeworks/week_5/user_A/gizmos/A_ChannelManager/AP_gizmos/A_ChannelManager.gizmo new file mode 100644 index 0000000..d5335e7 --- /dev/null +++ b/homeworks/week_5/user_A/gizmos/A_ChannelManager/AP_gizmos/A_ChannelManager.gizmo @@ -0,0 +1,552 @@ +#! C:/Program Files/Nuke10.0v5/nuke-10.0.5.dll -nx +version 10.0 v5 +Gizmo { + inputs 2 + addUserKnob {20 channelmanager l ChannelManager} + addUserKnob {6 showlayer l Show_Layers t "Show all layers embedded in the connected input" +STARTLINE} + addUserKnob {6 rgb_unpremult l "Unpremult RGB" -STARTLINE} + addUserKnob {68 premultt l (Un)premult M {None "Unpremult all layers" "Unpremult selected layer(s)" "" "" "" ""}} + premultt "Unpremult selected layer(s)" + addUserKnob {41 in l ChannelInput T Shuffle20.in} + addUserKnob {52 premult_sel1 T "nuke.toNode('Shuffle1').knob('knobChanged').setValue('''\n\na = nuke.toNode('Shuffle1').knob('in').value()\ng = nuke.toNode('Unpremult2')\ng.knob('channels').setValue(a)\n\n''')" +STARTLINE} + addUserKnob {52 premult_sel2 T "nuke.toNode('Shuffle4').knob('knobChanged').setValue('''\n\n\nb = nuke.toNode('Shuffle4').knob('in').value()\nh = nuke.toNode('Unpremult3')\nh.knob('channels').setValue(b)\n\n''')" +STARTLINE} + addUserKnob {52 premult_sel3 T "nuke.toNode('Shuffle7').knob('knobChanged').setValue('''\n\n\nc = nuke.toNode('Shuffle7').knob('in').value()\ni = nuke.toNode('Unpremult4')\ni.knob('channels').setValue(c)\n\n\n''')" +STARTLINE} + addUserKnob {52 premult_sel4 T "nuke.toNode('Shuffle10').knob('knobChanged').setValue('''\n\n\nd = nuke.toNode('Shuffle10').knob('in').value()\nl = nuke.toNode('Unpremult5')\nl.knob('channels').setValue(d)\n\n''')\n" +STARTLINE} + addUserKnob {52 premult_sel5 T "nuke.toNode('Shuffle13').knob('knobChanged').setValue('''\n\ne = nuke.toNode('Shuffle13').knob('in').value()\nm = nuke.toNode('Unpremult6')\nm.knob('channels').setValue(e)\n\n''')" +STARTLINE} + addUserKnob {52 premult_sel6 T "nuke.toNode('Shuffle16').knob('knobChanged').setValue('''\n\nf = nuke.toNode('Shuffle16').knob('in').value()\nn = nuke.toNode('Unpremult7')\nn.knob('channels').setValue(f)\n\n''')" +STARTLINE} + addUserKnob {68 mask l "Use Channels as" M {None Mask Stencil "" "" "" "" "" ""}} + mask Mask + addUserKnob {41 also_merge l "also merge" -STARTLINE T Merge5.also_merge} + addUserKnob {26 ""} + addUserKnob {22 ResetChannel t "Set all channels inputs to None" T "nuke.toNode('Shuffle1').knob('in').setValue('none')\nnuke.toNode('Shuffle1').knob('alpha').setValue('off')\nnuke.toNode('Shuffle4').knob('in').setValue('none')\nnuke.toNode('Shuffle4').knob('alpha').setValue('off')\nnuke.toNode('Shuffle7').knob('in').setValue('none')\nnuke.toNode('Shuffle7').knob('alpha').setValue('off')\nnuke.toNode('Shuffle10').knob('in').setValue('none')\nnuke.toNode('Shuffle10').knob('alpha').setValue('off')\nnuke.toNode('Shuffle13').knob('in').setValue('none')\nnuke.toNode('Shuffle13').knob('alpha').setValue('off')\nnuke.toNode('Shuffle16').knob('in').setValue('none')\nnuke.toNode('Shuffle16').knob('alpha').setValue('off')\n\n\nnuke.toNode('Shuffle2').knob('alpha').setValue('off')\nnuke.toNode('Shuffle3').knob('alpha').setValue('off')\nnuke.toNode('Shuffle5').knob('alpha').setValue('off')\nnuke.toNode('Shuffle6').knob('alpha').setValue('off')\nnuke.toNode('Shuffle8').knob('alpha').setValue('off')\nnuke.toNode('Shuffle9').knob('alpha').setValue('off')\nnuke.toNode('Shuffle11').knob('alpha').setValue('off')\nnuke.toNode('Shuffle12').knob('alpha').setValue('off')\nnuke.toNode('Shuffle14').knob('alpha').setValue('off')\nnuke.toNode('Shuffle15').knob('alpha').setValue('off')\nnuke.toNode('Shuffle17').knob('alpha').setValue('off')\nnuke.toNode('Shuffle18').knob('alpha').setValue('off')" +STARTLINE} + addUserKnob {41 channel_01 l Channel T Shuffle1.in} + addUserKnob {41 id01_1 l ID1_alpha T Shuffle1.alpha} + addUserKnob {41 id01_2 l ID1_alpha T Shuffle2.alpha} + addUserKnob {41 id01_3 l ID1_alpha T Shuffle3.alpha} + addUserKnob {26 ""} + addUserKnob {41 channel_02 l Channel T Shuffle4.in} + addUserKnob {41 id02_1 l ID2_alpha T Shuffle4.alpha} + addUserKnob {41 id02_2 l ID2_alpha T Shuffle5.alpha} + addUserKnob {41 id02_3 l ID2_alpha T Shuffle6.alpha} + addUserKnob {26 ""} + addUserKnob {41 channel_03 l Channel T Shuffle7.in} + addUserKnob {41 id03_1 l ID3_alpha T Shuffle7.alpha} + addUserKnob {41 id03_2 l ID3_alpha T Shuffle8.alpha} + addUserKnob {41 id03_3 l ID3_alpha T Shuffle9.alpha} + addUserKnob {26 ""} + addUserKnob {41 channel_04 l Channel T Shuffle10.in} + addUserKnob {41 id04_1 l ID4_alpha T Shuffle10.alpha} + addUserKnob {41 id04_2 l ID4_alpha T Shuffle11.alpha} + addUserKnob {41 id04_3 l ID4_alpha T Shuffle12.alpha} + addUserKnob {26 ""} + addUserKnob {41 channel_05 l Channel T Shuffle13.in} + addUserKnob {41 id05_1 l ID5_alpha T Shuffle13.alpha} + addUserKnob {41 id05_2 l ID5_alpha T Shuffle14.alpha} + addUserKnob {41 id05_3 l ID5_alpha T Shuffle15.alpha} + addUserKnob {26 ""} + addUserKnob {41 channel_06 l Channel T Shuffle16.in} + addUserKnob {41 id06_1 l ID6_alpha T Shuffle16.alpha} + addUserKnob {41 id06_2 l ID6_alpha T Shuffle17.alpha} + addUserKnob {41 id06_3 l ID6_alpha T Shuffle18.alpha} + addUserKnob {26 ""} + addUserKnob {26 "" l mask} + addUserKnob {41 maskChannelInput l "" -STARTLINE T Merge2.maskChannelInput} + addUserKnob {41 invert_mask l invert -STARTLINE T Merge2.invert_mask} + addUserKnob {41 inject -STARTLINE T Merge2.inject} + addUserKnob {41 fringe -STARTLINE T Merge2.fringe} + addUserKnob {41 mix T Merge2.mix} +} + Input { + inputs 0 + name mask + label "\[value number]" + xpos 1405 + ypos 684 + number 1 + } + Constant { + inputs 0 + color 1 + name Constant1 + xpos 1601 + ypos 751 + } + Switch { + inputs 2 + which {{"\[exists parent.input1]" x1776 1}} + name Switch1 + xpos 1405 + ypos 774 + } + Input { + inputs 0 + name Input1 + xpos 2347 + ypos -2416 + } + Unpremult { + name Unpremult8 + xpos 2347 + ypos -2339 + disable {{1-rgb_unpremult}} + } + Dot { + name Dot18 + xpos 2381 + ypos -2198 + } +set N6b63000 [stack 0] + Dot { + name Dot17 + xpos 2542 + ypos -2198 + } + Unpremult { + channels none + name Unpremult2 + xpos 2508 + ypos -2136 + } + Unpremult { + channels none + name Unpremult3 + xpos 2508 + ypos -2098 + } + Unpremult { + channels none + name Unpremult4 + xpos 2508 + ypos -2060 + } + Unpremult { + channels none + name Unpremult5 + xpos 2508 + ypos -2022 + } + Unpremult { + channels none + name Unpremult6 + xpos 2508 + ypos -1984 + } + Unpremult { + channels none + name Unpremult7 + xpos 2508 + ypos -1946 + } + Dot { + name Dot19 + xpos 2542 + ypos -1803 + } +push $N6b63000 + Dot { + name Dot16 + xpos 2209 + ypos -2198 + } + Unpremult { + channels all + name Unpremult1 + xpos 2175 + ypos -1813 + } +push $N6b63000 + Switch { + inputs 3 + which {{parent.premultt x1 0.068}} + name Switch4 + xpos 2352 + ypos -1807 + } + Dot { + name Dot15 + xpos 2386 + ypos -1656 + } +set N6b90400 [stack 0] + Dot { + name Dot2 + xpos 2386 + ypos -1507 + } + Dot { + name Dot5 + xpos 725 + ypos -1507 + } +set N6bb9c00 [stack 0] + Dot { + name Dot3 + xpos -1032 + ypos -1507 + } + LayerContactSheet { + width {{input.width}} + height {{input.height}} + center true + showLayerNames {{"1-Merge3.disable && 1-parent.disable" x1 1}} + name LayerContactSheet1 + xpos -1066 + ypos 415 + } +push $N6bb9c00 + Dot { + name Dot1 + xpos 725 + ypos -1374 + } +set N6bb9000 [stack 0] + Shuffle { + in {{{Shuffle1.in}}} + red black + green black + blue black + alpha off + name Shuffle2 + xpos -700 + ypos -957 + } +push 0 +push $N6bb9000 + Shuffle { + in {{{Shuffle17.in}}} + red black + green black + blue black + alpha off + name Shuffle18 + xpos 2153 + ypos -938 + } +push $N6bb9000 + Shuffle { + in {{{Shuffle16.in}}} + red black + green black + blue black + alpha off + name Shuffle17 + xpos 2041 + ypos -941 + } +push $N6bb9000 + Shuffle { + in none + red black + green black + blue black + alpha off + name Shuffle16 + knobChanged "\n\nf = nuke.toNode('Shuffle16').knob('in').value()\nn = nuke.toNode('Unpremult7')\nn.knob('channels').setValue(f)\n\n" + xpos 1931 + ypos -941 + } +push $N6bb9000 + Shuffle { + in {{{Shuffle11.in}}} + red black + green black + blue black + alpha off + name Shuffle12 + xpos 1092 + ypos -940 + } +push $N6bb9000 + Shuffle { + in {{{Shuffle14.in}}} + red black + green black + blue black + alpha off + name Shuffle15 + xpos 1594 + ypos -951 + } +push $N6bb9000 + Shuffle { + in {{{Shuffle13.in}}} + red black + green black + blue black + alpha off + name Shuffle14 + xpos 1491 + ypos -950 + } +push $N6bb9000 + Shuffle { + in none + red black + green black + blue black + alpha off + name Shuffle7 + knobChanged "\n\n\nc = nuke.toNode('Shuffle7').knob('in').value()\ni = nuke.toNode('Unpremult4')\ni.knob('channels').setValue(c)\n\n\n" + xpos 316 + ypos -950 + } +push $N6bb9000 + Shuffle { + in {{{Shuffle7.in}}} + red black + green black + blue black + alpha off + name Shuffle8 + xpos 426 + ypos -950 + } +push $N6bb9000 + Shuffle { + in {{{Shuffle8.in}}} + red black + green black + blue black + alpha off + name Shuffle9 + xpos 536 + ypos -950 + } +push $N6bb9000 + Shuffle { + in none + red black + green black + blue black + alpha off + name Shuffle10 + knobChanged "\n\n\nd = nuke.toNode('Shuffle10').knob('in').value()\nl = nuke.toNode('Unpremult5')\nl.knob('channels').setValue(d)\n\n" + xpos 873 + ypos -938 + } +push $N6bb9000 + Shuffle { + in {{{Shuffle10.in}}} + red black + green black + blue black + alpha off + name Shuffle11 + xpos 984 + ypos -938 + } +push $N6bb9000 + Shuffle { + in {{{Shuffle5.in}}} + red black + green black + blue black + alpha off + name Shuffle6 + xpos -56 + ypos -952 + } +push $N6bb9000 + Shuffle { + in {{{Shuffle4.in}}} + red black + green black + blue black + alpha off + name Shuffle5 + xpos -171 + ypos -951 + } +push $N6bb9000 + Shuffle { + in none + red black + green black + blue black + alpha off + name Shuffle4 + knobChanged "\n\n\nb = nuke.toNode('Shuffle4').knob('in').value()\nh = nuke.toNode('Unpremult3')\nh.knob('channels').setValue(b)\n\n" + xpos -279 + ypos -951 + } +push $N6bb9000 + Shuffle { + in {{{Shuffle2.in}}} + red black + green black + blue black + alpha off + name Shuffle3 + xpos -523 + ypos -955 + } +push 0 +push $N6bb9000 + Shuffle { + in none + red black + green black + blue black + alpha off + name Shuffle13 + knobChanged "\n\ne = nuke.toNode('Shuffle13').knob('in').value()\nm = nuke.toNode('Unpremult6')\nm.knob('channels').setValue(e)\n\n" + xpos 1389 + ypos -949 + } +push $N6bb9000 + Shuffle { + in none + red black + green black + blue black + alpha off + name Shuffle1 + knobChanged "\n\na = nuke.toNode('Shuffle1').knob('in').value()\ng = nuke.toNode('Unpremult2')\ng.knob('channels').setValue(a)\n\n" + selected true + xpos -850 + ypos -956 + } + Merge2 { + inputs 19+1 + operation disjoint-over + maskChannelMask none + mix {1} + name Merge2 + xpos 716 + ypos -457 + } +set N6c26400 [stack 0] + Dot { + name Dot8 + xpos 1495 + ypos -451 + } +set N6c26000 [stack 0] + Dot { + name Dot11 + xpos 1495 + ypos -119 + } +push $N6b90400 + Dot { + name Dot4 + xpos 2536 + ypos -1656 + } + Shuffle { + name Shuffle20 + xpos 2504 + ypos -855 + } + Dot { + name Dot7 + xpos 2538 + ypos -518 + } +set N6c61000 [stack 0] + Dot { + name Dot12 + xpos 2714 + ypos -518 + } + Merge2 { + inputs 2 + operation stencil + bbox B + also_merge {{{parent.Merge5.also_merge}}} + name Merge4 + xpos 2680 + ypos -123 + } + Dot { + name Dot9 + xpos 2714 + ypos 150 + } + Constant { + inputs 0 + channels alpha + color 1 + name Constant2 + xpos 1938 + ypos -729 + } +push $N6c26000 + Switch { + inputs 2 + which {{"Shuffle1.alpha || Shuffle2.alpha || Shuffle3.alpha || Shuffle4.alpha || Shuffle5.alpha || Shuffle6.alpha || Shuffle7.alpha || Shuffle8.alpha || Shuffle9.alpha || Shuffle10.alpha || Shuffle11.alpha || Shuffle12.alpha || Shuffle13.alpha || Shuffle14.alpha || Shuffle15.alpha || Shuffle16.alpha || Shuffle17.alpha || Shuffle18.alpha !=0 ? 0 : 1"}} + name Switch3 + xpos 1938 + ypos -457 + } + Dot { + name Dot6 + xpos 2127 + ypos -453 + } + Dot { + name Dot10 + xpos 2127 + ypos -3 + } +push $N6c61000 + Merge2 { + inputs 2 + operation mask + bbox B + name Merge5 + xpos 2504 + ypos -7 + } + Dot { + name Dot13 + xpos 2538 + ypos 88 + } + Dot { + name Dot14 + xpos 894 + ypos 88 + } +push $N6c26400 + Switch { + inputs 3 + which {{parent.mask}} + name Switch2 + xpos 716 + ypos 146 + } + Merge2 { + inputs 2 + operation copy + name Merge3 + xpos 716 + ypos 415 + disable {{1-parent.showlayer x1 1}} + } + Merge2 { + inputs 2 + operation mask + bbox B + name Merge1 + xpos 716 + ypos 774 + } +set N6c8c400 [stack 0] + Output { + name Output1 + xpos 716 + ypos 886 + } +push $N6c8c400 + Viewer { + frame_range 1-100 + fps 25 + colour_sample_bbox {-0.2927083373 -0.1572916657 -0.2916666567 -0.15625} + samplepoints {{-0.3645833433 -0.1416666657} + } + name Viewer1 + xpos 1048 + ypos 592 + } +end_group diff --git a/homeworks/week_5/user_A/gizmos/A_ChannelManager/init.py b/homeworks/week_5/user_A/gizmos/A_ChannelManager/init.py new file mode 100644 index 0000000..19e50de --- /dev/null +++ b/homeworks/week_5/user_A/gizmos/A_ChannelManager/init.py @@ -0,0 +1,4 @@ +## init.py +## loaded by nuke before menu.py + +nuke.pluginAddPath('./AP_gizmos') diff --git a/homeworks/week_5/user_A/gizmos/A_ChannelManager/menu.py b/homeworks/week_5/user_A/gizmos/A_ChannelManager/menu.py new file mode 100644 index 0000000..f87882b --- /dev/null +++ b/homeworks/week_5/user_A/gizmos/A_ChannelManager/menu.py @@ -0,0 +1,9 @@ +import os +import sys +import nuke + +# AP definitions + +toolbar = nuke.menu('Nodes') +AMenu = toolbar.addMenu('AP', icon='AP.png') +AMenu.addCommand('A_ChannelManager', 'nuke.createNode("A_ChannelManager")', icon='AP.png') \ No newline at end of file diff --git a/homeworks/week_5/user_A/gizmos/AdditiveKeyer.gizmo b/homeworks/week_5/user_A/gizmos/AdditiveKeyer.gizmo new file mode 100644 index 0000000..4d2741b --- /dev/null +++ b/homeworks/week_5/user_A/gizmos/AdditiveKeyer.gizmo @@ -0,0 +1,258 @@ +#! C:/Program Files/Nuke8.0v6/nuke-8.0.v6.dll -nx +version 8.0 v6 +Gizmo { + inputs 4 + help http://www.vfxwiki.org/tiki-index.php?page=additive+keyer + tile_color 0x566d6dff + addUserKnob {20 Options} + addUserKnob {41 Dark_value T Grade_dark_value.multiply} + addUserKnob {41 Light_value T Grade_light_value.multiply} + addUserKnob {41 Saturation l saturation T Saturation1.saturation} + addUserKnob {41 Dark_tint T dark_tint.multiply} + addUserKnob {41 Light_tint T light_tint.multiply} + addUserKnob {41 Constraindarks l "Constrain darks" T Constrain_darks.mix} + addUserKnob {41 mix l "Constrain Lights" T Constrain_lights.mix} + addUserKnob {41 Mix_back_BG t "Mix back original bg, handy if effect is to strong and you need an overall mix back" T Dissolve1.which} + addUserKnob {6 Log_with_Linear_output +STARTLINE} +} + Input { + inputs 0 + name BG + xpos -775 + ypos 418 + } + Log2Lin { + operation lin2log + name Log2Lin1 + xpos -775 + ypos 474 + disable {{"Log_with_Linear_output == 0? 1:0" i}} + } + Shuffle { + alpha black + name Shuffle5 + xpos -775 + ypos 522 + } +set N3a12c720 [stack 0] + Dot { + name Dot1 + selected true + xpos -741 + ypos 1451 + } +set N3a12ca90 [stack 0] + Input { + inputs 0 + name Matte + xpos -903 + ypos 420 + number 3 + } + Invert { + name Invert1 + xpos -903 + ypos 1358 + } +push $N3a12ca90 + Input { + inputs 0 + name FG + xpos -340 + ypos 405 + number 2 + } + Log2Lin { + operation lin2log + name Log2Lin3 + xpos -340 + ypos 452 + disable {{"Log_with_Linear_output == 0? 1:0" i}} + } + Shuffle { + alpha black + name Shuffle1 + xpos -340 + ypos 489 + } +set N3a12dbc0 [stack 0] + Input { + inputs 0 + name Ref + xpos -231 + ypos 404 + number 1 + } + Log2Lin { + operation lin2log + name Log2Lin4 + xpos -231 + ypos 445 + disable {{"Log_with_Linear_output == 0? 1:0" i}} + } + Shuffle { + alpha black + name Shuffle2 + xpos -231 + ypos 491 + } +set N3a12e610 [stack 0] + Merge2 { + inputs 2 + operation difference + name Merge2 + xpos -166 + ypos 805 + } + Shuffle { + alpha black + name Shuffle3 + xpos -166 + ypos 851 + } + Keyer { + operation "luminance key" + name Keyer1 + xpos -166 + ypos 886 + } + Shuffle { + red alpha + green alpha + blue alpha + name Shuffle4 + xpos -166 + ypos 939 + } +push $N3a12c720 +push $N3a12c720 + Keyer { + operation "luminance key" + name Keyer2 + xpos -625 + ypos 838 + } + Shuffle { + red alpha + green alpha + blue alpha + name Shuffle6 + xpos -625 + ypos 895 + } +set N3a39a7e0 [stack 0] +push $N3a12dbc0 +push $N3a12e610 + Merge2 { + inputs 2 + operation minus + name Merge1 + xpos -340 + ypos 594 + } + Saturation { + saturation 0.3 + name Saturation1 + xpos -340 + ypos 649 + } +set N3a39aec0 [stack 0] + Clamp { + minimum -15 + maximum 0 + name clamp + xpos -468 + ypos 814 + } + Grade { + black_clamp false + name Grade_dark_value + xpos -468 + ypos 871 + } + Grade { + black_clamp false + name dark_tint + xpos -468 + ypos 914 + } + Merge2 { + inputs 2 + operation multiply + mix 0 + name Constrain_darks + xpos -553 + ypos 1028 + } +push $N3a39a7e0 +push $N3a39aec0 + Clamp { + maximum 15 + name clamp2 + xpos -337 + ypos 803 + } + Grade { + name Grade_light_value + xpos -337 + ypos 862 + } + Grade { + name light_tint + xpos -337 + ypos 919 + } + Merge2 { + inputs 2 + operation multiply + mix 0 + name Constrain_lights + xpos -389 + ypos 1033 + } + Merge2 { + inputs 2 + operation plus + name Merge5 + xpos -481 + ypos 1119 + } + Merge2 { + inputs 2 + operation plus + name Merge6 + xpos -618 + ypos 1206 + } + Copy { + inputs 2 + from0 rgba.alpha + to0 rgba.alpha + name Copy1 + xpos -517 + ypos 1284 + } + Keymix { + inputs 3 + name Keymix1 + xpos -517 + ypos 1358 + } + Dissolve { + inputs 2 + name Dissolve1 + xpos -517 + ypos 1442 + } + Log2Lin { + name Log2Lin2 + xpos -517 + ypos 1509 + disable {{"Log_with_Linear_output == 0? 1:0" i}} + } + Output { + name Output1 + xpos -517 + ypos 1561 + } +end_group diff --git a/homeworks/week_5/user_A/gizmos/Despill.gizmo b/homeworks/week_5/user_A/gizmos/Despill.gizmo new file mode 100644 index 0000000..1593746 --- /dev/null +++ b/homeworks/week_5/user_A/gizmos/Despill.gizmo @@ -0,0 +1,163 @@ +#! C:/Program Files/Nuke8.0v6/nuke-8.0.v6.dll -nx +version 8.0 v6 +Gizmo { + inputs 2 + addUserKnob {20 despill l "Despill / Unspill"} + addUserKnob {4 color l Screencolor M {Green Blue "" "" ""}} + addUserKnob {26 "" l "Choose defaults"} + addUserKnob {32 setdefaultg l "Despill defaults greenscreen" T "knob mult_r 0\nknob mult_g 1\nknob mult_b 0\nknob color 0" +STARTLINE} + addUserKnob {32 setdefault l "Despill defaults bluescreen" -STARTLINE T "knob mult_r 0\nknob mult_g 0\nknob mult_b 1\nknob color 1"} + addUserKnob {32 dfsdf l "Unspill defaults greenscreen" T "knob mult_r 0.3\nknob mult_g 0.7\nknob mult_b 0.3\nknob color 0" +STARTLINE} + addUserKnob {32 sdfsdf l "Unspill defaults bluescreen" -STARTLINE T "knob mult_r 0.3\nknob mult_g 0.3\nknob mult_b 0.7\nknob color 1"} + addUserKnob {26 "" l "Channel despill gain" t "Multiply to get the amount that is subtracted from green the Screencolor channel and accordingly added to the other channels."} + addUserKnob {41 mult_r l Red T GAIN_R.multiply} + addUserKnob {41 mult_g l Green T GAIN_G.multiply} + addUserKnob {41 mult_b l Blue T GAIN_B.multiply} +} + Input { + inputs 0 + name Plate + xpos -169 + ypos -439 + } +set N3ff47710 [stack 0] + Shuffle { + green red + blue red + alpha black + name ShuffleRED + xpos -449 + ypos -207 + } + Input { + inputs 0 + name Spillmatte + xpos -730 + ypos -397 + number 1 + } +set N3ff47df0 [stack 0] + Grade { + name GAIN_R + xpos -853 + ypos -213 + } + Merge2 { + inputs 2 + operation plus + name ADDED_RED + xpos -853 + ypos 143 + } +push $N3ff47710 + Shuffle { + red blue + green blue + alpha black + name ShuffleBLUE + xpos -340 + ypos -210 + } +set N3ff48840 [stack 0] +push $N3ff47df0 + Grade { + name GAIN_B + xpos -730 + ypos -213 + } +set N3ff48bb0 [stack 0] + Merge2 { + inputs 2 + operation minus + name ADDED_BLUE1 + xpos -730 + ypos 91 + } +push $N3ff48840 +push $N3ff48bb0 + Merge2 { + inputs 2 + operation plus + name ADDED_BLUE + xpos -492 + ypos 92 + } + Switch { + inputs 2 + which {{parent.color}} + name Switch2 + selected true + xpos -492 + ypos 201 + } +push $N3ff47710 + Shuffle { + red green + blue green + alpha black + name ShuffleGREEN + xpos -236 + ypos -209 + } +set N400527a0 [stack 0] +push $N3ff47df0 + Grade { + name GAIN_G + xpos -611 + ypos -214 + } +set N40052b10 [stack 0] + Merge2 { + inputs 2 + operation plus + name SUBTRACTED_GREEN1 + xpos -611 + ypos -11 + } +push $N400527a0 +push $N40052b10 + Merge2 { + inputs 2 + operation minus + name SUBTRACTED_GREEN + xpos -236 + ypos -75 + } + Switch { + inputs 2 + which {{parent.color i}} + name Switch1 + xpos -236 + ypos -11 + } +push $N3ff47710 + Copy { + inputs 2 + from0 rgba.green + to0 rgba.green + name Copy1 + xpos 59 + ypos -17 + } + Copy { + inputs 2 + from0 rgba.blue + to0 rgba.blue + name Copy2 + xpos -382 + ypos 293 + } + Copy { + inputs 2 + from0 rgba.red + to0 rgba.red + name Copy3 + xpos -626 + ypos 434 + } + Output { + name Output1 + xpos -626 + ypos 544 + } +end_group diff --git a/homeworks/week_5/user_A/init.py b/homeworks/week_5/user_A/init.py new file mode 100644 index 0000000..d14fe8c --- /dev/null +++ b/homeworks/week_5/user_A/init.py @@ -0,0 +1,9 @@ +print 'userA`s tools is load' + +import os +import sys + +import nuke + +NUKE_PATH = os.environ.get('NUKE_PATH') +nuke.pluginAddPath(os.listdir(NUKE_PATH)) \ No newline at end of file diff --git a/homeworks/week_5/user_A/menu.py b/homeworks/week_5/user_A/menu.py new file mode 100644 index 0000000..b9a2ecc --- /dev/null +++ b/homeworks/week_5/user_A/menu.py @@ -0,0 +1,8 @@ +import nuke +if len(nuke.pluginPath(0)) == len(nuke.pluginPath(1)): + print u'plugins all load' + +for i in range(1, 4): + command = 'lambda: nuke.message("Command{}")'.format(i) + nuke.menu('Node Graph').addCommand('Command{}'.format(i), eval(command)) + diff --git a/homeworks/week_5/user_A/ofx/rsmb.ofx.bundle/Contents/Info.plist b/homeworks/week_5/user_A/ofx/rsmb.ofx.bundle/Contents/Info.plist new file mode 100644 index 0000000..36f98f6 --- /dev/null +++ b/homeworks/week_5/user_A/ofx/rsmb.ofx.bundle/Contents/Info.plist @@ -0,0 +1,40 @@ + + + + + BuildMachineOSBuild + 18D109 + CFBundleDevelopmentRegion + English + CFBundleGetInfoString + ReelSmart Motion Blur 6.2.0, Copyright 1999-2019 RE:Vision Effects, Inc. + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + ???? + CFBundleShortVersionString + 6.2.0 + CFBundleSignature + ???? + CFBundleSupportedPlatforms + + MacOSX + + CFBundleVersion + 6.2.0 + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 10B61 + DTPlatformVersion + GM + DTSDKBuild + 18B71 + DTSDKName + macosx10.14 + DTXcode + 1010 + DTXcodeBuild + 10B61 + + diff --git a/homeworks/week_5/user_A/ofx/rsmb.ofx.bundle/Contents/PkgInfo b/homeworks/week_5/user_A/ofx/rsmb.ofx.bundle/Contents/PkgInfo new file mode 100644 index 0000000..b0bc8e0 --- /dev/null +++ b/homeworks/week_5/user_A/ofx/rsmb.ofx.bundle/Contents/PkgInfo @@ -0,0 +1 @@ +???????? \ No newline at end of file diff --git a/homeworks/week_5/user_A/ofx/rsmb.ofx.bundle/Contents/Resources/REVision Effects.png b/homeworks/week_5/user_A/ofx/rsmb.ofx.bundle/Contents/Resources/REVision Effects.png new file mode 100644 index 0000000..70bf9ea Binary files /dev/null and b/homeworks/week_5/user_A/ofx/rsmb.ofx.bundle/Contents/Resources/REVision Effects.png differ diff --git a/homeworks/week_5/user_A/ofx/rsmb.ofx.bundle/Contents/Win64/rsmb.ofx b/homeworks/week_5/user_A/ofx/rsmb.ofx.bundle/Contents/Win64/rsmb.ofx new file mode 100644 index 0000000..463e93d Binary files /dev/null and b/homeworks/week_5/user_A/ofx/rsmb.ofx.bundle/Contents/Win64/rsmb.ofx differ diff --git a/homeworks/week_5/user_A/ofx/rsmbregular.ofx.bundle/Contents/Info.plist b/homeworks/week_5/user_A/ofx/rsmbregular.ofx.bundle/Contents/Info.plist new file mode 100644 index 0000000..36f98f6 --- /dev/null +++ b/homeworks/week_5/user_A/ofx/rsmbregular.ofx.bundle/Contents/Info.plist @@ -0,0 +1,40 @@ + + + + + BuildMachineOSBuild + 18D109 + CFBundleDevelopmentRegion + English + CFBundleGetInfoString + ReelSmart Motion Blur 6.2.0, Copyright 1999-2019 RE:Vision Effects, Inc. + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + ???? + CFBundleShortVersionString + 6.2.0 + CFBundleSignature + ???? + CFBundleSupportedPlatforms + + MacOSX + + CFBundleVersion + 6.2.0 + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 10B61 + DTPlatformVersion + GM + DTSDKBuild + 18B71 + DTSDKName + macosx10.14 + DTXcode + 1010 + DTXcodeBuild + 10B61 + + diff --git a/homeworks/week_5/user_A/ofx/rsmbregular.ofx.bundle/Contents/PkgInfo b/homeworks/week_5/user_A/ofx/rsmbregular.ofx.bundle/Contents/PkgInfo new file mode 100644 index 0000000..b0bc8e0 --- /dev/null +++ b/homeworks/week_5/user_A/ofx/rsmbregular.ofx.bundle/Contents/PkgInfo @@ -0,0 +1 @@ +???????? \ No newline at end of file diff --git a/homeworks/week_5/user_A/ofx/rsmbregular.ofx.bundle/Contents/Resources/CocoaProgressWindow.nib b/homeworks/week_5/user_A/ofx/rsmbregular.ofx.bundle/Contents/Resources/CocoaProgressWindow.nib new file mode 100644 index 0000000..e30877b Binary files /dev/null and b/homeworks/week_5/user_A/ofx/rsmbregular.ofx.bundle/Contents/Resources/CocoaProgressWindow.nib differ diff --git a/homeworks/week_5/user_A/ofx/rsmbregular.ofx.bundle/Contents/Resources/REVision Effects.png b/homeworks/week_5/user_A/ofx/rsmbregular.ofx.bundle/Contents/Resources/REVision Effects.png new file mode 100644 index 0000000..70bf9ea Binary files /dev/null and b/homeworks/week_5/user_A/ofx/rsmbregular.ofx.bundle/Contents/Resources/REVision Effects.png differ diff --git a/homeworks/week_5/user_A/ofx/rsmbregular.ofx.bundle/Contents/Win64/rsmbregular.ofx b/homeworks/week_5/user_A/ofx/rsmbregular.ofx.bundle/Contents/Win64/rsmbregular.ofx new file mode 100644 index 0000000..52a70f1 Binary files /dev/null and b/homeworks/week_5/user_A/ofx/rsmbregular.ofx.bundle/Contents/Win64/rsmbregular.ofx differ diff --git a/homeworks/week_5/user_A/ofx/rsmbvectors.ofx.bundle/Contents/Info.plist b/homeworks/week_5/user_A/ofx/rsmbvectors.ofx.bundle/Contents/Info.plist new file mode 100644 index 0000000..36f98f6 --- /dev/null +++ b/homeworks/week_5/user_A/ofx/rsmbvectors.ofx.bundle/Contents/Info.plist @@ -0,0 +1,40 @@ + + + + + BuildMachineOSBuild + 18D109 + CFBundleDevelopmentRegion + English + CFBundleGetInfoString + ReelSmart Motion Blur 6.2.0, Copyright 1999-2019 RE:Vision Effects, Inc. + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + ???? + CFBundleShortVersionString + 6.2.0 + CFBundleSignature + ???? + CFBundleSupportedPlatforms + + MacOSX + + CFBundleVersion + 6.2.0 + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 10B61 + DTPlatformVersion + GM + DTSDKBuild + 18B71 + DTSDKName + macosx10.14 + DTXcode + 1010 + DTXcodeBuild + 10B61 + + diff --git a/homeworks/week_5/user_A/ofx/rsmbvectors.ofx.bundle/Contents/PkgInfo b/homeworks/week_5/user_A/ofx/rsmbvectors.ofx.bundle/Contents/PkgInfo new file mode 100644 index 0000000..b0bc8e0 --- /dev/null +++ b/homeworks/week_5/user_A/ofx/rsmbvectors.ofx.bundle/Contents/PkgInfo @@ -0,0 +1 @@ +???????? \ No newline at end of file diff --git a/homeworks/week_5/user_A/ofx/rsmbvectors.ofx.bundle/Contents/Resources/CocoaProgressWindow.nib b/homeworks/week_5/user_A/ofx/rsmbvectors.ofx.bundle/Contents/Resources/CocoaProgressWindow.nib new file mode 100644 index 0000000..e30877b Binary files /dev/null and b/homeworks/week_5/user_A/ofx/rsmbvectors.ofx.bundle/Contents/Resources/CocoaProgressWindow.nib differ diff --git a/homeworks/week_5/user_A/ofx/rsmbvectors.ofx.bundle/Contents/Resources/REVision Effects.png b/homeworks/week_5/user_A/ofx/rsmbvectors.ofx.bundle/Contents/Resources/REVision Effects.png new file mode 100644 index 0000000..70bf9ea Binary files /dev/null and b/homeworks/week_5/user_A/ofx/rsmbvectors.ofx.bundle/Contents/Resources/REVision Effects.png differ diff --git a/homeworks/week_5/user_A/ofx/rsmbvectors.ofx.bundle/Contents/Win64/rsmbvectors.ofx b/homeworks/week_5/user_A/ofx/rsmbvectors.ofx.bundle/Contents/Win64/rsmbvectors.ofx new file mode 100644 index 0000000..5ce6865 Binary files /dev/null and b/homeworks/week_5/user_A/ofx/rsmbvectors.ofx.bundle/Contents/Win64/rsmbvectors.ofx differ diff --git a/homeworks/week_5/user_A/plugins/ColorCarpet/ColorCarpet.png b/homeworks/week_5/user_A/plugins/ColorCarpet/ColorCarpet.png new file mode 100644 index 0000000..d5312c3 Binary files /dev/null and b/homeworks/week_5/user_A/plugins/ColorCarpet/ColorCarpet.png differ diff --git a/homeworks/week_5/user_A/plugins/ColorCarpet/Windows/10_0/ColorCarpet.dll b/homeworks/week_5/user_A/plugins/ColorCarpet/Windows/10_0/ColorCarpet.dll new file mode 100644 index 0000000..ccf051c Binary files /dev/null and b/homeworks/week_5/user_A/plugins/ColorCarpet/Windows/10_0/ColorCarpet.dll differ diff --git a/homeworks/week_5/user_A/plugins/ColorCarpet/Windows/10_5/ColorCarpet.dll b/homeworks/week_5/user_A/plugins/ColorCarpet/Windows/10_5/ColorCarpet.dll new file mode 100644 index 0000000..8a4f6af Binary files /dev/null and b/homeworks/week_5/user_A/plugins/ColorCarpet/Windows/10_5/ColorCarpet.dll differ diff --git a/homeworks/week_5/user_A/plugins/ColorCarpet/Windows/11_0/ColorCarpet.dll b/homeworks/week_5/user_A/plugins/ColorCarpet/Windows/11_0/ColorCarpet.dll new file mode 100644 index 0000000..f23f463 Binary files /dev/null and b/homeworks/week_5/user_A/plugins/ColorCarpet/Windows/11_0/ColorCarpet.dll differ diff --git a/homeworks/week_5/user_A/plugins/ColorCarpet/Windows/11_1/ColorCarpet.dll b/homeworks/week_5/user_A/plugins/ColorCarpet/Windows/11_1/ColorCarpet.dll new file mode 100644 index 0000000..26f0f28 Binary files /dev/null and b/homeworks/week_5/user_A/plugins/ColorCarpet/Windows/11_1/ColorCarpet.dll differ diff --git a/homeworks/week_5/user_A/plugins/ColorCarpet/Windows/11_2/ColorCarpet.dll b/homeworks/week_5/user_A/plugins/ColorCarpet/Windows/11_2/ColorCarpet.dll new file mode 100644 index 0000000..249b038 Binary files /dev/null and b/homeworks/week_5/user_A/plugins/ColorCarpet/Windows/11_2/ColorCarpet.dll differ diff --git a/homeworks/week_5/user_A/plugins/ColorCarpet/Windows/11_3/ColorCarpet.dll b/homeworks/week_5/user_A/plugins/ColorCarpet/Windows/11_3/ColorCarpet.dll new file mode 100644 index 0000000..81d7f23 Binary files /dev/null and b/homeworks/week_5/user_A/plugins/ColorCarpet/Windows/11_3/ColorCarpet.dll differ diff --git a/homeworks/week_5/user_A/plugins/ColorCarpet/leafpictures.png b/homeworks/week_5/user_A/plugins/ColorCarpet/leafpictures.png new file mode 100644 index 0000000..e6617fc Binary files /dev/null and b/homeworks/week_5/user_A/plugins/ColorCarpet/leafpictures.png differ diff --git a/homeworks/week_5/user_A/plugins/ColorCarpet/menu.py b/homeworks/week_5/user_A/plugins/ColorCarpet/menu.py new file mode 100644 index 0000000..16b8ece --- /dev/null +++ b/homeworks/week_5/user_A/plugins/ColorCarpet/menu.py @@ -0,0 +1,28 @@ +"""Add the node to Nuke's UI.""" + +# Import built-in modules +import os +import platform + +# Import third-party nodes +import nuke # pylint: disable=import-error + + +def add_plugin(): + """Add the os- and variant specific node to Nuke's plugin path.""" + version = "{}_{}".format(nuke.NUKE_VERSION_MAJOR, nuke.NUKE_VERSION_MINOR) + path = os.path.join(os.path.dirname(__file__), platform.system(), version) + path = path.replace("\\", "/") + path = os.path.abspath(path) + nuke.pluginAddPath(path) + + +def add_to_ui(): + """Add the node to Nuke's UI.""" + menu = nuke.menu("Nodes").addMenu("Leafpictures", icon="leafpictures.png") + menu.addCommand("l_ColorCarpet", "nuke.createNode('ColorCarpet')", + icon="ColorCarpet.png") + + +add_plugin() +add_to_ui() diff --git a/homeworks/week_5/user_A/plugins/GR_Noise.dll b/homeworks/week_5/user_A/plugins/GR_Noise.dll new file mode 100644 index 0000000..16056ca Binary files /dev/null and b/homeworks/week_5/user_A/plugins/GR_Noise.dll differ diff --git a/homeworks/week_5/user_A/plugins/VRayDenoiser/VRayDenoiser.dll b/homeworks/week_5/user_A/plugins/VRayDenoiser/VRayDenoiser.dll new file mode 100644 index 0000000..ddec5e9 Binary files /dev/null and b/homeworks/week_5/user_A/plugins/VRayDenoiser/VRayDenoiser.dll differ diff --git a/homeworks/week_5/user_A/plugins/VRayDenoiser/VRayDenoiser.png b/homeworks/week_5/user_A/plugins/VRayDenoiser/VRayDenoiser.png new file mode 100644 index 0000000..788844c Binary files /dev/null and b/homeworks/week_5/user_A/plugins/VRayDenoiser/VRayDenoiser.png differ diff --git a/homeworks/week_5/user_A/plugins/VRayDenoiser/VRayTools.png b/homeworks/week_5/user_A/plugins/VRayDenoiser/VRayTools.png new file mode 100644 index 0000000..78db7f8 Binary files /dev/null and b/homeworks/week_5/user_A/plugins/VRayDenoiser/VRayTools.png differ diff --git a/homeworks/week_5/user_A/plugins/VRayDenoiser/menu.py b/homeworks/week_5/user_A/plugins/VRayDenoiser/menu.py new file mode 100644 index 0000000..e777732 --- /dev/null +++ b/homeworks/week_5/user_A/plugins/VRayDenoiser/menu.py @@ -0,0 +1,10 @@ +import os +import nuke +import types + +def createMenu(): + menu = nuke.menu('Nodes') + subMenu = menu.addMenu("V-Ray Tools", icon = "VRayTools.png") + subMenu.addCommand('VRayDenoiser', 'nuke.createNode("VRayDenoiser")', icon = "VRayDenoiser.png") + +createMenu() \ No newline at end of file diff --git a/homeworks/week_5/user_A/plugins/VRayDenoiser/readme.txt b/homeworks/week_5/user_A/plugins/VRayDenoiser/readme.txt new file mode 100644 index 0000000..3b8fbe6 --- /dev/null +++ b/homeworks/week_5/user_A/plugins/VRayDenoiser/readme.txt @@ -0,0 +1,41 @@ +There are 2 ways to setup the VRayDenoiser for Nuke plugin: + +1. Paste the VRayDenoiser folder and its contents in the plugin folder of the nuke installation you want to use with the plugin. + - Windows: C:\Program Files\Common Files\NUKE\x.x\plugins\ + - Linux: /usr/local/NUKE/x.x/plugins/ + - OSX: /Library/Application Support/NUKE/x.x/plugins/ + Where is the major.minor version of the NUKE in question. + +2. Add the VRayDenoiser folder to the NUKE_PATH environment variable before running NUKE. + example: + - Windows: set NUKE_PATH=/VRayDenoiser;%NUKE_PATH% + - Linux/OSX: export NUKE_PATH=/VRayDenoiser:$NUKE_PATH + +How to use: + +1. Start Nuke. + +2. Find VRayDenoiser in the V-Ray Tools menu. + +3. Load an image containing the denoising render elements(channels) exported from a V-Ray renderer. + e.g. Load a multi channel .exr file with a read node. +4. Connect the denoising information to the VRayDenoiser Node. You can modify the channels using Nuke's operators before that. +The denoiser will notify you if there are render elements that are not present or recognised correctly. You can manually assign channels to their roles in the Channels tab. +5. General denoiser setting are found in the main tab. See https://docs.chaosgroup.com/display/VRAY3MAX/V-Ray+Denoiser+%7C+VRayDenoiser+ for more information. + +Features: +1.4 + - Fix crash with 'frame blend' option in non-GUI mode +1.3 + - Enhance GPU memory management while denoising + - Fix crash when denoising VRayRenderer node +1.2 + - Reading Alpha channel correctly + - Update auto-assigning channels +1.1 + - If there is no 'noise level' channel you can set threshold + - Denoising images with overscan + - Can denoise an animation using multiple frames with the 'frame blend' option +1.0 + - Auto assign channels from input image as the channels used for denoising + - Support for denoising on CPU/GPU/All OpenCL devices diff --git a/homeworks/week_5/user_A/python/autoContactSheet.py b/homeworks/week_5/user_A/python/autoContactSheet.py new file mode 100644 index 0000000..708ee58 --- /dev/null +++ b/homeworks/week_5/user_A/python/autoContactSheet.py @@ -0,0 +1,103 @@ +# -------------------------------------------------------------- +# autoContactSheet.py +# Version: 1.0.0 +# Last Updated: August 23rd, 2018 +# -------------------------------------------------------------- + + +# -------------------------------------------------------------- +# USAGE: +# +# - Sets better defaults for the ContactSheet node in nuke, to automate all of the settings +# - Creates a second text node option that automatically sets bounding box & label +# - Finally, combines all this code together (and repeats in some areas for clarity) to make a fully-automatic ContactSheet node with the click of a button! +# +# Add this to menu.py +# -------------------------------------------------------------- + +import nuke + +def autoContactSheet(): + + # Start by creating lists to hold certain information -- this will become clear as we get into things + nodeList = [] + xVals = [] + yVals = [] + + # Loop through all selected nodes in the node graph + for node in nuke.selectedNodes(): + + # Checks whether the class of the selected node/nodes is a Read node or something else, and sets a variable which we will use to label our text nodes accordingly a bit later... + if node.Class() == "Read": + textValue = " [basename [file rootname [value [topnode].file]]]" + else: + textValue = " [value input.name]" + + # Creates a text node underneath every selected node & connects its input accordingly + textNode = nuke.createNode("Text2") + textNode.setInput(0, node) + + # Set the bbox of the text node to match the input format + textNode['box'].setValue(0, 0) + textNode['box'].setValue(0, 1) + textNode['box'].setExpression("input.width", 2) + textNode['box'].setExpression("input.height", 3) + textNode['xjustify'].setValue("left") + textNode['yjustify'].setValue("bottom") + + # Add relevant label as per the if/else statement above + textNode['message'].setValue(textValue) + textNode['shadow_opacity'].setValue('1') + textNode['label'].setValue('[value message]') + + # Add selected nodes to a list + nodeList.append(textNode) + + # Add the X and Y position of all selected nodes to their respective lists + xVals.append(node['xpos'].value()) + yVals.append(node['ypos'].value()) + + + # Create a contact sheet node. This will come in with the new defaults we set above! + cs = nuke.createNode("ContactSheet") + + # Add better knob defaults to Contact Sheet + cs['width'].setExpression("input.width * columns * resMult") + cs['height'].setExpression("input.height * rows * resMult") + cs['roworder'].setValue("TopBottom") + cs['colorder'].setValue("LeftRight") + cs['rows'].setExpression("ceil(inputs/columns)") + cs['columns'].setExpression("ceil(sqrt(inputs))") + + # Add custom knobs to the User tab to allow some control of our text nodes (User tab is created automatically by Nuke) + cs.addKnob(nuke.Text_Knob('','')) + cs.addKnob(nuke.Double_Knob('resMult', "Resolution Multiplier")) + cs['resMult'].setValue(1) + cs.addKnob(nuke.Text_Knob('','')) + cs.addKnob(nuke.Boolean_Knob('showText', 'Show Text', True)) + textBG_ops = "None", "Shadow", "Solid" + cs.addKnob(nuke.Enumeration_Knob('textBG', 'Text Background', textBG_ops)) + cs.addKnob(nuke.Double_Knob('textSize', 'Text Size')) + cs['textSize'].setValue(1) + cs.addKnob(nuke.Text_Knob('','')) + + iterator = 0 + + # Add relevant expressions to our text nodes, so the Text size & background options work as expected + for nodes in nodeList: + + cs.setInput(iterator, nodes) + nodes['enable_background'].setExpression(cs['name'].value()+".textBG == 2 ? 1 : 0") + nodes['enable_shadows'].setExpression(cs['name'].value()+".textBG == 1 ? 1 : 0") + nodes['disable'].setExpression(cs['name'].value()+".showText == 1 ? 0 : 1") + nodes['global_font_scale'].setExpression(cs['name'].value()+".textSize") + + iterator = iterator + 1 + + # Find the average of all selected nodes' X and Y positions + avgXpos = sum(xVals) / len(nodeList) + avgYpos = sum(yVals) / len(nodeList) + + # Force set the position of our newly created contact sheet in the node graph + cs['xpos'].setValue(avgXpos) + cs['ypos'].setValue(avgYpos+200) diff --git a/homeworks/week_5/user_A/python/autoCrop.py b/homeworks/week_5/user_A/python/autoCrop.py new file mode 100644 index 0000000..168feaa --- /dev/null +++ b/homeworks/week_5/user_A/python/autoCrop.py @@ -0,0 +1,65 @@ +import nuke + +def autoCrop(): + # keep original node information...we'll need this + original_nodes = nuke.selectedNodes() + + # deselect everything + all_nodes = nuke.allNodes() + for i in all_nodes: + i.knob("selected").setValue(False) + + for i in original_nodes: + i.knob("selected").setValue(True) + autocropper = nuke.createNode("CurveTool", "operation 0 ROI {0 0 input.width input.height} Layer rgba name Processing selected true", False) + + # let's get the node info for the curvewriter (we'll need this too) + # execute the curvewriter thru all the frames + root = nuke.root() + nuke.executeMultiple([autocropper,], ([int(root.knob("first_frame").value()), int(root.knob("last_frame").value()), 1],)) + + # deselect everything + all_nodes = nuke.allNodes() + for j in all_nodes: + j.knob("selected").setValue(False) + + # select the curvewriter + autocropper.knob("selected").setValue(True) + + # add crop node + cropnode = nuke.createNode("Crop", "label AutoCrop", False) + + # put the new data from the autocrop into the new crop + #nuke.knob(cropnode.name()+".box", nuke.knob(autocropper.name()+".autocropdata")); + cropbox = cropnode.knob("box"); + autocropbox = autocropper.knob("autocropdata"); + cropbox.copyAnimations(autocropbox.animations()) + + # turn on the animated flag + cropnode.knob("indicators").setValue(1) + cropnode.knob("icon").setValue("warning.xpm") + + # deselect everything + all_nodes = nuke.allNodes() + for j in all_nodes: + j.knob("selected").setValue(False) + + # select the curvewriter and delete it + autocropper.knob("selected").setValue(True) + + # delete the autocropper to make it all clean + nuke.delete( autocropper ) + + # deselect everything + all_nodes = nuke.allNodes() + for j in all_nodes: + j.knob("selected").setValue(False) + + # select the new crop + cropnode.knob("selected").setValue(True) + + # place it in a nice spot + nuke.autoplace(cropnode) + + # De-Select it + cropnode.knob("selected").setValue(False) diff --git a/homeworks/week_5/user_A/python/labelAutobackdrop.py b/homeworks/week_5/user_A/python/labelAutobackdrop.py new file mode 100644 index 0000000..5da6908 --- /dev/null +++ b/homeworks/week_5/user_A/python/labelAutobackdrop.py @@ -0,0 +1,83 @@ +import nuke + +nameLabel = "" +enumerationPulldown = " 20 35 42 55 100 200" +enumerationColour = " Grey Blue Green Yellow" + +def labelAutobackdrop(): + + global nameLabel, enumerationPulldown, enumerationColour + selNodes = nuke.selectedNodes() + if not selNodes: + return nuke.nodes.BackdropNode() + + + + p = nuke.Panel('Label') + p.addSingleLineInput("Label Name", nameLabel) + p.addEnumerationPulldown("Font Size:", enumerationPulldown) + p.addEnumerationPulldown("Colour:", enumerationColour) + result = p.show() + nameLabel = p.value("Label Name") + enumVal = p.value("Font Size:") + enumCol = p.value("Colour:") + if enumCol == "Grey": + r = 0.267 + g = 0.267 + b = 0.267 + if enumCol == "Blue": + r = 0.373 + g = 0.482 + b = 0.533 + if enumCol == "Green": + r = 0.318 + g = 0.447 + b = 0.302 + if enumCol == "Yellow": + r = 0.533 + g = 0.525 + b = 0.282 + if enumCol == None: + r = 0.18 + g = 0.18 + b = 0.18 + hexColour = int('%02x%02x%02x%02x' % (r*255,g*255,b*255,1),16) + + + # Calculate bounds for the backdrop node. + bdX = min([node.xpos() for node in selNodes]) + bdY = min([node.ypos() for node in selNodes]) + bdW = max([node.xpos() + node.screenWidth() for node in selNodes]) - bdX + bdH = max([node.ypos() + node.screenHeight() for node in selNodes]) - bdY + + # Expand the bounds to leave a little border. Elements are offsets for left, top, right and bottom edges respectively + left, top, right, bottom = (-10, -80, 10, 10) + bdX += left + bdY += top + bdW += (right - left) + bdH += (bottom - top) + + if enumCol == None: + pass + else: + + n = nuke.nodes.BackdropNode(xpos = bdX, + bdwidth = bdW, + ypos = bdY, + bdheight = bdH, + note_font = 'Arial', + label = nameLabel, + note_font_size=enumVal, + name = nameLabel, + tile_color = hexColour, + gl_color = hexColour) + + + + # revert to previous selection + + n['selected'].setValue(False) + for node in selNodes: + node['selected'].setValue(True) + + return n diff --git a/homeworks/week_5/user_A_nuke.bat b/homeworks/week_5/user_A_nuke.bat new file mode 100644 index 0000000..c61105c --- /dev/null +++ b/homeworks/week_5/user_A_nuke.bat @@ -0,0 +1,3 @@ +set NUKE_PATH=G:\TDClass3\NukeClass3\homeworks\week_5\user_A + +"C:\Program Files\Nuke11.1v1\Nuke11.1.exe" \ No newline at end of file diff --git a/homeworks/week_5/user_B/init.py b/homeworks/week_5/user_B/init.py new file mode 100644 index 0000000..0f436a4 --- /dev/null +++ b/homeworks/week_5/user_B/init.py @@ -0,0 +1 @@ +print 'userB`s tools is load' diff --git a/homeworks/week_5/user_B_nuke.bat b/homeworks/week_5/user_B_nuke.bat new file mode 100644 index 0000000..eb0a52c --- /dev/null +++ b/homeworks/week_5/user_B_nuke.bat @@ -0,0 +1,3 @@ +set NUKE_PATH=G:\TDClass3\NukeClass3\nuke_lunch\user_B + +"C:\Program Files\Nuke11.1v1\Nuke11.1.exe" \ No newline at end of file