Pages

Sunday, October 5, 2014

PyTake2 create take using python in Houdini

PyTake is now completely rewritten, new version is now fully object oriented. It allows the user to create and edit takes in houdini using python.

It works with all version of Houdini (Apprentice, Apprentice HD, escape, master or Indie.) Free for all usage ( comercial or not ).



To create a new take, just instance a new Take() object :

import PyTake2 as pt

# This will create a new take and add it to the take list
myTake = pt.Take('mytake')

#This will include the display flag of the node « /obj/grid/grid1 » to the take.
myTake.includeDisplayFlag('/obj/grid/grid1')

# You can also use a hou.Node() as parameter :
node = hou.node('/obj/sphere/sphere1')
myTake.includeDisplayFlag(node)

# To include all parms of a node to the take, use :
myTake.includeParms(node)

# To add only some parameters, use :
myTake.includeParms(node, parms_dict={'radx':None, 'rady':None, 'radz':None))

# To add only some parameters, and set node's parameters values use :
# This will set radx to 5, rady to 1 and radz to 2 in the take.
myTake.includeParms(node, parms_dict={'radx':5, 'rady':1, 'radz':2),set_parms_value=True)

#To exclude parms from the take, use :
myTake.includeParms(node, parms_dict={'radx':None, 'rady':None, 'radz':None},include=False)

# To copy a take
copy_take = myTake.copy()
# => this create a new take name_copy

# To remove a take :
myTake.remove()