Skip to content

hasattrib

If you know the attribute class ahead of time, using hasdetailattrib, hasprimattrib, haspointattrib, or hasvertexattrib may be faster.

int  hasattrib(<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 1 if the attribute exists, or 0 otherwise.

Examples

examples

// Check whether the point group "pointstouse" exists.
if (hasattrib("defgeo.bgeo", "pointgroup", "pointstouse")) {
// Do something with the point group
}