Skip to content

Instantly share code, notes, and snippets.

View raganmd's full-sized avatar
🚀
do all the things

Matthew Ragan raganmd

🚀
do all the things
View GitHub Profile
float remap(float value, float inMin, float inMax, float outMin, float outMax){
return (outMax - outMin) * (value - inMin) / (inMax - outMin) + newMin;
}
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
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));
}
'''
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:
:: generic format for an autodstart
{pathToTouchDesigner} {pathToToe}
:: -R sets reapeat
:: --fullscreen sets player in full screen mode
{pathToVLC} {pathToFile} -R --fullscreen
#Touch Working files
###################
*.*.toe
CrashAutoSave.toe
TouchDesignerCrash*.dmp
# dependencies
dep/python
# log files #
:: 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
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))
:: 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