hey Guys,
i m trying to get the color node incoming connection so that i can store
it for later use,
ever thing works well before for loop but when i run for loop to chk the
type then it give me error :
# Traceback (most recent call last):
# File "<string>", line 12, in <module>
# File "<string>", line 17, in <module>
# TypeError: 'NoneType' object is not iterable
and i have no idea how to fix it, please help.
thanks a lot.
have a good weekend. :)
import maya.cmds as cmds
# getting the shape node from transform node
selectedObj = cmds.ls(sl = True )[0]
selectType = cmds.listRelatives( selectedObj, shapes = True )
#getting the name of shader connected to it
listConnect = cmds.listConnections(selectType, type="shadingEngine")[0]
shadername = (listConnect + ".surfaceShader")
shader = cmds.listConnections(shadername)[0]
colorAttribute = (shader+".color")
colorValues = cmds.getAttr(colorAttribute)
print colorValues
inputConnectionCheck = cmds.listConnections(colorAttribute,destination =
True)
print inputConnectionCheck
for incoming in inputConnectionCheck:
if cmds.objectType( incoming, isType='file'):
filePath = cmds.getAttr(incoming+".fileTextureName")
print filePath
else:
colorValues = cmds.getAttr(colorAttribute)
RGBvalues = colorValues[0]
redValue = RGBvalues[0]
greenValue = RGBvalues[1]
blueValue = RGBvalues[2]
print (redValue, greenValue, blueValue)
--
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/6f64d6a1-4329-4115-b9e0-1aeec25e58ce%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.