Is the expression language in Houdini Hscript?

   6383   5   0
User Avatar
Member
131 posts
Joined: Oct. 2011
Offline
Hi,

I am trying to read the docs on the expressions and it seems to suggest using python, but are the expressions such as bbox, ceil, etc that you type into parameter fields, hscript or is this just a separate expression language?

Also I am watching the SideFX tutorial vids but haven't seen them use python instead of these. I am just curious how the python version looks. I assume it wouldn't be as short?




Thanks.
User Avatar
Member
168 posts
Joined:
Offline
You have

boundingBox(self) → hou.BoundingBox
Return an axis-aligned 3D bounding box that is sized and positioned to be large enough to hold this geometry.

and Pythons command:
math.ceil()
Albert
User Avatar
Member
1390 posts
Joined: July 2005
Offline
Fact is, these things are little messy in Houdini, but after some period you can really get use to it. Nothing like a +10 years of software development. And Houdini still opens very old hip files

If you open a textport in Houdini (ALT+T) and search for a help for your expression:

/-> exhelp bbox

at the start of most pages there is a “REPLACED BY”, like this one:


/ -> exhelp bbox
float bbox (string surface_node, float type)
REPLACED BY
hou.Geometry.boundingBox()

Returns bounding box information for a surface node.

The <type> can be one of D_XMIN, D_YMIN, D_ZMIN, D_XMAX, D_YMAX, D_ZMAX,
D_XSIZE, D_YSIZE, or D_ZSIZE for the corresponding values of the
bounding box.

RELATED
* centroid


So, if you know the hscript expression an look for its Python equivalent this is probably good starting point.

One nice thing I usually do, when I feel like I'm lost is to search the expression by a key word:

exhelp -k ceil


As to my personal preferences I hardly ever use Python for expressions. Hscript is much more handy for a single line stuff.
User Avatar
Member
131 posts
Joined: Oct. 2011
Offline
Thanks guys. I was watching the vid tutorials here:
http://www.sidefx.com/index.php?option=com_content&task=blogcategory&id=192&Itemid=346 [sidefx.com]

And I didn't see them using python expression (not that I blame). Also I assume if you were to use python, then the icon on the top right of the parameters pane has to be changed to Python?

Also would there be any performance difference purely for expressions? Python is nice but long function calls might reduce some readability i think, because of limited field space.

I wonder if it would be possible to sort of alias the old hscript expression calls with python ones. Not really sure.




Cheers.
User Avatar
Member
168 posts
Joined:
Offline
If for eg. You need to loop throw list of nodes and perform some operation then you will have to use python.
If for eg. you need quick access to bounding box of the object, it will be easier and quicker to use hscript.

Yes, when you want to use python on some node, you will have to swich from hscript so you will have python icon in the corner
Albert
User Avatar
Member
131 posts
Joined: Oct. 2011
Offline
Thanks tmdag, that's a very good guideline.
  • Quick Links