Houdini 12 VEX VEX functions

Copies the value of a geometry attribute into a variable.

Overview

  1. int getattribute(string geometry, type &value, string attribute_type, string attribute_name, int number, int vertex_number)

  2. int getattribute(string path, float value[], string style, string attribute, int prim_number, int vertex_number)

Returns 0 if importing the attribute failed, 1 on success.

geometry

The name of the geometry file to reference. Inside Houdini, this may be “op:full_path_to_sop” to reference a SOP.

value

The attribute value (may be uninitialized on function failure)

attribute_type
One of
detail

Detail or global attribute

prim

Primitive attribute

point

Point attribute

vertex

Vertex attribute

attribute_name

The name of the attribute (i.e. “Cd” or “P”)

number

The point or primitive number. For detail attributes, this can be left as 0.

vertex_number

For vertex attributes, the primitive should be specified as the number parameter and the vertex_number specifies which vertex of the primitive should be referenced. For point, primitive and detail attributes, the vertex_number is ignored.

Examples

vector        pos, uv, clr;
// Get the position of point 3 in "defgeo.bgeo"
getattribute("defgeo.bgeo", pos, "point", "P", 3, 0);

// Get the value of the "uv" attribute for vertex 2 of primitive
// number 3 in the file defgeo.bgeo
getattribute("defgeo.bgeo", uv, "vertex", "uv", 3, 2);

// Get the value of the "Cd" attribute for primitive 7
// in the SOP specified by the path "/obj/geo1/color1" (Houdini
// only)
getattribute("op:/obj/geo1/color1", clr, "primitive", "Cd", 7);

On this page

Contexts: all