Skip to content

Instantly share code, notes, and snippets.

Avatar

Matthew Ragan raganmd

View GitHub Profile
View glslRemap.glsl
float remap(float value, float inMin, float inMax, float outMin, float outMax){
return (outMax - outMin) * (value - inMin) / (inMax - outMin) + newMin;
}
View sumRowExample.py
def onCellChange(dat, cells, prev):
for eachCell in cells:
if eachCell.col == 0:
if eachCell == 1:
targetRows = dat.row(eachCell.row)
sumOfRows = sum([int(val) for val in targetRows[1:]])
op('table2')[eachCell.row, 0] = sumOfRows
return
View coordsFor2DArray.glsl
ivec3 CoordsFrom2DArray( vec3 size, int id ){
float xCoord = mod(float(id), size.x);
float yCoord = fract( (float(id) / (size.x * size.y)) ) * size.y;
float zCoord = (float(id) / (size.x * size.y * size.z)) * size.z;
return ivec3(int(xCoord), int(yCoord), int(zCoord));
}
View menuFromMOD.py
'''
used in a custom parameter for a menu. Example syntax would be:
me.mod.datMenuMOD.MenuFromChildren(op('someOp'), parName)
where null_menu is a table with at least two columns:
name
label'''
class MenuFromChildren:
View TouchDesignerAutoStart.cmd
:: generic format for an autodstart
{pathToTouchDesigner} {pathToToe}
View startVLCWindows.cmd
:: -R sets reapeat
:: --fullscreen sets player in full screen mode
{pathToVLC} {pathToFile} -R --fullscreen
View td-gitignore
#Touch Working files
###################
*.*.toe
CrashAutoSave.toe
TouchDesignerCrash*.dmp
# dependencies
dep/python
# log files #
View td19-summit-win-batch.cmd
:: echo
:: Display messages on screen, turn command-echoing on or off.
:: "%~dp0"
:: The %~dp0 (that's a zero) variable when referenced within a Windows batch file will expand to
:: the drive letter and path of that batch file. The variables %0-%9 refer to the command line
:: parameters of the batch file. %1-%9 refer to command line arguments after the batch file name.
:: %0 refers to the batch file itself.
:: as a note this CMD or BAT needs to run as admin in order to work correctly
View python-env-var-example.py
import os
toe_file = 'path\\to\\your\\file.toe'
# set environment variable
toe_env_var = 'controller'
os.environ['STARTUP'] = toe_env_var
os.startfile(toe_file)
print("startting file with {}".format(toe_env_var))
View env-var-example.cmd
:: echo
:: Display messages on screen, turn command-echoing on or off.
:: "%~dp0"
:: The %~dp0 (that's a zero) variable when referenced within a Windows batch file will expand to
:: the drive letter and path of that batch file. The variables %0-%9 refer to the command line
:: parameters of the batch file. %1-%9 refer to command line arguments after the batch file name.
:: %0 refers to the batch file itself.
:: as a note this CMD or BAT needs to run as admin in order to work correctly