Monday, November 26, 2012

PyTakes for Houdini

Hi everybody,



As I don't really like the hscript command hou.hscript in order to drive takes creation in houdini, I decided to create my own python module for that.
So here is the really first version of the module, you can drive takes creation, remove, setup, etc. by python.

In the help .pdf you can find fonctions already implemented :



How to use:

Just copy the PyTakes.py file in "houdini_Install_Dir/houdini/python2.6libs" then in houdini juste import the module as normal python module with "import PyTakes".

Exemple to create a new take called "occlusion" and assign few parameters on this take:

#Import the PyTakes module
import PyTakes as pt

 #Create a new take and change the current take to that new take
pt.createTake("occlusion", change=True)

#Include parameters "shading_quality" and "occlusion_shader" of object "groundGeo" to the current take.
pt.includeParm("obj/groundGeo", ["shading_quality","occlusion_shader"] )

#Include display flag to the current take and set it to "True"
pt.includeDisplayFlag("obj/groundGeo", autoSet=True, value=True)

The script allows list as input for object and parameters:

#Include parameters "shading_quality" and "occlusion_shader" of objects geo1 and geo2 
#If an object or a parameters is not found, it will be skipped ( a warning promps if verbose=True )
pt.includeParm("[obj/geo1",obj/geo2"], ["shading_quality","occlusion_shader"] )