I've created a custom render node for the movie I'm working on and I've gotten it to do all the backflips and other funny things I want it to but I've been stuck with this one problem for ages.
I want to set affinity within nuke when I hit render i.e. - press render button, in write node's "before render" script input a script runs that asks the user which processors he/she wants to render on. Only use the selected cores to render and then in the after render script input set nuke to run on all the cores again.
I do a lot of local rendering so this would help a lot because I work on one comp while i render 2 or 3 others and if they run on different cores it lessens the bottleneck on my computer of DOOM!!!
Something like -
loopAmt = nuke.env['numCPUs'] ##store number of cores of machine in loopAmt variable
uiPanel = nuke.Panel("Set Affinity") ## Create ui panel
for i in range (loopAmt): ##Create a checkbox for each core
uiPanel.addBooleanCheckBox("Core" + str(i) + ": ", "True") ## Add checkbox for each core
uiPanel.show() ## Display ui panel
selCores = [] ##list to store selection
for i in range (loopAmt): ##check if was selected for each core
if uiPanel.value("Core" + str(i) + ": ") == True:
selCores.append(i) ##store value
if selCores == []: ## if user selects no cores, use all cores
for i in range (loopAmt): ## add all cores to list
selCores.append(i) ##store value
##set nuke to run on selCores[0] only
##add other selCores cores for nuke to run on as well
for core in selCores[1:]:
##add core