Hi Jean-Luc,

the way I personally do this is by using the Write nodes' beforeRender knob. This will execute any python code you give it every time before a render. I then use a little script that saves the nuke file and backs up any previous backup scripts into a hidden folder, so that every tiem you render, you know you have the respective nuke script in the render directory. Here is the code (I just ripped it out of my pipeline code so let me know if it's missing something):
http://pastebin.com/pq9E1h9k

I then use this line to assign a knob default to the Write nodes' beforeRender knob:
import nuke
nuke.knobDefault('Write.beforeRender', 'saveRenderScript()')


The above does not modify the nuke script name to reflect the rendered image's name, but I can add that (after a shower and a coffee :) ).



Cheers,
frank


On 27/02/14 08:57, jean-luc wrote:
Hi all

I just wanted to ask a little advice/help for a tool I have in my menu.py.

I was given this script and I don't know how to write python so I have no idea 
how to modify it, or if it's even possible.

Here is the situation:

The script allows me to save a snapshot of the current script to the active 
write nodes folder. I use it to save a backup of the script along the images I 
just rendered.
There are a couple of things I'd like to modify if I could.

1 - at the moment, the copy of the nuke script keeps the original name. Could 
it be changed to save it with the name of the images rendered in that folder

2 - If I try to run the "copy script" before rendering, it complains because 
sometimes the folder doesn't exit yet (It would be created at render time) so I need to 
save it after the render. Not ideal as I often forget to do it after the render is done. 
Could the script be automatically run at render time instead of having to do it manually?
I was thinking of adding a check box in the write node that would automatically run the 
"copy script" each time you press the render button. I would always keep it on 
by default.

I hope this make sense.
It's a very useful tool and I'd love to see it work automatically. It's a life 
saver!

script is attached.
Cheers
Jean-Luc










_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to