Extension property doesn't update in expression

Using the TOX file attached in this post: console in a texture? [ 099 component ] - #3 by raganmd

The parent().StartRow expression in the Select DAT doesn’t update until I force cook it. But I do see the correct value when I type op.DP.StartRow in the Textport. I see this issue in 2021.16124 and also 2021.38110.

Those properties are in the init function of the extension, so the extension requires initialization to update. If you want that variable to be dynamic, you’d be better off creating a custom parameter for Startrow, and then referencing parent().par.Startrow in your selectDAT

You will need a dependable. As StartRow is in fact just a simple variable, touchdesigner does not know when to recook the refferencing parameter,
Instead of self.StartRow = initital_value write self.StartRow = tdu.Dependency( initital_value )
Now, when you set the value of self.StartRow via self.StartRow.val = changed_value it notifies all parameters etc. that subscribed to that property to recook.
https://docs.derivative.ca/Dependency_Class

1 Like

Thank you, making it a Dependency works. I just wonder why it was working for @raganmd when he made this. That was a few years ago so maybe things have changed.

This TOX is more than 4 years old now - at the time I wasn’t using dependencies, and a few elements in Touch behaved differently. Out of curiosity I checked the wiki history, and the dependency class doesn’t show up in the wiki until august of 2017:

I’d almost bet that I was using a stable build of Touch when making this example, and didn’t even think to use dependency objects. LOTS of python optimization has happed in the last 4 years - and it could be that members used to be non-optimized, which would have allowed this to work - I honestly don’t remember :sweat_smile:

@alphamoonbase’s suggestion to use dependencies does the trick, you could also choose to update the select pars directly. These days I’d probably create custom pars for the start / end rows - reference those with the select, and then drive those pars with the extension.