Hey Guys,

I'll admit, dictionaries are not my strong point, and I could use a little help 
;)

I'm looping through a dictionaries values, to find a particular value.  If it 
doesn't find the value, okay fine.  But if it does find the value, I need the 
key the value belongs to.

#=============================
import pymel.core as pm
from itertools import chain

sel = pm.ls(sl=1, fl=True)

connectedVertGroups = {}
vertGroups = {}
for i, vtx in enumerate(sel):
    
    if vtx not in chain( *connectedVertGroups.values() ):
        connectedVerts = [ vert for vert in vtx.connectedVertices() ]
        connectedVerts.append(vtx)
        connectedVertGroups["group_{0}".format(i)] = connectedVerts
        vertGroups["group_{0}".format(i)] = vtx

    else:
        '''
        TODO - Get the Key in connectedVertGroups that vtx belongs to, and add 
connected verts to it if they're not already in it. verify it's also in the 
correct vertGroup key.
        '''
        connectedVerts = [ vert for vert in vtx.connectedVertices() if vert not 
in connectedVertGroups.values() ]
#===========================  


Thx
Kev
  

-- 
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/ca0fd043-916f-4701-b541-c451cb6b2811%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to