Difference between revisions of "Attributes Class"

From TouchDesigner Documentation
Jump to: navigation, search
(Tag: 2018.28070)
 
Line 4: Line 4:
 
|Sectionsummary=
 
|Sectionsummary=
 
|items=
 
|items=
 
 
{{ClassMember
 
{{ClassMember
 
     |class=Attributes
 
     |class=Attributes

Latest revision as of 13:54, 4 October 2018

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


Members[edit]

owner(Read Only):

The OP to which this object belongs.

Methods[edit]

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:

Information associated with SOP geometry. Points and primitives (polygons, NURBS, etc.) can have any number of attributes - position (P) is standard, and built-in optional attributes are normals (N), texture coordinates (uv), color (Cd), etc.

A sequence of vertices form a Polygon in a SOP. Each vertex is an integer index into the Point List, and each Point holds an XYZ position and attributes like Normals and Texture Coordinates.

A surface type in SOPs including polygon, curve (NURBS and Bezier), patch (NURBS and Bezier) and other shapes like sphere, tube, and metaball. Points and Primitives are part of the Geometry Detail, which is a part of a SOP.