Wiki, Local variables in python too.

It will be really helpful to indicate the Python code of local variables in the wiki.
Now we only have Hscript : … mitive_SOP

Thx !

It should be more clear, you are correct.
If you bring up the Python help for an operator though, you will find any locally defined members and methods: … ss#Members


I read python help, but i coun’t find an equivalent.

exemple : How write this expression in python :
tdu.rand(me.prims) “just discovered”
rand($CR) ?

Or complete this sooo helpful page : … _Tips#Time


We could extend the Tips page, but unfortunately every operator has its own unique set.
so for rand($CR)

I would first look at the definition of $CR → red primitive color
then look at the Primtive SOP python class members:

inputColor (Read Only) The current primitive color being evaluated or a default if not present, expressed as a 4-tuple.



In the cases where you can’t find the attribute directly, you could go through the attributes:

me.inputPrim.Cd[0] for example.

Thank you rob !

me.inputPrim.Cd[0] is a good example.

This really help me for the syntax.

Why rand($PR) is not equal to tdu.rand(me.prims) ?
In python it takes everything. exemple :
primitivePython.1.toe (4.25 KB)

$PR is a numeric index

me.prims is a python list of all the primitives, so it never changes throughout the cook.
(the list is the list)

You’ll want:



Thank you rob !

Everything is clear now.