# Create and use User Data

Overview

## Use Cinema 4D User Data

User data allows to link own parameters and settings with objects. Via XPresso graphs, these properties can then be used, for example, to control an object size, position or color. This user data can also be operated directly in After Effects when the corresponding object is selected in the object list of the Cineware effects settings.

### Create User Data in Cinema 4D

The creation of user data is possible in Cinema 4D directly via the Attribute Manager, provided that a tag or object is selected. However, only objects are currently supported for use in After Effects as carriers of user data. The example described below shows the typical work steps:

Step 1:

We will start by creating the Cinema 4D scene that will be used within After Effects. To do this, we create a simple MoGraph Text object here and swirl the letters around on it a bit using a Random Effector. A Push Apart Effector helps to prevent overlapping of letters. The following figures show this setup.

This configuration randomly moves and rotates all the letters of the text one by one before establishing a minimum distance between them.
This figure shows the settings used for the two MoGraph effectors.
Step 2:

After all the necessary objects and materials have been created, it's time to think about what parameters about them might be of interest to us in After Effects. In principle, almost any property comes into question for this, such as the intensity of the letter swirl, the thickness (Depth) of the letters or even their color. Everything that is configured via simple numerical values, vectors, colors or a text input can also be operated directly in After Effects. In this example, for example, the Depth of the letters and of course the displayed Text Spline itself could be interesting. We will therefore create user data for these two properties.

The first thing to do is to identify the settings of interest for passing to After Effects. Here we decide on the depth and text spline settings on the text object.

Consideration of the parameters for which user data is to be created is important, as we need to be sure about their data types. For example, the depth is a floating point value, so it can also have a decimal part. The Text spline is a string. Accordingly, user data must also be created for these data types.
To do this, select the text object and open the User menu in the Attribute Manager. Select Manage User Data there. This opens a separate administration window in which the creation and administration of multiple user data is very convenient. To do this, you will find an Add button in the upper left corner. After clicking, a new entry appears in the left column. The settings for this user data entry can be found in the column to the right. Enter the term Text depth there, for example, under Name. This is also the term under which the parameter will later appear in After Effects. Therefore, choose names that are as meaningful as possible.
As Data Type choose floating point value and the Unit Length unit for the reasons mentioned above, because this is a dimension. Under Default Value you can then store a value that is used by default. This ensures later that meaningful settings are already used, even if you have not yet edited this user data value individually. The left half of the following figure shows these settings.
Then continue by pressing the Add button again. You name this second user data entry Text-String, for example, and assign the Data Type Text for it. For Default Value you can, for example, enter Text. These settings can be seen on the right in the following figure. Finally, close the window by clicking the OK button.

Using the user data management window, we create two user data that will later be used to set the depth and the text.

A new User Data tab will now appear at the Text object in the Attribute Manager, where you can find our user data we just created. Subsequent changes to their names or even to the order in which these settings are displayed can be made by reopening the user data management window.

With the text object selected, a user data section appears in the Attribute Manager, where our user data appears.
Step 3:

This step is about connecting the user data with the parameters to be controlled. We will first consider the simple method using an automatism.
To do this, first right-click on the user data name Text Depth in the Attribute Manager. In the context menu that pops up, select XPressions/Set Driver. This marks this value for the control of another parameter. Which parameter this should be is now defined with a second action.
To do this, open the Object tab of the Text object in the Attribute Manager and right-click on the name of the parameter you want to control. In this case, that would be the Depthparameter. In the context menu this time select XPressions/Set Driven (Absolute).
As an indication of the external control of this parameter, you can now see a change in the keyframe icon in front of the Depthparameter. In addition, a new XPresso Tag appears on the object. This includes all the logic of the link between the user data value and the object parameter. It does not matter on which object these settings are available. For example, you could also use user data on the text object to control a setting on one of the effectors. The following figure shows the two steps for linking user data and parameters.

By using the Set Driver/Set Driven commands, a link is established between user data value and parameter on the object.
Now, if you make a change to the Text Depth user data value, you should be able to see how it leads to a change in the actual extrusion depth on the text. Using the Depth parameter on the Text object is no longer possible from this point on. because it gets its value exclusively from our user data value Text Depth. You can remove this connection at any time by deleting the XPresso Tag on the object.
Finally, repeat these steps for the Text spline user data value and the parameter of the same name on the text object. The scene is now ready to be passed to After Effects.
Step 4:

