I need to get all the selected vertices and store them in an array so I can loop through and find out information about each vert.
Although I cannot figure this out.
sel = cmds.ls(sl=1)
print sel
Returns:
//[u'pCube1.vtx[50:53]', u'pCube1.vtx[74:77]']
More or less I need my 'sel' variable to print out this:
pCube1.vtx[50]
pCube1.vtx[51]
pCube1.vtx[52]
pCube1.vtx[53]
pCube1.vtx[74]
pCube1.vtx[75]
pCube1.vtx[76]
pCube1.vtx[77]
Does anyone know how to do this without literally stripping the string apart? I think that's a very messy way around it and would like to know if there's another possibility! Maybe with the Maya API using OpenMaya?
Well, it seems research has paid off!
cmds.ls(sl=1, fl=1)
the 'fl' flag stands for "Flatten", Flatten returns a list of objects so that each component is identified individually.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With