Hierarchy selection not in alphabetical order

66 views
Skip to first unread message

likage

unread,
Sep 7, 2016, 8:32:55 PM9/7/16
to Python Programming for Autodesk Maya
For example, I have 5 polygons in my scene.. Individual pieces in the following hierarchy:
  • abs_geo
  • std_geo
  • nor_geo
  • stz_geo
  • poly_geo

If I shift-select from the first node to the last node, abs_geo to poly_geo and I run the following line: 
cmds.ls(sl = True)
# Result: [u'abs_geo', u'std_geo', u'nor_geo', u'stz_geo', u'poly_geo'] #


However, say if I run the following command:
cmds.select("*_geo")
cmds
.ls(sl = True)
# Result: [u'abs_geo', u'nor_geo', u'poly_geo', u'std_geo', u'stz_geo'] #


The latter part have sorted out my result in alphabetical order. Is there anyway in which I can still make use of the latter method but while maintaining the output result to be the same as the first (non-alphabetical order)? Is this possible?

likage

unread,
Sep 7, 2016, 8:39:40 PM9/7/16
to Python Programming for Autodesk Maya
Just to add on, it will be like reading the selection from top-down, and I am using polygons as a very simple example for it..

Justin Israel

unread,
Sep 7, 2016, 11:10:19 PM9/7/16
to python_in...@googlegroups.com
On Thu, Sep 8, 2016 at 12:32 PM likage <dissid...@gmail.com> wrote:

The latter part have sorted out my result in alphabetical order. Is there anyway in which I can still make use of the latter method but while maintaining the output result to be the same as the first (non-alphabetical order)? Is this possible?

Your first example is just maintaining selection order, right?

In the case of the command cmds.select("*_geo"), how is the API supposed to make assumptions about a particular visual representation in your view (a UI concept)? It is performing a selection from a completely code-based perspective. This is similar to a glob, such as when you do "ls *.ext" to list files in a shell. Should Maya assume you want breadth-first ordering? Depth-first ordering? Where should it take the cues from? What is the preferred selection order of a glob of matching names? Seems they just settled on a sorted result, without having any visual cues to know.

That being said, maybe someone here knows of an addition step you could take to resort the objects. 

 

--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/2fd491d1-8fa5-4c05-8ad8-fcb5bae661a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages