Attributes Class

From Derivative
Jump to navigation Jump to search

An Attributes object describes a set of Prim Class, Point Class, or Vertex Class attributes, contained within a SOP.


owner(Read Only):

The OP to which this object belongs.


create(name, default)Attribute:

Create a new Attribute.

  • name - The name of the attribute.
  • default - (Optional) Specify default values for custom attributes. For standard attributes, default values are implied.

Standard attributes are: N (normal), uv (texture), T (tangent), v (velocity), Cd (diffuse color).

# create a Normal attribute with implied defaults.
n = scriptOP.pointAttribs.create('N')

# set the X component of the first point's Normal attribute.
scriptOp.points[0].N[0] = 0.3 

# Create a Vertex Attribute called custom1 with defaults set to (0.0, 0.0)
n = scriptOP.vertexAttribs.create('custom1', (0.0, 0.0) )

# Create a Primitive Attribute called custom2 defaulting to 1
n = scriptOP.primAttribs.create('custom2', 1 )

TouchDesigner Build: