→ float or string
Many node algorithms involve iterating over a series of points (or primitives or vertices, but we’ll use points for the examples). These nodes evaluate their parameters for each point, setting a variable that you can access from an expression in that parameter to a value specific to that point. For example, the TX variable is set to evaluate to the X value of the position of the current point. These variables are called local variables because they are local to the expressions inside parameters in the node.
In the Hscript expression language, you use $ to evaluate local variables,
just like how you evaluate global variables. In Python, you use
the lvar function. So, the Python equivalent of
Inside a parameter expression you can drop the
hou. prefix from the
call to lvar, since Houdini implicitly runs
from hou import * when
it evaluates expressions.
If you call this function from outside a parameter expression it will raise hou.NotAvailable. If you call it with an invalid variable name, it will raise hou.OperationFailed. Note that you cannot use this function to evaluate Houdini global variables; instead use hou.expandString().
Note that hou.SopNode.curPoint() and similar methods on the hou.SopNode and hou.PopNode classes return the current point that the node is iterating over. Using the point, you can evaluate attributes, etc, to perform the equivalent of a local variable. You can also access information that may not be accessible through local variables.