Jump to content
kgoossens

generating directories

Recommended Posts

Hi everybody.

Sorry for the n00b question. But I'm struggling to find this.

I'd like for Houdini to generate directories for the images I'm rendering. Something like what you can do in Maya <Camera>/<RenderLayer>/Filename... What kind of expression do I need or what would in need to create a folder while rendering.

like $HIP/`dirCreateFunction`/image_${F4}.picnc

Okay Have found my answer here

Edited by kgoossens

Share this post


Link to post
Share on other sites

The minimalist solution - highly error - prone is to wrap hscript's umkdir with expression:

string mkdir(string dir) 
{

    string command = strcat("umkdir ", dir);
    string result  = execute(command);
    return dir;

}

so that

$JOB/`mkdir("images")`/test.jpg

would work. Something more elaborated (possible Python call wrapped similarly), checking path, permission flags etc highly recommended. Refusing temptation of creating folders automatically is even more recommended :).

skk.

ps Install either by Menu Edit -> Aliases & Variables -> Expressions Tab or with a line executed in 123.py

exread &lt;houdini_path&gt;/myexpressions.cmd

edit: looks like 4 years later I'm still repeating myself...

Edited by SYmek

Share this post


Link to post
Share on other sites

For this purposes I wrote python script, which need set in Pre-render path of every rop node.

import os
curNode=hou.pwd().path()
path=hou.parm(curNode+"/vm_picture").eval()
fPath=path[0:path.rfind("/")]
if os.path.exists(fPath)==0: os.makedirs(fPath)
i=1
lParm=hou.parm(curNode+"/vm_filename_plane"+str(i))
while(lParm!=None):
    lPath=lParm.eval()
    flPath=lPath[0:lPath.rfind("/")]
    if (os.path.exists(flPath)==0) and (hou.parm(curNode+"/vm_disable_plane"+str(i)).eval()==0): os.makedirs(lPath[0:lPath.rfind("/")])
    i+=1
    lParm=hou.parm(curNode+"/vm_filename_plane"+str(i))

Edited by vi_rus
  • Like 1

Share this post


Link to post
Share on other sites

I write Pre-Render Script in Hscript

umkdir -p `chs("vm_picture")`:h

That's simple.It's my default mantra setting.

If and when you use ROP Output Driver

umkdir -p `chs("sopoutput")`:h

I always use this.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×