Jump to content

$ @ ` ch op HOM HSCRIPT VEX

Recommended Posts

I'm trying to learn houdini, and one thing which I'm getting really stuck at is the syntax and (apparent) inconsistency of expressions / snippets of code - or at least there's so many little idiosyncrasies that it's driving me nuts.


I've looked around as much as I can in various documentations, but couldn't find a single piece of text which describes an overview of all of these things, instead the info is scattered all over the place, probably because some of these are legacy and dates back decades while others are quite new. 


As far as I understand:

$ is for global variables (in HSCRIPT ? and python too? are there substitutes for VEX?)

@ is for attributes in VEX (is it possible to access attributes in HSCRIPT?)

ch is for referencing a channel (i.e. a parameter of something from the GUI?) (is this HSCRIPT? or PYTHON?)

I'm still not sure what op or ` (backtick) are for or when to use them.


What I'm after is a very short (hopefully not more than a few sentences per item) summary of what each of these things are, and in what context we are supposed to use them. 


Also, what is the context of what we enter into textfields? E.g. when I write sin($T) into the position of an object. Is this HSCRIPT? or Python? Or is that a Houdini Expression which is a whole other context separate to HSCRIPT?






Share this post

Link to post
Share on other sites

Yes you are right. The differences in syntax can be very confusing at first. I will try to answer your questions as best and short as I can:


In vex wrangle nodes you can access some global variables with the @ syntax ($F = @Frame).

As a workaround you can always create a parameter and reference that in vex. In the parameter field you can specify your global variables.


I'm not sure it's possible to access those attributes in HSCRIPT directly. Anyway I would recommend using Python or VEX for these purposes.


ch can be replaced by opparm in HSCRIPT and hou.node().evalparm() in python


op is for referencing operators instead of parameters. This can be used in string parameters which expect a Houdini operator as an Input and in several other places.


The backticks are used if the expression would otherwise be used literally. This is the case in string parameters. you need the backticks to evaluate the expression first and use the result as a string.


$T is an expression. Expressions are separate from HSCRIPT as you have to precede an expression with the echo command in the textport to evaluate it.


I hope this information is helpful to you.


P.S.: Yes, the information is scattered across the documentation, but it's all there. I suggest you try to find the stuff in the docs. You might stumble across some more interesting stuff and learn a thing or two.




Edited by dennis.weil

Share this post

Link to post
Share on other sites

Hi thanks, yes it is very useful thanks. It's still a bit confusing having so many different syntax / languages used in the same space, but I guess it's a matter of time. 

Share this post

Link to post
Share on other sites

Someone counted 5 languages in Houdini so which makes it frustrating for sure. I've been at it 2+ years and it constantly catches me out. Remembering the iterations of "position" alone are a nightmare. VEX seems to be the future and seems fairly straightforward but for the most part SideFX's approach to UX has always completely baffled me.   

Share this post

Link to post
Share on other sites

Yes last time I tried houdini (I think it was v10), Python was just beginning to appear and everything wasn't implemented yet (documentation was full of 'coming soon'), so you still had to use HSCRIPT and oldschool $Expressions in many places. I think now it seems it's fully integrated so HSCRIPT can become obselete and I will just stick to Python for everything operational (and VEX for anything kernel based).

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now