- Commit and push to origin/main after every meaningful change
- Concise commit messages in English
cmd/td-cli/— Go CLI entry |internal/— Go packages |td/— Python scripts for TD- Build:
go build -o td-cli ./cmd/td-cli/ - Handler recovery: if DAT errors break POST routes, paste
td/td_cli_handler.pyinto/project1/TDCliServer/handler
td-cli status # Check connection
td-cli context --depth 2 # Project summary
td-cli exec -f scene.py --verify /project1 --screenshot /project1/render1
td-cli harness observe /project1 --depth 2 # Deep inspect
td-cli harness verify /project1 --assert '<json>'
td-cli harness rollback <id> # Undo
td-cli tox export /project1/base1 -o base1.toxCore commands: ops list|create|delete|info|rename|copy|search, par get|set|pulse|expr|export, connect|disconnect, exec "<code>"|exec -f <file>, dat read|write, chop info|channels|sample, sop info|points, pop info|points|bounds, table rows|cell, screenshot, tox export|import, network export|import, docs <op>|search|api
Flags: --port N, --project <path>, --json, --timeout <ms>
- Types live in
tdmodule:op.create(td.nullTOP, 'name')— lowercase prefix always (td.audiodeviceinCHOP) - Helper:
_T('nullTOP')=getattr(td, 'nullTOP') - No
popnetin TD 099 — POPs are standalone, connect like regular ops - Custom pars:
page.appendFloat('Name', label='Label')returns ParGroup — set.defaultand.valseparately
- Generator: gridPOP, pointgeneratorPOP, circlePOP, spherePOP
- Modifier: noisePOP, transformPOP, particlePOP, mathPOP, randomPOP
- Converter: soptoPOP, poptoSOP (
par.pop = pop_op, NOT wire), choptoPOP, toptoPOP geometryCOMP: usepar.pathsop(NOTpar.sop)
renderTOPuses parameter refs:par.camera,par.geometry,par.lights(space-separated paths) — NOT wire- Rotate at
geometryCOMPlevel (stable), NOT at POP/SOP level cam.par.lookat = geokeeps rotating geometry centered- Wireframe:
constantMATwithpar.wireframe = 'on'
par.tx/ty/tz= spatial translation (pushes points away!) — DON'T use for animationpar.t4d= 4D noise dimension — use for smooth temporal animationpar.gain= displacement amplitude (keep 0.1–1.5) |par.spread= harmonic (keep 0.1–0.8)
| Operator | Correct | Wrong |
|---|---|---|
| selectCHOP | channames |
chans |
| mathCHOP | gain, fromrange1/2, torange1/2 |
clamp |
| analyzeCHOP | function='rmspower' |
'average' (cancels ±audio→0) |
| noiseCHOP | rough |
roughness |
| levelTOP | brightness1 |
brightness |
| compositeTOP | operand='add' (string!) |
blend / int index |
| lightCOMP | dimmer, cr/cg/cb |
intensity, colorr |
| blurTOP | size |
— |
| pointgeneratorPOP | numpoints |
rate |
| spherePOP | radx/rady/radz |
radius |
| noisePOP | spread, gain, t4d |
tx/ty/tz |
| gridPOP | sizex/sizey, cols/rows |
— |
| poptoSOP | pop (par ref, NOT wire) |
— |
| geometryCOMP | pathsop |
sop |
| glslmultiTOP | pixeldat, vec0name, vec0valuex/y/z/w |
— |
| constantMAT | wireframe='on'/'off', wirewidth |
— |
audiodevicein → select(chan1) → audiofilter → analyze(rmspower) → lag → math(gain)
Gains: bass=5, mid=10, high=20 | Clamp in shader: clamp(val, 0.0, 2.0)
audiodeviceinCHOPoutputs 1 channel (chan1) — don't selectchan1-chan8- Audio reactivity:
par.expr = "op('math_bass')['chan1'] * 2.0"(NOTpar.val = X)
uTDOutputInfo.resbroken — hardcode aspect:vec2(1.78, 1.0)- No geometry shaders on macOS — use raymarching in GLSL TOP
- Use
vUV.stfor UVs,TDOutputSwizzle()on fragColor rootis baseCOMP object, not function —root.time(notroot().time)
Wire + par.top to SAME independent upstream node. Target must NOT depend on feedback.
glsl → fb(wire+par.top) → levelTOP(opacity=0.85) → compositeTOP[1]
glsl → compositeTOP[0]
- DO NOT set
geo.par.pathsop— causes cook self-loop - Use display/render flags:
null_out.display = True; null_out.render = True - Programmatic SOPs default to
display=False, render=False— MUST set explicitly
- Inside COMPs referencing outside ops: MUST use absolute paths (
op('/project1/math_bass')) - Top-level ops referencing each other: relative paths OK
- Name collisions: TD appends suffix (
sl_bass→sl_bass1) — verify withop.name
- Quick:
parameterCOMP—par.op=ctrl.path,par.builtin=False,par.custom=True - Custom:
containerCOMP(align='column')+sliderCOMP(hmode='fill') windowCOMPfor guaranteed interaction (container viewer needs A key)
- Defaults to POST — always set
par.reqmethod = 'get'for REST APIs par.includeheader = Falseto get clean JSONonResponse(dat, statusCode, headerDict, data): statusCode is dict{'code': 200, 'message': 'OK'}— usestatusCode.get('code', 0)
import td— usetd.lowercaseTypeFAMILY(not uppercase globals)- Position every node:
op.nodeCenterX = x; op.nodeCenterY = y - renderTOP:
par.camera/geometry/lights(not wires) - feedbackTOP: wire + par.top to same upstream node
- poptoSOP:
par.pop = pop_op(par ref, not wire) - Audio:
par.expr = "..."(notpar.val = X) - noisePOP animation:
par.t4d(notpar.tx/ty/tz) - geometryCOMP: set display/render flags on output SOP, don't set
par.pathsop - Expressions inside COMPs: absolute paths to outside ops
- COMP outputs: use
outCHOP/outTOP/outSOP/outDAT(real container outputs, not null named 'out') - Set
comp.commenton baseCOMP: brief description, output type, key params - Verify node names after bulk create (TD may add numeric suffix)
parameterexecuteDATinside a COMP cannot watch its own parent COMP's custom params — place it OUTSIDE- Extension cleanup:
comp.par.extension1is a Python expression, NOT a path — never assign an operator to it. If stale, clear withpar.extension1=''+reinitextensions.pulse()+comp.clearScriptErrors() - Stale COMP script errors persist even after fixing the cause — always call
comp.clearScriptErrors()after extension/script fixes - Custom par UI triggers:
parameterexecuteDATcannot watch baseCOMP custom params — use Toggle par +constantCHOP(expr)+chopexecuteDATinstead of Pulse par - timerCHOP periodic trigger:
donechannel off→on may not fire reliably in cycle mode — usetimer_fractionoff→on instead (fires at each cycle start). Don't filter bychannel.nameinonOffToOn - timerCHOP start:
par.startis a pulse — usepar.start.pulse(), notpar.start = True
def pos(op_ref, x, y):
op_ref.nodeCenterX = x
op_ref.nodeCenterY = yLeft→right = data flow, top→bottom = parallel. Column spacing ~300px, row ~150px.