Besides the automated linking of user data and parameters described in the last step, such relationships between values can also be created manually in an XPresso graph. This is useful, for example, when conversions or other logical relationships between inputs and transfers to parameters are to occur. The manual creation of an XPresso graph will be demonstrated here with a simple example. The goal here should be that we use a user data color input as a color in the assigned material of the text object. This way we can also influence the text color directly in After Effects afterwards.
We start by selecting the text object and again invoking the Manage User Data command in the Attribute Manager's User Data menu. We create a new entry there via Add, name it e.g. with Text Material Color and assign the Data Type Color. We confirm this input at the end via the OK button of the window.

Create a new user data entry on the Text object for entering the material color.

For the following steps we need an XPresso Tag. It does not matter at which object in the Object Manager this tag is created. For example, you could select the text object and then have the XPresso Tag added via the Tags menu of the Object Manager under Programming Tags/XPresso.
In our specific case, two XPresso Tags are already present due to the previous steps to link the two user data. Therefore, we can directly use one of these tags. To do this, double-click one of the XPresso Tags on the text object. The XPresso Editor opens and displays the XPresso graph of this tag, as shown in the figure below.
XPresso graphs consist of nodes that provide inputs and outputs for data. Connections between these inputs and outputs (called Ports) are used to exchange values between nodes. Nodes can, for example, perform simple calculations or - as in our case - represent an object and its parameters. In the circuit shown below, the text node represents our text object. The node has two sides, a blue input side and a red output side for data. From this we can already see that the left text node outputs a value, which is then picked up by the right text node, which again represents our text object. Here the user data value for the text string is output and passed to the Text Spline parameter of the same text object.
Now, to output our color user data value to the left text node as well, click on the red area in the node's header. A context menu opens, in which all available outputs are listed. We are only interested in the User Data category here, where you can find our user data color value. Select the entry for Text Material Color there. The outputs labeled .R, .G, and .B would output only the red, green, or blue portion of our color.

Adding the output of the user data color value at the node of the text object

This color value is now to be passed to the material assigned to the text object. If you don't have a material in the scene yet, create one via the Material Manager and assign it to the text object. Then drag the material from the Material Manager into the XPresso Editor graph. A new node is automatically created for this material. If you have already closed your XPresso Editor, you can have it reopened at any time by double-clicking the XPresso Tag behind the text object.
Since we now want to pass a color value to this material node, we need a new input to it. So this time we click on the blue input side of the node and then select Color/Color/Color from the list of possible parameters. This gives us an input for the complete color value that will be used as a color in the material's color channel.

Adding the material node and creating an input for the color in the color channel.

The final step is simple. With the left mouse button held down, we draw a connecting line between the output for text material color at the text node and the input for the color at the material node, as shown by the green line in the following image. If you can't read the names on the inputs and outputs correctly, double-click the header of the nodes. This automatically adjusts their size so that all names can be read completely.
With this, our node graph is already finished and we can close the XPresso Editor again. If you now want to test the graph, select the Text object and edit the user data value for the color in the Attribute Manager. The color in the material should change accordingly. The scene can now be saved and is then ready to be passed to After Effects.

Draw a connection between the output user data value at the text node and the color input at the material node.

### Using User Data in After Effects

After adding our Cinema 4D scene to a composition in After Effects, we gain access to the user data contained there via the Cineware effects settings. To do this, select the text object in the Object List. The user data of this object will then appear in a separate area below, separated by data types. The following image will mark it with a red frame. Here we how have the setting for the depth of the text created in the previous section of this documentation, which can be edited here directly in After Effects by entering a number or using a slider.

After selecting an entry in the object list, the user data related to this object will appear in a separate area of the effect settings, sorted by data type.

Editing the Text User Data directly is not possible. To do this, you must first press the Edit Text button. This creates a text layer in your composition. Double-clicking this layer in the Timeline automatically activates the Text Tool and a reddish highlight appears in the Composition view. The content of this area can be marked manually using the mouse by pressing and holding the left mouse button to highlight it and simply typing the new text. This is then used as input for the Cinema 4D User Data.

Editing Text User Data is done via a separate text layer in the composition (red highlighted area in the composition view). The original text was edited in this way directly in After Affects.

Finally, we will use the previously created material color user data to change the material of the text object. Clicking the color swatch opens the standard After Effects color picker, letting you select a new color.

Color User Data can be edited directly by clicking the small color box in the Cineware effects settings.