channelBox right click

209 views
Skip to first unread message

mt

unread,
Sep 6, 2010, 10:47:11 AM9/6/10
to python_inside_maya
Do you guys know why a new channelBox created via script doesn't have
a right-click attribute menu? Do I need to reimplement it, or is there
a better way of having it working like it does on the maya-default
mainChannelBox?

Taylor Carrasco

unread,
Sep 6, 2010, 8:04:02 PM9/6/10
to python_in...@googlegroups.com
Do you mean the attributes them selves (say the label for the attribute or the textfield, assuming youre using PyQt) -
Are you using Mel?

We need some more info on this one here...


mt

unread,
Sep 7, 2010, 2:47:07 AM9/7/10
to python_inside_maya
Hi Taylor,

Using pyqt and pymel.
Right click on the attribute names (allowing to key/lock/mute etc
selected attrs)

Phil Sloggett

unread,
Sep 7, 2010, 3:09:30 AM9/7/10
to python_in...@googlegroups.com
This gets you a large chunk of the way...:

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

cmds.window()
cmds.formLayout( 'form' )
cmds.channelBox( 'dave' )
cmds.formLayout( 'form', e=True, af=(('dave', 'top', 0), ('dave', 'left', 0), ('dave', 'right', 0), ('dave', 'bottom', 0)) )
cmds.showWindow()

cmds.popupMenu('someStupidMenu',p='dave',pmc=lambda *args: mm.eval('generateChannelMenu someStupidMenu 1'))

unfortunately that last piece of the way may involve most of the work - I've only had a glance, but it looks like theres some weird UI name issue when it tries to build your custom menu and, unless theres a quick workaround, you may need to re-implement the generateChannelMenu mel command (might not be a bad idea anyway, doing evals of mel scripts in python always leaves a funny taste in my mouth). At least, for the most part, it should be a literal translation of the MEL found with a "whatIs generateChannelMenu", then just fix whatever's not working.



mAtt RINGOT

unread,
May 9, 2014, 11:36:16 AM5/9/14
to python_in...@googlegroups.com
Hey guys,

I know it's a really old post but does anyone found the way to fix that rightClick issue ?

I've having the same thing.. The right click is working but still refere to the maya default channelBox...

If you select TranlateZ in the maya default channelBox and then right click and key selected on rotateY in your created ChannelBox, it will key the TranslateZ...
I was thinking, is there a way to connect the current selection of the created channelBox to the maya default channelBox ? It should fix the issue...

Thanks,

m.
Message has been deleted

mAtt RINGOT

unread,
Jul 26, 2014, 6:37:04 AM7/26/14
to python_in...@googlegroups.com
Hey, I finally had time to look at that so here's the thing, all the channelBox commands are hard-coded to the mayaChannelBox, I had to modify 3 differents files.

On windows :
C:\Program Files\Autodesk\Maya2013\scripts\startup\generateChannelMenu.mel
C:\Program Files\Autodesk\Maya2013\scripts\startup\selectedChannels.mel
C:\Program Files\Autodesk\Maya2013\scripts\startup\channelBoxCommand.mel

In the generateChannelMenu.mel :: generateChannelMenu proc had this :

global proc generateChannelMenu( string $parent, int $popupMenu ) { 
    setParent -m $parent; 
    global string $gChannelBoxName; 
    string $popUpMenuParent = `control -q -p $parent`; 
    string $toks[]; tokenize $popUpMenuParent "|" $toks; 
    $gChannelBoxName = $toks[size($toks)-1];

Then replace all the 'mainChannelBox' by '$gChannelBoxName' in all the 3 files, add the line :

    global string $gChannelBoxName; 

If the string $gChannelBoxName is not declared in the proc.

Eveything works fine for me. I can send the files if needed. 

Thanks,

m.
Reply all
Reply to author
Forward
0 new messages