This documentation is for the free plugin Py4D in CINEMA 4D R11.5 and not for the C4DSDK of Python in CINEMA 4D R12. For R12, please visit PluginCafe.com
A datatype which contains information about a gradient. This type is called by value. Check out:
#op is a BaseList2D instance and contains a Gradient element at the given position [GRADIENT_1]
#in this case you have to send the object back to apply the change.
gradient = op[GRADIENT_1] # does not return a reference, just a copy of this element
gradient.DoubleKnots() # edit the content
op[GRADIENT_1] = gradient # send back
| Parameter: | v (Gradient) – Copy constructor. |
|---|---|
| Return type: | Gradient |
| Returns: | The new gradient. |
Returns a hash of the whole gradient state, including the needles, colors and interpolation type.:
print hash(obj) #hash calls obj.__hash__()
| Return type: | int |
|---|---|
| Returns: | Hash value |
Inverts the knots.
| Return type: | bool |
|---|---|
| Returns: | True if successful, otherwise False. |
Initializes the renderer.
| Return type: | bool |
|---|---|
| Returns: | True if successfull, otherwise False. |
Calculates a gradient pixel. Needs InitRender before.
| Parameter: | pos (float) – X position. |
|---|---|
| Return type: | Vector |
| Returns: | Calculated pixel. |
Insert a knot. Not passed arguments will be set with default values.
| Parameters: |
|
|---|---|
| Return type: | int |
| Returns: | The new knot Note The new knot index is GetKnotCount - 1 |
Delete a knot.
| Parameter: | index (int) – index knot. Note 0 <= index < GetKnotCount |
|---|
Returns the information about a knot.
| Parameter: | index (int) – The index. |
|---|
Note
The new knot index has to be 0 <= index < Gradient.GetKnotCount
Check out this small example how to use:
col, brightness, pos, bias, index = gradient.GetKnot(index)
| Parameters: |
|
|---|
Set the values of a knot. Just the passed arguments will be set, the other will be discarded.
| Parameters: |
|
|---|
Gets a data item from the gradient container.
| Parameter: | id (int) – One of the following flags
|
||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Return type: | Depends on id. | ||||||||||||
| Returns: | The data. |
Gets a data item from the gradient container.
| Parameters: |
|
|---|
Gets the knot count.
| Return type: | int |
|---|---|
| Returns: | Knot count. |