csp Posted November 29, 2013 Share Posted November 29, 2013 (edited) 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. example: (' 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.Pseudocode: [CODE]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 [/CODE] Any idea how to do that? The most tricky part for me is how to get children takes in an array. Edited November 29, 2013 by cparliaros Quote Link to comment Share on other sites More sharing options...
graham Posted November 29, 2013 Share Posted November 29, 2013 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) geo.parm("take").set(takeName) geo.moveToGoodPosition() merge.setNextInput(geo) merge.moveToGoodPosition() merge.render() 2 Quote Link to comment Share on other sites More sharing options...
csp Posted November 29, 2013 Author Share Posted November 29, 2013 (edited) 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][/size][/color][/size][/color]split() does more than I was thinking! Edited November 30, 2013 by cparliaros Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.