Hi all,
i would like to pulse a button each time a value has changed. How can i archive that?
Thanks in advance
Christian
Hi all,
i would like to pulse a button each time a value has changed. How can i archive that?
Thanks in advance
Christian
Assuming that youâre working with an operator that has a parameter that can be pulsed, youâll probably want to do this with an execute - CHOP execute DAT, or DAT execute DAT.
These run a script based on the parameters you set.
An operatorâs parameters can be accessed with the .par method. For example. Add a constant chop to your network, make sure itâs named âconstant1â. Add a text DAT and try the following script:
op( 'constant1' ).par.value0 = 1
Right click on the text DAT and select Run. Looking closer at the constant CHOP hit the plus sign on the parameters window - itâs in the upper right next to the bullseye. This will expand all of the parameters.
Youâll notice that in the expanded view that there are string names for the parameters on the left hand side in gray.
name0
value0
name1
value1
These are the par names that you use when accessing a parameter through a script.
Going back to our first example, you could change the name of the first channel in the constant CHOP with:
op( 'constant1' ).par.name0 = 'nice_work'
Provided that the above makes sense. Add a trigger CHOP to your network, in the text DAT try the following:
op( 'trigger1' ).par.triggerpulse.pulse()
triggerpulse is the name of the parameter, and .pulse() is the method used to pulse that parameter.
From here you can begin to think about how a change in your network will trigger this kind of operation. You can take a look at the attached example to see how that works with a simple button.
base_pulse_method_example.tox (1.54 KB)
Hi Matthew
Thx for reply! Will check as soon as I can
Greets
Christian
Hey @raganmd, im working on a Program where i need to extect one Pulse, everytime a Slider ( or a Math Chop) chances its value, how can i do that?
Hi @jjoonnas,
can you describe what you mean by value change? Generally a value change would be when the value of a CHOP changes over the time of 1 frame. Meaning if you manually drag a slider over the course of 7 frames, then technically the value changes every one of these 7 frames.
For this case, you could use a CHOP Execute DATâs âOn Value Changeâ callback or a Logic CHOP with its Convert Input
parameter set to âOn When Value Changedâ.
Otherwise using the Logic CHOP as described and adding a CHOP Execute DAT to it using the âOn Off To Onâ callback, would allow for running scripts only ones per change event (which could last multiple frames)
cheers
Markus
Hey, i figured it out by now. Im just starting in Touchdesigner, so i didnt know all the possibilities. I just used a Logic CHOP, it worked perfectly. Thanks thoo!!!