How Hscript and Expressions are different?
5014 6 2- sweetroll
- Member
- 28 posts
- Joined: Sept. 2019
- Offline
Hi, I'm new to houdini and found concept of Hscript and Expressions quite confusing for me. I could find out there were several languages such as Python, VEX, Hscript etc for Houdini. Maybe this is a stupid question but it's pretty confusing to me whether Hscript is Expressions or they're different while they're compatible each other (like Expressions as a distinct language itself). I googled and found some answers but I couldn't get clear answer yet. In some sources it seemed they were explaining as if Hscript was something distinguishable from Expressions while it seemed some others were explaining otherwise. I was studying Hscript and felt like I couldn't put this curiosity back anymore.
- jlait
- Staff
- 6220 posts
- Joined: July 2005
- Offline
It isn't a stupid question.
hscript is a shell-like language, similar to csh or bash.
However, when you use back-ticks to escape it doesn't run shell commands, but a separate expression language. This is also the language that is used by default in parameters.
If you open a textport in Houdini (Windows::Textport) and type
3 + 2
it doesn't work because it tries to run the command 3
But
echo `3 + 2`
will invoke the expression language and evaluate 3+2.
I tend to call the expression language EXPR, but most people will just call it HScript. But I think it is simplest to think of there being Python VEX, Hscript, and Hscript Expressions as separate languages to learn. It is likely you don't have to learn HScript, only Hscript expressions, for example. Most of what hscript did is better done with python.
Our goal was to remove both Hscript and Hscript expressions and replace them with Python. Due to performance issues, however, HScript Expressions are likely to stick around.
hscript is a shell-like language, similar to csh or bash.
However, when you use back-ticks to escape it doesn't run shell commands, but a separate expression language. This is also the language that is used by default in parameters.
If you open a textport in Houdini (Windows::Textport) and type
3 + 2
it doesn't work because it tries to run the command 3
But
echo `3 + 2`
will invoke the expression language and evaluate 3+2.
I tend to call the expression language EXPR, but most people will just call it HScript. But I think it is simplest to think of there being Python VEX, Hscript, and Hscript Expressions as separate languages to learn. It is likely you don't have to learn HScript, only Hscript expressions, for example. Most of what hscript did is better done with python.
Our goal was to remove both Hscript and Hscript expressions and replace them with Python. Due to performance issues, however, HScript Expressions are likely to stick around.
- tamte
- Member
- 8592 posts
- Joined: July 2007
- Offline
jlaitfor this reason it would be nice to expand docs a bit to describe syntax of hscript expressions, since the art of doing {} multiline hscript expressions is almost lost because there are no docs for it and one can't just use ‘if’ syntax from HScript
Due to performance issues, however, HScript Expressions are likely to stick around
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- jpparkeramnh
- Member
- 178 posts
- Joined: Jan. 2013
- Offline
I “rediscovered” Hscript a little bit recently when using it to run Houdini in terminal mode instead of Hython. As a shell-like experience I find it nicer than using Python as the syntax is cleaner and easier to type, for example when listing the contents of a network and rendering:
Python:
Hscript:
Python:
o = hou.node('/out') print o.children() o.node('mantra1').render()
Hscript:
cd /out ls render mantra1
- sweetroll
- Member
- 28 posts
- Joined: Sept. 2019
- Offline
- jpparkeramnh
- Member
- 178 posts
- Joined: Jan. 2013
- Offline
- Mike_A
- Member
- 184 posts
- Joined: Aug. 2018
- Offline
-
- Quick Links