Zero Posted June 21, 2010 Share Posted June 21, 2010 Hello there, I've searched both the Houdini docs as well as the forums, but I can't find the solution. I'm relatively new to Houdini and have a considerable Python background, so while learning Houdini, I try to do everything in Python. I've learned about the dopoption() command in Hscript, and managed to use it in my own tests but I would really like to use as little Hscript as possible. As a matter of fact, my expression is in Python, but to get the option out of the currently processed object in a DOP node, I have to do: hscriptExpression("dopoption($DOPNET, $OBJID, 'Position', 'tx')") I would really like to know what the proper, "pythonic" way of achieving this would be. Many thanks in advance. Quote Link to comment Share on other sites More sharing options...
graham Posted June 21, 2010 Share Posted June 21, 2010 To get the equivalent of dopoption() you can do something like this: dopobject = some instance of hou.DopObject position_subdata = dopobject.findSubData("Position") position_options = position_subdata.options() tx = position_options.field("tx") Of course you could always do it using a chained together command: dopobject.findSubData("Position").options().field("tx") If you are doing this as part of an expresion you'll have to use lvar("OBJID") in order to help get the currently being worked on DOP object since hou.DopNode does not have a hou.DopNode.curObject() function. dopobject = hou.pwd().simulation().findObject(str(lvar("OBJID"))) Quote Link to comment Share on other sites More sharing options...
Zero Posted June 22, 2010 Author Share Posted June 22, 2010 Brilliant! Thank you so much, that's exactly what I was looking for. And although pwd().simulation().findObject(str(lvar("OBJID"))).findSubData("Position").options().field("tx") is much longer than what I had before, at least I've learned a lot more about the hou module. Thanks again. 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.