How can we reorder an attributes in the channel box??
In the past we use to work with the Michael Comet tool scripts... who rename for you the attributes and reorder it as you want!!! up or down!
Now this scripts in Maya 2011 work but don't work!!!! no error during scripts execution.... but do nothing....!!! What have change into 2011 and make it not work???
Here the original comet scripts as examples:
Thanks
// --------------------------------------------------------------------------
// cometAttrEditor.mel - MEL Script
// --------------------------------------------------------------------------
//
// DESCRIPTION:
// A util for dealing with some attribute stuff.
//
// REQUIRES:
// Nothing.
//
//
// USAGE:
// source "cometAttrEditor.mel"; cometAttrEditor();
//
// AUTHORS:
// Michael B. Comet - comet@comet-cartoons.com
// Copyright ©2004 Michael B. Comet - All Rights Reserved.
//
// VERSIONS:
// 1.00 - Aug 27, 2004 - Initial Release.
//
// --------------------------------------------------------------------------
/*
* cometAttrEditor() - Main Entry
*/
global proc cometAttrEditor()
{
if (`window -q -ex cometAttrEditorWin`)
{
showWindow cometAttrEditorWin ;
return ;
}
window -w 230 -h 60 -t "Comet Attr. Editor - 1.00" cometAttrEditorWin ;
formLayout mainForm ;
button -l ("Move UP") -c ("cAE_moveAttrs(0)") -ann ("Slide selected channelBox attributes up.") btnUp ;
button -l ("Move DOWN") -c ("cAE_moveAttrs(1)") -ann ("Slide selected channelBox attributes down.") btnDown ;
formLayout -e
-af btnUp "top" 5
-an btnUp "bottom"
-af btnUp "left" 5
-ap btnUp "right" 0 50
-af btnDown "top" 5
-an btnDown "bottom"
-ap btnDown "left" 0 50
-af btnDown "right" 5
mainForm ;
showWindow cometAttrEditorWin ;
}
// --------------------------------------------------------------------------
/*
* cAE_moveAttrs() - Adjust attrs
*/
global proc cAE_moveAttrs(int $dir)
{
// What objs and attrs are highlighted in the channel box?
string $cbObjs[] = `channelBox -q -mol mainChannelBox` ;
string $cbAttrs[] = `channelBox -q -sma mainChannelBox` ;
int $i;
string $obj ;
for ($obj in $cbObjs)
{
if ($dir == 0) // Work top to bottom if moving up
{
for ($i=0; $i < size($cbAttrs); ++$i)
cAE_moveAttr($obj, $cbAttrs, $dir) ;
}
else if ($dir == 1) // Work bottom to top moving down
{
for ($i=size($cbAttrs)-1; $i >= 0; --$i)
cAE_moveAttr($obj, $cbAttrs, $dir) ;
}
// Must do this or channel box won't refresh.
string $sel[] = `ls -sl -l`;
select -cl ;
refresh ;
select -r $sel ;
}
}
// --------------------------------------------------------------------------
/*
* cAE_moveAttr() - Adjust one attr specified up or down.
* $dir: 0=up 1=down
*/
global proc cAE_moveAttr(string $obj, string $attr, int $dir)
{
string $udAttrs[] = `listAttr -ud $obj` ; // Get just user defined ones.
int $i ;
// First find out where in the order of all the user defined attrs this one is.
int $idx = -1 ;
for ($i=0; $i < size($udAttrs); ++$i)
{
if ($udAttrs == $attr)
{
$idx = $i;
break ;
}
}
// If we couldn't find it, it's not a ud, so ignore, we can't shift.
if ($idx < 0)
{
warning -sl 0 ("Can't shift "+$obj+"."+$attr+" it's not user defined.") ;
return ;
}
print ("// Shifting "+($dir==0 ? "Up" : "Down")+" "+$idx+".) "+$obj+"."+$attr+" //\n") ;
// Now shift as needed
if ($dir == 0 && $idx > 0)
{
cAE_dropToBottom($obj, $udAttrs) ; // First this goes down
cAE_dropToBottom($obj, $udAttrs) ; // Then the one above
// Then do the rest
for ($i=$idx+1; $i < size($udAttrs); ++$i)
{
cAE_dropToBottom($obj, $udAttrs) ;
}
}
else if ($dir == 1 && $idx < size($udAttrs)-1)
{
cAE_dropToBottom($obj, $udAttrs) ; // First the one below goes down
cAE_dropToBottom($obj, $udAttrs) ; // First this goes down
// Then do the rest
for ($i=$idx+2; $i < size($udAttrs); ++$i)
{
cAE_dropToBottom($obj, $udAttrs) ;
}
}
}
// --------------------------------------------------------------------------
/*
* cAE_dropToBottom() - Drop an attr to bottom by rename and back
*/
global proc cAE_dropToBottom(string $obj, string $attr)
{
renameAttr ($obj+"."+$attr) ($attr+"TEMPREN") ; // there
renameAttr ($obj+"."+$attr+"TEMPREN") ($attr) ; // and back again
}
// --------------------------------------------------------------------------
cometAttrEditor;