This setup allows points to be shared between primitives. For example, a polygon contains its own list of vertices that are not shared with other primitives, but vertices in different polygons may refer to the same point. When that point moves, the corresponding vertices on all adjacent polygons will also move, preventing polygon edges from separating.
Note that you can use hou.Vertex.point to retrieve a point from a vertex, but there is no method to retrieve all the vertices referring to a point. Houdini does not store this information internally, but you can derive it. The best way to quickly retrieve this information is to build a dictionary mapping all points to sets of vertices, and then reuse this dictionary in your algorithm.
Methods ¶
attribValue(name_or_attrib)
→ int
, float
, str
, tuple
or dict
Return the value store in this vertex for a particular attribute. The attribute may be specified by name or by hou.Attrib object.
Looking an attribute value using a hou.Attrib object is slightly faster than looking it up by name. When looking up attribute values inside a loop, look up the hou.Attrib object outside the loop, and pass it into this method.
Raises hou.OperationFailed if no attribute exists with this name.
floatAttribValue(name_or_attrib)
→ float
Return the vertex attribute value for a particular floating point attribute. The attribute may be specified by name or by hou.Attrib object.
Raises hou.OperationFailed if no attribute exists with this name or the attribute is not float of size 1.
In most cases, you’ll just use hou.Vertex.attribValue to access attribute values. Houdini uses this method internally to implement attribValue.
floatListAttribValue(name_or_attrib)
→ tuple
of float
Return the vertex attribute value for a particular floating point attribute. The attribute may be specified by name or by hou.Attrib object. The return value is a tuple of floats.
It is valid to call this method when the attribute’s size is 1. In this case, a tuple with one element is returned.
See also hou.Vertex.attribValue.
intAttribValue(name_or_attrib)
→ int
Return the vertex attribute value for a particular integer attribute of size 1. The attribute may be specified by name or by hou.Attrib object. See hou.Vertex.floatAttribValue for more information.
intListAttribValue(name_or_attrib)
→ tuple
of int
Return the vertex attribute value for a particular integer attribute. The attribute may be specified by name or by hou.Attrib object. The return value is a tuple of ints. See hou.Vertex.floatListAttribValue for more information.
stringAttribValue(name_or_attrib)
→ str
Return the vertex attribute value for a particular string attribute. The attribute may be specified by name or by hou.Attrib object. See hou.Vertex.floatAttribValue for more information.
stringListAttribValue(name_or_attrib)
→ tuple
of str
Return the vertex attribute value for a particular string attribute. The attribute may be specified by name or by hou.Attrib object. The return value is a tuple of strings.
It is valid to call this method when the attribute’s size is 1. In this case, a tuple with one element is returned.
See also hou.Vertex.attribValue.
dictAttribValue(name_or_attrib)
→ dict
Return the vertex attribute value for a particular dictionary attribute. The attribute may be specified by name or by hou.Attrib object. See hou.Vertex.floatAttribValue for more information.
dictListAttribValue(name_or_attrib)
→ tuple
of str
Return the vertex attribute value for a particular dictionary attribute. The attribute may be specified by name or by hou.Attrib object. The return value is a tuple of dictionaries.
It is valid to call this method when the attribute’s size is 1. In this case, a tuple with one element is returned. See hou.Vertex.floatAttribValue for more information.
setAttribValue(name_or_attrib, attrib_value)
Store an attribute value in this vertex. The attribute may be specified by name or by hou.Attrib object, and must be an existing vertex attribute in the geometry. You would typically call this method from the code of a Python-defined SOP.
Raises hou.OperationFailed if no attribute exists with this name or if the attribute’s data type does not match the value passed in. If the attribute’s size is more than 1, the attribute value must be a sequence of integers/floats, and the size of the sequence must match the attribute’s size.
If the attribute is an array, the seqeunce must be a flat array, not an array of tuples. If the attribute is float, ensure the python objects are float, and not integer (1.0, not 1).
Raises hou.GeometryPermissionError if this geometry is not modifiable.
attribType()
→ hou.attribType enum value
Return the enumerated value hou.attribType.Vertex. Points, primitives, vertices, and geometry support the same set of methods for querying their attributes, and this method is one of them.
See also:
point()
→ hou.Point
Return the hou.Point object that this vertex refers to. Each vertex refers to exactly one point.
prim()
→ hou.Prim
Return the hou.Prim object containing this vertex.
If the primitive is a face, use hou.Prim.vertices to access the other vertices in the primitive. If it is a surface, use hou.Surface.vertex, hou.Surface.numRows, and hou.Surface.numCols.
geometry()
→ Geometry
Return the hou.Geometry object containing this vertex.
number()
→ int
Return the number of this vertex within its primitive. Vertices in the same primitive are numbered sequentially starting from 0, and the vertices returned by hou.Prim.vertices are in order by their number.
linearNumber()
→ int
Return the number of this vertex within its whole detail. Vertices in the detail are sometimes in the same order as they occur in primitives, but this is often not true. Linear vertex numbers in a detail are sequential, starting from 0, and ending with one less than the total number of vertices in the detail. This can be useful so that a function that can be applied to point, vertex, primitive, or detail attributes doesn’t have to take two numbers just to handle the vertex case.