Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Hi, I read a lot of threads here about this reflection-layer etc....but I didn´t come up with the solution:
I just want to feed the Roughness with an shader in my case a c4d.Xbitmap. But I have issues to access it because , the console says module has no attribute ..... Here is small code snippet:
mat=doc.SearchMaterial("Mat") ref_layer=mat.GetReflectionLayerIndex(0).GetDataID() gloss=op[c4d.ID_USERDATA,2] #just the texture path from userdata color_gloss=c4d.BaseList2D(c4d.Xbitmap) color_gloss[c4d.BITMAPSHADER_FILENAME]=gloss mat[ref_layer + c4d.REFLECTION_LAYER_MAIN_VALUE_ROUGHNESSLINK]=color_gloss #Problem color_gloss[c4d.BITMAPSHADER_BLACKPOINT]=1 color_gloss[c4d.BITMAPSHADER_WHITEPOINT]=0 mat.InsertShader(color_gloss)
But as I said, Cinema can´t find the Reflection_LAYER_MAIN_VALUE_ROUGHNESSLINK in the c4d module Also no highlighted code for this ID, even though i added per drag and drop into the code editor.... What I am doing wrong?
Hello @ThomasB,
thank you for reaching out to us. The problem in your script is that Cinema 4D R23 gave you an incorrect symbol when you dragged the roughness shader parameter into your script. You can always look up the correct symbols in our C++ or Python documentation, or right away use the numeric values they do stand for by inspecting the resource files. You can find a fixed version below.
Cheers, Ferdinand
"""Cinema 4D R23 did link some incorrect symbols for the layer shader when dragging and dropping parameters into the console. This problem does not exist anymore as of R25. """ import c4d def main(): """ """ mat = doc.SearchMaterial("Mat") layerIndex = mat.GetReflectionLayerIndex(0).GetDataID() color_gloss = c4d.BaseList2D(c4d.Xbitmap) color_gloss[c4d.BITMAPSHADER_FILENAME] = op[c4d.ID_USERDATA, 1] # REFLECTION_LAYER_MAIN_SHADER_ROUGHNESS is the correct symbol. When push # comes to shove, you can also always look into header files to find out # the raw numeric values the symbols stand for. mat[layerIndex + c4d.REFLECTION_LAYER_MAIN_SHADER_ROUGHNESS] = color_gloss mat.InsertShader(color_gloss) if __name__ == '__main__': main()
Thanks for the quick answer Ferdinand, I already thought of something like that, but unfortunately I didn't find it straight away in the C ++ API .... Is this drag and drop misbehavior fixed in R25?