>
>
> I got this message : # Error: line 1: unindent does not match any outer 
> indentation level # 
>

I guess I made a wrong indent somewhere ?

import os
import maya.cmds as cmds
from PIL import Image

#change the path here
path = "/Users/francesco/Desktop/selectionMaya"


#list the items in the folder
dir = os.listdir(path)

junk = [".mayaSwatches", ".DS_Store", ".picasa.ini"]





for texture in dir:
    if texture not in junk:
try:
img = Image.open(texture)
except IOError:
print 'cannot open', img


#Get Ratio
        #img.size[0] -> width
        #img.size[1] -> height
        #ratio = img.size[0]/img.size[1]

        #create a nurbsPlane for each texture
        mesh = cmds.nurbsPlane(name = texture)
        #create a shader
        shader=cmds.shadingNode("blinn",asShader=True)
        #a file texture node
        name = texture.split(".")[0]
        file_node=cmds.shadingNode("file", name = "file_" + name, 
asTexture=True)
        #assign a texture
        cmds.setAttr( "file_" + name +'.fileTextureName', path +'/'+ 
texture, type="string")

        # a shading group
        shading_group= 
cmds.sets(renderable=True,noSurfaceShader=True,empty=True)
        #connect shader to sg surface shader
        cmds.connectAttr('%s.outColor' %shader ,'%s.surfaceShader' 
%shading_group)
        #connect file texture node to shader's color
        cmds.connectAttr('%s.outColor' %file_node, '%s.color' %shader)
        cmds.select(mesh)
        cmds.hyperShade( assign=shader)

 

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/497d5b1c-abd3-4845-84aa-610cff6529c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to