hello everyone,
i have a small problem ![]()
i need to assign a texture on a polyplane in python.
here is the code of the functions:
def createMaterial( name, color, type ):
cmds.sets( renderable=True, noSurfaceShader=True, empty=True, name=name + 'SG' )
cmds.shadingNode( type, asShader=True, name=name )
cmds.setAttr( name+".color", color[0], color[1], color[2], type='double3')
cmds.connectAttr(name+".outColor", name+"SG.surfaceShader")
def assignMaterial (name, object):
cmds.sets(object, edit=True, forceElement=name+'SG')
def assignNewMaterial( name, color, type, object):
createMaterial (name, color, type)
assignMaterial (name, object)
assignNewMaterial( 'sphereShader' + str(n+1), (array_Structure_cloud[n][3] * 0.00392, array_Structure_cloud[n][4] * 0.00392, array_Structure_cloud[n][5] * 0.00392), 'blinn', 'sphere' + str(n+1) )
this part of the script creates a cuple of new materials for some spheres and change the color of them.
that works fine.
but i dont know how to assigne a new texture.
i tried this:
cmds.createNode('file',n='file1')
cmds.setAttr( 'file1.ftn', 'C:\Users\sepp\Desktop/test.JPG',type='string' )
s = cmds.getAttr('file1.ftn')
# Result: $TMPDIR/smile.gif #
s = cmds.getAttr('file1.ftn',x=True)
# Result: /var/tmp/smile.gif #
cmds.connectAttr('file1')
the result is the texture in the attribute editor but with no assignment to the material of the plane.
any ideas?
merci and sunny greetings, sepp