pbowmar Posted September 6, 2008 Share Posted September 6, 2008 Hi, So, I'm trying to write a "pure" Python script to replace an overly-complex Hscript that I have. The Hscript works fine and is fast, but it needs arrays and whatnot, so I figured it was a good candidate for replacement with Python. Three lines in, I'm stumped already Basically, if I look at the Hscript help for "opfind" it assures me it has been replaced by hou.node() or hou.Node() which frankly, is some really confusing function naming but I digress. I've looked through the help for both of those functions and can't see anything even vaguely resembling "opfind". Of course I could write my own "opfind" by finding the children of / and then iterating over them, but then I'm writing my own not using "hou.Node()" except peripherally. So, how does hou.Node() replace "opfind"? In the meantime I've given up on making a pure Python script and I'll use opfind with hou.hscript() but that kind of defeats the purpose of my exercise. Is Python in 9.5 still not really a replacement for Hscript? I'm not being negative, just trying to set my own realistic expectations for what it can do. Cheers, Peter B Quote Link to comment Share on other sites More sharing options...
pbowmar Posted September 7, 2008 Author Share Posted September 7, 2008 OK clearly not ready for replacing Hscript but certainly nice to be able to use dictionaries etc. opglob not implemented, no real opfind etc. that's cool, I'm digging the Python Quote Link to comment Share on other sites More sharing options...
graham Posted September 7, 2008 Share Posted September 7, 2008 Unfortunately HOM has changed very little, if at all between 9.1 and 9.5 Quote Link to comment Share on other sites More sharing options...
pbowmar Posted September 7, 2008 Author Share Posted September 7, 2008 Bummer. So, while I'm here, how do I get a spare parameter to evaluate? I have added via Edit Parameter Interface a new parameter, let's say called "buddy" on a Parameter VOP parmvop = hou.node("/whatever/node") print parmvop.parm("parmuniform").evalAsInt() works fine, returns 1 or 0. evalAsString() returns on or off. Perfect! Same thing using "buddy" fails as the parm is returned as a "None" type parmvop.spareParms() returns nothing! Sigh. Quote Link to comment Share on other sites More sharing options...
rdg Posted September 7, 2008 Share Posted September 7, 2008 Like this? >>> me = hou.node('/obj/geo1')>>> me.evalParm("buddy") 0.0 >>> me = hou.node('/vex/surface1/parameter1') >>> me.evalParm("buddy") 0.0 there is also evalParmTuple() for float3 and such. Georg Quote Link to comment Share on other sites More sharing options...
pbowmar Posted September 7, 2008 Author Share Posted September 7, 2008 Yeah, now that it's morning I see the error in my code, it's working fine. I should not code after 10pm it seems Cheers, peter B Quote Link to comment Share on other sites More sharing options...
pbowmar Posted September 7, 2008 Author Share Posted September 7, 2008 Just discovered hou.ParmTemplate including folders for awesome auto-UI building. I'm now sold on HOM Which of course results in some frustration that it's not finished or documented fully However, the asCode() function usually gets me where I want to be. 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.