auto create folder?

   5560   2   0
User Avatar
Member
243 posts
Joined: Oct. 2007
Offline
Hi! Here's a simple question:
Let's say I do a render with mutiples planes and render layers, is it possible to have folders automatically created at rendertime instead of creating them all manually. Maya as that kind of option and it's a real time saver.

Exemple: if you write this as the render image name: <Scene>\<RenderLayer>\<RenderLayer>.

It will create a path with your scene name, another subfolder with your render layer name, and than the image will have the name of the render layer…I use that ALL the time and really wish I could do the same thing in Houdini…maybe I can, but I don't know how…

Please help me!!!

Cheers!
JR Gauthier
Character Animation & Design
www.turboatomic.com
http://www.vimeo.com/user2847970 [vimeo.com]
User Avatar
Member
1926 posts
Joined: Nov. 2006
Offline
I've always done this using a simple python script run from my Pre-Render script.

You can put the following code in a python module, then import it and run it in the script parm.

import hou
import os

def verifyPlanePaths(rop_node):
“”“ Ensure that all directories of Extra Images Planes
are created.
”“”
# Get the number of planes.
num_planes = rop_node.evalParm(“vm_numaux”)

for i in range(num_planes):
# Skip Disabled planes.
if rop_node.evalParm(“vm_disable_plane%s” % i):
continue

# Using external file.
if rop_node.evalParm(“vm_usefile_plane%s” % i):
# Get the target file path.
file_path = rop_node.evalParm(“vm_filename_plane%s” % i)
# Get the directory component of the path.
dir_path = os.path.dirname(file_path)
# If the target directory doens't exist, create it.
if not os.path.isdir(dir_path):
os.makedirs(dir_path)


In the Pre-Render script, set the language to Python and then add this, renaming rendermodule with whatever your module name is called.

import rendermodule; rendermodule.verifyPlanePaths(hou.pwd())

Edit: I've attached the script in a rendermodule.py file since the forum screwed up the formatting.

Attachments:
rendermodule.tar.gz (477 bytes)

Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
243 posts
Joined: Oct. 2007
Offline
Sweet, I'll have a look!
If I understand well, it checks if a path exists, and if not, it creates it?

I know there is also a variable to get my scene name automatically, does the same thing exist for render planes and takes?

Thanks very very much!
JR Gauthier
Character Animation & Design
www.turboatomic.com
http://www.vimeo.com/user2847970 [vimeo.com]
  • Quick Links