selecting attributes in channelBox?

1,840 views
Skip to first unread message

martin tomoya

unread,
Sep 3, 2010, 6:56:43 AM9/3/10
to python_inside_maya
Does anyone know a way to select attributes in the channelBox from a
python script?

Nicolas Combecave

unread,
Sep 3, 2010, 7:59:49 AM9/3/10
to python_in...@googlegroups.com
I'd be very interested to hear about this too. We had to find a workaround, which involved selectionLists and dragAttrContext to manipulate channelBoxAttrs, but it was way more complicated than selecting directly the attribute via select -r persp.translateX for example, and being able to use the virtual slider...

Nicolas

On Fri, Sep 3, 2010 at 12:56 PM, martin tomoya <orw...@gmail.com> wrote:
Does anyone know a way to select attributes in the channelBox from a
python script?

damon shelton

unread,
Sep 3, 2010, 1:25:51 PM9/3/10
to python_in...@googlegroups.com
is this to allow for the usage of the middle mouse virtual slider function?

when in a move mode, by clicking on one of the directional handles of any manipulator allows you to middle mouse drag after that in only that axis, or all three when you are in the transform mode
if you are trying to do it for attrs other than the default transforms then that is another story.



John Creson

unread,
Sep 3, 2010, 1:29:16 PM9/3/10
to python_in...@googlegroups.com
You're trying to perform the selection?
Not read the selection?
right?

> --
> http://groups.google.com/group/python_inside_maya

mt

unread,
Sep 3, 2010, 4:02:15 PM9/3/10
to python_inside_maya
yes I'm trying to select attributes in a channelBox, so I can use the
mmb slider function.
Not only for transforms but for all attributes (the original maya
channelBox behaviour)

Anyone has an idea how to do it?



On Sep 3, 6:29 pm, John Creson <johncre...@gmail.com> wrote:
> You're trying to perform the selection?
> Not read the selection?
> right?
>
>
>
> On Fri, Sep 3, 2010 at 1:25 PM, damon shelton <damondshel...@gmail.com> wrote:
> > is this to allow for the usage of the middle mouse virtual slider function?
>
> > when in a move mode, by clicking on one of the directional handles of any
> > manipulator allows you to middle mouse drag after that in only that axis, or
> > all three when you are in the transform mode
> > if you are trying to do it for attrs other than the default transforms then
> > that is another story.
>
> > On Fri, Sep 3, 2010 at 4:59 AM, Nicolas Combecave <zezebubulon...@gmail.com>

damon shelton

unread,
Sep 3, 2010, 5:01:22 PM9/3/10
to python_in...@googlegroups.com
I could suggest looking at HUD sliders instead, Maya's channelBox doesn't have the functionality to select attributes only query selected attributes

HUDsliders don't do MMB but does give you fast access from the viewport


mt

unread,
Sep 3, 2010, 5:06:23 PM9/3/10
to python_inside_maya
thanks damon, but I need to be able to 'reproduce' the mmb
functionality based on attributes selected in another tool.
That's why I thought the most reliable way would be to be able to auto-
select attributes in the channelBox.

Tim Fowler

unread,
Sep 3, 2010, 7:51:29 PM9/3/10
to python_in...@googlegroups.com
Internally the chanelBox just uses a dragAttrContext for MMB...you say
that there was something complicated about using one directly
yourself?

Nicolas Combecave

unread,
Sep 3, 2010, 7:52:14 PM9/3/10
to python_in...@googlegroups.com
Definitely, you should look into building a selectionList, and trigger a dragAttrContext.
It's basically the way we do it here.

Nicolas


Ted Charlton

unread,
Sep 3, 2010, 8:22:27 PM9/3/10
to python_in...@googlegroups.com
Thanks Tim.

How is the channelBox enableLabelSelection flag used?

  -enableLabelSelection (-els)        boolean       queryedit
    Enables the selection of attributes in the channelBox when used in conjunction with -attributeEditorMode. Default is false. Queried, returns a boolean.



Tim Fowler

unread,
Sep 3, 2010, 8:45:34 PM9/3/10
to python_in...@googlegroups.com
How's it going Ted!

Off the top of my head I don't remember anything about that flag, and
just heading out for the long weekend, but if nobody gets back I'll
look at it Tuesday.

mikk...@gmail.com

unread,
Sep 3, 2010, 4:33:33 PM9/3/10
to python_in...@googlegroups.com
Funny, I was just in the middle of getting this to work myself. So far I think you need to use channelBox (q = True, sma = True) to query the selected main (top) channels. However, I haven't gotten it to work yet but perhaps if we all put our heads together, a solution will surface. :)

Mikkel
> --
>
> http://groups.google.com/group/python_inside_maya

mikk...@gmail.com

unread,
Sep 3, 2010, 5:10:49 PM9/3/10
to python_in...@googlegroups.com
This will get the selected channels in the main channel box and append them to the list chList:

# ----- Start script ------

import maya.cmds as cmds
import maya.mel as mel

def getChannels (*args):

gChannelBoxName = mel.eval('$temp=$gChannelBoxName')
chList = cmds.channelBox (gChannelBoxName, q=True, sma = True)
if chList:
for channel in chList:
print channel
else:
print 'No channels selected!'
return False

getChannels()
> --
>
> http://groups.google.com/group/python_inside_maya
Reply all
Reply to author
Forward
0 new messages