Maya plane with image

This is a small PyMEL script sript that I wrote for maya 2011 to create a polyplane and add an image texture to it. Just select an image and there you go.

filename = fileDialog2(caption = "Select a file", okCaption = "Use this please", cancelCaption = "No, don't do it!", ds = 2, fm = 1 )
if filename != None:
    
    file = createNode('file', name = "imageplanetexturefile")
    file.fileTextureName.set(filename)
    
    shdr, sg = createSurfaceShader( 'lambert', name = "imageplaneshader" )
        
    file.outColor >> shdr.color
    
    filesize = file.outSize.get()
    
    imgplane = polyPlane(name = "imageplane", width = filesize[0], height = filesize[1])
    
    sets(sg, forceElement = imgplane[0])

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>