View td-set-custom-pars-to-default.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def reset_defaults(touch_designer_operator:OP) -> None: | |
# get our custom parmameters for an operator | |
custom_pars = touch_designer_operator.customPars | |
# loop through all pars and reset them to their defaults | |
for each_par in custom_pars: | |
touch_designer_operator.par[each_par.name] = each_par.default | |
# to use this function, you pass in an operator - below is an example of how | |
# to reset the custom pars on an operator called `base1` |
View script_top_download_img_cb.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# me - this DAT | |
# scriptOp - the OP which is cooking | |
import cv2 | |
import numpy | |
import requests | |
# press 'Setup Parameters' in the OP to call this function to re-create the parameters. | |
def onSetupParameters(scriptOp): | |
page = scriptOp.appendCustomPage('Custom') |
View python-reqs.cmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@REM Example of how to install a collection of python externals | |
@REM into a project directory | |
@REM set python install destination | |
set FILEDEST=%~dp0python-libs | |
@REM pip install commands for the python version for TouchDesigner | |
@REM This assumes we've already installed the coresponding version of python | |
@REM on Windows |
View scriptDAT-isDefault.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# me - this DAT | |
# scriptOp - the OP which is cooking | |
# | |
# press 'Setup Parameters' in the OP to call this function to re-create the parameters. | |
def onSetupParameters(scriptOp): | |
page = scriptOp.appendCustomPage('Custom') | |
p = page.appendOP('Targetop', label='Target Operator') | |
return | |
# called whenever custom pulse parameter is pushed |
View json-handler.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
def Json_to_dict(json_file): | |
'''converts json to a python dictionary | |
''' | |
with open(json_file, 'r') as target_file: | |
json_dict = json.load(target_file) | |
return json_dict | |
def Save_dict_to_json(input_dict, json_file): |
View insideBox.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
View TD-Python-style.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on PEP8 | |
# Classes | |
SomethingClass | |
class Foo: | |
# Public Methods and Functions | |
Something_public_method |
View bezier-snippet.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bezier | |
import numpy as np | |
# press 'Setup Parameters' in the OP to call this function to re-create the parameters | |
def onSetupParameters(scriptOp): | |
page = scriptOp.appendCustomPage('Custom') | |
p = page.appendFloat('Val1', label='P1', size=3) | |
page = scriptOp.appendCustomPage('Custom') | |
p = page.appendFloat('Val2', label='P2', size=3) |
View td_par_helper_class.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class par_helper: | |
'''A generalized parameter helper for simple par callbacks | |
The intention of this extension is to provide a slim interface | |
for easily scritable actions intended to be connected to custom | |
changes. The model assumes that the developer would like to | |
call a scriptable action whose function name matches the parameter | |
name. | |
''' | |
def __init__(self, my_op, actionsMOD, debug=False): |
View _startProject.cmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
rem turn off echo | |
rem set TouchDesigner build numbers | |
set TOUCHVERSION=2021.10330 | |
rem set our project file target | |
set TOEFILE="dev-env.toe" | |
rem set the rest of our paths for executables |
NewerOlder