Exporting a CHOP in a SOP

So I have a L-System at the start of my network and I want to change the random seed at the press of a buttion. I thought this was simple enough to do, I just export a count CHOP to the seed parameter.
That made the program grind to a halt. It did not like it.
After some digging I figured out that the export was making touchdesigner re-evaluate the SOP at every frame so it could check whether the key had been pressed.
So now I’m stuck.
How can I change the value of the random seed in a cpu intensive SOP?

hey @EtherDrawn , this is because the Count CHOP is cooking every frame.
I have attached two possible solutions:

  1. Instead of a Count CHOP, use a Pattern CHOP, set to “random non-repeating integer”

  2. Use the Count CHOP but export to your L-system SOP via Null CHOP set to Selective cooking (this means it only cooks if the value changes)

I recommend option 1, as the selective cooking only at first sight seems like the perfect fix, but it can cause issues when it causes a ‘cooking ripple’ to go through your network.

random_seed_options_that_dont_cook.tox (1.4 KB)

1 Like

That’s great! Thanks for your help. I’m still having problems witht this method however as when I click the button in the .tox you sent it works once and then the CHOP export no longer works.
I tried a clean file and still had the same problem. I tried both an export and a python reference.

I can’t see what the issue is in your network, but here’s an example how to use a reference to a CHOP channel in an L-system SOP - you see every click on the button has an effect in the SOP - does this help?random_number_to_l_system_SOP.tox (1.3 KB)

or if you post your .toe file I can point the issue out to you.

It’s not an issue with my network. It’s whenever I export a button or keyboardin to the pattern CHOP. It happens in the .tox you sent me, on a clean file and in my network. I’m on version 2020.20020

Interesting. That is quite an old build though you’re using, I can’t reproduce that issue on 2021.15800 (current stable release). Does the solution with Count CHOP and selective Null work fine on your machine?

Yeah, you should really upgrade off the 2020.20020 build. That was a first release in 2020 and superseded but another build within weeks as we found some bugs once the first release was public.

It does yeah thank you. I’ll be upgrading soon so hopefully things will work afterwards