Hey everybody,

I'm starting to work on some tools that will operate on selected component 
islands.  But once again, im banging my head on the keyboard trying to 
understand how maya wants me to think.  This stuff is so easy in XSI ;)

anyways, I'm passing in a component selection and returning the connected verts 
for each selected island. I'm using Pymel (i know what your gonna say), but I 
can't really figure out a good way to get the selected islands without having 
to do a ton of looping.

so far I'm just passing in the selection list, which kinda represents the 
selected islands, but not really. I guess it depends on how you selected, and 
in what order.

so errr, uhh what's the best way to do this?  and I definitely wouldn't mind 
some speed suggestions on my code so far, by someone who's been through this. 
Aside from not using pymel ;)

==============

import pymel.core as pm
from itertools import chain

# list of component selections
selection = pm.selected()

#loop through each item of the list (selection islands)
for component in selection:
    print "========================================"
    print "Component ID/'s is {0}".format(component)

    #make a list of connected verts
    connectedVerts = [ island.connectedVertices() for island in component ]

    #print it pretty
    for item in set( chain(*connectedVerts) ):
        print item

=============

Thanks!
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/7d24cbfc-4ee7-4b69-a69b-99625c6a6816%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to