Adding/Removing Blocks via Python in MathCombine POP

Hello everyone,

I have a very specific question regarding the automation of the MathCombine POP component in TouchDesigner.

**Is it possible to programmatically add or remove blocks (combine parameter ) via Python in the MathCombine POP?
**
Thank you in advance for your assistance.

Check the docs for the sequence class here:

1 Like

The trick is to directly manipulate the hidden parameter numBlocks, which controls the number of input blocks (rows) in the operator.

To add a block (increment the number of inputs), you use the following Python expression:

Python

op('mathcombine1').seq.comb.numBlocks += 1

And, for completeness, to remove a block (decrement the number of inputs):

Python

op('mathcombine1').seq.comb.numBlocks -= 1

You can also remove a specific block by passing the index to the destroyBlock(block) function.

op('mathcombine1').seq.comb.destroyBlock( 3 )