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?

-------------------------------------------

locator = cmds.ls(type='locator')
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

-- 
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/f80f142c-74cb-474e-9f40-c7036a03f463%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to