I'm still fairly new to Maya and python, so i have a few questions.
I have two lists:
1. Materials
2. Locators
I want to compare each list and if the locator has the same name as the material then:
getAttr transforms from the locator and setAttr color to the material.
If I define the name of the material and locator as 'someMaterial', it works.
How do I make it so I don't have to define the names of the material or locator as that can be completely random?
Also, the locators will always have the same name as the material by default, unless there is a better way to compare?
-------------------------------------------
someMaterialLoc=[]
for x in locator:
if x == 'someMaterialShape1':
someMaterialLoc.append(x)
print someMaterialLoc
allShaders =
cmds.ls(type='VRayMtl')
someMaterial =[]
for x in allShaders:
if x =='someMaterial':
someMaterial.append(x)
print someMaterial
if str(someMaterial[0]) == someMaterialLoc[0][0:12]:
red = cmds.getAttr(someMaterialLoc[0], '.translateX')
green = cmds.getAttr(someMaterialLoc[0], '.translateY')
blue = cmds.getAttr(someMaterialLoc[0], '.translateZ')
cmds.setAttr ((someMaterial[0] + '.color'), red, green, blue, type = 'double3' )
-------------------------------------------
Any recommendations would be greatly appreciated.
Thanks,
Jeremy