Descriptions in Cinema 4D

In Cinema 4D most object, tag and material parameters are accessed from the Attributes Manager. In the API the set of such parameters is called the description. With Python it is possible to set and get the data for the parameters.

../_images/attr.png

Syntax

All base list objects have a description. Each description element has an ID, normally available as a constant. Access the description element with the operator [] (defined in GeListNode.__getitem__() and GeListNode.__setitem__()):

obj[id]
obj[id,subid]
obj[id,subid, subsubid]

Example:

obj[c4d.SWEEPOBJECT_SCALE] = 0.5  # Sets the Scale of a Sweep Subdivision Surface to 50%
x = obj[c4d.SWEEPOBJECT_SCALE] # Assigns x the X coordinate of the object position

The object passed to [] can also be an object of type DescID.

Finding the Element ID

You do not have to remember all these IDs, nor look them up in tables. It is easy to get the ID and sub-ID for a description element using drag and drop within Cinema 4D. Just open up the Attributes Manager on an object/material/shader etc. and drag the element to the Python console edit field. In the following picture the ID of a Sphere’s Radius element is PRIM_SPHERE_RAD.

../_images/attr_drag.png