In Python we have something like hou.expandString() to evaluate string with ie. env variables. In VEX is kinda works automatically, but not when I use chsraw().
Please taka a look at screenshot.
I would like to get the raw string from parameter, do some string modification, and write it to attribute as an expanded(evaluated) version of string. $JOB should expand to path. I am puzzled why it doesn't.
I saw in some old post that there used to be eval() and evals() functions, but they are no more.
Use chs() rather than chsraw() if you want Houdini to expand aliases. Is there some particular reason you're favouring chsraw()? You can still perform string manipulation shenanigans - this works, for example:
I would like to replace '.$F4.' with @primnum. If I use chs(), then I wont have frame padding pattern, it will be expanded to current frame. Once I manipulate string, I would like to write it to @path in expanded form.
On the bright side, I got it working in PythonSOP. Just curious what happened to evals() and what is the replacement method.
I would like to replace '.$F4.' with @primnum. If I use chs(), then I wont have frame padding pattern, it will be expanded to current frame. Once I manipulate string, I would like to write it to @path in expanded form.
On the bright side, I got it working in PythonSOP. Just curious what happened to evals() and what is the replacement method.
Thanks!
why not use a different token than "$F4" for the file number? Use a c format string, "%04d", and then use sprintf to format with the frame number.
To be even more accurate and still on point with my problem, I actually use '${F}'. This is what is generated by File - Geometry parameter, so I want to make it easy for users. They just pick the sequence and don't worry about pattern.
tas3d To be even more accurate and still on point with my problem, I actually use '${F}'. This is what is generated by File - Geometry parameter, so I want to make it easy for users. They just pick the sequence and don't worry about pattern.
Yeah, I can see wanting to allow users to use the file chooser. In that case, you might need to use two path parameters. One exposed to the user, and another with an expression that does the substitution. Then vex only sees the evaluated path with the substituted token.
I would like to replace '.$F4.' with @primnum. If I use chs(), then I wont have frame padding pattern, it will be expanded to current frame. Once I manipulate string, I would like to write it to @path in expanded form.
On the bright side, I got it working in PythonSOP. Just curious what happened to evals() and what is the replacement method.
Thanks!
For this particular case abspath() and relpath() would work. They expand path variables.
yeah, sorry ) I was confused by the fact that literals are already expanded in vex. Looks like there's no runtime evaluation of string (and hscript in general).