Group {
name GM_Crop1
tile_color 0xaa55ffff
label "\[value calculate]\nBox: x:\[value this.Crop_GM.box.x] y:\[value this.Crop_GM.box.y] r:\[value this.Crop_GM.box.r] t:\[value this.Crop_GM.box.t] "
selected true
xpos 840
ypos 27
addUserKnob {20 User}
addUserKnob {41 calculate l Use: T calculate_proxy.calculate}
addUserKnob {26 space l "" -STARTLINE T " "}
addUserKnob {6 sync l "Sync Values" -STARTLINE}
sync true
addUserKnob {26 ""}
addUserKnob {7 all_dir l "All Direction" R -1000 1000}
addUserKnob {7 all_dir_perc l "All Direction" +HIDDEN R 0 200}
all_dir_perc 100
addUserKnob {26 ""}
addUserKnob {7 vertical l Vertical R -1000 1000}
addUserKnob {7 vertical_perc l Vertical +HIDDEN R 0 200}
vertical_perc 100
addUserKnob {7 horizontal l Horizontal R -1000 1000}
addUserKnob {7 horizontal_perc l Horizontal +HIDDEN R 0 200}
horizontal_perc 100
addUserKnob {26 ""}
addUserKnob {7 left l Left R -1000 1000}
addUserKnob {7 left_perc l Left +HIDDEN R 0 200}
left_perc 100
addUserKnob {7 right l Right R -1000 1000}
addUserKnob {7 right_perc l Right +HIDDEN R 0 200}
right_perc 100
addUserKnob {7 top l Top R -1000 1000}
addUserKnob {7 top_perc l Top +HIDDEN R 0 200}
top_perc 100
addUserKnob {7 bottom l Bottom R -1000 1000}
addUserKnob {7 bottom_perc l Bottom +HIDDEN R 0 200}
bottom_perc 100
addUserKnob {26 ""}
addUserKnob {41 reformat T Crop_GM.reformat}
addUserKnob {41 intersect -STARTLINE T Crop_GM.intersect}
addUserKnob {41 crop l "black outside" -STARTLINE T Crop_GM.crop}
addUserKnob {26 ""}
addUserKnob {26 TEXT l "" +STARTLINE T "1.1 version"}
addUserKnob {26 HeadlineB l "" +STARTLINE T "GM_Crop© by Attila Gasparetz"}
}
Input {
inputs 0
name Input
xpos 510
ypos 255
}
set Nefea5400 [stack 0]
Crop {
box {{"-((((((((all_dir_perc * input.format.r)/100 \n+(horizontal_perc * input.format.r) /100\n+(left_perc * input.format.r) /100) /3)\n-input.format.r) *3)+input.format.r))\n-(input.format.r))"} {"-(((((((all_dir_perc * input.format.t)/100 \n+(vertical_perc * input.format.t) /100\n+(bottom_perc * input.format.t) /100) /3)\n-input.format.t) *3)+input.format.t )\n-input.format.t)"} {"(((((all_dir_perc * input.format.r)/100 \n+(horizontal_perc * input.format.r) /100\n+(right_perc * input.format.r) /100) /3)\n-input.format.r) *3)+input.format.r"} {"(((((all_dir_perc * input.format.t)/100 \n+(vertical_perc * input.format.t) /100\n+(top_perc * input.format.t) /100) /3)\n-input.format.t) *3)+input.format.t\n"}}
reformat {{Crop_GM.reformat}}
intersect {{Crop_GM.intersect}}
crop {{Crop_GM.crop}}
name Crop_GM1
label percentage
xpos 620
ypos 321
}
push $Nefea5400
Crop {
box {{"-(((input.format.r + all_dir) + horizontal + left) - input.format.r )"} {"-(((input.format.t + all_dir) + vertical + bottom) - input.format.t )"} {"(input.format.r + all_dir) + horizontal + right"} {"(input.format.t + all_dir) + vertical + top"}}
name Crop_GM
label pixel
xpos 400
ypos 321
}
Switch {
inputs 2
which {{calculate}}
name Switch_Crop
label "Which: \[value which]"
xpos 510
ypos 321
}
Output {
name Output1
xpos 510
ypos 375
}
NoOp {
inputs 0
name calculate_proxy
knobChanged "n = nuke.thisGroup()\nk = nuke.thisKnob()\nkn = k.name()\npixel_knobs = \['all_dir','vertical','horizontal','left','right','top','bottom']\npercentage_knobs = \['all_dir_perc','vertical_perc','horizontal_perc','left_perc','right_perc','top_perc','bottom_perc']\nif kn == 'calculate':\n if n\['calculate'].value() == 'Pixel values':\n for knob in pixel_knobs:\n n\[knob].setVisible(True)\n for knob in percentage_knobs:\n n\[knob].setVisible(False)\n if n\['sync'].value() == True:\n # percentage to pixel width\n all_p = n\['all_dir_perc'].value()\n hor_p = n\['horizontal_perc'].value()\n with n:\n inp_all = nuke.toNode(\"Input\").width()\n n\['all_dir'].setValue(0)\n n\['horizontal'].setValue((inp_all / 100) * (all_p + hor_p - 100) - inp_all)\n # percentage to pixel height\n all_p = n\['all_dir_perc'].value()\n ver_p = n\['vertical_perc'].value()\n with n:\n inp_all = nuke.toNode(\"Input\").height()\n n\['vertical'].setValue((inp_all / 100) * (all_p + ver_p - 100) - inp_all)\n # percentage to pixel left\n left_p = n\['left_perc'].value()\n with n:\n inp_all = nuke.toNode(\"Input\").width()\n n\['left'].setValue((inp_all / 100) * (left_p) - inp_all)\n # percentage to pixel right\n right_p = n\['right_perc'].value()\n with n:\n inp_all = nuke.toNode(\"Input\").width()\n n\['right'].setValue((inp_all / 100) * (right_p) - inp_all)\n # percentage to pixel top\n top_p = n\['top_perc'].value()\n with n:\n inp_all = nuke.toNode(\"Input\").height()\n n\['top'].setValue((inp_all / 100) * (top_p) - inp_all)\n # percentage to pixel bottom\n bottom_p = n\['bottom_perc'].value()\n with n:\n inp_all = nuke.toNode(\"Input\").height()\n n\['bottom'].setValue((inp_all / 100) * (bottom_p) - inp_all)\n else:\n pass\n else:\n for knob in pixel_knobs:\n n\[knob].setVisible(False)\n for knob in percentage_knobs:\n n\[knob].setVisible(True)\n if n\['sync'].value() == True:\n # pixel to percentage width\n all = n\['all_dir'].value()\n hor = n\['horizontal'].value()\n with n:\n inp_all = nuke.toNode(\"Input\").width()\n n\['all_dir_perc'].setValue(100)\n n\['horizontal_perc'].setValue((((all + hor) + inp_all) / inp_all) * 100)\n # pixel to percentage height\n all = n\['all_dir'].value()\n ver = n\['vertical'].value()\n with n:\n inp_all = nuke.toNode(\"Input\").height()\n n\['all_dir_perc'].setValue(100)\n n\['vertical_perc'].setValue((((all + ver) + inp_all) / inp_all) * 100)\n # pixel to percentage left\n left = n\['left'].value()\n with n:\n inp_all = nuke.toNode(\"Input\").width()\n n\['left_perc'].setValue(((left + inp_all) / inp_all) * 100)\n # pixel to percentage right\n right = n\['right'].value()\n with n:\n inp_all = nuke.toNode(\"Input\").width()\n n\['right_perc'].setValue(((right + inp_all) / inp_all) * 100)\n # pixel to percentage top\n top = n\['top'].value()\n with n:\n inp_all = nuke.toNode(\"Input\").height()\n n\['top_perc'].setValue(((top + inp_all) / inp_all) * 100)\n # pixel to percentage bottom\n bottom = n\['bottom'].value()\n with n:\n inp_all = nuke.toNode(\"Input\").height()\n n\['bottom_perc'].setValue(((bottom + inp_all) / inp_all) * 100)\n else:\n pass"
tile_color 0xff
label "DON'T TOUCH"
note_font "Verdana Bold"
xpos 734
ypos 249
addUserKnob {20 User}
addUserKnob {4 calculate l Use: M {"Pixel values" Percentage ""}}
}
end_group