selectType() - a broken command?


#1

I’m playing around with selection masks and came to the conclusion that there is something fishy going on with this command.

# Part 1 - Run this, select some components, then run part 2
import pymel.core as pm
pm.mel.changeSelectMode("-component")

pm.selectType(edge=True, polymeshEdge=True)
pm.selectType(allComponents=False, objectComponent=True, edge=True, polymeshEdge=True)


# Part 2 - notice the below comment. Try and select edges now - it will jump back to vertex selection
import pymel.core as pm
pm.mel.changeSelectMode("-component")

# pm.selectType(edge=True, polymeshEdge=True)
pm.selectType(allComponents=False, objectComponent=True, edge=True, polymeshEdge=True)

So, we need the setup in Part 1 where we call exec selectType twice - else the mask seems to revert back to the “old” one.

Also, what exactly does the objectComponent -flag do? Changing that boolean does nothing. True has the same effect as False - or am I missing something?

Did a g/re/p on the native script files and found this in texturePanelMenus.mel

$cmd = ("changeSelectMode -component; setComponentPickMask \"Facet\" true; " +
            "selectType -ocm -alc false; " +
            "selectType -ocm -facet true; " +
            "selectType -sf false -se false -suv false -cv false; ");


setComponentPickMask is a MEL script consisting of… even more selectType -commands -_- Not cool.
Maybe someone with Maya API skills knows why this command is so broken!?!


#2

I have no idea what exactly is objectComponent but I tried your code.

It works fine when objectComponent is set to False, or not changed.

# Select some vertices and run

pm.mel.changeSelectMode("-component")
pm.selectType(allComponents=False, edge=True, polymeshEdge=True)

# It should change to select edges


using objectComponent=True, will allow you to select vertices and edges at the same time. Something that I’ve never understood in Maya, why would you want to do that?