here is a little tutorial for all who want to dig deeper into the scripting of nuke
it explains most of it in there and most of it is self explaining
you can write this really quick with a couple lines of tcl code
proc sendtofarm {} {
# I give my plugin a name for sourcing it. In this case it's sendtofarm this will enable the environment Variables just in case you work with those
global env
#cause we want to save our script before we send it to the render farm
set command [knob root.name]
if [modified] {script_save_as ""}
# for displaying only the name of the script without the entire path in our little window we will create later
set name [file tail [knob root.name]]
# well we still need the scriptname to execute on the command line or send it to the renderer
set script [knob root.name]
#most distrusted renderer are looking for the first and the last frame
set s [knob first_frame]
set e [knob last_frame]
set dur [expr [knob last_frame]-[knob first_frame] +1]
#in this case I add the procs to my render management for dividing it equally to the artists if the artist needs more, type it in
set procs 10
# I'm looking for a write node to execute
set writeNodeNb 0
foreach node [nodes] {
if {[class $node] == "Write" && [knob $node.disable] != true} {
incr writeNodeNb
}
}
if {$writeNodeNb == 0} {
message "No (enabled) IWrite found";
return;
}
#I need to set up a panel so we can see what we are sending to the distributed renderer
set rndr ""
if [catch {
panel "Nuke the Farm" {
{"name:" name}
{"start:" s}
{"end:" e}
{"duration:" dur}
{"procs" procs}
{buttons cancel "Submit"}
} } rndr ] return
# here I split up the entire frame range per job, something like a 100 frames on 10 jobs and round it
set ca [expr $dur/$procs]
set c [expr {round ($ca)}]
# here I submit it to the distributed renderer
[exec ///command for your distributed renderer\\ -s $s -e $e -c $c $name]
}