UNSOLVED Python - Gradient userdata - Set colour and alpha

Hi there,

I'm looking for a method to set both colour and alpha gradients for a single userdata.


The attributes of the gradient I need to set are:


and for the alpha gradient:


I can get the alpha gradient with:


but I can see no way to set it.

Anybody know what I'm missing?



Hello @pixelsinprogress,

Thank you for reaching out to us. I must unfortunately tell you that it currently is technically not possible to set the alpha values of a c4d.Gradient instance in Python.

In C++ this works because there Gradient::GetAlphaGradient returns a pointer to the underlying alpha gradient. The Python layer unfortunately makes a copy of that layer, severing the connection between the alpha gradient and its associated color gradient (which is also why the Python docs warn about that). I also tried some other venues of poking around in the alpha data by using C4DAtom.SetParameter, but these unfortunately also do not work in Python.

I have created a ticket for this to be fixed at some point, as I would agree this is something the Python layer should be able to handle. But this is not a bug, as this was done somewhat intentionally. So, it might take a long time before we (most likely @m_adam) will find the time to do it.