Component variables and Constant CHOP values

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.

Here’s my test project Variables_and_Constant_CHOP_values.toe (4.8 KB)

Hi @totally_wired - Matthew here :slight_smile:

What’s your TD build and OS?

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

vars

Wondering if there’s some other difference that might be causing this issue for you

Hi Matthew!

I was running 099 2021.13610 on Windows 10. Now installed 2021.15800 as a parallel build, and oddly enough, works fine on both builds.

Thanks for your help and tutorials!

Gremlins… go figure. :laughing:

Nice example by the way - I love seeing a clear set of steps to try and find / isolate a problem.

1 Like

Welp, I started the tutorial over from scratch with the latest build and I’m getting the same odd behavior. :upside_down_face:
modules_local_variables_and_storage_latest.toe (5.0 KB)

Oh lovely. :sob:

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.

Thanks Matthew!

@totally_wired - gotcha. If you’re thinking about presets, then custom pars, or internal pars are a great way to go.

Here’s a write-up about building a preset system using custom pars:

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!