Just to follow up for any others that might see this that are still
learning the basics like me.....
I ran into an issue with my original code that I posted above. Sometimes
just selecting the set with cmds.select() it returns a list out of order. A
post on highend3d provided the answer.....instead use
cmds.listConnections(). Here is the code that worked and consistently
returned the list in the correct order along with the rest of my script for
setting keyframes on the weights.
import maya.cmds as cmds
#create a list of the members of each set and assign to variables
TGT = cmds.listConnections('leafTgt_SET' + '.dagSetMembers')
GEO = cmds.listConnections('leafGeo_SET' + '.dagSetMembers')
for t,g in zip(TGT,GEO):
#create a blendshape deformer from objects in each list and assign the
result to variable.
BS = cmds.blendShape(t,g)
#set timeslider to frame 100
cmds.currentTime(100)
#set the blendshape w to 1.
cmds.setAttr(BS[0] + '.' + t ,1)
#set more keyframes......
cmds.setKeyframe(BS[0] + '.' + t)
cmds.currentTime(115)
cmds.setAttr(BS[0] + '.' + t,0)
cmds.setKeyframe(BS[0] + '.' + t)
>
--
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/4178c04b-864a-44cf-8144-da58dc70b6ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.