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) |
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): |
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 |
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
projectDep = f'{project.folder}/td-python-dep' | |
if projectDep not in sys.path: | |
sys.path.append(projectDep) | |
for each in sys.path: | |
print(each) | |
else: | |
pass |
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
py -{versionNumber} -m pip install {module} --target="{pathToTargetDir}" | |
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=2020.26630 | |
rem set our project file target | |
set TOEFILE="project.toe" | |
rem set the rest of our paths for executables |
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 requests | |
dataURL = 'https://www.purpleair.com/json?show=182&fbclid=IwAR17uHJ8zpHcj7nwipL7_KRleF8uj9DEZ3Gqz-8AfQwVVC7rYdfWC61aM0Q' | |
rawData = requests.get(dataURL) | |
msg = rawData.json() | |
results = msg.get('results') | |
for eachDict in results: |
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 tduDist(point1, point2): | |
p1 = tdu.Vector(point1) | |
p2 = tdu.Vector(point2) | |
return p1.distance(p2) |
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 numpy | |
def numpyDist(point1, point2): | |
p1 = numpy.array(point1) | |
p2 = numpy.array(point2) | |
return numpy.linalg.norm(p1-p2) |
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 math | |
def distance(x1, y1, z1, x2, y2, z2): | |
return math.sqrt((x2 - x1)**2 + (y2 - y1)**2 + (z2 - z1)**2) |