Jump to content

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
Link to comment
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
Link to comment
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
Link to comment
Share on other sites

  • 5 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...