Hi, I’m following ‘THP 494/589 | A little about Modules, Locals, and Storage’ by Matthew Ragan and in this part I’m getting a different result when using a component variable to drive the value of a Constant CHOP.
In the video referencing a variable seems to be enough to make the Constant cook whenever the variable changes, while in my case the Constant cooks only once, getting stuck at the value the variable had the moment the reference was made. The workaround I found was using an Execute to force the Constant to cook with cook(force=True), but I’m wondering if this is a reasonable solution.
In any case this is just for the sake of experimenting, I suspect this may be a deprecated technique considering the tutorial is a bit dated.
Looking at your toe file, this still looks like it’s behaving correctly - for me constant1 that has var expressions works both for the LFO and the slider.
Windows 10
099 2021.15800
Wondering if there’s some other difference that might be causing this issue for you
On a side note - these days I’d usually encourage folks to use custom pars on or internal pars for these kinds of uses.
Like you noted, this video is a bit dated now, and expressions like me.var() come from a time when python was starting to take over from T-Script in TouchDesigner. I’d bet if you downloaded the old version of touch from when this tutorial was made it’d work like a charm.
As your experimenting and thinking about how to track variables for your projects these days, I’d look at both Custom Pars and Internal Pars. They’re both easier to create and manage, and support binding, which makes a huge difference when working with variables.
Oh, I see. Ultimately I’m looking for a reasonable way of implementing a preset system -collecting parameter values, storing and recalling them- in a large project I’m working on, so I’ll look at the alternatives then.
Wow fascinating.
I really like the idea of saving the data to a.json file, I’ll give it a try. Started implementing custom pars and so far so good.
Thanks again!