Hi there
I have very strange stuff happening with python parameter expressions [www.sidefx.com] in string parameters
Basically it seems completly random weither the expression will compute or not. Sometimes the expression will just stay as plain text (the parameter does not become blue), sometimes it does work immediatly.
I've done dozen of HDA for my company, but I still can't find a way to make this work everytime. This is always the one thing that takes me the most time.
Is there a specific thing to do with the interface when adding the python expression? I usually clic in the parameter, alt+e, type my expression then clic "apply" in the houdini edit string window. It does not work.
Doing a right clic on the parameter > Expression > Toggle Expression does not work either.
See exemples of problems in the screenshot:
1/
- string_b should compute and return "exemple text" from string_a
- string_c does compute and return "exemple text" from string_a, but is using `chs()` rather than hou.evalParm()
- string_d does not compute and return "EXEMPLE TEXT"
2/ string_toggle_a should compute and return "toggle is 0"
2/ string_toggle_b should compute and return "toggle is 0"
Can anyone help me on this ?
Python Parameter Expression in string parameters
1835 5 1- BenWall
- Member
- 13 posts
- Joined: April 2019
- Offline
- Andr
- Member
- 900 posts
- Joined: Feb. 2016
- Offline
- tamte
- Member
- 8554 posts
- Joined: July 2007
- Online
its not random, there are certain rules to in which mode the Alt+E editor is opened
but regardless of the initial mode you can easily change it at the bottom
so just make sure it says Python Expression or depending on what you want (Hscript Expression, String)
as to the rules I observed (which may still be the useful for Houdini that don't have that choice exposed yet):
if your parameter is showing raw value (highlighted label) Alt+E will open in Edit Expression mode, using the current nodes language
otherwise it opens as Edit String
but regardless of the initial mode you can easily change it at the bottom
so just make sure it says Python Expression or depending on what you want (Hscript Expression, String)
as to the rules I observed (which may still be the useful for Houdini that don't have that choice exposed yet):
if your parameter is showing raw value (highlighted label) Alt+E will open in Edit Expression mode, using the current nodes language
otherwise it opens as Edit String
Edited by tamte - Feb. 1, 2023 12:33:47
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- BenWall
- Member
- 13 posts
- Joined: April 2019
- Offline
Andr
Try to force set a keyframe with alt+lmb on the parameter and then write the python expression.
See if this helps
That did the trick, thanks a lot!
tamte
but regardless of the initial mode you can easily change it at the bottom
so just make sure it says Python Expression or depending on what you want (Hscript Expression, String)
Is it a feature in the latest version of houdini ? I'm on 19.0.5 and can't find it in the Edit String/Expression window
- tamte
- Member
- 8554 posts
- Joined: July 2007
- Online
BenWallI think it was added in 19.5
Is it a feature in the latest version of houdini ? I'm on 19.0.5 and can't find it in the Edit String/Expression window
the Edit String/Expression window was renamed to just Edit
so if it still says Edit String/Expression than you dont have that feature and you can follow the described rules and see if it holds up for you
Edited by tamte - Feb. 2, 2023 14:44:22
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- t3
- Member
- 8 posts
- Joined: March 2023
- Offline
-
- Quick Links