On 05/03/2013 at 15:45, xxxxxxxx wrote:
I have a problem where I have code that creates a shader and loads a file into the color and alpha channel and activates the alpha channel, but then nothing will render in either the viewport or the Picture Viewer. If I disable the alpha I can render again, but I dont know why I can render with both? Any ideas? Thanks!
Using R14 Studio
import c4d
from c4d import documents
#Welcome to the world of Python
def main() :
#replace with your path
file = "/Volumes/Textures/Leaves/Leaf1.tif"
def insertobj() :
obj = c4d.BaseObject(c4d.Oplane)
doc.InsertObject(obj)
c4d.EventAdd()
doc = documents.GetActiveDocument()
mat = c4d.BaseMaterial(c4d.Mmaterial)
sha = c4d.BaseList2D(c4d.Xbitmap)
sha[c4d.BITMAPSHADER_FILENAME] = file
mat.InsertShader( sha )
mat[c4d.MATERIAL_COLOR_SHADER] = sha
mat[c4d.MATERIAL_USE_ALPHA]=True
mat[c4d.MATERIAL_ALPHA_SHADER] = sha
mat.Message( c4d.MSG_UPDATE )
mat.Update( True, True )
doc.InsertMaterial( mat )
insertobj()
mat = doc.SearchMaterial("Mat")
obj = doc.SearchObject("Plane")
doc.SetActiveObject(obj)
doc.SetActiveMaterial(mat)
c4d.CallCommand(12169);
if __name__=='__main__':
main()