tscript to python

hello!

what is the equivalent of this in python in that context?

$N → len(me.inputs[0].points)

rand($PT) → tdu.rand(me.inputs[0]) not correct, but cant fugue out, because the default python expression was me.inputPoint.pscale[0], and this is not working with tdu.rand. i need to pull points from point SOP not from group right?

$PT → ?

It’s helpful understanding the object oriented nature of the Python implementation in TouchDesigner. Then it becomes easier to go through this three and find the hierarchy of objects:

derivative.ca/wiki099/index … ory:Python

For instance you dont need len() because there is a .numPoints attribute on all SOPs as a part of the SOP class:

derivative.ca/wiki099/index … =SOP_Class

If you keep digging down, you’ll see under the SOP class is the Points class, which holds multiple Point objects.

You probably are looking for the .index attribute on the point:

derivative.ca/wiki099/index … oint_Class

https://www.indaehwang.com/touchdesigner/tscrpit-to-python-in-touchdesigner/

$PT : The Point Number of the Template-> me.inputPoint.index