HouPyTake2 is a Python wrapper around the Hscript commands to create and edit Houdini’s takes. You can create and edit takes, include or remove node(s) or parameter(s) as well as flags.
No support will be provided anymore on that script, Houdini has now an python API for takes: hou.takes
Compatibility: Houdini 14, 15, 15.5, 16, 16.5, 17.0
Just copy the PyTake2.py file into your $PYTHONPATH or on windows: C:\Users\%USERNAME%\Documents\houdini16.0, on MAC OSX it would be: ~/Library/Preferences/houdini/16.0.
Import the module PyTake2 in your python script.
Here is a quick example on how to use the module PyTake2. To have more information about the API, have a look on the API Documentation section bellow.
import PyTake2 geo1 = hou.node("/obj/geo1") geo2 = hou.node("/obj/geo2") geo3 = hou.node("/obj/geo3") null = hou.node("/obj/geo4/null1") print("create take1, empty") take1 = PyTake2.Take(name="take1") print("go back to main") PyTake2.returnToMainTake() print("create takeA and B") # create take A and include all parameters from geo3 node takeA = PyTake2.Take(name="take_A") takeA.includeDisplayFlag(geo1) print takeA # create take B ( empty ) set take A as parent takeB = PyTake2.Take(name="take_B", parent=takeA) print("TakeB parent: " + takeB.getParent().getName()) # add parameter to take B, here we add a parm tuple ( t ) # as wel a a float parameter ( scale ) takeB.includeParms([hou.node("/obj/geo1").parmTuple("t"), hou.node("/obj/geo1").parm("scale")]) # merge take C and take B print("create takeC from take A") takeC = PyTake2.Take(name="take_C") takeC.includeParmsFromTake(takeA) print("TakeC parent: " + takeC.getParent().getName()) print("TakeC members: " + str(takeC.getTakeMembers())) print("Remove display flag from take C") takeC.includeDisplayFlag(geo1, False) print("TakeC members: " + str(takeC.getTakeMembers())) PyTake2.setTake(takeC) # create take D and set parent take A takeD = PyTake2.Take(name="take_D") takeD.setParent(takeA) print("TakeD parent: " + takeD.getParent().getName()) # create take E and add parameters from a node according to a pattern PyTake2.returnToMainTake() takeE = PyTake2.Take(name="take_E") takeE.includeParmsFromNode(null, ["parm*", "cacheInput"]) # set parent to None ( Main ) takeE.setParent(None) # copy take A takeA.copy("take_A_COPY") print("current take:") print PyTake2.currentTake()
name: (str) Name of the take.
parent: (Take) Parent take, if empty, parent take will be current take.
set_to_current: (bool) If set to True, the take will be set as current take.
include_node: (hou.Node or string) A hou.Node object or a node path to be included in the take. It can be a list of hou.Node or string.
include_parm: (hou.parm or hou.parmTuple) a parm ( or parm tuple ) object to be included in the take. It can be a list.
_add_to_scene: (bool) Must be set to True used only internally.
take = PyTake2.Take("my_take", include_node=hou.node("/obj/geo1"), include_parm=hou.parm("/obj/geo1/scale"))
node: (str) path of the node or instance of hou.Node().
include: (bool) Flag Include / Exclude switch.
set_flag: (bool) Set the node's render flag.
flag_value: (bool) Value of the flag to be set.
Raise a InvalidFlagType if the given node doesn't have a render flag.
node: (str) path of the node or instance of hou.Node()
include: (bool) Flag Include / Exclude switch.
set_flag: (bool) Set the node's display flag.
flag_value: (bool) Value of the flag to be set.Raise a InvalidFlagType if the given node doesn't have a display flag.
node: (str) path of the node or instance of hou.Node()
include: (bool) Flag Include / Exclude switch.
set_flag: (bool) Set the node's bypass flag.
flag_value: (bool) Value of the flag to be set.
Raise a InvalidFlagType if the given node doesn't have a bypass flag.
take = PyTake2("mytake") take.includeParms([hou.node("/obj/geo1").parmTuple("t"), hou.node("/obj/geo1").parm("scale")])
Parameters can be filtered with an houdini-style pattern matching "parms_name_filter"
which can be either a single string or a list of string.
null = hou.node("/obj/geo1/null") take = PyTake2.Take(name="mytake") take .includeParmsFromNode(null, ["parm*", "cacheInput"])
The take parameter can be either a Take object or a take name.
force: (bool) Force a source take has the same included parameter as the destination, the source will overwrite the destination
or None.
If None, the take's parent will be set to Main take.
The copy can be set to current take with argument set_current.
recursive: (bool) if True, remove all child takes as well.
file_path: (str) A valid path where to save the file.
recursive: (bool) if True, save as well as children take of the node.
PyTake2.TakeCreationError(TakeError)
PyTake2.TakeDeleteError(TakeError)
PyTake2.TakeSetError(TakeError)
PyTake2.InvalidFlagType(TakeError)
PyTake2.InvalidNode(TakeError)
v1.0.0: First commit