I try to do some modifications on a flux given by a CHOP node with expressions but although thi may sound a bit basic I cannot find any example on that.
Basically I have a Null CHOP outputing a flux named Chan1 and I would like to apply some math on it like clamping according to some conditions etc. It could be done in an Expression CHOP but as the code takes a few lines it is not very manageable. I then would like to use an DAT “CHOP Execute”, which seems to be convenient for that (is it?).
How can I get the Chan1 held by the parameter From Component (set to the Null CHOP), modify it and output it?
Is there a variable like $V or something I can use?
How to output it regarding the fact that the Execute does not have a channel output?
Try the example I attached. In the CHOP Execute DAT I added an
echo $args
statement so you can open the textport to see all the arguments that the CHOP Execute DAT spits out.
Then I used a Dat to CHOP to get the result from a DAT back into CHOPs, but you can also go direct to a CHOP using a script as shown.
As for TouchDesigner jargon, I think what you are referring to as “flux” we call channels?
Let me know if that’s what you were looking for. conditional.tox (798 Bytes)
Thank you very much to both of you: I wanted to provide more details to Elburz this morning when I saw Ben’s post.
Ben, in spite of my “generalist” termilology (I am often playing with several node based applications so I am a bit slow to get the one of TD) you got it right
It does exactly what I was looking for. I also really appreciate you put 2 ways of doing the same thing, that really helps me to understand how things work.
Considering the 2 ways, I guess the “direct to chop” approach is the more efficient, isn’t it? I say that because as a string conversion is often a bit costy and that’s how the DAT to CHOP works.
Looking to the graph produced by the 2 solutions, and from a newby point of view, I find it a bit disturbing to have like a “flux disruption” in the channel path. Indeed there is no visual connection between the DAT Execute and its outputs and the graph seems less easily readable.
Wouldn’t it be convenient to have a “script CHOP” with channels as inputs and outputs? Or maybe to modify the Expression CHOP to be able to put a script of several lines instead of just an expression?
Anyway those examples are really on the point and that’s exaclty the kind of examples that would help to get the concepts if in the documentation.
[b]May I suggest to add it in the CHOP Execute doc page? /b
Hey werwack,
The good news is that there is a Script CHOP in 088, which uses Python and can take any number of CHOPs as inputs and can create channels however you see fit.