AutoWrite v1.0


 
This location is for Registered Users Only.
Perhaps you need to login or register.
Contributor: Tim BOWMAN
Semi-automatic output paths for Write nodes in Nuke.
Requirements:
6.0, 6.1 or later
Linux, Mac, Windows
24 Nov 2010
1602

AutoWrite

Semi-automatic output paths for Write nodes in Nuke.

The gist:

Create output paths by parsing the Nuke script name and path.

Most of the information needed for the output of a Nuke script is contained in it's name. We can reduce manual name changing on behalf of the artists and simultaneously increase consistency by creating a Write node that creates (and updates) it's own output path by parsing the script's name.

The details:

Most projects at a facility will use a standardized file hierarchy, which means that a Nuke script's name and path on the filesystem will often contain all the information needed to define the output destination for it's render. As an example, here is a path from one of my comp scripts:

/Volumes/PICO/show/testproj/abc/abc123/nuke/abc123_comp_v01.nk

From this path, we can see that I have a project called "testproj" that has a sequence with an abbreviation "abc" and that there is a shot called "abc123" in that sequence. I am working on composite version #1 on that shot.

What I do to create an AutoWrite is add a tab to the Write node where I break down these path elements in four knobs: project root, sequence name (or abbreviation), shot name and script name. These knobs are then re-assembled to create the AutoWrite's output path.

Since each facility creates their own file structure, I have set it up for my own structure and I leave it to you to parse your own paths for your facility.

Installation:

Put this script in your Nuke path and add this line to your menu.py: import autowrite

Important note:

Because this node creates paths that don't yet exist on the filesystem, you'll want to implement the beforeRender callback listed in the Nuke manual (page 575 for Nuke 6.1v2.) That way your auto-generated output paths get auto-created on render and life stays groovy.

LICENSE

Copyright (c) 2010 Tim BOWMAN

Permission is hereby granted, free of charge, to any person obtaininga copy of this software and associated documentation files (the"Software"), to deal in the Software without restriction, includingwithout limitation the rights to use, copy, modify, merge, publish,distribute, sublicense, and/or sell copies of the Software, and topermit persons to whom the Software is furnished to do so, subject tothe following conditions: The above copyright notice and this permission notice shall beincluded in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OFMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE ANDNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BELIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTIONOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTIONWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2010 Tim BOWMAN Permission is hereby granted, free of charge, to any person obtaininga copy of this software and associated documentation files (the"Software"), to deal in the Software without restriction, includingwithout limitation the rights to use, copy, modify, merge, publish,distribute, sublicense, and/or sell copies of the Software, and topermit persons to whom the Software is furnished to do so, subject tothe following conditions: The above copyright notice and this permission notice shall beincluded in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OFMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE ANDNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BELIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTIONOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTIONWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please login in order to download these files.

Comments   

 
+1 # Caro Lasil 2011-02-22 06:35
thanks a lot !
 
 
# Anselm Lier 2011-07-05 09:34
Thank you very much! This Script helps me a lot! I have been looking for something like this for a long time...
 
 
# Anselm Lier 2011-07-06 02:43
after installing your script, Nuke won't overwrite existing files from the Write node nor when flipbooking. Is there a way tot tell Nuke to overwrite existing files?
 
 
# Tim BOWMAN 2011-07-06 04:55
Hi Anselm. That's a curious problem you've got there. The AutoWrite doesn't change anything about how the files are written, it just just helps you put them in the right place. Take a look at the error message(s) you're getting to help you figure out what's happening. Does this issue occur when using a regular write node, too?
 
 
# Anselm Lier 2011-07-06 07:00
Thanks for the quick response...
Yes, it also occurs when i use a regular write node. Previously I only encountered this problem when rendering exr. But now it also happens when writing tga.
 
 
# Anselm Lier 2011-07-06 07:05
It might be a windows related problem though. I just deleted the file manually and Nuke still won't render to the same place.
 
 
# Anselm Lier 2011-07-06 07:49
I just figured out that your script is not the problem. Somehow the beforRender callback is what keeps me from overwriting. I wrote it according to the latest Nuke manual. Can you maybe tell me what I did wrong? Here is what I entered in the init.py:

def createWriteDir( ):
import nuke, os
file = nuke.filename(n uke.thisNode())
dir = os.path.dirname ( file )
osdir = nuke.callbacks. filenameFilter( dir )
os.makedirs(osdir)
nuke.addBeforeRender(createWriteDir)

When I remove the init.py everything runs normally, but then I would have to create the directories manually, right?

Cheers,
Anselm
 
 
# Anselm Lier 2011-07-08 04:52
For those interested I'll post a solution that someone gave me in a different forum.
Appearently it's not overwriting the file that's the problem. It's creating the path. By os.makedirs(osd ir) Nuke tries to create a path that already exists. So the solution is to put
if not os.path.isdir(o sdir): os.makedirs(osd ir)
instead.
 
 
# asin shin 2011-08-03 05:11
hello sir, thankyou for the script, im still new to nuke and python. im kinda lost from the beginning, can u guide me?

regards,
shin
 
 
# Anselm Lier 2011-08-03 07:33
In your /.Nuke folder you can save a menu.py and a init.py file. You can create and save these files with the Nuke script editor. Or even a text editor.
You install the autowrite script according to the manual given above. Then you put these lines into your init.py :
def createWriteDir( ):
import nuke, os
file = nuke.filename(n uke.thisNode())
dir = os.path.dirname ( file )
osdir = nuke.callbacks. filenameFilter( dir )
if not os.path.isdir(o sdir): os.makedirs(osdir)
nuke.addBeforeRender(createWriteDir)
The lines 2 to 6 are indented (=moved to the right, ? my english is not so good ?) by one tab. Otherwise they might not work.
Usually the .Nuke folder is located in your users directory.
Hope I could help you. I'm also still a newby to Nuke...

I also changes some lines in the autowrite script to make it fit to my folder structure. But that is quite simple, just read the lines carefully and you will find out what they do in detail.

To make changes work you need to restart Nuke.

Regards,
Anselm
 
 
# vivek tekale 2012-03-24 07:01
hey thanks for the script... but i hv one question... if i want a version up render from the same nuke file ?
 
 
# Anselm Lier 2012-04-03 02:01
There is a part in the script that says [value script]. If you have this in your write nodes file path you only have to save your script as mynukesrcipt_v0 1.nk. Now if you want to save/render a new version just hit shift+alt+s and nuke saves a new version and the write node will put the new name into its file path due to the [value script].
Is that what you wanted to know?
My write nodes file path for example is [join [lrange [split [value root.name] / ] 0 3 ] / ]/03_Output/01_ WIP/[value script]_[value views]/[value script]_[value views].d.tga
 
 
# kaushal shah 2012-05-02 05:47
hi, while clicking on AutoWrite i am getting following error...

name 'autowrite' is not defined

Traceback (most recent call last):
File "", line 1, in
NameError: name 'autowrite' is not defined

any clue for this :-))
 
 
# kaushal shah 2012-05-02 06:58
i have solved the problem
thank you for ur amazing superb script
 
 
# kaushal shah 2012-05-03 05:21
Ooops!!! still i want to add something more in Auto Write node....
i am using 6.3 v4
(for .dpx render format)
colorspace raw data should be on
&
transfer should be log

what shd i add into the script ?
 
 
# vivek tekale 2012-05-03 05:33
hi kaushal...
That is all done in my comp... u'll find the codes for raw data ON and transfer to log.. check in my PC...
 
 
# sujit nandurdikar 2013-04-11 23:39
can anyone pls tell me is i want my output image name as input name....then how to alter this script for this...........
 
 
+2 # Tim BOWMAN 2013-04-12 18:46
Hello to everyone asking about modifications to this script! You might find the AutoWrite tutorial helpful: http://www.nukepedia.com/written-tutorials/how-to-build-an-automatic-write-node/

Stay awesome!
 

You have no rights to post comments

We have 2579 guests and 128 members online