In this quick example you will learn how to access Userdata via C.O.F.F.E.E. script in Cinema 4D Xpresso.

You may control userdata via xpresso by using #ID_USERDATA command.
Here is an example for assigning a string “Test” to Userdata ID 1. For example that might be used for your copyright notice. You may add protection to your xpresso as well so it cannot be changed without a password. (Click here for adding password protection to Cinema 4D Xpresso tutorial.)

[fancy_code_box]main() { var doc = GetActiveDocument(); var userdata = doc->FindObject(“User Data”); // A Null that’s holding the User Data userdata#ID_USERDATA:1 = “Test”; } [/fancy_code_box]


Remember all userdatas have unique ID numbers. When you add or remove your userdata
they might still remain in memory and they get +1 ID number. So if you have a complex setup with
lots of userdata options it would be much easier to check their IDs before accessing them.
You can also use If/Else statements to control your setup via userdata.

1 reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.