Houdini Pre-Render-Script for Folder-Creation

Problem:

Houdini does not support folder Creation when Rendering, but you can run a python script before the render starts.

1) Put under your Mantra-Node under Scripts > Pre-Render-Script execfile(“$HIP/YOURSCRIPTLOCATION/YOURSCRIPT.py”)

Screen Shot 2014-06-12 at 10.08.32

 

2) Your pathParm should point to the ‘out/mantra1/vm_picture’  parameter of your Node.

Check if Folder-Exsists
import os
pathParm = hou.parm('out/mantra1/vm_picture')
currentFile = hou.parm('vm_picture') # hou.parm('out/mantra1/vm_picture').unexpandedString()
currentPath = os.path.dirname(currentFile)
if not os.path.exists(currentPath):
    os.makedirs(currentPath)
if os.path.isfile(currentFile):
    pathParm.set(currentFile.replace("$F", "$F+1oha"))

 

3) The above code is as well up-counting the Version, but you should change it for your needs.

No Comments

Add Comment