Skip to content

Function Reference

Ulysses Popple edited this page Nov 18, 2017 · 2 revisions

Utility functions

float

float :: Float -> Tree Float

Make a Haskell Float usable by LambdaDesigner.

int

int :: Int -> Tree Int

Make a Haskell Int usable by LambdaDesigner.

bool

bool :: Bool -> Tree Bool

Make a Haskell Bool usable by LambdaDesigner.

str

str :: String -> Tree ByteString

Make a Haskell String usable by LambdaDesigner as a python string.

bstr

bstr :: String -> Tree ByteString

Make a Haskell String usable by LambdaDesigner as a python expression.

ternary

ternary :: Tree Bool -> Tree a -> Tree a -> Tree a

Create a ternary python expression.

scycle

scycle :: Float -> Float -> Tree Float

Cycle from 0 to the second argument at a speed of seconds multiplied by the first argument.

sincycle

sincycle :: Float -> Float -> Tree Float

Same as scycle but cycling in a sin pattern.

Mathematical operators

Note: These might cause an error in python if you try to multiply expressions that can't be multiplied together.

(!+)

(!+) :: (Show a) => Tree a -> Tree a -> Tree a

Add two python expressions together. (float 1) !+ (float 2) works, as does (str "hello, ") !+ (str "world")

(!*)

(!*) :: (Show a) => Tree a -> Tree a -> Tree a

Multiply two python expressions together. (float 1) !* (float 2) works.

(!%)

(!%) :: (Show a) => Tree a -> Tree a -> Tree a

Modulo two python expressions together. (float 1) !* (float 2) works.

(!==)

(!*) :: Tree a -> Tree a -> Tree Bool

Check for equality between two python expressions.

floor

floor :: (Num n) => Tree n -> Tree n

Floor a numeric python expression.

ceil

ceil :: (Num n) => Tree n -> Tree n

Ceil a numeric python expression.

osin

osin :: (Num n) => Tree n -> Tree n

Sin a python expression

pmax

pmax :: (Num n) => Tree n -> Tree n -> Tree n

Use python's max function

pyMathOp

pyMathOp :: (Num n) => String -> Tree n -> Tree n

Use Python's math library

TouchDesigner generated variables

seconds

seconds :: Tree Float

The number of seconds since starting TD.

frames

frames :: Tree Int

The number of frames since starting TD.

Chop operations

chopChan

chopChan :: Int -> Tree CHOP -> Tree Float

Take the specified channel by index of a CHOP operator as a python expression.

chopChan0

chopChan0 :: Tree CHOP -> Tree Float

Shorthand for chopChan 0

chopChanName

chopChanName :: String -> Tree CHOP -> Tree Float

Take the specified channel by name of a CHOP operator as a python expression.

DAT operations

numRows

numRows :: Tree DAT -> Tree Int

Get the number of rows of a table DAT as a python expression.

Vector operations

emptyV[X]

emptyV4 = (Nothing, Nothing, Nothing, Nothing)
emptyV3 = (Nothing, Nothing, Nothing)
emptyV2 = (Nothing, Nothing)

Generate an empty vector of size X

vecXMap

vec2Map :: (ByteString, ByteString) -> String -> (Maybe (Tree a), Maybe (Tree a)) -> [(ByteString, Tree ByteString)]

Map a Haskell Vec2 to parameter names.

vec2Map' :: String -> Vec2 -> [(ByteString, Tree ByteString)]

Shorthand for vec2Map ("x", "y")

dimenMap :: String -> IVec2 -> [(ByteString, Tree ByteString)]

Shorthand for vec2Map ("w", "h")

vec3Map :: (ByteString, ByteString, ByteString) -> String -> Vec3 -> [(ByteString, Tree ByteString)]

Map a Haskell Vec3 to parameters

vec3Map' :: String -> Vec3 -> [(ByteString, Tree ByteString)]

Shorthand for vec3Map ("x", "y", "z")

rgbMap :: String -> Vec3 -> [(ByteString, Tree ByteString)]

Shorthand for vec3Map ("r", "g", "b")

vec4Map :: (ByteString, ByteString, ByteString, ByteString) -> String -> Vec4 -> [(ByteString, Tree ByteString)]

Map a Haskell Vec4 to parameters.

vec4Map' :: String -> Vec4 -> [(ByteString, Tree ByteString)]

Shorthand for vec4Map ("x", "y", "z", "w")

xVX

xV3 :: Tree Float -> Vec3
xV4 :: Tree Float -> Vec4

Map only the first argument of a VecX

iv2

iv2 :: (Int, Int) -> IVec2

Create an integer vec2.

Casting

casti

casti :: (Integral i) => Tree f -> Tree i

Cast to an integer.

castf

castf :: (Floating f) => Tree i -> Tree f

Cast to a float.

caststr

caststr :: (Show a) => Tree a -> Tree ByteString

Miscellaneous

fix :: (Op a) => BS.ByteString -> Tree a -> Tree a

Give an operator the specified name in TouchDesigner.