How to insert an attribute?

How to insert an attribute?

mcw0
Advisor Advisor
570 Views
2 Replies
Message 1 of 3

How to insert an attribute?

mcw0
Advisor
Advisor

I have a node with a number of attributes.  I want to create a new attribute and have it at a specific position in the channelBox.  It sure would be nice if Maya had a reorder for attributes.  But it doesn't.  So we are left with deleting attributes and undoing the delete to juggle attribute placement...thanks Maya.

 

I wrote a script awhile back at a studio to do this and forgot to make myself a copy.  It worked at the time and I thought I'd always be able to rewrite it.  But today is that day and it's not working.  When I run my script, it's as if nothing happens.  The new attribute is nowhere to be found.  Yet, if I run the script step by step, it works.  So there must be some kind of refresh that I'm missing when I run the script.  I've even tried inserting a few refresh commands into my code and it doesn't help.  Any ideas?

0 Likes
Accepted solutions (1)
571 Views
2 Replies
Replies (2)
Message 2 of 3

mcw0
Advisor
Advisor

It may have something to do with having the node selected and the channelBox populated.  I just tried running

select -r $node;

refresh;

pause -sec 10;

 

The channelBox doesn't actually refresh and populate until after the 10 seconds.  So all the refresh commands I tried in my code wasn't helping at all because the channelBox never got populated.  😞

I remember now the script I wrote before had the node selected.  UGH!  Now have to figure out a solution for this in an automated process.

0 Likes
Message 3 of 3

mcw0
Advisor
Advisor
Accepted solution

My goal was to not change my undo queue to infinite.  And to use "channelBoxCommand -deleteAttributes".  Using that command means only one undo.  But I bit the bullet and set my undo queue to infinite to get around this issue.  And then setting it back to finite after.  If anyone comes up with a solution to updating the channelBox, I'd love to hear about it.  Thanks.

0 Likes