Callbackscript. Know previous value.

   1347   2   0
User Avatar
Member
339 posts
Joined: June 2013
Online
Hi
I tried to do a setup today where a callback script would do something based on the previous and new value of the parameter. Since evaluating the parameter returns the new value, I come up with a contraption where I have a second hidden parameter which sole job is to track: on callback evaluation, get the previous exposed parameter former value and receive the new value on the last execution of the callback.

This is hacky, not scaling well and while works ok for one parameter as I started to think I might need something similar for multiple parameters I was like… “Hold up”… So…

Is there a proper way the old and new value of a parameter. If not is there another proper way to track the old values that lives in the asset?


Thanks
Pedro
User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
maybe you could retrieve last value from detail array attribute that you update after the callback?

but I'm not sure how does it compare performance-wise..
Edited by Andr - Aug. 3, 2019 07:57:40
User Avatar
Member
178 posts
Joined: Jan. 2013
Offline
Use the cachedUserData method on a node to store intermediate values(or userData if you want it to be saved with the HIP):

https://www.sidefx.com/docs/houdini/hom/nodeuserdata.html [www.sidefx.com]
  • Quick Links