Automatically setting every new TOP to "Nearest" and 32-bit RGBA with OP Find DAT

Here’s how to have all new TOPs automatically be “Nearest pixels” and 32-bit RGBA:

More info in Elburz’ and Paketa12’s video (@11:58):

  1. Create an OP Find DAT
  2. Under the OP Find DAT’s “Families” page, only TOP should be active.
  3. At the bottom right of OP Find, expand its callback DAT.
  4. Inside of it, delete the existing code, and this code instead:
def onFindOPGetInclude(dat, curOp, row):
	curOp.par.inputfiltertype = 0
	curOp.par.filtertype = 0
	curOp.par.format = 4
	
	return True

Here’s where I got the settings from:

Now, all TOPs I create will have these settings.
If you want more control, the script can apply only to a certain path, for example.

2 Likes

Good trick! For forward compatibility you should use the string names for those menu entries though, since the menu contents may change in the future and the indices may change.

Thanks! I found the string names on the wiki: TouchDesigner Documentation

Now the code is much more readable:

def onFindOPGetInclude(dat, curOp, row):
	curOp.par.inputfiltertype = "nearest"
	curOp.par.filtertype = "nearest"
	curOp.par.format = "rgba32float"
	
	return True
1 Like

Great! Another trick to find the names is to just hold your mouse over the parameter name when the entry is selected. It’ll show you the name of the currently selected entry.

1 Like