Skip to content

attribsize

If you know the attribute class ahead of time, using detailattribsize, primattribsize, pointattribsize, or vertexattribsize may be faster.

int  attribsize(<geometry>geometry, string attribclass, string attribute_name)

<geometry>

When running in the context of a node (such as a wrangle SOP), this argument can be an integer representing the input number (starting at 0) to read the geometry from.

Alternatively, the argument can be a string specifying a geometry file (for example, a .bgeo) to read from. When running inside Houdini, this can be an op:/path/to/sop reference.

attribclass

One of "detail" (or "global"), "point", "prim", or "vertex".

You can also use "primgroup", "pointgroup" or "vertexgroup" to read from groups.

Returns

The size of an attribute’s type.

  • For a vector type, this is the number of components.
  • For an integer, float, or string, this returns 1.
  • For an array attribute, this returns the size of the tuples in the array. The tuple size is controlled by the Size parameter on the Attribute Create node.

If the attribute does not exist, returns 0.

  • This function works with the attribute’s type. It does not return the size of an attribute value. You can’t use this function to get the length of a string or array value.

Examples

examples

// Get the size of the position attribute of "defgeo.bgeo"
int size = attribsize("defgeo.bgeo", "point", "P");