How can I query selected in tool settings/paint in Maya similar to how its done with the channel box



I been trying to find info about this, I want to be able to query the influences I have selected so I can make a script to help with skinning


Just to clarify, do you mean query things like textFields and textScrollLists for their current values and selected items, the way you can use the channelBox command to ask about and set the values in the channelBox?


The channelbox was a example of you can select items and query them, like selecting the XYZ translates of a object then being able to print it. I cant find a way to query what I have selected in the inf’s menu of the paint tools i’ve only figured it out for the inf im painting on.


The Influences list in the Paint Skin Weights tool is a treeView. You can get a list of existing treeViews like this:


There were two names in my output, and for me, the one we want has the id “theSkinClusterInflList”.

I don’t see a way to query what’s selected in it in the treeView documentation (nor wrap the selection callbacks, as I can’t query them either), but I do see that you can get the children, and you can ask specifically if a child is selected, so we can roll our own get-selected:

def getPaintWeightsWindowSelectedInfls (tv):
    kids = cmds.treeView(tv, query=True, children=True)
    return filter(lambda x: cmds.treeView(tv, query=True, itemSelected=x), kids)

Now I can get the selected children like this:


Hopefully that answers the question. Feel free to clarify further if not, or ask any follow-up questions.