PDA

View Full Version : Changing attribute order?


GrafOrlok
02-24-2003, 10:55 AM
Is there any way to change the order of custom attributes in the channel box?

I have made a zillion attributes and if I need to change anything on one of them, it pops right back to the end of the list (undo won't fix it). And to keep some kind of structure I'd want them to be kept in a specific order.

Don't tell me I have to re-add all attributes...

GrafOrlok
02-24-2003, 11:30 AM
Found it myself in the Maya help MEL faq.:rolleyes:

How can I change the order of extra attributes in the Channel Box?

You can't change the order of extra attributes in the Channel Box. Maya requires the order to be the order in which they were created.

You could write a script that reads the current attributes, deletes them all, and adds them again in the order you want. However, this would break connections with expressions and other objects.


GAAAH:D
I'm not a very skilful MEL writer. Anyone have any idea of how I'd go about diong this. Sounds like as much trouble as removing all the extra attributes and then re-adding them with all values and everything...

Anyone?

mattwood
02-24-2003, 01:57 PM
You could try writing out your scene as an .ma file then editing it in a text editor. May work, may not. Do some test first though - it could have nasty side effects.

Razvan
02-24-2003, 02:12 PM
Actually is very simple to reorder them, just right click on the attribute delete it and then hit undo, your attribute will be the last one in the list.

GrafOrlok
02-24-2003, 02:39 PM
That was probably the weirdest workaround... But, YES it worked perfectly!
This should probably work even if you had SDK-connections too, something the Maya help stated couldn't be done.
Then again: The simplest solutions are the hardest to find! :thumbsup:

Thanx:beer:

StefanA
02-16-2004, 02:36 PM
Hiya All,

This was almost a year since this thread appeared :) But, the problem is still present(?). I have a lot of attributes which I'm using for a "set driven key" situation. And now I find my self trying to add a attribute, but I would like to have it in the same "section" as the others.

ex.

EyeBrow_Left_1
EyeBrow_Left_2
EyeBrow_Left_3
EyeBrow_Right_1
EyeBrow_Right_2
EyeBrow_Right_3

and I would like to add:

EyeBrow_Left_4
EyeBrow_Right_4

to be in the correct place. Now this would be easy to redo if I only had these controls, but the fact is that I have about 40 controls. Anyone have any tips regarding this?

best regards

/stefan andersson

StefanA
02-16-2004, 02:59 PM
Never mind about changing the order of the attributes. It can't be done without loosing all the connections to the linked objects. This blows big time since maya it self changes the order if you rename any attribute.

= [ from the online documentation ] =

How can I change the order of extra attributes in the Channel Box?

You can't change the order of extra attributes in the Channel Box. Maya requires the order to be the order in which they were created.

You could write a script that reads the current attributes, deletes them all, and adds them again in the order you want. However, this would break connections with expressions and other objects.
How do I change projects with MEL?

Here's an example for a project named trumpet:

workspace -o "/home/matt/maya/projects/trumpet";
np_resetBrowserPrefs;
pv_resetWorkspace;
pv_goCurrentProject;
print ("Current project is trumpet\n");



back to the drawing board.... [lots of bad evil words]

/stefan andersson

GrafOrlok
02-16-2004, 08:22 PM
Did you actually try Razvan's tip to delete and undo? That solved my problem and from what I can see it would solve yours too. It is a little fiddling to get it right, but way easiear than re-doing the whole thing!

/Staffan
Fido film

dmcgrath
02-16-2004, 09:22 PM
I think the delete/undo will work for you, although it is really a hack job way to do it, I would take advantage of it if you can.


You'll have to delete/undo all three of your left eyebrow things first and then add the left eyebrow 4. Then repeat it with the right side, save an extra file out as a different neme and then try it. That way you won't be taking any chances.

macaroniKazoo
02-16-2004, 09:37 PM
http://www.macaronikazoo.com/mel/download/zooReorderAttribs.mel

this script will reorder attributes without breaking any connections. the alias documentation is a bit dumb if it suggests deleteing the attribs, and remaking them, because if you just rename instead of deleting, you get exactly the same effect. renaming an attrib puts it at the bottom of the attrib list.

anyway, thats what this script does. has worked solidly for me in the past.

cheers.

Razvan
02-17-2004, 05:09 AM
Another way to do this, and more intuitive, it's to save the file as Maya ASCII (.ma) and change the order the attributes are created. It's very simple, just find the 'addAttr' string (this is the command that creates the attributes) and reorder them.
The lines should something look like this:

'addAttr -ci true -sn "ATTRNAME_1" -ln "ATTRNAME_1" -min 0 -max 1 -at "bool";'
'addAttr -ci true -sn "ATTRNAME_2" -ln "ATTRNAME_2" -min 0 -max 1 -at "bool";'

macaroniKazoo
02-17-2004, 06:30 AM
Originally posted by Razvan
Another way to do this, and more intuitive, it's to save the file as Maya ASCII (.ma) and change the order the attributes are hmmm, while not super difficult, hacking scene text files is far from intuitive...

StefanA
02-17-2004, 08:51 AM
Hi All,

The delete undo tip isnt really applical here since I have about 50+ sliders.
Hacking the ma file is an option though, but also not very intuitive.

macaroniKazoo, I did try that mel script but it didn't work on Linux (I'm using Maya 5.0.1/Linux).




The problem is solved!! This mel script will solve the problem and is also working on Maya 4.5, 5.0.1 under Linux
http://dpk.stargrav.com/pafiledb/pafiledb.php?action=file&id=5

And it doesn't break the connections if you have expressions or set driven keys



best regards

/stefan andersson

Razvan
02-17-2004, 12:07 PM
I meant intuitive because you can see and reorder the lines as opposed to delete/undo where you have to think in advance and delete other attributes in order to get it right, I was not referring to the workflow. But how difficult could be to search for 'addAttr' and cut/paste the line under/above other line ...? It will work flawlessly because maya puts the attrs in the channel box in the order they are created, says so in the docs ...

CGTalk Moderation
01-14-2006, 12:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.