Jump to content

Python Take List

Recommended Posts

I want, with given the parent take name to get a list of all take children in Python?

The Hscript command is: http://www.sidefx.co...ommands/takels

but unfortunately python version is not yet implemented.

What I want to do is easier for me in python. I could use hou.script("takels") but the result is not clean.


 ('  1\n  2\n  3\n  4\n  5\n  6\n', '') [/CODE]

Let me explain what I am after.

I am building a tool where I want the user to be able to have a parent take and then a list of children with different values on the tool. Then on the DA he will have to select the parent take and hit render.


parent = "mainTake"
children = hou.script("takels -p mainTake")
for each children:
create a geoRop and set take parameter
end forloop.
link all geoRops to a mergeRop

Any idea how to do that? The most tricky part for me is how to get children takes in an array.

Edited by cparliaros

Share this post

Link to post
Share on other sites

You can just call split() on the first string in the result and it will remove all the extraneous whitespace and new line characters. Then, you just need to construct your ROPs.

parent = "mainTake"
childTakes = hou.hscript("takels -p {0}".format(parent))[0].split()

OUT = hou.node("/out")
merge = OUT.createNode("merge")

for takeName in childTakes:
    geo = OUT.createNode("geometry", takeName)



  • Like 2

Share this post

Link to post
Share on other sites

thank you very much graham,

I had pretty much the same script as you have above, the only I was missing was your second line:

chilgTakes = hou.hscript("takels -p {0}".format(parent))[0].split()[/CODE]


split() does more than I was thinking!

Edited by cparliaros

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now