CINEMA 4D uses a string system to localize UI elements. Each UI element has an ID, usually represented as an enum Constant, and that ID relates to a string within the str file for each language.
To get global strings, you can use GeLoadString()
To get the dialog strings, you can use GeResouce:LoadString()
Getting description strings is a bit more tricky. For this, you have to get the description container for the Atom and check the container. Prior to CINEMA 4D R15.037, there’s no Python API availaible for this. CINEMA 4D R15.037 added the option to iterate through the description. Only __iter__ is implemented, so you must loop through the description to get the container for the correct attribute.
The convenience function below returns the string for a given attribute within a node. You can optionally provide a cycle ID to get the string for a specific value of a drop-down or radio element. Pass a cycle ID of ‘val’ to evaluate the attribute for the given node instance and return the string for the current value.
def getDescString(node, attrID, cycleID=0):
Get the string associated with a descripiton element
GeLoadString & GeResource:LoadString only apply to dialog strings
the node containing the description attributes
the attribute ID to get names for
the ID of the cycle (dropdown) element to get the name for
- if 0 or omitted, the attribute name is returned
- if 'val', the value of the attr in the node is evaluated
- otherwise, the specific cycle ID is returned
desc = node.GetDescription(c4d.DESCFLAGS_DESC_0)
for bc, param, group in desc:
if param.id == attrID: #param is a descID, we have to get the integer ID part