Hi Jean-Luc :)
You can stuff something into the before render on the python tab of your write
nodes to get the behaviour you're describing, e.g., save_script_this_write()
Modified the code below.
Cheers, t
import shutil
import os.path
def save_script_this_write():
script = nuke.root().name()
n = nuke.thisNode()
render_folder = os.path.dirname(n["file"].value())
dest_base_name = os.path.basename(n["file"].value()).split('.')[0] + ".nk"
dest = os.path.join(render_folder, dest_base_name)
if not os.path.isdir(render_folder):
print "making dirs"
os.mkdir(render_folder)
print "SaveScriptToWriteDir: Saving", script, "to", dest
shutil.copyfile(script, dest)
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