View Full Version : Trouble attaching textures with Python

10 October 2011, 11:00 PM
Hey everyone

I'm trying to texture a solar system i made using only Python but I seem to be running into some trouble

I'm using a modified version of the code we went over in class yet I keep getting a syntax error at the line starting with "getShader ="

here is my code:

def findShapeNode(obj):
#finds all the relationships of the node
getRelatives = cmds.listRelatives(obj)
for node in getRelatives:
if cmds.nodeType(node) == 'mesh':
return node
return 'null'

def makePlanetShader(pd):
#get the shapeNode
getShape = findShapeNode(cmds.listRelatives(pd[0])
#create the shader
getShader = cmds.shadingNode(pd[0]+'Blinn',asShader=True)
#create the shading Engine Node
getShaderSG = cmds.sets(renderable=True,noSurfaceShader=True,empty=True,name=getShader+'SG')
#connect the shader to the shading engine
#connect the oject to the shading engine
#make the texture

def makeTexture(getShader,pd):
getFile = cmds.shadingNode('file',asTexture=True)

I've tried removing the "cmds.getRelatives" command in the line before it, and that allows it to run with no errors, just nothing happens lol. No blinn gets created no file texture, nothing. All that happens is a defaultRenderLayer keeps getting created

And help would be greatly appreciated, thank you

CGTalk Moderation
10 October 2011, 11:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.