I found the solution to my problem, on the internet, with code samples:
https://www.c4dcafe.com/ipb/forums/topic/101805-materials-and-shaders-with-python/

Kantronin
@Kantronin
Posts made by Kantronin
-
RE: How to create a layer Reflection (Legacy) ?
-
How to create a layer Reflection (Legacy) ?
Hi
I created a material.
I inserted a texture into the COLOR channel.
Then, I inserted another texture into the BUMP channel.Now, I want to insert a texture for the specularity, but I don't know how to create a Layer Reflection (Legacy)
I only activated the REFLECTANCE channel with the following code:mat [c4d.MATERIAL_USE_REFLECTION] = True
Then I want to apply the following values for this layer:
0.5 for REFLECTION_LAYER_MAIN_VALUE_ROUGHNESS
1.0 for REFLECTION_LAYER_MAIN_VALUE_REFLECTION
0.2 for REFLECTION_LAYER_MAIN_VALUE_SPECULAR
1.0 for REFLECTION_LAYER_MAIN_VALUE_BUMPI suppose that these values must be prefixed by the variable 'mat' which represents the material and also by the id of the layer.
-
RE: Transparency channel - Color update
I found the solution (I already had this problem but I couldn't remember the right code)
mat [c4d.MATERIAL_TRANSPARENCY_COLOR] = c4d.Vector (1.0, 1.0, 1.0) #color white
mat.Update (True, True) -
Transparency channel - Color update
Hi,
In the 'Transparency' channel of a material, I need to modify the color.
How to read and modify this value with Python ?
I already have the material identifier. -
RE: How to apply a material to a selection of an object
I found the solution to my problem in the Script Log window which shows the manual commands in python
-
How to apply a material to a selection of an object
Hi,
I know how to apply a material to an object, but I would like to know how to apply a material to one of the object's selections only.
-
Welding point for a polygon
Hi
C4D has a command which allows to weld points of a mesh.
I would like to make a script in python which would allow me to weld very close points.
How can I call this command with python ? -
Adding points to a spline
Hi,
I would like to add points to a spline, spreading them evenly, without changing the shape of this spline.
I can do a python script, but is there a simple way to make this change ? -
Using AddEditNumberArrows
Hi,
I am using a datafield of type AddEditNumberArrows, and I want to have increase or decresase of 0.1
I defined it like this:
self.AddEditNumberArrows(datafield_displacement,c4d.BFH_LEFT,70,10)
And I initialized it in the following way:
self.SetFloat(datafield_displacement,0.1,min=0.0)
Currently, the values of increments or decrementations are egal to 1.
How to have 0.1 ?
-
RE: Transform coordinates of a polygon's points
Indeed, it is necessary to use two matrices
For an object named polygonName, we will have:Matrix = polygonName.GetMg () inverseMatrix = ~ Matrix
Matrix converts local coordinates to global coordinates.
After finishing working in global coordinates, we return to local coordinates with inverseMatrix
We can thus modify the polygon with the new local coordinates.These two matrices allow to work with the points, which is very convenient.
This subject is very well explained here:
Link