0

I'm writing a tool for may that returns the vertices in the same order as selected, but I get them in numerical order.

import maya.cmds as cmds

cmds.selectPref(tso=True)

print(cmds.ls( orderedSelection=True))
print(cmds.ls( sl=True,))
Peter
  • 67
  • 1
  • 8
  • 1
    It's possible, but you need to not have anything selected, run `cmds.selectPref(tso=True)` Then separately run `print(cmds.ls( orderedSelection=True))` But that's really inconvenient and Preferences > Setting > Selection > Track Selection Order does nothing. – Peter Jan 07 '20 at 19:54
  • note that if you select with anykind loop, it won't retain anything. it really need to select one by one the components – DrWeeny Jan 07 '20 at 20:11
  • Okay, now this works, even though when I tried it before, it didn't. ` import maya.cmds as cmds if (cmds.selectPref(tso=True, q=True)==0): cmds.selectPref(tso=True) print(cmds.ls( orderedSelection=True))` – Peter Jan 07 '20 at 20:11

1 Answers1

0

For some reason, this started working, when I had tried it before and it didn't

import maya.cmds as cmds

if (cmds.selectPref(tso=True, q=True)==0):
    cmds.selectPref(tso=True)
print(cmds.ls( orderedSelection=True))
Peter
  • 67
  • 1
  • 8