[QUOTE=rgkovach123;26249]It is stored in Preferences. I don’t believe it defaults to True, but I could be wrong (it is a performance hit to track the selection order).
As far as I can remember the “ls” command always returns the selection sorted, not in the order it was selected.
selection(sl) boolean create
List objects that are currently selected.
orderedSelection(os) boolean create
List objects and components that are currently selected in their order of selection. This flag depends on the value of the -tso/trackSelectionOrder flag of the selectPref command. If that flag is not enabled than this flag will return the same thing as the -sl/selection flag would.[/QUOTE]
Ok, this is super weird. I queried the trackSelectionOrder and got False. Still, I have never had a problem with ls(selection=True) not being sorted in order of selection. Both for pymel and cmds module.