Bravlin

Untitled

Jun 4th, 2014
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.15 KB | None | 0 0
  1. # 2014.06.04 For hardcore XSI fans
  2. # Original .mel idea by 'jimtheartist'
  3. # Script converted to python and edited by Bravlin Pechatnik
  4. # This script isn't convertor from one component selection filter to another with adjacent multiplication
  5. # It's an alternative to selection filter. First function call would switch component mode, second one - apply adjacent multiplication
  6. # Bind this pythone keys:
  7. # AdjacentSelection.AdjacentVerts()
  8. # AdjacentSelection.AdjacentEdges()
  9. # AdjacentSelection.AdjacentFaces()
  10.  
  11. import maya.cmds as mc
  12.  
  13. def AdjacentVerts():
  14.     preselect = mc.ls(sl = True, fl = True)
  15.     preselect_chek = mc.filterExpand(sm = (31,32,34,35))
  16.     preselect_chek_component = mc.filterExpand(sm = (31))
  17.     print preselect_chek
  18.     if preselect_chek == None:
  19.         mc.selectMode(co = True)
  20.         mc.selectType(pv = True)
  21.     elif preselect_chek_component == None:
  22.         mc.selectMode(co = True)
  23.         mc.selectType(pv = True)
  24.     else:
  25.         sel = mc.ls(sl = True, fl = True)
  26.         mc.ConvertSelectionToEdges()
  27.         mc.ConvertSelectionToVertices()
  28.         mc.select(sel, d = True)
  29.  
  30.  
  31. def AdjacentEdges():
  32.     preselect = mc.ls(sl = True, fl = True)
  33.     preselect = mc.ls(sl = True, fl = True)
  34.     preselect_chek = mc.filterExpand(sm = (31,32,34,35))
  35.     preselect_chek_component = mc.filterExpand(sm = (32))
  36.     print preselect_chek
  37.     if preselect_chek == None:
  38.         mc.selectMode(co = True)
  39.         mc.selectType(pe = True)
  40.     elif preselect_chek_component == None:
  41.         mc.selectMode(co = True)
  42.         mc.selectType(pe = True)
  43.     else:
  44.         sel = mc.ls(sl = True, fl = True)
  45.         mc.ConvertSelectionToVertices()
  46.         mc.ConvertSelectionToEdges()
  47.         mc.select(sel, d = True)
  48.  
  49.        
  50. def AdjacentFaces():
  51.     preselect = mc.ls(sl = True, fl = True)
  52.     preselect_chek = mc.filterExpand(sm = (31,32,34,35))
  53.     preselect_chek_component = mc.filterExpand(sm = (34))
  54.     print preselect_chek
  55.     if preselect_chek == None:
  56.         mc.selectMode(co = True)
  57.         mc.selectType(pf = True)
  58.     elif preselect_chek_component == None:
  59.         mc.selectMode(co = True)
  60.         mc.selectType(pf = True)
  61.     else:        
  62.         sel = mc.ls(sl = True, fl = True)
  63.         selType = mc.filterExpand(sm = 34)
  64.         mc.ConvertSelectionToEdges()
  65.         mc.ConvertSelectionToFaces()
  66.         mc.select(sel, d = True)
Advertisement
Add Comment
Please, Sign In to add comment