On 21/03/2016 at 10:49, xxxxxxxx wrote:
I'm working on some basic pipeline tools for R17, and I just ran into my first problem that I can't seem to solve based on the documentation that's currently available. Essentially -- I'm only able to figure out how to modify the texture applied to a color / diffuse channel, and not reflection. (I haven't tried it on any other channel just yet.)
Here is the function I'm writing:
def changeTexture( mat, tex_path, channel=c4d.MATERIAL_COLOR_SHADER ) :
''' Changes the texture on a material's specified channel. Defaults to the color channel. '''
tex = c4d.BaseList2D(c4d.Xbitmap)
tex[c4d.BITMAPSHADER_FILENAME] = tex_path
mat[channel] = tex
mat.InsertShader(tex)
mat.Message(c4d.MSG_UPDATE)
mat.Update(1,1)
c4d.EventAdd()
return True
This works fine when operating on the default c4d.MATERIAL_COLOR_SHADER container. And, based on what i'm seeing in mmaterial.h, should work on all the other channels as well. Except i see a comment above the other channels referring to them as "legacy illumination values" -- so i'm assuming something changed when the reflectance model changed recently.
I can get a BaseShader object for the reflection channel with the following:
shd = mat[c4d.MATERIAL_REFLECTION_SHADER]
.. but based on the BaseShader documentation, I don't see a way to access bitmap file data.
Any nudge in the right direction would be helpful.
Thanks!
m