# Difference between revisions of "VexCheatSheet"

A glossary of terms and stuff, more complete explainations are over on the HoudiniVex page, or more beginner level explainations on the JofOfVex pages.

### Vex type prefixes

The default is float, so you rarely need the f@ prefix.

// floats and integers
f@myfloat = 12.234; // float
i@myint = 5; // integer

// vectors
u@myvector2 = {0.6, 0.5}; // vector2 (2 floats)
v@myvector = {1,2,3}; // vector (3 floats)
p@myquat = {0,0,0,1}; // quaternion / vector4 / 4 floats

// matricies
2@mymatrix2 = {1,2,3,4}; // matrix2 (2x2 floats)
3@mymatrix3 = {1,2,3,4,5,6,7,8,9}; // matrix3 (3x3 floats)
4@mymatrix4 = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; // matrix (4x4 floats)

// strings and dictionaries
s@mystring = 'a string'; // string
d@mydict = {}; // dict, can only instantiate as empty type
d@mydict['key'] = 'value'; // can set values once instantiated

The sidefx documentation is here: https://www.sidefx.com/docs/houdini/vex/snippets.html#attributes

### Common attribute names

The ones I use a lot, more can often be found by opening a vop for various contexts and looking at the default global ins and outs, pulling apart sidefx nodes.

I've added prefix types here too. You don't need them, but its good practice, both to remind you what these attrib types are, and to avoid accidentally setting normal as a float or a transform as a quaternion. :)

i@Frame; // current frame
f@Time; // current time in seconds
i@ptnum; // current point number
i@vtxnum; // current vertex number
i@primnum; // current prim number
i@elemnum; // handy morphing attribute; if you're in a point wrangle its ptnum, if in a vertex wrangle its @vtxnum, primwrangle @primnum.
i@numpt; // total number of points. both @ptnum and @numpt are integers, so if dividing, remember to cast @ptnum to a float
i@numvtx; // total number of verticies
i@numprim; // total number of prims

v@N; // the normal. If this hasn't been set, vex will calculate it for you just by calling it without initialised values
v@up; // a vector to control the spin around the normal when using instancing/copytopoints/etc
p@orient; // vector4 used as explicit rotation for instances
3@transform; // matrix3 used to control rotation and scale for instances
4@localtransform; // matrix (4x4) used for kinefx joints
f@pscale; // uniform scale for instances
v@scale; // XYZ scale control for instances

v@P; // current elements position. can be set for points, can be read for vertices and prims. Prims will guess the midpoint, not always reliable!
v@Cd; // diffuse colour

v@v; // velocity, used for rendering and simulation
v@w; // spin velocity used for rbd generally
v@force; // used in simulation for many solvers that don't like you to edit v directly, but v will be calculated after updating force

There's many attributes used by instancing/copytopoints, but I don't use them that often. You can find the full list and explainations at