I'm writing a plugin to change the bitmaps within layered shaders. I've found here some great examples on how to change parameters in LayerShaderLayer but have yet to figure out exactly how to change and update a bitmap in the layered shader.
Here's my latest attempt. I know that I probably don't have to update all elements, but to be sure, I updated a few.
mat = doc.GetFirstMaterial()
shd = mat.GetFirstShader()
if shd.GetName() == "Layer":
layShd = mat[c4d.MATERIAL_COLOR_SHADER]
layShdFirst = layShd.GetFirstLayer()
print layShdFirst.GetParameter(c4d.LAYER_S_PARAM_SHADER_LINK)
theBitmap = c4d.BaseList2D(c4d.Xbitmap) #create a bitmap baseshader
theBitmap[c4d.BITMAPSHADER_FILENAME] = "/Woven_Black_Carpet_Flat.jpg"
theBitmap.InsertUnder(layShd)
#layShdFirst.SetParameter(c4d.LAYER_S_PARAM_ALL_ACTIVE, True)
#print layShdFirst.GetBitmap()
layShdFirst.SetParameter(c4d.LAYER_S_PARAM_SHADER_LINK, theBitmap)
layShd.Message(c4d.MSG_UPDATE)#update
shd.Message(c4d.MSG_UPDATE)#update
mat.Update(True, True)
print layShdFirst.GetParameter(c4d.LAYER_S_PARAM_SHADER_LINK)