Reputation: 418
I'm trying to query what animation layers are selected using Python.
MEL works fine:
treeView -query -selectItem ("AnimLayerTabanimLayerEditor")
However a similar Python command returns an error:
cmds.treeView(q=True, selectItem=[True, "AnimLayerTabanimLayerEditor"])
Error:
// Error: TypeError: file <maya console> line 1: Flag 'selectItem' must be passed a boolean argument when query flag is set //
The weird part is that selectItem asks for 2 arguments: a string, then a boolean (I've tried it in that order too). The MEL command works without a boolean (tried that in Python too).
Upvotes: 0
Views: 3527
Reputation: 12218
It looks like you forgot to invert the order: in python the first argument is the target of the command, and the keywords come after; in Mel the flags come first.
If you're querying you just want the query
and selectItem
flags both true in Python:
selected = cmds.treeView (mytreeview, q=True, selectItem=True)
and setting looks like:
cmds.treeView(mytreeview, e=True, selectItem = ('thingToSelect', True))
Upvotes: 2