複製したオペーレーターの出力を自動的につなげる方法 / How to automatically connect the outputs of duplicated operations.

Relicator COMPで複製したオペレーターを任意のオペレーターのInputに自動的につなげる方法。複製する個数を変える度に、手動でつなげなくて良いので便利。

1は、自分の連番を元にした角の数の多角形を描画する3base1を複製、5layout1は、複製された多角形をグリッド上に配置している。

複製されたオペレーターを自動的につなげるには、2のスクリプトを以下の様に書く。

def onRemoveReplicant(comp, replicant):

	replicant.destroy()
	return

def onReplicate(comp, allOps, newOps, template, master):

	for c in newOps:
		#c.display = True
		#c.render = True
		#c.par.display = 1
		#c.par.clone = comp.par.master
		c.outputConnectors[0].connect(op('layout1'))
		pass

	return

13行目で、OPを生成する度に、5layout1に接続している。

サンプルファイル

https://github.com/arkwknsk/touchdesigner/blob/master/tips/replicator/replicator.toe