Jump to content

trying to make pre-render directories


kleer001

Recommended Posts

EDIT: All I had to do was change the channel scripting language to python. That handy little pull down on the right hand side IS NOT for the channel contents, it's for the imported script. Ugh. Totally fixed.

 

Btw, here's some code fixing sideFx's blind side on creation of folders for image planes.

 

----------

 

Sadly the new coolness of "Create Intermediate Directories" doesn't work for image plane folders with global variables in their name.

 

I've already submitted and RFE. And I'm working on some tiny little python to help out, but it doesn't seem to do the job.

 

I've got 5 image planes standard in this pipe I wanna toss together:

import os
import hou

self_mantra = "/out/"+hou.expandString("$OS")
for i in range(1,6):
    chan_name = self_mantra + "/vm_filename_plane" + str(i)
    plane_chan = hou.parm(chan_name)
    plane_chanVal = plane_chan.eval()
    plane_bits = plane_chanVal.split('/')
    folder_name = '/'.join(plane_bits[:-1])
    if not os.path.exists(folder_name):
        os.makedirs(folder_name)

        
Right? That looks fine to me. All the pieces work. I've slapped it into the pre-render script channel as an expression. So, it should run once before the frame starts, right? But it doesn't seem to run at all.

 

Ugh, what did I miss?! Does this work for you? What do you do to make those directories automagically?

Edited by kleer001
Link to comment
Share on other sites

and some more code for the remedial home pipeline builder:

import os
import hou

# requires $SHOW/EPISODE/SEQ/SHOT/VER pipeline global variables
# along with the formatted Different File paths like:
# $JOB/renders/${SHOW}_${EPISODE}_${SEQUENCE}_$SHOT/$ELEM/$VER/
# Spec/${SHOW}_${EPISODE}_${SEQUENCE}_${SHOT}_${ELEM}_${OS}$VER.S.$F4.tif

self_mantra = "/out/"+hou.expandString("$OS")
# hard coded to 16 just because 16 layers is a lot
for i in range(1,16):
    chan_name = self_mantra + "/vm_filename_plane" + str(i)
    switch_chan = self_mantra + "/vm_disable_plane" + str(i)
    plane_chan = hou.parm(chan_name)
    if plane_chan != None:
        if not hou.parm(switch_chan).eval():
            plane_chanVal = plane_chan.eval()
            plane_bits = plane_chanVal.split('/')
            folder_name = '/'.join(plane_bits[:-1])
            if not os.path.exists(folder_name):
                os.makedirs(folder_name)

Edited by kleer001
Link to comment
Share on other sites

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...