Hi everyone!
I am working on a little python tool that sets file node output paths. For this I want to put in the expression $F4 for frames, however, if I try to just naively add the string ‘$F4’ python evaluates the expression before it enters it and puts in the actual static frame number ‘1001’ instead of the expression ‘$F4’.
What would be the syntax to tell python to just paste the raw string into the parameter instead of trying to evaluate the expression?
Thanks for the read!
Set raw value with python
3269 4 0- underscoreus
- Member
- 24 posts
- Joined: 7月 2017
- Offline
- jerry7
- Member
- 629 posts
- Joined: 11月 2013
- Offline
- underscoreus
- Member
- 24 posts
- Joined: 7月 2017
- Offline
jerry7
If you want set parameter, just set it.hou.parm('/out/mantra1/vm_picture').set("$HIP/$F4.jpg")
If you want get raw value of parameter,print hou.parm('/out/mantra1/vm_picture').rawValue()
Here is the code I am running:
val = "$F4" updateie = hou.node("/obj/geo1/box_in") updateie.parm("file").set(val)
The file path the node gets is:
“0000”
So it seems as though the “$F4” is evaluated to be “0000” instead of the plain text “$F4”.
- tamte
- Member
- 8602 posts
- Joined: 7月 2007
- Offline
- underscoreus
- Member
- 24 posts
- Joined: 7月 2017
- Offline
tamte
try thisval = "\$F4"
however this almost sounds like you are using Python SOP, which would not be a good idea for a tool that sets parameters or interacts with the scene
Ah! I completely forgot about the ‘\’ escape character! Thanks Tomas.
Also, to answer the question you didn't directly make, it's a python script node in TOPS. Its meant to update SOP level file node paths as they are simmed in TOPS so I am always sure I am looking at the latest cache. It can get a little hairy since I have 3 caches that are building on each other. So I need to make sure my constraint cache is the latest version before I sim my RDB and then that my RBD sim is the latest before I sim my secondaries.
I basically just got tired of jumping all around my network updating the file parameters, so now this python node does it for me as the TOP net is making the caches on the go
Thanks again!
Edited by underscoreus - 2020年3月20日 23:12:10
-
- Quick Links