Problems with Default Specular Layer? [SOLVED]
On 21/02/2017 at 04:51, xxxxxxxx wrote:
Cinema 4D Version: R17.055
Platform: Windows ;
Language(s) : PYTHON ;
I want to change some parameters of the Default Specular Layer in C4D R17,but it's not working,I don't know why?
Here is the code below:
import c4d from c4d import gui def main() : doc.StartUndo() mats = doc.GetActiveMaterials() if not mats: return for mat in mats: mat[c4d.REFLECTION_LAYER_MAIN_DISTRIBUTION] = 3 mat[c4d.REFLECTION_LAYER_MAIN_ADDITIVE] = 0 doc.AddUndo(c4d.UNDOTYPE_CHANGE,mat) doc.EndUndo() c4d.EventAdd() if __name__=='__main__': main()
Thank you for any help!
On 21/02/2017 at 09:43, xxxxxxxx wrote:
It's been a while since I worked with materials in Python, but if I remember correctly you need to add the layerID to your atrribute index
reflayer = mat.GetReflectionLayerIndex(idx) mat[c4d.REFLECTION_LAYER_MAIN_DISTRIBUTION + reflayer.GetDataID()] = 3
On 21/02/2017 at 17:48, xxxxxxxx wrote:
You are talented! It's working now.