Jump to content

Hscript replacements in Python?


pbowmar

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...