I tried everything to figure out how to use the newly added Python-Command "LayerShader.AddLayer()" in S24.
As far as I know it only adds the "Type" of Layer. For Example I want to add a certain shader to the Layer I first use AddLayer(c4d.TypeShader) and this will give me an empty "Shader". But how can I define this shader to a specific Shader then?
I tried everything but I dont get it... does someone know how to do it?
Thx in advance!
Hi @PdZ-1 welcome in plugincafe.
The type need to be one of the LayerType.
So to have a regular BaseShader you first need to create a TypeShader layer and then set the link.
Find a code snippet
# Main function
# Retrieveh teh Layer Shader
mat = doc.GetFirstMaterial()
sha_xlayer = mat.GetFirstShader()
# Create an HSL layer
hsl = sha_xlayer.AddLayer(c4d.TypeHSL)
# Create a Shader Layer
shader_layer = sha_xlayer.AddLayer(c4d.TypeShader)
# Create a Gradient Shader
gradient_shader = c4d.BaseShader(c4d.Xgradient)
# Insert this gradient to the material (so the material become the owner of this shader too)
# Finally set the Shader Layer link to the Gradient Shader
# Execute main()
without further questions or replies, we will consider this topic as solved by Monday, the 30th and flag it accordingly.
Thank you for your understanding,