oglu
Hi.. Id like to get into python and my first script should be a material island selection...
First step select material from selected face, second search for neighbouring faces with same material..
I could need some starting help...
pshipkov
I replied once, but after reading your message again i realized that i got you wrong, so:

import maya.cmds as mc
# select object or face
b = mc.ls(sl=1)[0].split("[")[0] # remember a token for comparison below
mc.hyperShade(smn=1) # that will select the shader
s = mc.ls(sl=1)[0] # remember the selected shader
sg = mc.listConnections(s+".oc", s=0, d=1)[0] # figure out the shading group
# select the faces of the same object with same shader attached
l = []
for o in mc.sets(sg, q=1):
    if b not in o: continue
    l.append(o)
mc.select(l)

Hope that helps.
Reply 0 0
oglu
thanks peter... very kind...

i will go thru and come back if i have further questions...


edit:
hmm, the sript isnt exact what id like to do... i know i should find a way myself but its hard if you have no idea how to start... the script is working great for one object and not affecting all other objects in the scene... and i definitely keep it in my selection tool set... but id like to select one material island...

like the three faces here on this sphere but not the four on top...
thanks again for helping...
sel.jpg
Reply 0 0
Reply