python node force cook every frame?
4583 5 0- aoakenfo
- Member
- 28 posts
- Joined: Nov. 2015
- Offline
- Enivob
- Member
- 2537 posts
- Joined: June 2008
- Offline
Python is kind of ‘lose’ as far as scrubbing refresh goes. I have not yet been able to get full update when scrubbing, but you can get full update when rendering or exporting of you populate the Pre-Frame or Post-Frame script of any ROP.
Here is the code, replace the path with the path to your Python node and python def.
PS: Don't forget to switch the script field from the default language of Hscript to Python.
Here is the code, replace the path with the path to your Python node and python def.
exec(hou.node("/obj/subnet1/pythonscript1").parm('python').eval());myDef("my_data_if_any")
PS: Don't forget to switch the script field from the default language of Hscript to Python.
Edited by Enivob - April 16, 2017 19:30:02
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
- aoakenfo
- Member
- 28 posts
- Joined: Nov. 2015
- Offline
Thanks for the response. However, it's not really the direction I'm looking to go.
My original intent was to accumulate an arbitrary value over frames, much like @Frame or @Time. I banged my head with detail once and timeshift until I realized everything I was doing was effectively constant (unchanged). The same graph is evaluated every frame, so all the same values are calculated every frame, and nothing carries over. At least, that's my current mental model.
My next thought was to flush those values to disk, to persist them between frames. And that's where I am. I'm new to Houdini, and probably abusing it, so any advice is appreciated.
My original intent was to accumulate an arbitrary value over frames, much like @Frame or @Time. I banged my head with detail once and timeshift until I realized everything I was doing was effectively constant (unchanged). The same graph is evaluated every frame, so all the same values are calculated every frame, and nothing carries over. At least, that's my current mental model.
My next thought was to flush those values to disk, to persist them between frames. And that's where I am. I'm new to Houdini, and probably abusing it, so any advice is appreciated.
Edited by aoakenfo - April 16, 2017 20:24:16
- BabaJ
- Member
- 2041 posts
- Joined: Sept. 2015
- Offline
- Enivob
- Member
- 2537 posts
- Joined: June 2008
- Offline
Hmm…this code worked for me in a quick test. I clicked Play and a bunch of numbers accumulated.
I think the problem in your first posted code is that you are passing the ‘w’ parameter. Passing the ‘a’ parameter allows for appending to existing file as well as creating it if it does not exist.
with open(r"C:\Users\YourUserName\Desktop\foo.txt", "a") as f: f.write(hou.expandString("$F"))
Edited by Enivob - April 16, 2017 21:32:49
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
- aoakenfo
- Member
- 28 posts
- Joined: Nov. 2015
- Offline
-
- Quick Links