The easiest solution seems to be to just loop through each view that the Write node is set to render. Something like this:

n = nuke.thisNode()
outFile = n['file'].value()
for v in n['views'].value().split(' '):
   viewDir = os.path.dirname(outFile.replace('%v', v))
   if not os.path.exists(viewDir):
       os.makedirs(viewDir)

This isn't as complete as it probably should be (for alternate/special case handling), but you get the idea.

Also, keep in mind that this will break if you have view names containing spaces. There are other workarounds for that situation...

-Nathan

-----Original Message----- From: Holger Hummel|Celluloid VFX
Sent: Thursday, March 31, 2011 12:49 PM
To: Nuke Python discussion
Subject: [Nuke-python] beforeRender and stereo views


Hi all,

i ran into a small issue here regarding the beforeRender knob on the
write node.
i want to set up a function call to create the necessary output
folder(s) for a write node on a stereo project. when calling that
function - say 'createFolders()' - it does that only for the left view
but not the right view. in the write node's file knob there's the "%v",
of course and i'd like to separate the left and right view into
different folders by that. first, i used
"nuke.thisNode()['file'].toScript()" to pass the folder to the function.
that did not work at all - of course. then i tried
"nuke.thisNode()['file'].evaluate()" which does create the folder for
the left view only and rendering the right view fails with nuke saying
that the folder does not exist.
anybody knows how to deal with this? is there a nice way of doing this
or do i really have to check inside my function whether it has the "%v"
and then do it inside the function?
any help/hint is appreciated.

cheers,
Holger


--
Holger Hummel  -  [email protected]

Celluloid Visual Effects, Paul-Lincke-Ufer 39/40, 10999 Berlin
phone +49 (0)30 / 54 735 220  -  [email protected]

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

Reply via email to