Thank you for reaching out to us. As announced here, Maxon is currently conducting a company meeting. Please understand that our capability to answer questions is therefore limited at the moment.
To be frank here, your code looks a bit ChatGPT-ish, it at least invents things, contains syntax which simply does not exist. Please disclose the usage of ChatGPT.
DTYPE_SPLINE simply does not exist, because the GUI and datatype are custom as you point out yourself in your other thread. As the c4d.SplineData page will tell you, the plugin/data type ID symbol for the class is
AddUserData call does also make little sense, there is no function with such signature in our API. Also the
userdata.GetData() call is equally nonsensical.
Find below an example for adding a
SplineData user parameter.
"""Adds a SplineData user data parameter to the selected object.
Must be run as a Script Manager script with at least one object selected. This script is using
Python 3.10 syntax, i.e., can only be run 2023.2 or higher. Remove the line `op: c4d.BaseObject |
None` to make the script run in older versions.
doc: c4d.documents.BaseDocument # The active document.
op: c4d.BaseObject | None # The selected object, can be #None.
"""Runs the example.
if not op:
raise RuntimeError("Please select an object.")
# Create a description container for the data type CUSTOMDATATYPE_SPLINE.
bc: c4d.BaseContainer = c4d.GetCustomDataTypeDefault(c4d.CUSTOMDATATYPE_SPLINE)
bc[c4d.DESC_NAME] = "MySpline" # Set the name of the parameter.
bc[c4d.DESC_SHORT_NAME] = "MySpline" # Set the name of the parameter.
# Disable the horizontal grid lines in the SplineCustomGui. This is just one of the many special
# description settings this GUI does come with. As always, you will find them documented under
# the custom GUI.
bc[c4d.SPLINECONTROL_GRID_H] = False
# Add a new user data parameter for the container.
paramId: c4d.DescID = op.AddUserData(bc)
# Create a new spline using the cubic interpolation preset with five points and write the spline
# to our new parameter. Then push an update event to Cinema 4D.
spline: c4d.SplineData = c4d.SplineData()
op[paramId] = spline
# Some of your code. I really do not want to be rude here, and when you have written this
# yourself, my apologies, but this looks very much like ChatGPT gibberish to me.
# Meaningless, default values are booleans for groups.
# userdata_data.SetData(c4d.DESC_DEFAULT, c4d.SplineData())
# Redundant, the default value is on.
# userdata_data.SetData(c4d.DESC_ANIMATE, c4d.DESC_ANIMATE_ON)
# Meaningless, splines have no unit.
# userdata_data.SetData(c4d.DESC_UNIT, c4d.DESC_UNIT_REAL)
# Meaningless, splines only have this UI.
# userdata_data.SetData(c4d.DESC_CUSTOMGUI, c4d.CUSTOMGUI_SPLINE)
# More gibberish.
# userdata_data.SetData(c4d.DESC_SCALEH, 100)
# userdata_data.SetData(c4d.DESC_CUSTOMGUI, spline_data)
if __name__ == '__main__':